Java BufferedImage Flip flipVertically(BufferedImage source)

Here you can find the source of flipVertically(BufferedImage source)

Description

Flips a given image vertically.

License

Apache License

Parameter

Parameter Description
source The source image.

Return

BufferedImage

Declaration

public static BufferedImage flipVertically(BufferedImage source) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.awt.Graphics2D;

import java.awt.image.BufferedImage;

public class Main {
    private static BufferedImage bimg;
    private static Graphics2D g2;
    private static int w;
    private static int h;

    /**//from   w w w .j av a  2s .  c om
     * Flips a given image vertically.
     * @param source The source image.
     * @return BufferedImage
     */
    public static BufferedImage flipVertically(BufferedImage source) {
        w = source.getWidth();
        h = source.getHeight();
        bimg = new BufferedImage(w, h, source.getType());
        g2 = bimg.createGraphics();
        g2.drawImage(source, 0, 0, w, h, 0, h, w, 0, null);
        g2.dispose();

        return bimg;
    }
}

Related

  1. flipImageVertically(BufferedImage theImage)
  2. flipVertical(BufferedImage im)
  3. flipVertically(BufferedImage image)
  4. flipVertically(BufferedImage image)
  5. flipVertically(BufferedImage image, RenderingHints hints)
  6. horizontalflip(BufferedImage img)
  7. verticalFlip(BufferedImage img)
  8. verticalFlip(BufferedImage img)