Draw a scaled version of a sketch

Date:    Thu, 24 Nov 1994 01:04:03 -0600
From:    Matthew Caldwell <sexkittn@BURN.DEMON.CO.UK>

>I need a script that draws a scaled dupicate of the users sketch. Based on a
>sprite with trails the user can draw on screen. I can similtaneously draw a
>100% size dupe of the sketch but I want a smaller version. 


  global hOrigin, vOrigin, hO2, vO2, scaleFactor
  -- you need to set or calculate these somewhere:
  -- hOrigin and vOrigin are the top-left coords of the drawing area
  -- hO2 and vO2 are the top-left coords of the copy area
  -- scaleFactor is the ratio of copy size to drawing size
  -- (this should probably be a float, eg 0.5)
 

  on mouseDown
    put the mouseH into oldH
    put the mouseV into oldV
    put integer((oldH - hOrigin) * scaleFactor + hO2) into oldH2
    put integer((oldV - vOrigin) * scaleFactor + vO2) into oldV2
    repeat while the mouseDown
      put the mouseH into newH
      put the mouseV into newV
      put integer((newV - vOrigin) * scaleFactor + vO2) into newV2
      put integer((newH - hOrigin) * scaleFactor + hO2) into newH2
      drawLine(oldH, oldV, newH, newV)
      drawLine(oldH2, oldV2, newH2, newV2)
      put newH into oldH
      put newV into oldV
      put newH2 into oldH2
      put newV2 into oldV2
    end repeat
  end mouseDown
drawLine is a routine using sprite trails to draw a line between two points; several versions of this have been posted recently, so I won't rehash it

As usual, this is untested so may need some fiddling, but as you can see, the basic process is to calculate the position of each point in your full-size drawing relative to some origin, scale this relative position and then place the scaled point relative to some other origin.

____
\  /  Matthew Caldwell <sexkittn@burn.demon.co.uk>
 \/   Do you have the Texas Chainsaw Mascara?