Changed to .NET Framework and worked on Texture.cs
This commit is contained in:
@@ -5,8 +5,10 @@ namespace RecrownedAthenaeum.Types
|
||||
/// <summary>
|
||||
/// A wrapper that makes sure anything implementing can be drawn with options.
|
||||
/// </summary>
|
||||
public interface IDrawable
|
||||
public interface IRectangleDrawable
|
||||
{
|
||||
|
||||
byte[] ColorData {
|
||||
get;
|
||||
}
|
||||
}
|
||||
}
|
@@ -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[]));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user