At 9:37 AM +0900 11/20/2000, Fumio Nonaka wrote:
>Hi Yariv,
>
>The following movie script creates new member horizontally flipped the member
>defined as a parameter to and returns the reference of new member.
>
>[Test inf the message window]
>put xFlipMemberH(member("Bitmap"))
>-- (member 5 of castLib 1)
>
>on xFlipMemberH memberRef
> sourceImage = memberRef.image
> sourceWidth = sourceImage.width
> sourceHeight = sourceImage.height
> newImage = image(sourceWidth, sourceHeight, memberRef.depth)
> repeat with i = 1 to sourceWidth
> destinationRect = rect(i - 1, 0, i, sourceHeight)
> sourceRect = rect(sourceWidth - i, 0, sourceWidth - i + 1, sourceHeight)
> newImage.copyPixels(sourceImage, destinationRect, sourceRect)
> end repeat
> newBitmap = new(#bitmap)
> newBitmap.image = newImage
> return newBitmap
>end
You're working too hard, man- use a quad:
on flipH(img)
buffer = image(img.width, img.height, img.depth)
sRect = img.rect
L = sRect[1]
T = sRect[2]
R = sRect[3]
B = sRect[4]
destQuad = [point(R, T), point(L, T), point(L, B), point(R, B)]
buffer.copyPixels(img, destQuad,sRect)
return buffer
end
called:
member("xx").image = flipH(member("x").image)
The other possible flip permutations should be easy to work out from
this example.
/r
--
Roy Pardi
[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!]