using System;
using System.Collections.Generic;
using System.Text;
namespace Orvid.Graphics
{
///
/// A Multi-Image Image,
/// This clas was created specifically for
/// The Tiff File Format.
///
public class MiImage : Shapes.Shape
{
private Image[] Images;
private UInt32 CurIndx;
///
/// The Active index of the MiImage,
/// This is the index of the Image
/// that gets drawn when Draw() is called.
///
public UInt32 ActiveIndex
{
get
{
return CurIndx;
}
set
{
SetActiveIndex(value);
}
}
///
/// The default contructor for a MiImage.
///
/// The First Image to add to the MiImage.
public MiImage(Image init)
{
Images = new Image[] { init };
CurIndx = 0;
}
///
/// Create a new MiImage from an Image Array.
///
/// The image array to create the MiImage from.
public MiImage(Image[] images)
{
Images = new Image[images.Length];
Array.Copy(images, Images, images.Length);
CurIndx = 0;
}
///
/// Get the image at the specified index.
///
/// The index of the image to get.
/// The image at the specified Index.
public Image GetImage(UInt32 indx)
{
if (indx < Images.Length)
return Images[indx];
throw new Exception("No Image at specified Index!");
}
///
/// Set's the active index to the specified value.
///
/// What to set the active index to.
public void SetActiveIndex(UInt32 indx)
{
if (indx < Images.Length)
CurIndx = indx;
throw new Exception("No Image at specified Index!");
}
///
/// Adds the specified image at the end of the MiImage.
///
/// The image to add.
public void AppendImage(Image i)
{
Image[] tmp = new Image[Images.Length + 1];
Array.Copy(Images, tmp, Images.Length);
tmp[tmp.Length - 1] = i;
Images = tmp;
}
public override void Draw()
{
Parent.DrawImage(new Vec2(base.X, base.Y), Images[CurIndx]);
}
}
}