add Width and Height to Texture

This commit is contained in:
Colin McMillen 2023-06-29 22:21:41 -04:00
parent 712472bdfb
commit f822a07602

View File

@ -125,14 +125,19 @@ void main() {
public class Texture : IDisposable {
public int Handle;
public int Width;
public int Height;
public Texture(string path) {
Image<Rgba32> image = Image.Load<Rgba32>(path);
Console.WriteLine($"image loaded: {image.Width}x{image.Height}");
Width = image.Width;
Height = image.Height;
Console.WriteLine($"image loaded: {Width}x{Height}");
//foreach (IExifValue exif in image.Metadata.ExifProfile.Values) {
// Console.WriteLine($"{exif.Tag} : {exif.GetValue()}");
//}
byte[] pixelBytes = new byte[image.Width * image.Height * Unsafe.SizeOf<Rgba32>()];
byte[] pixelBytes = new byte[Width * Height * Unsafe.SizeOf<Rgba32>()];
image.CopyPixelDataTo(pixelBytes);
image.Dispose();