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.Convolutions
{
    public class Sharpen : AbstractOperation
    {
        public static readonly string OperationName = typeof(Sharpen).FullName;

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

        public override Bitmap Do(Bitmap bmp)
        {
            int[,] kernel = {
            {  0,  -2,  0},
            { -2,  11, -2},
            {  0,  -2,  0} };
            AForge.Imaging.Filters.Convolution filter = new AForge.Imaging.Filters.Convolution(kernel);            
            return filter.Apply(bmp);
        }

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

        public override void FromXml(XmlNode node)
        {
            
        }

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

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