1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- namespace BBIWARG.Utility
- {
-
-
-
- public class ImageSize
- {
-
-
-
- public float DiagonalLength { get { return MaxPixel.Length; } }
-
-
-
- public int Height { get; private set; }
-
-
-
- public Vector2D MaxPixel { get; private set; }
-
-
-
- public int NumPixels { get { return Width * Height; } }
-
-
-
- public int Width { get; private set; }
-
-
-
-
-
- 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);
- }
- }
- }
|