Flip an image

hello, i have been programming an image editor program, and i make an UI where you can click a button and change the image, but i have been struggling, i am trying to flip an image but it flips outside the range, i have been trying to use the scale(-1,1) but it havent work either or trying to set image(img, 600, 480) to put it at a zone that dont hides the menu bar, but it doest work either, please help.

here is the code i have been trying to use

int i = 0;                
while (i < pixels.length) {
  r = red  (pixels[i]);
  g = green(pixels[i]);
  b = blue (pixels[i]);

  color newColor = color(r, g, b); 
  pixels[pixels.length - 1 - i] = newColor;      
  i = i + 1;           //next pixel!
  if (i % width >= picWidth)        // This will ignore anything on the line that goes after the image like buttons
      i = i + width - picWidth;
Tagged:
Sign In or Register to comment.