Jesus · Bible · HTML · CSS · JS · PHP · SVG · Applications

imageaffinematrixget

Description

The imageaffinematrixget of Image for PHP get an affine transformation matrix.

Syntax

imageaffinematrixget(
    int $type,
    array|float $options
): array|false

Parameters

type

One of the IMG_AFFINE_* constants.

options

If type is IMG_AFFINE_TRANSLATE or IMG_AFFINE_SCALE, options has to be an array with keys x and y, both having float values.

If type is IMG_AFFINE_ROTATE, IMG_AFFINE_SHEAR_HORIZONTAL or IMG_AFFINE_SHEAR_VERTICAL, options has to be a float specifying the angle.

Return

An affine transformation matrix (an array with keys 0 to 5 and float values) or false on failure.

Examples

1 · type options · IMG_AFFINE_TRANSLATE

<?

$type = IMG_AFFINE_TRANSLATE;
$options = array('x' => 2, 'y' => 3);

$return = imageaffinematrixget($type, $options);

print_r($return);

?>
Array
(
    [0] => 1
    [1] => 0
    [2] => 0
    [3] => 1
    [4] => 2
    [5] => 3
)

2 · type options · IMG_AFFINE_SCALE

<?

$type = IMG_AFFINE_SCALE;
$options = array('x' => 2, 'y' => 3);

$return = imageaffinematrixget($type, $options);

print_r($return);

?>
Array
(
    [0] => 2
    [1] => 0
    [2] => 0
    [3] => 3
    [4] => 0
    [5] => 0
)

3 · type options · IMG_AFFINE_ROTATE

<?

$type = IMG_AFFINE_ROTATE;
$options = 90.0;

$return = imageaffinematrixget($type, $options);

print_r($return);

?>
Array
(
    [0] => 6.1232339957368E-17
    [1] => 1
    [2] => -1
    [3] => 6.1232339957368E-17
    [4] => 0
    [5] => 0
)

4 · type options · IMG_AFFINE_SHEAR_HORIZONTAL

<?

$type = IMG_AFFINE_SHEAR_HORIZONTAL;
$options = 90.0;

$return = imageaffinematrixget($type, $options);

print_r($return);

?>
Array
(
    [0] => 1
    [1] => 0
    [2] => 1.6331239353195E+16
    [3] => 1
    [4] => 0
    [5] => 0
)

5 · type options · IMG_AFFINE_SHEAR_VERTICAL

<?

$type = IMG_AFFINE_SHEAR_VERTICAL;
$options = 90.0;

$return = imageaffinematrixget($type, $options);

print_r($return);

?>
Array
(
    [0] => 1
    [1] => 1.6331239353195E+16
    [2] => 0
    [3] => 1
    [4] => 0
    [5] => 0
)
HomeMenu