Size
in package
Table of Contents
Properties
Methods
- __construct() : mixed
- Creates a new Size instance
- align() : Size
- Aligns current size's pivot point to given position and moves point automatically by offset.
- fit() : Size
- Resize given Size to best fitting size of current size.
- fitsInto() : bool
- Checks if given size fits into current size
- getHeight() : int
- Get the current height
- getRatio() : float
- Calculate the current aspect ratio
- getWidth() : int
- Get the current width
- relativePosition() : Point
- Calculate the relative position to another Size based on the pivot point settings of both sizes.
- resize() : Size
- Resize to desired width and/or height
- set() : mixed
- Set the width and height absolutely
- setPivot() : mixed
- Set current pivot point
- getConstraint() : Constraint
- Runs constraints on current size
- resizeHeight() : Size
- Scale size according to given constraints
- resizeWidth() : Size
- Scale size according to given constraints
Properties
$height
Height
public
int
$height
$pivot
Pivot point
public
Point
$pivot
$width
Width
public
int
$width
Methods
__construct()
Creates a new Size instance
public
__construct([int $width = null ][, int $height = null ][, Point $pivot = null ]) : mixed
Parameters
- $width : int = null
- $height : int = null
- $pivot : Point = null
align()
Aligns current size's pivot point to given position and moves point automatically by offset.
public
align(string $position[, int $offset_x = 0 ][, int $offset_y = 0 ]) : Size
Parameters
- $position : string
- $offset_x : int = 0
- $offset_y : int = 0
Return values
Sizefit()
Resize given Size to best fitting size of current size.
public
fit(Size $size[, mixed $position = 'center' ]) : Size
Parameters
- $size : Size
- $position : mixed = 'center'
Return values
SizefitsInto()
Checks if given size fits into current size
public
fitsInto(Size $size) : bool
Parameters
- $size : Size
Return values
boolgetHeight()
Get the current height
public
getHeight() : int
Return values
intgetRatio()
Calculate the current aspect ratio
public
getRatio() : float
Return values
floatgetWidth()
Get the current width
public
getWidth() : int
Return values
intrelativePosition()
Calculate the relative position to another Size based on the pivot point settings of both sizes.
public
relativePosition(Size $size) : Point
Parameters
- $size : Size
Return values
Pointresize()
Resize to desired width and/or height
public
resize(int $width, int $height[, Closure $callback = null ]) : Size
Parameters
- $width : int
- $height : int
- $callback : Closure = null
Return values
Sizeset()
Set the width and height absolutely
public
set(int $width, int $height) : mixed
Parameters
- $width : int
- $height : int
setPivot()
Set current pivot point
public
setPivot(Point $point) : mixed
Parameters
- $point : Point
getConstraint()
Runs constraints on current size
private
getConstraint([Closure $callback = null ]) : Constraint
Parameters
- $callback : Closure = null
Return values
ConstraintresizeHeight()
Scale size according to given constraints
private
resizeHeight(int $height[, Closure $callback = null ]) : Size
Parameters
- $height : int
- $callback : Closure = null
Return values
SizeresizeWidth()
Scale size according to given constraints
private
resizeWidth(int $width[, Closure $callback = null ]) : Size
Parameters
- $width : int
- $callback : Closure = null