using System.Drawing; using System.IO; namespace RecrownedAthenaeum.Graphics { public class Texture : IRectangleDrawable { //TODO Complete a basic texture capable of being rendered by a batch. byte[] textureData; public byte[] ColorData { get { return textureData; } } public Texture() { } public Texture(byte[] textureData) { this.textureData = textureData; } public Texture(string path) { LoadFromPNG(path); } public void LoadFromPNG(string path) { using (FileStream file = new FileStream(path, FileMode.Open)) { using (Bitmap bitmap = new Bitmap(file)) { ImageConverter converter = new ImageConverter(); textureData = (byte[]) converter.ConvertTo(bitmap, typeof(byte[])); } } } } }