PixelRect
Namespace: Hex1b.Surfaces
Assembly: Hex1b.dll
Represents a rectangle in pixel coordinates.
public readonly record struct PixelRect : IEquatable<PixelRect>Implements
Constructors
PixelRect(int, int, int, int)
Represents a rectangle in pixel coordinates.
Parameters:
X(Int32): Left edge (inclusive).Y(Int32): Top edge (inclusive).Width(Int32): Width in pixels.Height(Int32): Height in pixels.
public PixelRect(int X, int Y, int Width, int Height)Properties
Area
Gets the area of this rectangle.
Returns: Int32
public int Area { get; }Bottom
Gets the bottom edge (exclusive).
Returns: Int32
public int Bottom { get; }Height
Height in pixels.
Returns: Int32
public int Height { get; init; }IsEmpty
Gets whether this rectangle has zero area.
Returns: Boolean
public bool IsEmpty { get; }Right
Gets the right edge (exclusive).
Returns: Int32
public int Right { get; }Width
Width in pixels.
Returns: Int32
public int Width { get; init; }X
Left edge (inclusive).
Returns: Int32
public int X { get; init; }Y
Top edge (inclusive).
Returns: Int32
public int Y { get; init; }Methods
Contains(int, int)
Returns whether this rectangle contains the specified point.
Parameters:
Returns: Boolean
public bool Contains(int x, int y)Contains(PixelRect)
Returns whether this rectangle fully contains another.
Parameters:
other(PixelRect):
Returns: Boolean
public bool Contains(PixelRect other)Intersect(PixelRect)
Returns the intersection of this rectangle with another.
Parameters:
other(PixelRect):
Returns: PixelRect
public PixelRect Intersect(PixelRect other)Overlaps(PixelRect)
Returns whether this rectangle overlaps another.
Parameters:
other(PixelRect):
Returns: Boolean
public bool Overlaps(PixelRect other)Subtract(PixelRect)
Subtracts a rectangle from this one, returning up to 4 remaining fragments.
Parameters:
hole(PixelRect): The rectangle to subtract.
Returns: IReadOnlyList<PixelRect>
List of non-empty fragments remaining after subtraction.
public IReadOnlyList<PixelRect> Subtract(PixelRect hole)