Drawing on the Screen with Lines

Date:    Mon, 7 Nov 1994 18:26:06 -0600
From:    Matthew Caldwell <sexkittn@BURN.DEMON.CO.UK>
Subject: Re: "Signing" a document
The trouble with using trails and a sot is that the screen doesn't update often enough to get more than a spray of dots, certainly not a clear enough line to sign your name with. Here's a variation which gets around this problem:

The following goes in a movie script. Sprite 2 here contains a basic 1-pixel tools palette line and is offstage as the movie begins

  on startMovie
    puppetSprite 2, true
    set the trails of sprite 2 = true
  end startMovie
 
  on drawLine v1, h1, v2, h2
    -- check for horizontal or vertical lines and make
    -- them 1 pixel wide
    if v1 = v2 then set v1 = v1 + 1
    if h1 = h2 then set h1 = h1 + 1
    -- check direction of line and set endpoints
    -- and type appropriately
    if v1 > v2 then
      if h1 > h2 then
        spriteBox 2, h2, v2, h1, v1
        set the type of sprite 2 = 5
      else
        spriteBox 2, h1, v2, h2, v1
        set the type of sprite 2 = 6
      end if
    else
      if h1 > h2 then
        spritebox 2, h2, v1, h1, v2
        set the type of sprite 2 = 6
      else
        spritebox 2, h1, v1, h2, v2
        set the type of sprite 2 = 5
      end if
    end if
    -- show it
    updateStage
  end drawLine

Sprite 1 is just an invisible rectangle to act as the "paper" and its script goes like this:

  on mouseDown
    set oldV = the mouseV
    set oldH = the mouseH
    repeat while the mouseDown
      set newV = the mouseV
      set newH = the mouseH
      drawLine(oldV, oldH, newV, newH)
      set oldV = newV
      set oldH = newH
    end repeat
  end mouseDown
As you can see, the idea is that instead of just getting a dot each time you update the mouse position, you draw a line from the old mouse position to the current one.
____
\  /  Matthew Caldwell <sexkittn@burn.demon.co.uk>
 \/   Who's that woman? I know her well, all decked out head to toe...