Picasso API  2.2
Functions
Matrix
Graphic Functions

Functions

PEXPORT ps_matrix *PICAPI ps_matrix_create (void)
 Create a identity matrix object.
PEXPORT ps_matrix *PICAPI ps_matrix_create_init (float sx, float shy, float shx, float sy, float tx, float ty)
 Create a matrix with given parameters.
PEXPORT ps_matrix *PICAPI ps_matrix_create_copy (const ps_matrix *matrix)
 Create a matrix copy from an exist one.
PEXPORT ps_matrix *PICAPI ps_matrix_ref (ps_matrix *matrix)
 Increases the reference count of the matrix by 1.
PEXPORT void PICAPI ps_matrix_unref (ps_matrix *matrix)
 Decrements the reference count for the matrix object. If the reference count on the matrix falls to 0, the matrix is freed.
PEXPORT void PICAPI ps_matrix_init (ps_matrix *matrix, float sx, float shy, float shx, float sy, float tx, float ty)
 Initialize an existing matrix object with given parameters.
PEXPORT void PICAPI ps_matrix_translate (ps_matrix *matrix, float tx, float ty)
 Modify a matrix by translating.
PEXPORT void PICAPI ps_matrix_scale (ps_matrix *matrix, float sx, float sy)
 Modify a matrix by scaling.
PEXPORT void PICAPI ps_matrix_rotate (ps_matrix *matrix, float angle)
 Modify a matrix by rotating.
PEXPORT void PICAPI ps_matrix_shear (ps_matrix *matrix, float shx, float shy)
 Modify a matrix by shearing.
PEXPORT void PICAPI ps_matrix_invert (ps_matrix *matrix)
 Modify a matrix by inverting.
PEXPORT void PICAPI ps_matrix_reset (ps_matrix *matrix)
 Reset a matrix to identity matrix.
PEXPORT void PICAPI ps_matrix_flip_x (ps_matrix *matrix)
 Flip a matrix in the horizontal direction.
PEXPORT void PICAPI ps_matrix_flip_y (ps_matrix *matrix)
 Flip a matrix in the vertical direction.
PEXPORT void PICAPI ps_matrix_multiply (ps_matrix *result, const ps_matrix *a, const ps_matrix *b)
 Multiplies the matrix in a and b together and stores the result in result.
PEXPORT ps_bool PICAPI ps_matrix_is_identity (const ps_matrix *matrix)
 Checks whether the matrix is the identity transform matrix.
PEXPORT ps_bool PICAPI ps_matrix_is_equal (const ps_matrix *a, const ps_matrix *b)
 Checks whether two matrix are equal.
PEXPORT float PICAPI ps_matrix_get_determinant (const ps_matrix *matrix)
 Return the determinant from a matrix.
PEXPORT void PICAPI ps_matrix_set_translate_factor (ps_matrix *matrix, float tx, float ty)
 Set the translate factors to the matrix.
PEXPORT ps_bool PICAPI ps_matrix_get_translate_factor (ps_matrix *matrix, float *tx, float *ty)
 Get the translate factors from the matrix.
PEXPORT void PICAPI ps_matrix_set_scale_factor (ps_matrix *matrix, float sx, float sy)
 Set the scale factors to the matrix.
PEXPORT ps_bool PICAPI ps_matrix_get_scale_factor (ps_matrix *matrix, float *sx, float *sy)
 Get the scale factors from the matrix.
PEXPORT void PICAPI ps_matrix_set_shear_factor (ps_matrix *matrix, float shx, float shy)
 Set the shear factors to the matrix.
PEXPORT ps_bool PICAPI ps_matrix_get_shear_factor (ps_matrix *matrix, float *shx, float *shy)
 Get the shear factors from the matrix.
PEXPORT void PICAPI ps_matrix_transform_point (const ps_matrix *matrix, ps_point *point)
 Transform an existing point using the matrix.
PEXPORT void PICAPI ps_matrix_transform_rect (const ps_matrix *matrix, ps_rect *rect)
 Transform an existing rectangle using the matrix.
PEXPORT void PICAPI ps_matrix_transform_path (const ps_matrix *matrix, ps_path *path)
 Transform an existing path using the matrix.

Function Documentation

Create a identity matrix object.

Returns:
If the function succeeds, the return value is the pointer to a new matrix object. If the function fails, the return value is NULL.
Note:
To get extended error information, call ps_last_status.
See also:
ps_matrix_create_init, ps_matrix_create_copy, ps_matrix_ref, ps_matrix_unref
ps_matrix * ps_matrix_create_copy ( const ps_matrix matrix)

