Search content:

 

Personal Menu
Username:
Password:
Save password

Become a member

Forgot Password?

 

Don't miss these
Sub Hunt
Wait for DigitalVideo Cuepoint
Vector Shapes - Create Spiral & Create Spiral Twist
SceneList
changing the color of a flash movie clip with lingo
Inno Setup Pro
PDFCreator Xtra
Set Static Property of a Flash Member
Data Linker Xtra
PictureXtra
MediaMacros Xtras Mall
 

 

 

Behavior Rotate Image Algorithm - Imaging Lingo

Added on 8/23/2005

 

Compatibilities:
behavior D8 D8_5 D9 Mac Parent PC Shockwave

This item has not yet been rated

Author: Chunick (website)

This code was originally written by Luke Wigley. I've modified it so you can pass it an image object and also a colour for the background

on rotateImage (anImage, anAngle, anOffSet, aColour)
  --------------------------------------------------------------------
  -- rotates the supplied image.
  -- anAngle is specified in degrees.
  -- I Added the image parameter and the colour parameter, aColour.
  -- the offset parameter is the pivot point of the rotation.
  -- pass along the member.regPoint for rotation around the center point
  -- the colour parameter is the background colour of the empty image
  -- which you get when you rotate an image.
  -- original code by Luke Wigley www.lingoworkshop.com
  --------------------------------------------------------------------
  aRect = anImage.rect
  aQuad = [point(0,0), point(aRect.width,0), point(aRect.width,aRect.height), point(0,aRect.height)]
  newQuad = []
  anAngle = anAngle * pi/180.0
  repeat with j = 1 to 4
    thisPoint = aQuad[j]
    x = thisPoint[1] - anOffSet[1]
    y = thisPoint[2] - anOffSet[2]
    thisPoint[1] = x * cos(anAngle) - y * sin(anAngle)
    thisPoint[2] = x * sin(anAngle) + y * cos(anAngle)
    newQuad[j] = thisPoint + anOffSet
  end repeat
  newImage = image(anImage.width, anImage.height, anImage.depth)
  newImage.floodFill(point(0,0), aColour)
  newImage.copyPixels(anImage, newQuad, aRect, [#useFastQuads: 0])
  return newImage
end

 


Upload Provided by ABCUpload ASP

Contact

MMI
22 West Court Sq
Suite 2C
Newnan, GA 30263
USA

Fax - (206) 339-5833

Send e-mail