package plugin.basic;

import plugin.IPlugin;

import java.awt.Color;
import java.awt.image.BufferedImage;


public class HorizontalFlip implements IPlugin {

    @Override
    public BufferedImage perform(BufferedImage img) {
        BufferedImage res = new BufferedImage(img.getWidth(), img.getHeight(), img.getType());

        for (int i = 0; i < img.getWidth(); i++)
            for (int j = 0; j < img.getHeight(); j++) {
                Color c = new Color(img.getRGB(i, j));
                res.setRGB(img.getWidth() - 1 - i, j, c.getRGB());
            }
        return res;
    }

    @Override
    public String getName() {
        return "Horizontal Flip";
    }

}