|
|
|
Flip Image Algorithm - Imaging Lingo
Added on 8/23/2005
|
This code will flip your image.
on flipImage (anImage, aFlip)
--------------------------------------------------------------------
-- original code by Luke Wigley www.lingoworkshop.com
-- I added the flip parameter.
-- aFlip can be these values: #flipV, #flipH, #flipVH
--------------------------------------------------------------------
aRect = anImage.rect
aQuad = [point(0,0), point(aRect.width,0), point(aRect.width,aRect.height), point(0,aRect.height)]
Case aFlip of
#flipV:
newQuad = [aQuad[4], aQuad[3], aQuad[2], aQuad[1]]
#flipH:
newQuad = [aQuad[2], aQuad[1], aQuad[4], aQuad[3]]
#flipVH:
newQuad = [aQuad[3], aQuad[4], aQuad[1], aQuad[2]]
end Case
newImage = image(anImage.width, anImage.height, anImage.depth)
newImage.copyPixels(anImage, newQuad, aRect)
return newImage
end
|
|