package plugin.basic;

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

import plugin.IPlugin;

public class RotateLeftFilter implements IPlugin {

    @Override
    public BufferedImage perform(BufferedImage img) {
        BufferedImage res = new BufferedImage(img.getHeight(), img.getWidth(), 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(j, res.getHeight() - 1 - i, c.getRGB());
            }
        return res;
    }

    @Override
    public String getName() {
        return "Rotate Left";
    }

}