using System.Drawing;
using System.Xml;
using ImageBlockz.Api;


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

        public ToImage() : base(OperationType.Output)
        {
        }

        protected ToImage(string operationName)
            : this()
        {

        }

        public Bitmap Image { get; set; }

        public override Bitmap Do(Bitmap img)
        {
            Image = img;

            return img;
        }

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

        public override void FromXml(XmlNode node)
        {
        }

        public override string GetFormattedName()
        {
            return "To Image";
        }


        public override string GetInfo()
        {
            return "To: Main";
        }

        public Bitmap GetImage()
        {
            return Image;
        }
    }
}