Mirror images


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


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…


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!)


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


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

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.