Skip to content
Nick edited this page Nov 16, 2019 · 6 revisions

How does it work?

There are multiple ways to flip an image. In this library I choose the easy way, but this is not the fastest.

At first you create a new blank image with the dimensions form the original. Than you have iterate every pixel. The current pixel will get a new position for the flip. In horizontal the new x position is the image width - the current x position of the pixel. A vertical flip is same with the image height. Now you have the new pixel position and the pixel could placed in the blank image.

int newx = horizonal ? image.width - x : x;
int newy = vertical ? image.height - y : y;

Clone this wiki locally