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">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>netstandard2.0</TargetFramework>
|
<TargetFramework>net48</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3"/>
|
<PackageReference Include="Newtonsoft.Json" Version="12.0.3"/>
|
||||||
|
@ -5,8 +5,10 @@ namespace RecrownedAthenaeum.Types
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// A wrapper that makes sure anything implementing can be drawn with options.
|
/// A wrapper that makes sure anything implementing can be drawn with options.
|
||||||
/// </summary>
|
/// </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;
|
using System.IO;
|
||||||
|
|
||||||
namespace RecrownedAthenaeum.Types {
|
namespace RecrownedAthenaeum.Types {
|
||||||
public class Texture {
|
public class Texture : IRectangleDrawable {
|
||||||
byte[] textureData;
|
byte[] textureData;
|
||||||
|
public byte[] ColorData {
|
||||||
|
get {
|
||||||
|
return textureData;
|
||||||
|
}
|
||||||
|
}
|
||||||
public Texture() {
|
public Texture() {
|
||||||
Image img = Image.FromFile()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Texture(byte[] textureData) {
|
public Texture(byte[] textureData) {
|
||||||
this.textureData = textureData;
|
this.textureData = textureData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Texture(string path) {
|
||||||
|
LoadFromPNG(path);
|
||||||
|
}
|
||||||
|
|
||||||
public void LoadFromPNG(string path) {
|
public void LoadFromPNG(string path) {
|
||||||
using (FileStream file = new FileStream(path, FileMode.Open)) {
|
using (FileStream file = new FileStream(path, FileMode.Open)) {
|
||||||
Image img = new Image();
|
using (Bitmap bitmap = new Bitmap(file)) {
|
||||||
img.LoadFromPNG(file);
|
ImageConverter converter = new ImageConverter();
|
||||||
|
textureData = (byte[]) converter.ConvertTo(bitmap, typeof(byte[]));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user