More Mirror Image

BlitzPlus Forums/BlitzPlus Programming/More Mirror Image

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

oops, it should be SetBuffer BackBuffer() with brackets

Have you noticed the Edit link in the top corner of each of your posts? You can use it.

That is cool Wolron, thanks!