Table of Contents

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

size Size
position Position

Returns

bool

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

size Size
position Position
origin Position

Returns

bool

GetAllPositions(Size)

Gets all positions within the size bounds (for iteration)

public static IEnumerable<Position> GetAllPositions(this Size size)

Parameters

size Size

Returns

IEnumerable<Position>

GetCenter(Size)

Gets the center position of the size

public static Position GetCenter(this Size size)

Parameters

size Size

Returns

Position

ToRectangle(Size, Position)

Creates a rectangle from a size with the specified origin

public static Rectangle ToRectangle(this Size size, Position origin = default)

Parameters

size Size
origin Position

Returns

Rectangle