Here you can find the source of flipPixels(int[] imgPixels, int imgw, int imgh)
Parameter | Description |
---|---|
imgPixels | the pixels contained within the image |
imgw | the width of the image |
imgh | the hieght of the image |
public static int[] flipPixels(int[] imgPixels, int imgw, int imgh)
//package com.java2s; //License from project: Open Source License public class Main { /**/*from w w w . j a va 2s . c o m*/ * Flip an array of pixels vertically * * @param imgPixels the pixels contained within the image * @param imgw the width of the image * @param imgh the hieght of the image * * @return int[] the pixel array fliped */ public static int[] flipPixels(int[] imgPixels, int imgw, int imgh) { int[] flippedPixels = null; if (imgPixels != null) { flippedPixels = new int[imgw * imgh]; for (int y = 0; y < imgh; y++) { for (int x = 0; x < imgw; x++) { flippedPixels[((imgh - y - 1) * imgw) + x] = imgPixels[(y * imgw) + x]; } } } return flippedPixels; } }