More Mirror Image

BlitzPlus Forums/BlitzPlus Programming/More Mirror Image

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

OK I used TFormImage to mirror an image horizontally but the problem is that it draws from left to right from the x coordinate supplied which is not what I wanted. I just wanted to mirror and image and then use it normally.

So I wrote this function which others may find useful.
I am aware that I could probably just Peek and Poke all the pixels to mirror it, so if someone wants to post that code, it would be cool.

; Mirror an image horizontally
Function ccMirrorImageHoriz(TheImage%)
;make a copy to work on
TempImage% = CopyImage(TheImage)
;flip it
TFormImage TempImage, -1, 0, 0, 1
;now draw it back to the original image
;note the corrected x coord
SetBuffer ImageBuffer(TheImage)
Cls
DrawImage(TempImage, ImageWidth(TempImage), 0)
FreeImage(TempImage)
SetBuffer BackBuffer
End Function