using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;

namespace Icarus.Graphics.Animation
{
	public abstract class AbstractFrame
		: AbstractRenderable, IFrame
	{
        #region IFrame
        public abstract Bitmap getFrameImage();
        #endregion

        #region IRenderable
        //public abstract void Render(System.Drawing.Point coordinates, IRenderParameters parameters);
        //public abstract void Render(System.Drawing.Rectangle destination, IRenderParameters parameters);
        #endregion

        /**
		 * This is the anchor point used for the frame.
		 */
        private Point m_AnchorPoint = new Point(0, 0);

		/**
		 * This is the size of the frame.
		 */
		private Size m_FrameSize = new Size(0, 0);

		/**
		 * Returns the anchor point of the frame.
		 */
		public Point getAnchorPoint() 
		{
			return m_AnchorPoint;
		}

		/**
		 * Sets up a new anchor point.
		 */
		public void setAnchorPoint(Point p) 
		{
			m_AnchorPoint = p;
		}

		/**
		 * Initializes the frame using the anchor point and bitmap
		 * passed in, and returns true if the initialization went
		 * through successfully, and false if it did not.
		 */
		public bool initialize(Point anchor, Bitmap image) 
		{
			this.setAnchorPoint(anchor);

			this.m_FrameSize.Width = image.Width;
			this.m_FrameSize.Height = image.Height;

			return this.initializeFromBitmap(image);
		}
	
		/**
		 * Will return the size of the frame.
		 */
		public override Size GetSize()
		{
			return m_FrameSize;
		}

		public abstract bool initializeFromBitmap(Bitmap image);
	}
}