> Hey all,I hate to ask such a basic question, I am just juggling several
> things at the moment. Could someone drop up a quick script of
> imaging lingo that would take an image and rotate it 180degrees. I am
> major stressed, we are installing our piece, and I FOUND THAT THE
> FRAMERATE IS MUCH GREATER IF THE IMAGES ARE ROTATED 180
> DEGRESS. VERY  odd. but it seems to work consistently. if i keep the
> sprites rotated at 0 degrees, the framerate is  half of what it is if i
> rotatethem 180 degrees.thanks

I did some basic flipping and rotating imaging not too long ago. Hope this
helps.

-Kurt

--------------
--------------
--Sample call: member("testDest").image =
mirrorImage(member("test").image.duplicate(), "diagonalTLBR")

on mirrorImage sourceImage, axis
  --need a square image to avoid distortion
  squareDimension = max(sourceImage.width, sourceImage.height)
  destinationImage = image(squareDimension, squareDimension,
sourceImage.depth)
  tempImage = image(squareDimension, squareDimension, sourceImage.depth)
  
  destinationRect = rect((squareDimension - sourceImage.width)/2,\
  (squareDimension - sourceImage.height)/2,\
  squareDimension - (squareDimension - sourceImage.width)/2,\
  squareDimension - (squareDimension - sourceImage.height)/2)
  
  tempImage.copypixels(sourceImage, destinationRect, sourceImage.rect,
[#ink:36])
  
  sourceImage = tempImage
  
  case axis of
    "horizontal":
      flipQuad = [point(0, destinationImage.height),\
point(destinationImage.width, destinationImage.height),\
point(destinationImage.width, 0),\
point(0, 0)]
      
    "vertical":
      flipQuad = [point(destinationImage.width, 0),\
point(0, 0),\
point(0, destinationImage.height),\
point(destinationImage.width, destinationImage.height)]
      
    "diagonalTLBR":
      flipQuad = [point(destinationImage.width, destinationImage.height),\
point(destinationImage.width, 0),\
point(0, 0),\
point(0, destinationImage.height)]
      
    "diagonalTRBL":
      flipQuad = [point(0, 0),\
point(0, destinationImage.height),\
point(destinationImage.width, destinationImage.height),\
point(destinationImage.width, 0)]
      
    otherwise:
      put "Invalid axis - choices are horizontal, vertical, diagonalTLBR,
diagonalTRBL"
  end case
  
  destinationImage.copyPixels(sourceImage, flipQuad, sourceImage.rect)
  
  return destinationImage
end
--------------------------------

--member("testDest").image = rotateImage(member("test").image.duplicate(),
90)

--This only deals with 90 degree increments.
on rotateImage sourceImage, degree
  --need a square image to avoid distortion
  squareDimension = max(sourceImage.width, sourceImage.height)
  destinationImage = image(squareDimension, squareDimension,
sourceImage.depth)
  tempImage = image(squareDimension, squareDimension, sourceImage.depth)
  
  destinationRect = rect((squareDimension - sourceImage.width)/2,\
  (squareDimension - sourceImage.height)/2,\
  squareDimension - (squareDimension - sourceImage.width)/2,\
  squareDimension - (squareDimension - sourceImage.height)/2)
  
  tempImage.copypixels(sourceImage, destinationRect, sourceImage.rect,
[#ink:36])
  
  sourceImage = tempImage
  
  case degree of
    270:
      rotateQuad = [point(0, destinationImage.height),\
point(0, 0),\
point(destinationImage.width, 0),\
point(destinationImage.width, destinationImage.height)]
      
    180:
      rotateQuad = [point(destinationImage.width, destinationImage.height),\
point(0, destinationImage.height),\
point(0, 0),\
point(destinationImage.width, 0)]
      
    90:
      rotateQuad = [point(destinationImage.width, 0),\
point(destinationImage.width, destinationImage.height),\
point(0, destinationImage.height),\
point(0, 0)]
      
    otherwise:
      put "Invalid degree - choices are 90, 180, 270"
  end case
  
  destinationImage.copyPixels(sourceImage, rotateQuad, sourceImage.rect)
  
  return destinationImage
end
--------------
--------------

[To remove yourself from this list, or to change to digest mode, go to 
http://www.penworks.com/lingo-l.cgi  To post messages to the list, email 
[EMAIL PROTECTED]  (Problems, email [EMAIL PROTECTED]). Lingo-L is for 
learning and helping with programming Lingo.  Thanks!]

Reply via email to