class Box implements BoxInterface
A box implementation
Methods
__construct(integer $width, integer $height)
Constructs the Size with given width and height |
||
integer |
getWidth()
Gets current image width |
|
integer |
getHeight()
Gets current image height |
|
BoxInterface |
scale(float $ratio)
Creates new BoxInterface instance with ratios applied to both sides |
|
BoxInterface |
increase(integer $size)
Creates new BoxInterface, adding given size to both sides |
|
Boolean |
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) |
|
integer |
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 |
|
BoxInterface |
widen(integer $width)
Resizes box to given width, constraining proportions and returns the new box |
|
BoxInterface |
heighten(integer $height)
Resizes box to given height, constraining proportions and returns the new box |
Details
at line 39
public
__construct(integer $width, integer $height)
Constructs the Size with given width and height
at line 55
public integer
getWidth()
Gets current image width
at line 63
public integer
getHeight()
Gets current image height
at line 71
public BoxInterface
scale(float $ratio)
Creates new BoxInterface instance with ratios applied to both sides
at line 79
public BoxInterface
increase(integer $size)
Creates new BoxInterface, adding given size to both sides
at line 87
public Boolean
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)
at line 99
public integer
square()
Gets current box square, useful for getting total number of pixels in a given box
at line 107
public string
__toString()
Returns a string representation of the current box
at line 115
public BoxInterface
widen(integer $width)
Resizes box to given width, constraining proportions and returns the new box
at line 123
public BoxInterface
heighten(integer $height)
Resizes box to given height, constraining proportions and returns the new box