fliping image?

BlitzMax Forums/BlitzMax Programming/fliping image?

Caton(Posted March) [#1]
how can I change image from left to right?


Midimaster(Posted March) [#2]
You can change the drawing direction:
SuperStrict
Graphics 800,600
Repeat
	Cls
	SetScale -1,1
	DrawText "Hallo",400,100
	Flip 1
Until KeyHit(KEY_ESCAPE)
End



Kryzon(Posted March) [#3]
There are two ways: flipping the way you display the image, and flipping the image data itself.

To flip the way you display the image (edit: ninja'd by Midimaster):
SetScale( -1.0, 1.0 )
DrawImage( ... )

To flip the image data:
Local tempPixmap:TPixmap = LoadPixmap( ... )
Local myImage:TImage = LoadImage( XFlipPixmap( tempPixmap ) )
....
DrawImage( myImage ... )

In case the image is going to stay flipped then it's better to flip the image data once, as that is permanent.
In case the image goes back and forth between flipped and unflipped, use the scale which is only temporary and easy to change.