Create a matrix copy from an exist one.

Parameters:
matrixPointer to an existing matrix object.
Returns:
If the function succeeds, the return value is the pointer to a new matrix object. If the function fails, the return value is NULL.
Note:
To get extended error information, call ps_last_status.
See also:
ps_matrix_create_init, ps_matrix_create, ps_matrix_ref, ps_matrix_unref
ps_matrix * ps_matrix_create_init ( float  sx,
float  shy,
float  shx,
float  sy,
float  tx,
float  ty 
)

Create a matrix with given parameters.

Parameters:
sxThe horizontal scaling factor.
shyThe vertical skewing factor.
shxThe horizontal skewing factor.
syThe vertical scaling factor.
txThe horizontal translating factor.
tyThe vertical translating factor.
Returns:
If the function succeeds, the return value is the pointer to a new matrix object. If the function fails, the return value is NULL.
Note:
To get extended error information, call ps_last_status.
See also:
ps_matrix_create, ps_matrix_create_copy, ps_matrix_ref, ps_matrix_unref
void ps_matrix_flip_x ( ps_matrix matrix)

Flip a matrix in the horizontal direction.

Parameters:
matrixPointer to an existing matrix object.
See also:
ps_matrix_reset, ps_matrix_flip_y, ps_matrix_invert
void ps_matrix_flip_y ( ps_matrix matrix)

Flip a matrix in the vertical direction.

Parameters:
matrixPointer to an existing matrix object.
See also:
ps_matrix_reset, ps_matrix_flip_x, ps_matrix_invert
float ps_matrix_get_determinant ( const ps_matrix matrix)

Return the determinant from a matrix.

Parameters:
matrixPointer to an existing matrix object.
Returns:
The determinant of the matrix.
See also:
ps_matrix_is_equal, ps_matrix_is_identity, ps_matrix_multiply
ps_bool ps_matrix_get_scale_factor ( ps_matrix matrix,
float *  sx,
float *  sy 
)

Get the scale factors from the matrix.

Parameters:
matrixPointer to an existing matrix object.
sxPointer to a buffer to receiving the scale factor in x dimension.
syPointer to a buffer to receiving the scale factor in y dimension.
Returns:
True if is success, otherwise False.
See also:
ps_matrix_set_scale_factor
ps_bool ps_matrix_get_shear_factor ( ps_matrix matrix,
float *  shx,
float *  shy 
)

Get the shear factors from the matrix.

Parameters:
matrixPointer to an existing matrix object.
shxPointer to a buffer to receiving the shear factor in horizontal.
shyPointer to a buffer to receiving the shear factor in vertical.
Returns:
True if is success, otherwise False.
See also:
ps_matrix_set_shear_factor
ps_bool ps_matrix_get_translate_factor ( ps_matrix matrix,
float *  tx,
float *  ty 
)

Get the translate factors from the matrix.

Parameters:
matrixPointer to an existing matrix object.
txPointer to a buffer to receiving the translate factor in x direction.
tyPointer to a buffer to receiving the translate factor in y direction.
Returns:
True if is success, otherwise False.
See also:
ps_matrix_set_translate_factor
void ps_matrix_init ( ps_matrix matrix,
float  sx,
float  shy,
float  shx,
float  sy,
float  tx,
float  ty 
)

Initialize an existing matrix object with given parameters.

Parameters:
matrixPointer to an existing matrix object.
sxThe horizontal scaling factor.
shyThe vertical skewing factor.
shxThe horizontal skewing factor.
syThe vertical scaling factor.
txThe horizontal translating factor.
tyThe vertical translating factor.
See also:
ps_matrix_translate, ps_matrix_scale, ps_matrix_shear, ps_matrix_rotate
void ps_matrix_invert ( ps_matrix matrix)

Modify a matrix by inverting.

Parameters:
matrixPointer to an existing matrix object.
See also:
ps_matrix_flip_x, ps_matrix_flip_y, ps_matrix_reset
ps_bool ps_matrix_is_equal ( const ps_matrix a,
const ps_matrix b 
)

Checks whether two matrix are equal.

Parameters:
aPointer to an existing matrix object.
bPointer to an existing matrix object.
Returns:
True if a and b are equal, otherwise False.
See also:
ps_matrix_is_identity, ps_matrix_get_determinant, ps_matrix_multiply

Checks whether the matrix is the identity transform matrix.

Parameters:
matrixPointer to an existing matrix object.
Returns:
True if is identity, otherwise False.
See also:
ps_matrix_is_equal, ps_matrix_get_determinant, ps_matrix_multiply
void ps_matrix_multiply ( ps_matrix result,
const ps_matrix a,
const ps_matrix b 
)

