diff --git a/RecrownedAthenaeum/RecrownedAthenaeum.csproj b/RecrownedAthenaeum/RecrownedAthenaeum.csproj index 9f81f67..fc2659a 100644 --- a/RecrownedAthenaeum/RecrownedAthenaeum.csproj +++ b/RecrownedAthenaeum/RecrownedAthenaeum.csproj @@ -1,6 +1,6 @@ - netstandard2.0 + net48 diff --git a/RecrownedAthenaeum/Types/IDrawable.cs b/RecrownedAthenaeum/Types/IRectangleDrawable.cs similarity index 68% rename from RecrownedAthenaeum/Types/IDrawable.cs rename to RecrownedAthenaeum/Types/IRectangleDrawable.cs index d034038..43204cf 100644 --- a/RecrownedAthenaeum/Types/IDrawable.cs +++ b/RecrownedAthenaeum/Types/IRectangleDrawable.cs @@ -5,8 +5,10 @@ namespace RecrownedAthenaeum.Types /// /// A wrapper that makes sure anything implementing can be drawn with options. /// - public interface IDrawable + public interface IRectangleDrawable { - + byte[] ColorData { + get; + } } } diff --git a/RecrownedAthenaeum/Types/Texture.cs b/RecrownedAthenaeum/Types/Texture.cs index 4aa0399..8aeebb2 100644 --- a/RecrownedAthenaeum/Types/Texture.cs +++ b/RecrownedAthenaeum/Types/Texture.cs @@ -1,19 +1,33 @@ +using System.Drawing; +using System.Drawing.Drawing2D; +using System.Drawing.Imaging; using System.IO; + namespace RecrownedAthenaeum.Types { - public class Texture { + public class Texture : IRectangleDrawable { byte[] textureData; + public byte[] ColorData { + get { + return textureData; + } + } public Texture() { - Image img = Image.FromFile() } 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)) { - Image img = new Image(); - img.LoadFromPNG(file); + using (Bitmap bitmap = new Bitmap(file)) { + ImageConverter converter = new ImageConverter(); + textureData = (byte[]) converter.ConvertTo(bitmap, typeof(byte[])); + } } }