BoxInterface
in
Interface for a box.
Table of Contents
Methods
- __toString() : string
- Returns a string representation of the current box.
- contains() : bool
- Checks whether current box can fit given box at a given start position, start position defaults to top left corner xy(0,0).
- getHeight() : int
- Gets box height.
- getWidth() : int
- Gets box width.
- heighten() : static
- Resizes box to given height, constraining proportions and returns the new box.
- increase() : static
- Creates new BoxInterface, adding given size to both sides.
- scale() : static
- Creates new BoxInterface instance with ratios applied to both sides.
- square() : int
- Gets current box square, useful for getting total number of pixels in a given box.
- widen() : static
- Resizes box to given width, constraining proportions and returns the new box.
Methods
__toString()
Returns a string representation of the current box.
public
__toString() : string
Return values
stringcontains()
Checks whether current box can fit given box at a given start position, start position defaults to top left corner xy(0,0).
public
contains(BoxInterface $box[, PointInterface $start = null ]) : bool
Parameters
- $box : BoxInterface
- $start : PointInterface = null
Return values
boolgetHeight()
Gets box height.
public
getHeight() : int
Return values
intgetWidth()
Gets box width.
public
getWidth() : int
Return values
intheighten()
Resizes box to given height, constraining proportions and returns the new box.
public
heighten(int $height) : static
Parameters
- $height : int
Return values
staticincrease()
Creates new BoxInterface, adding given size to both sides.
public
increase(int $size) : static
Parameters
- $size : int
Return values
staticscale()
Creates new BoxInterface instance with ratios applied to both sides.
public
scale(float $ratio) : static
Parameters
- $ratio : float
Return values
staticsquare()
Gets current box square, useful for getting total number of pixels in a given box.
public
square() : int
Return values
intwiden()
Resizes box to given width, constraining proportions and returns the new box.
public
widen(int $width) : static
Parameters
- $width : int