Multiplies the matrix in a and b together and stores the result in result.

Parameters:
resultPointer to an existing matrix object in which to store the result.
aPointer to an existing matrix object.
bPointer to an existing matrix object.
See also:
ps_matrix_is_identity, ps_matrix_is_equal ps_matrix_get_determinant

Increases the reference count of the matrix by 1.

Parameters:
matrixPointer to an existing matrix object.
Returns:
If the function succeeds, the return value is the pointer to the matrix object. If the function fails, the return value is NULL.
Note:
To get extended error information, call ps_last_status.
See also:
ps_matrix_create_init, ps_matrix_create, ps_matrix_create_copy, ps_matrix_unref
void ps_matrix_reset ( ps_matrix matrix)

Reset a matrix to identity matrix.

Parameters:
matrixPointer to an existing matrix object.
See also:
ps_matrix_flip_x, ps_matrix_flip_y, ps_matrix_invert
void ps_matrix_rotate ( ps_matrix matrix,
float  angle 
)

Modify a matrix by rotating.

Parameters:
matrixPointer to an existing matrix object.
angleThe angle, in radians, which to rotate the specified matrix.
See also:
ps_matrix_translate, ps_matrix_shear, ps_matrix_scale
void ps_matrix_scale ( ps_matrix matrix,
float  sx,
float  sy 
)

Modify a matrix by scaling.

Parameters:
matrixPointer to an existing matrix object.
sxThe scale factor for the X dimension.
syThe scale factor for the Y dimension.
See also:
ps_matrix_translate, ps_matrix_shear, ps_matrix_rotate
void ps_matrix_set_scale_factor ( ps_matrix matrix,
float  sx,
float  sy 
)

Set the scale factors to the matrix.

Parameters:
matrixPointer to an existing matrix object.
sxThe scale factor in x dimension.
syThe scale factor in y dimension.
See also:
ps_matrix_get_scale_factor
void ps_matrix_set_shear_factor ( ps_matrix matrix,
float  shx,
float  shy 
)

Set the shear factors to the matrix.

Parameters:
matrixPointer to an existing matrix object.
shxThe shear factor for the horizontal.
shyThe shear factor for the vertical.
See also:
ps_matrix_get_shear_factor
void ps_matrix_set_translate_factor ( ps_matrix matrix,
float  tx,
float  ty 
)

Set the translate factors to the matrix.

Parameters:
matrixPointer to an existing matrix object.
txThe amount, in pixels, which the translate factor in x direction.
tyThe amount, in pixels, which the translate factor in y direction.
See also:
ps_matrix_get_translate_factor
void ps_matrix_shear ( ps_matrix matrix,
float  shx,
float  shy 
)

Modify a matrix by shearing.

Parameters:
matrixPointer to an existing matrix object.
shxThe shear factor for the horizontal.
shyThe shear factor for the vertical.
See also:
ps_matrix_translate, ps_matrix_scale, ps_matrix_rotate
void ps_matrix_transform_path ( const ps_matrix matrix,
ps_path path 
)

Transform an existing path using the matrix.

Parameters:
matrixPointer to an existing matrix object.
pathAn existing path which will be transformed.
See also:
ps_matrix_transform_point, ps_matrix_transform_rect
void ps_matrix_transform_point ( const ps_matrix matrix,
ps_point point 
)

Transform an existing point using the matrix.

Parameters:
matrixPointer to an existing matrix object.
pointAn existing point which will be transformed.
See also:
ps_matrix_transform_rect, ps_matrix_transform_path
void ps_matrix_transform_rect ( const ps_matrix matrix,
ps_rect rect 
)

Transform an existing rectangle using the matrix.

Parameters:
matrixPointer to an existing matrix object.
rectAn existing rectangle which will be transformed.
See also:
ps_matrix_transform_point, ps_matrix_transform_path
void ps_matrix_translate ( ps_matrix matrix,
float  tx,
float  ty 
)

Modify a matrix by translating.

Parameters:
matrixPointer to an existing matrix object.
txThe amount, in pixels, which to translate in x direction.
tyThe amount, in pixels, which to translate in y direction.
See also:
ps_matrix_scale, ps_matrix_shear, ps_matrix_rotate
void ps_matrix_unref ( ps_matrix matrix)

Decrements the reference count for the matrix object. If the reference count on the matrix falls to 0, the matrix is freed.

Parameters:
matrixPointer to an existing matrix object.
See also:
ps_matrix_create_init, ps_matrix_create, ps_matrix_create_copy, ps_matrix_ref