using Bridge.Html5;
using Mox.Shared.Renderer;

namespace Mox.Bridge.Renderer
{
	public class WebGLImage : ImageBase
	{
		public WebGLImage(byte[] _aData, string _sExtension)
		{
			var encoder = new Base64Encoder(_aData);
			Image = new HTMLImageElement
			{
				Src = "data:image/" + _sExtension + ";base64," + encoder.GetEncoded()
			};
		}

		public override int Width
		{
			get
			{
				return Image.Width;
			}
		}

		public override int Height
		{
			get
			{
				return Image.Height;
			}
		}

		public HTMLImageElement Image
		{
			get;
		}
	}
}
