ImageSize.cs 774 B

123456789101112131415161718192021222324252627
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace bbiwarg.Utility
  7. {
  8. public class ImageSize
  9. {
  10. public int Width {get; private set;}
  11. public int Height {get; private set;}
  12. public Vector2D MaxPixel {get; private set;}
  13. public float DiagonalLength { get { return MaxPixel.Length; } }
  14. public int NumPixels { get { return Width * Height; } }
  15. public ImageSize(int width, int height) {
  16. Width = width;
  17. Height = height;
  18. MaxPixel = new Vector2D(width - 1, height - 1);
  19. }
  20. public Vector2D getAbsolutePoint(Vector2D relativePoint) {
  21. return relativePoint.scale(MaxPixel);
  22. }
  23. }
  24. }