Draw image flipped

BlitzMax Forums/BlitzMax Programming/Draw image flipped

plash(Posted 2008) [#1]
Is it possible to draw an image vertically/horizontally flipped? (instead of processing and holding the flipped image in memory)

This question is driver independent, it would be nice if it were dx and gl.

EDIT: Just thought of something.. Is it just as simple as flipping the texcoords? (top-left <> top-right and bottom-left <> bottom-right; for a vertical flip)


Zeke(Posted 2008) [#2]
Function DrawImageEx(image:timage,x#,y#,frame=0,flipx=0,flipy=0)
	Local x0#,y0#,x1#,y1#
	x0=x ; y0=y ; x1=image.width ; y1=image.height
	If flipx
		x0:+x1
		x1=-x1
	EndIf
	If flipy
		y0:+y1
		y1=-y1
	EndIf
	DrawImageRect image,x0,y0,x1,y1,frame
End Function



MGE(Posted 2008) [#3]
What about using SetTransForm(rot,xscale,yscale) and setting the x,y scale to a negative value?


Htbaa(Posted 2008) [#4]
Flipping is different from rotating.

Edit: Oops! Didn't read your post well enough! Does it actually accept negative scale values?


EOF(Posted 2008) [#5]
SetScale 1,1 ' normal
SetScale -1,1 ' x flipped
SetScale 1,-1 ' y flipped
SetScale -1,-1 ' both flipped



MGE(Posted 2008) [#6]
I always do rotation, scale in 1 go so it would be:

SetTransform(0,1,1) ' normal
SetTransform(0,-1,1) ' x flipped
SetTransform(0,1,-1) ' y flipped
SetTransform(0, -1,-1) ' both flipped

:)