/// <summary> /// Constructs a new instance of <see cref="TrackableObjectChangedEventArgs"/> from the specified values. /// </summary> /// <param name="newPosition">The <see cref="NewPosition"/>.</param> /// <param name="oldPosition">The <see cref="OldPosition"/>.</param> /// <param name="newSize">The <see cref="NewSize"/>.</param> /// <param name="oldSize">The <see cref="OldSize"/>.</param> public TrackableObjectChangedEventArgs(PointF newPosition, PointF oldPosition, SizeF newSize, SizeF oldSize) { NewPosition = newPosition; OldPosition = oldPosition; NewSize = newSize; OldSize = oldSize; }
/// <summary> /// Rounds a <see cref="SizeF"/> value down to the nearest <see cref="SizeShort"/> value. /// </summary> /// <param name="value">The <see cref="SizeF"/> value to round.</param> /// <returns>The <see cref="SizeShort"/> representing the rounded value.</returns> public static SizeShort Truncate(SizeF value) => new SizeShort((short)(value.Width), (short)(value.Height));
/// <summary> /// Subtracts a <see cref="SizeF"/> by another <see cref="SizeF"/>. /// </summary> /// <param name="sz1">The <see cref="SizeF"/> to be subtracted from.</param> /// <param name="sz2">The <see cref="SizeF"/> to subtract.</param> /// <returns>A <see cref="SizeF"/> representing the difference.</returns> public static SizeF Subtract(SizeF sz1, SizeF sz2) => sz1 - sz2;
/// <summary> /// Adds two <see cref="SizeF"/> structures together and returns the result. /// </summary> /// <param name="sz1">The first <see cref="SizeF"/> to add.</param> /// <param name="sz2">The second <see cref="SizeF"/> to add.</param> /// <returns>A new <see cref="SizeF"/> structure that is the addition of the provided structurs.</returns> public static SizeF Add(SizeF sz1, SizeF sz2) => sz1 + sz2;
/// <summary> /// Constructs a new instance of <see cref="RectangleF"/> from the specified <see cref="X"/>, <see cref="Y"/>, <see cref="Width"/> and <see cref="Height"/>. /// </summary> /// <param name="x">A value representing the <see cref="X"/> of the <see cref="RectangleF"/>.</param> /// <param name="y">A value representing the <see cref="Y"/> of the <see cref="RectangleF"/>.</param> /// <param name="width">A value representing the <see cref="Width"/> of the <see cref="RectangleF"/>.</param> /// <param name="height">A value representing the <see cref="Height"/> of the <see cref="RectangleF"/>.</param> public RectangleF(float x, float y, float width, float height) { Location = new PointF(x, y); Size = new SizeF(width, height); }
/// <summary> /// Constructs a new instance of <see cref="RectangleF"/> from the specified <see cref="PointF"/> and <see cref="SizeF"/>. /// </summary> /// <param name="location">The <see cref="Location"/> of the <see cref="RectangleF"/>.</param> /// <param name="size">The <see cref="Size"/> of the <see cref="RectangleF"/>.</param> public RectangleF(PointF location, SizeF size) { Location = location; Size = size; }
/// <summary> /// Constructs a new <see cref="Size"/> structure from the specified <see cref="SizeF"/> by rounding values up to the nearest whole number. /// </summary> /// <param name="value">The <see cref="Size"/> to be rounded up.</param> /// <returns>The <see cref="Size"/> representing the rounded <see cref="SizeF"/>.</returns> public static Size Ceiling(SizeF value) => new Size((int)Math.Ceiling(value.Width), (int)Math.Ceiling(value.Height));
/// <summary> /// Updates the <see cref="Size"/> of the current <see cref="Camera"/> instance. /// </summary> /// <param name="size">A <see cref="SizeF"/> representing the new <see cref="Size"/> of the <see cref="Camera"/>.</param> public void SetSize(SizeF size) { Size = size; }
/// <summary> /// Offsets a <see cref="PointF"/> by the specified <see cref="SizeF"/>. /// </summary> /// <param name="pt">The <see cref="PointF"/> that should be offset.</param> /// <param name="sz">The <see cref="SizeF"/> to offset by.</param> /// <returns>A new <see cref="PointF"/> that has been offset.</returns> public static PointF Add(PointF pt, SizeF sz) => pt + sz;
/// <summary> /// Constructs a new instance of <see cref="PointF"/> from the specified <see cref="SizeF"/>. /// </summary> /// <param name="sz">The <see cref="SizeF"/> to construct the <see cref="PointF"/> from.</param> /// <remarks> /// The <see cref="SizeF.Width"/> will become the <see cref="X"/> and the <see cref="SizeF.Height"/> will become the <see cref="Y"/>. /// </remarks> public PointF(SizeF sz) : this() { _x = sz.Width; _y = sz.Height; }
/// <summary> /// Subtracts a <see cref="PointF"/> by a <see cref="SizeF"/>. /// </summary> /// <param name="pt">The <see cref="PointF"/> to be subtracted from.</param> /// <param name="sz">The <see cref="SizeF"/> to subtract.</param> /// <returns>A <see cref="PointF"/> representing the difference.</returns> public static PointF Subtract(PointF pt, SizeF sz) => pt - sz;
/// <summary> /// Rounds a <see cref="SizeF"/> value to the nearest <see cref="SizeByte"/> value. /// </summary> /// <param name="value">The <see cref="SizeF"/> value to round.</param> /// <returns>The <see cref="SizeByte"/> representing the rounded value.</returns> public static SizeByte Round(SizeF value) => new SizeByte((byte)Math.Round(value.Width), (byte)Math.Round(value.Height));
/// <summary> /// Rounds a <see cref="SizeF"/> value up to the nearest <see cref="SizeByte"/> value. /// </summary> /// <param name="value">The <see cref="SizeF"/> value to round.</param> /// <returns>The <see cref="SizeByte"/> representing the rounded value.</returns> public static SizeByte Ceiling(SizeF value) => new SizeByte((byte)Math.Ceiling(value.Width), (byte)Math.Ceiling(value.Height));
/// <summary> /// Rounds a <see cref="SizeF"/> value down to the nearest <see cref="SizeByte"/> value. /// </summary> /// <param name="value">The <see cref="SizeF"/> value to round.</param> /// <returns>The <see cref="SizeByte"/> representing the rounded value.</returns> public static SizeByte Truncate(SizeF value) => new SizeByte((byte)(value.Width), (byte)(value.Height));
/// <summary> /// Constructs a new <see cref="Size"/> from the specified <see cref="SizeF"/> by rounding all values to the nearest whole number. /// </summary> /// <param name="value">The <see cref="SizeF"/> to be rounded.</param> /// <returns>The <see cref="Size"/> representing the rounded <see cref="SizeF"/>.</returns> public static Size Round(SizeF value) => new Size((int)Math.Round(value.Width), (int)Math.Round(value.Height));
/// <summary> /// Rounds a <see cref="SizeF"/> value up to the nearest <see cref="SizeShort"/> value. /// </summary> /// <param name="value">The <see cref="SizeF"/> value to round.</param> /// <returns>The <see cref="SizeShort"/> representing the rounded value.</returns> public static SizeShort Ceiling(SizeF value) => new SizeShort((short)Math.Ceiling(value.Width), (short)Math.Ceiling(value.Height));
/// <summary> /// Rounds a <see cref="SizeF"/> value to the nearest <see cref="SizeShort"/> value. /// </summary> /// <param name="value">The <see cref="SizeF"/> value to round.</param> /// <returns>The <see cref="SizeShort"/> representing the rounded value.</returns> public static SizeShort Round(SizeF value) => new SizeShort((short)Math.Round(value.Width), (short)Math.Round(value.Height));
/// <summary> /// Increases the <see cref="Size"/> of the <see cref="RectangleF"/> by the specified <see cref="Drawing.SizeF"/>. /// </summary> /// <param name="size">The <see cref="Drawing.SizeF"/> to increase the <see cref="RectangleF"/> by.</param> /// <returns>A new <see cref="RectangleF"/> with the increased <see cref="Size"/>.</returns> public RectangleF Inflate(SizeF size) => new RectangleF(Location, Size + size);
/// <summary> /// Alters the <see cref="Size"/> of the current <see cref="Camera"/> instance by the specified <see cref="Vector2F"/>. /// </summary> /// <param name="adjustment">The <see cref="Vector2F"/> representing how much to increase/decrease the <see cref="Size"/>.</param> public void ResizeCamera(Vector2F adjustment) { Size = new SizeF(Size.Width + adjustment.X, Size.Height + adjustment.Y); }
/// <summary> /// Constructs a new <see cref="Size"/> from the specified <see cref="SizeF"/> by rounding all values down to the nearest whole number. /// </summary> /// <param name="value">The <see cref="SizeF"/> to be rounded down.</param> /// <returns>The <see cref="Size"/> representing the rounded <see cref="SizeF"/>.</returns> public static Size Truncate(SizeF value) => new Size((int)(value.Width), (int)(value.Height));