[EMAIL PROTECTED] wrote
> Can someone show me how to flip an image object using copypixels? I tried
> playing around with the quad parameter, but couldn't really grasp what's
> going on.
if a quad is like this
[point1, point2, point3, point4]
where the points correspond to the corners of a quad - like this
point1 -- point2
| |
point4 -- point3
then to flip horizontally, the quad would look like this
point2 -- point1
| |
point3 -- point4
and to flip vertically, the quad would look like this
point4 - -point3
| |
point1 -- point2
So if the original quad of an image is this
aRect = anImage.rect
aQuad = [point(0,0), point(aRect.width,0), point(aRect.width,aRect.height),
point(0,aRect.height)]
then to flip horizontally, the new quad would be
newQuad = [aQuad[2], aQuad[1], aQuad[4], aQuad[3]] -- flipH
and to flip vertically,
newQuad = [aQuad[4], aQuad[3], aQuad[2], aQuad[1]] -- flipV
So, to flip an image using copypixels, do something like this
on mFlipImageV (me, anImage)
-- returns a new image
aRect = anImage.rect
aQuad = [point(0,0), point(aRect.width,0),
point(aRect.width,aRect.height), point(0,aRect.height)]
newQuad = [aQuad[4], aQuad[3], aQuad[2], aQuad[1]] -- flipV
newImage = image(anImage.rect.width, anImage.rect.height, anImage.depth)
newImage.copyPixels(anImage, newQuad, aRect)
return newImage
end
Luke
[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/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!]