Documentation

Size
in package

Table of Contents

Properties

$height  : int
Height
$pivot  : Point
Pivot point
$width  : int
Width

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

$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
Size

fit()

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
Size

fitsInto()

Checks if given size fits into current size

public fitsInto(Size $size) : bool
Parameters
$size : Size
Return values
bool

getHeight()

Get the current height

public getHeight() : int
Return values
int

getRatio()

Calculate the current aspect ratio

public getRatio() : float
Return values
float

getWidth()

Get the current width

public getWidth() : int
Return values
int

relativePosition()

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
Point

resize()

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
Size

set()

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
Constraint

resizeHeight()

Scale size according to given constraints

private resizeHeight(int $height[, Closure $callback = null ]) : Size
Parameters
$height : int
$callback : Closure = null
Return values
Size

resizeWidth()

Scale size according to given constraints

private resizeWidth(int $width[, Closure $callback = null ]) : Size
Parameters
$width : int
$callback : Closure = null
Return values
Size

        
On this page

Search results