pix 0.9: Reference Manual

::pixTop, Main, Index

Help procedures.

CommandsTop, Main, Index

colorHTMLtoRGBA [::pix]Top, Main, Index

Converts an HTML color string into an RGBA value and returns it as a Tcl list.

colorHTMLtoRGBA HTMLcolor
Parameters
HTMLcolorA color string
Return value

A Tcl list {r g b a}.

degToRad [::pix]Top, Main, Index

Converts degrees to radians.

degToRad angle
Parameters
angleA double value (in degrees).
Return value

A double value (in radians).

determinantMatrix [::pix]Top, Main, Index

Computes the determinant of a 3x3 matrix.

determinantMatrix matrix
Parameters
matrixA Tcl list of 9 numbers representing the 3x3 matrix.
Return value

The matrix determinant as a double.

drawPixSurface [::pix]Top, Main, Index

Draws object to Tk photo.

drawPixSurface object ?photo?
Parameters
objectimg, ctx object or 'pixphoto' name.
photoTk pix photo variable. Optional, default "".
Return value

Nothing.

drawSurface [::pix]Top, Main, Index

Draws object to Tk photo.

drawSurface object photo
Parameters
objectimg or ctx object.
photoTk photo variable.
Return value

Nothing.

fromB64 [::pix]Top, Main, Index

Converts a base64-encoded string or data URL into an img object.

fromB64 string
Parameters
stringBase64-encoded image data or a data URL.
Return value

An img object.

getKeys [::pix]Top, Main, Index

Retrieves all registered object keys from both the context and image tables.

getKeys
Return value

A Tcl dictionary containing two keys:

ctx A Tcl list of all ctx handles.
img A Tcl list of all img handles.
font A Tcl list of all font handles.
path A Tcl list of all path handles.

identityMatrix [::pix]Top, Main, Index

Creates a 3x3 identity matrix.

identityMatrix
Return value

The identity matrix as a Tcl list of 9 elements.

invMatrix [::pix]Top, Main, Index

Inverts the specified 3x3 transformation matrix.

invMatrix ?matrix?
Parameters
matrixOptional Tcl list of 9 numbers representing an input 3x3 matrix . Optional, default identityMatrix.
Return value

The inverted 3x3 matrix as a Tcl list of 9 elements.

mulMatrix [::pix]Top, Main, Index

Multiplies a sequence of 3x3 matrices together.

mulMatrix ?args?
Parameters
argsA variable list of matrices, where each matrix is a Tcl list of 9 numbers.
Return value

The resulting multiplied matrix as a Tcl list of 9 elements.

nearlyEqualMatrix [::pix]Top, Main, Index

Checks whether two matrices are approximately equal.

nearlyEqualMatrix matrix1 matrix2
Parameters
matrix1A Tcl list of 9 numbers representing an input 3x3 matrix
matrix2A Tcl list of 9 numbers representing an input 3x3 matrix
Return value

1 if the matrices are approximately equal, 0 otherwise.

pathObjToString [::pix]Top, Main, Index

Parses a path object and returns its SVG path string representation.

pathObjToString path
Parameters
pathpath object handle
Return value

The parsed path as an SVG-style string.

rotMatrix [::pix]Top, Main, Index

Creates a transformation rotation matrix or multiplies an existing one.

rotMatrix angle ?matrix?
Parameters
angleDouble value (in radians).
matrixOptional Tcl list of 9 numbers representing an input 3x3 matrix . Optional, default identityMatrix.
Return value

The rotated 3x3 matrix as a Tcl list of 9 elements.

scaleMatrix [::pix]Top, Main, Index

Creates a scaling matrix or multiplies an existing one.

scaleMatrix scale ?matrix?
Parameters
scaleA Tcl list {x y} representing scale factor coordinates.
matrixOptional Tcl list of 9 numbers representing an input 3x3 matrix . Optional, default identityMatrix.
Return value

The scaled 3x3 matrix as a Tcl list of 9 elements.

svgStyleToPathObj [::pix]Top, Main, Index

Transforms an SVG-style path string into a path object.

svgStyleToPathObj path
Parameters
pathAn SVG path data string.
Return value

A new handle path object.

toB64 [::pix]Top, Main, Index

Converts an img or ctx object into a base64-encoded string.

toB64 object
Parameters
objectimg or ctx object handle.
Description

Note: On the Nim side, the base64 module is considered unstable. It is recommended to use the toBinary command combined with Tcl's native binary encode base64 command instead.

Return value

A base64-encoded string.

toBinary [::pix]Top, Main, Index

Converts an img or ctx object into raw binary image data.

toBinary object ?format?
Parameters
objectimg or ctx object handle.
formatImage format string (png, qoi, bmp, ppm) . Optional, default png.
Return value

A byte array string in binary format.

transformMatrixPoint [::pix]Top, Main, Index

Transforms a 2D point using a 3x3 transformation matrix.

transformMatrixPoint point matrix
Parameters
pointA Tcl list {x y} representing the point coordinates.
matrixA Tcl list of 9 numbers representing the 3x3 matrix.
Return value

A Tcl list {x y} containing the transformed coordinates.

transMatrix [::pix]Top, Main, Index

Creates a translation matrix or multiplies an existing one.

transMatrix trans ?matrix?
Parameters
transA Tcl list {x y} representing translation distance coordinates.
matrixOptional Tcl list of 9 numbers representing an input 3x3 matrix . Optional, default identityMatrix.
Return value

The translated 3x3 matrix as a Tcl list of 9 elements.