using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using System.Xml;
using ImageBlockz.Operations.InOut;
using ImageBlockz.Api;
using ImageBlockz.Core;
using AForge.Imaging.Filters;

namespace ImageBlockz.Operations.Filters
{
    public class GrayScaleRGB : AbstractOperation
    {
        public static readonly string OperationName = typeof(GrayScaleRGB).FullName;

        public GrayScaleRGB()
            : base(OperationType.Filter)
        {
        
        }

        public override Bitmap Do(Bitmap bmp)
        {
            AForge.Imaging.Filters.Grayscale filter = new AForge.Imaging.Filters.Grayscale(0.2125, 0.7154, 0.0721);
            bmp = filter.Apply(bmp);
            AForge.Imaging.Filters.GrayscaleToRGB filter2 = new AForge.Imaging.Filters.GrayscaleToRGB();
            return filter2.Apply(bmp);
        }

        public override XmlNode ToXml(XmlDocument xmlDoc)
        {
            return xmlDoc.CreateElement(OperationName);
        }

        public override void FromXml(XmlNode node)
        {
            
        }

        public override string GetFormattedName()
        {
            return "GrayScale";
        }


        public override string GetInfo()
        {
            return "No parameters.";
        }
    }
}
