interface BoxInterface

Interface for a box.

Methods

int
getHeight()

Gets box height.

int
getWidth()

Gets box width.

scale(float $ratio)

Creates new BoxInterface instance with ratios applied to both sides.

increase(int $size)

Creates new BoxInterface, adding given size to both sides.

bool
contains(BoxInterface $box, PointInterface $start = null)

Checks whether current box can fit given box at a given start position, start position defaults to top left corner xy(0,0).

int
square()

Gets current box square, useful for getting total number of pixels in a given box.

string
__toString()

Returns a string representation of the current box.

widen(int $width)

Resizes box to given width, constraining proportions and returns the new box.

heighten(int $height)

Resizes box to given height, constraining proportions and returns the new box.

Details

at line 24
int getHeight()

Gets box height.

Return Value

int

at line 31
int getWidth()

Gets box width.

Return Value

int

at line 40
BoxInterface scale(float $ratio)

Creates new BoxInterface instance with ratios applied to both sides.

Parameters

float $ratio

Return Value

BoxInterface

at line 49
BoxInterface increase(int $size)

Creates new BoxInterface, adding given size to both sides.

Parameters

int $size

Return Value

BoxInterface

at line 60
bool contains(BoxInterface $box, PointInterface $start = null)

Checks whether current box can fit given box at a given start position, start position defaults to top left corner xy(0,0).

Parameters

BoxInterface $box
PointInterface $start

Return Value

bool

at line 68
int square()

Gets current box square, useful for getting total number of pixels in a given box.

Return Value

int

at line 75
string __toString()

Returns a string representation of the current box.

Return Value

string

at line 84
BoxInterface widen(int $width)

Resizes box to given width, constraining proportions and returns the new box.

Parameters

int $width

Return Value

BoxInterface

at line 93
BoxInterface heighten(int $height)

Resizes box to given height, constraining proportions and returns the new box.

Parameters

int $height

Return Value

BoxInterface