Mirror images


#1

what’s the quickest way to get a mirror image of an image?


#2

Good question… I guess you could create a new one, and draw the image into it using an affine transform that flips it over. That’s not optimally fast though…


#3

hmm. OK, how do I flip on one axis using an AT? rotation’s no use: does both axis.

can we do negative scaleds like Java?

(heads fried here!)


#4

yes, it’d be a negative scale and a translation to get it back into position


#5

well I did my own for verticle only, involving lockPixelDataWhatever and a memcpy for each line.

only vertical was what I needed.

then I realised I didnt need it at all!


How to mirror an Image and change its colour
#6

I know this is an old post, but I just wanted to thank both Karbon and Jules for pointing out that an AffineTransform.scaled(-1,1) will flip the image. That wasn’t apparent from the notes in the header.


#7