Changed to .NET Framework and worked on Texture.cs
This commit is contained in:
parent
713df6d111
commit
e29602d055
@ -1,6 +1,6 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
<TargetFramework>net48</TargetFramework>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3"/>
|
||||
|
@ -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[]));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user