NAME

Prima::types - builtin types

DESCRIPTION

Auxillary second-citizen classes that are not usually created manually but used as results of Prima methods and accepted as inputs. These classes names can be distinguished that their name is started by a lower-case letter.

Prima::array

Overloaded C array that can be used transparently as a normal perl array of numbers. The reason Prima::array exists is that Prima methods don't need to do expensive conversions between a perl array of scalars to C array of integers or floats.

new LETTER = [idsS], BUF = undef

Creates a new C array with type either int, double, short, and unsigned short. There are also methods new_int, new_double, new_short, and new_ushort that to the same.

BUF, a normal perl string, can be used to initialize the array, if any (and can be pre-populated with pack()). Otherwise an array is created as empty.

is_array SCALAR

Checks whether SCALAR is a Prima::array object.

substr OFFSET, LENGTH, REPLACEMENT

Emulates perl's substr except operates not on character but C type level. Returns a new Prima::array object.

append ARRAY

Assuming two arrays have same type, appends the ARRAY's contents to own content.

clone

Clones the array.

Prima::matrix

An array of 6 doubles with some helper methods attached.

A,B,C,D,X,Y

Named accessor properties for the 6 members. The members can just as well be accessed directly with array syntax.

clone

Clones the matrix object

identity

Resets the matrix to identity

inverse_transform @POINTS | $POINTS_ARRAY

Applies inverse matrix tranformation to an array or arrayref of points, and returns in the same format (i e array for array, ref for ref).

new [ @ARRAY ]

Creates a new object and optionally initializes it with @ARRAY

multiply MATRIX

Multiplies the matrices and stores the result

rotate ANGLE

Rotates the matrix

scale MX,MY

Scales the matrix

shear DX,DY

Shears the matrix

set @ARRAY

Assigns all 6 members at once

translate DX,DY

Translates the matrix

transform @POINTS | $POINTS_ARRAY

Applies matrix tranformation to an array or arrayref of points, and returns in the same format (i e array for array, ref for ref).

Prima::rect

Represents rectangular object either as rectangle ( X1,Y1,X2,Y2 ) or box ( X,Y,WIDTH,HEIGHT ).

box

Returns X, Y, WIDTH, HEIGHT

clone

Clones the object

enlarge N

Enlarges the rectangle by N

inclusive

Rectangle itself is agnostic of its 2D presentation, but assuming the coordinates are inclusive-exclusive, inclusive returns X1,Y1,X2,Y2 as inclusive-inclusive rectangle.

intersect RECT

Intersects with RECT and stores the result

is_empty

Returns true if rectangle's width and height are zero

is_equal RECT

Returns true if both rectangles are equal

new () | (WIDTH,HEIGHT) | (X1,Y1,X2,Y2)

Creates new object with rectangle syntax

new_box X,Y,WIDTH,HEIGHT

Creates new object with box syntax

origin

Returns X,Y

shrink N

Shrinks the rectangle by N

size

Return WIDTH and HEIGHT

union RECT

Joins with RECT and stores the result

AUTHOR

Dmitry Karasik, <dmitry@karasik.eu.org>.

SEE ALSO

Prima