package filter.basic;

import filter.Filter;

import java.awt.image.BufferedImage;

/**
 * Created by Alexandre on 24/04/2016.
 */
public class RotateLeft implements Filter
{
    // TODO
    @Override
    public BufferedImage perform(BufferedImage img)
    {
        BufferedImage res = new BufferedImage(img.getWidth(), img.getHeight(), img.getType());
        int w = img.getWidth();
        int h = img.getHeight();
        for (int i = 0; i < w; i++)
            for (int j = 0; j < h; j++)
                res.setRGB(j, h - i - 1, img.getRGB(i, j));
        return res;
    }

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