More Mirror Image

BlitzPlus Forums/BlitzPlus Programming/More Mirror Image

Grey Alien(Posted 2004) [#1]
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


Grey Alien(Posted 2004) [#2]
oops, it should be SetBuffer BackBuffer() with brackets


WolRon(Posted 2004) [#3]
Have you noticed the Edit link in the top corner of each of your posts? You can use it.


Grey Alien(Posted 2004) [#4]
That is cool Wolron, thanks!