Scroll to navigation

pod::Prima::types(3) User Contributed Perl Documentation pod::Prima::types(3)

NAME

Prima::types - builtin types

DESCRIPTION

This document describes the auxiliary second-citizen classes that are used as results of Prima methods and accepted as inputs. Objects that instantiate from these classes are usually never created manually. The names of some of these classes begin with a lower-case letter, to underscore their auxiliary nature.

Prima::array

An overloaded C array that can be used transparently as a normal perl array. The array can only hold numbers. The reason the "Prima::array" class exists is so Prima methods won't need to do expensive conversions between a perl array of scalars to a C array of integers or floats.

Creates a new C array with the type of either int, double, short, or unsigned short. There are also methods "new_int", "new_double", "new_short", and "new_ushort" that do 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 empty.

Checks whether the SCALAR is a "Prima::array" object.
Emulates perl's "substr" except operates not on characters but on the individual numeric entries of the array. Returns a new "Prima::array" object.
Assuming that two arrays have the same type, appends the ARRAY's contents to its content.
Clones the array.

Prima::matrix

An array of 6 doubles with some helper methods attached.

Named accessory properties for the 6 members. The members can just as well be accessed directly with the array syntax.
Clones the matrix object
Sets the matrix to "Prima::matrix::identity", or (1,0,0,1,0,0)
Applies the inverse matrix tranformations to an array or an arrayref of points and returns the result matrix in the same format (i e array for array, ref for ref).
Creates a new object and optionally initializes it with @ARRAY
Multiplies the matrices and stores the result
Rotates the matrix
Scales the matrix
Shears the matrix
Assigns all the 6 members at once
Translates the matrix
Applies matrix tranformations to an array or arrayref of points and returns the result matrix in the same format (i e array for array, ref for ref).

See also: Prima::Matrix

Prima::Matrix

Same as "Prima::matrix" but explicitly binds to drawable objects so that all changes to the matrix object are immediately reflected in the drawable.

Features all the methods available to "Prima::matrix" (except "apply"), plus the ones described below.

Creates a new matrix object instance
Accesses the associated drawable object
Returns the current matrix
Sets the matrix to "Prima::matrix::identity", or (1,0,0,1,0,0)
Saves and restores the matrix content in the internal stack

Prima::rect

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

Returns X, Y, WIDTH, HEIGHT
Clones the object
Enlarges the rectangle by N
Rectangle itself is agnostic of its 2D presentation, but assuming the coordinates are inclusive-exclusive, "inclusive" returns X1,Y1,X2,Y2 as the inclusive-inclusive rectangle.
Intersects with the RECT rectangle and stores the result
Returns true if the rectangle width and height are zero
Returns true if both rectangles are equal
Creates a new object assuming the rectangle syntax
Creates new object assuming the box syntax
Returns X and Y
Shrinks the rectangle by N
Returns the WIDTH and HEIGHT of the rectangle
Joins the rectangle with the RECT rectangle and stores the result

AUTHOR

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

SEE ALSO

Prima

2024-02-01 perl v5.38.2