xflip/yflip TImage

BlitzMax Forums/BlitzMax Programming/xflip/yflip TImage

deps(Posted 2005) [#1]
Hi,

Is it possible to draw a image fliped along the x and y axis? Didn't find anything about it in the docs or with the forum search.

I know that I can use XFlipPixmap/YFlipPixmap but it is more videomem-friendy to just flip the u,v coordinates when drawing the image. (If that's possible at all, never tried it myself. Maybe the "right" way to do it is to draw the back of the polygon instead.)


Shagwana(Posted 2005) [#2]
The "SetScale" command is your freind here. Use it with negative numbers.

SetScale -1.0,1.0  'Flips the x
SetScale 1.0,-1.0  'Flips the y
SetScale -1.0,-1.0 'Flips both the x and the y

'Other things of intrest ...
SetScale -2.0,2.0  'Flip in the x and scale it 2x!
SetScale 1.0,1.0   'Put drawing back to normal


Its a state machine command too, so dont forget to set it back to normal after you are done with it, Else you will find it effecting all drawing operations after its called. The negative numbers will flip the drawing to the other side of the handle, so you might want to adjust the drawing location to get it to the correct postion you intended.


deps(Posted 2005) [#3]
The "SetScale" command is your freind here. Use it with negative numbers.


Great, thanks a lot. Didn't know the setscale command could do this. :)

Would be great if the next update to blitzmax contains a "real" image flipping command. One that positions the drawing location to the correct side of the handle too.


FlameDuck(Posted 2005) [#4]
The commands you're looking for are:
LockImage
XFlipPixmap
YFlipPixmap
and
SetImageHandle

This should allow you to do what you want. However a negative SetScale is much faster.


Ferminho(Posted 2005) [#5]
This should allow you to do what you want. However a negative SetScale is much faster.

...and SetScale won't modify the original image as X/YFlipPixmap does (if you have more than one reference to the original you should flip-draw and then unflip - 2 times slower!)