class Position

Hold and computes position of objects added to canvas.

Constants

TOP_LEFT

Top left of the canvas.

TOP_CENTER

Top center of the canvas.

TOP_RIGHT

Top right of the canvas.

CENTER_LEFT

Center left of the canvas.

CENTER

Center of the canvas.

CENTER_RIGHT

Center right of the canvas.

BOTTOM_LEFT

Center left of the canvas.

BOTTOM_CENTER

Bottom center of the canvas.

BOTTOM_RIGHT

Bottom right of the canvas.

Methods

__construct(string $position = 'center', int $offsetX, int $offsetY)

Position constructor.

array
getXY(int $canvasWidth, int $canvasHeight, int $imageWidth, int $imageHeight)

Translate the textual position + offsets into x,y values.

string
getText()

No description

int
getOffsetY()

No description

int
getOffsetX()

No description

Details

at line line 69
__construct(string $position = 'center', int $offsetX, int $offsetY)

Position constructor.

Parameters

string $position Defaults to center.
int $offsetX Defaults to 0.
int $offsetY Defaults to 0.

at line line 86
array getXY(int $canvasWidth, int $canvasHeight, int $imageWidth, int $imageHeight)

Translate the textual position + offsets into x,y values.

Parameters

int $canvasWidth Width of canvas.
int $canvasHeight Height of canvas.
int $imageWidth Width of image/object added.
int $imageHeight Height of image/object added.

Return Value

array Array of X and Y coordinates: array($x, $y).

Exceptions

Exception When invalid position.

at line line 127
string getText()

Return Value

string

at line line 134
int getOffsetY()

Return Value

int

at line line 141
int getOffsetX()

Return Value

int