using System; using System.Collections.Generic; using System.Linq; using System.Drawing; using System.Text; using System.Threading.Tasks; namespace bbiwarg.Utility { public class ImageSize { public int Width {get; private set;} public int Height {get; private set;} public Vector2D MaxPixel {get; private set;} public float DiagonalLength { get { return MaxPixel.Length; } } public int NumPixels { get { return Width * Height; } } public ImageSize(int width, int height) { Width = width; Height = height; MaxPixel = new Vector2D(width - 1, height - 1); } public Vector2D getAbsolutePoint(Vector2D relativePoint) { return relativePoint.scale(MaxPixel); } public Vector2D getRelativePoint(Vector2D absolutePoint) { return new Vector2D(absolutePoint.X / Width, absolutePoint.Y / Height); } } }