Browse Source

add Width and Height to Texture

main
Colin McMillen 1 year ago
parent
commit
f822a07602
  1. 9
      Program.cs

9
Program.cs

@ -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();

Loading…
Cancel
Save