Java Utililty Methods Image Flip

List of utility methods to do Image Flip

Description

The list of methods to do Image Flip are organized into topic(s).

Method

voidflipImage(int stride, int height, int b[])
flip Image
int tmp[] = new int[stride];
for (int row = 0; row < height / 2; row++) {
    int rowa = row;
    int rowb = height - 1 - rowa;
    System.arraycopy(b, rowa * stride, tmp, 0, stride);
    System.arraycopy(b, rowb * stride, b, rowa * stride, stride);
    System.arraycopy(tmp, 0, b, rowb * stride, stride);
ObjectflipImage(Object nativeImage, boolean flipHorizontal, boolean flipVertical)
flip Image
throw new RuntimeException();
ImageflipImageVertically(Image img)
Flips an image vertically.
int w = img.getWidth(null);
int h = img.getHeight(null);
BufferedImage bimg = toBufferedImage(getEmptyImage(w, h));
Graphics2D g = bimg.createGraphics();
g.drawImage(img, 0, 0, w, h, 0, h, w, 0, null);
g.dispose();
return toImage(bimg);
int[]flipPixels(int[] imgPixels, int imgw, int imgh)
Flip an array of pixels vertically
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;