Class SizeExtensions
- Namespace
- Gloam.Core.Extensions.Primitives
- Assembly
- Gloam.Core.dll
Extension methods for Size operations
public static class SizeExtensions
- Inheritance
-
SizeExtensions
- Inherited Members
Methods
Contains(Size, Position)
Checks if a position is within the bounds of a size (assuming origin at 0,0)
public static bool Contains(this Size size, Position position)
Parameters
Returns
Contains(Size, Position, Position)
Checks if a position is within the bounds of a size with a specific origin
public static bool Contains(this Size size, Position position, Position origin)
Parameters
Returns
GetAllPositions(Size)
Gets all positions within the size bounds (for iteration)
public static IEnumerable<Position> GetAllPositions(this Size size)
Parameters
size
Size
Returns
GetCenter(Size)
Gets the center position of the size
public static Position GetCenter(this Size size)
Parameters
size
Size
Returns
ToRectangle(Size, Position)
Creates a rectangle from a size with the specified origin
public static Rectangle ToRectangle(this Size size, Position origin = default)