using System.Drawing;

namespace ZionGraphics.Filtering
{
    class Compression : IFilter
    {
        public override Bitmap Apply(Bitmap bitmap)
        {
            int value = (int)bitmap.VerticalResolution;

            if (Intensity == 0)
                return bitmap;

            Quality quality = new Quality { Intensity = this.Intensity };

            bitmap = quality.Apply(bitmap);

            if (Intensity >= 66 && bitmap.VerticalResolution >= 300)
                value = 300;
            else if (Intensity < 66 && Intensity >= 50 && bitmap.VerticalResolution >= 200)
                value = 200;
            else if (Intensity < 50 && Intensity >= 33 && bitmap.VerticalResolution >= 150)
                value = 150;
            else if (Intensity < 33 && bitmap.VerticalResolution >= 100)
                value = 100;

            Resolution resolution = new Resolution { Intensity = value };

            return bitmap;
        }
    }
}
