class JitterMatrix

A named matrix which may be used for data storage and retrieval, resampling, and matrix type and planecount conversion operations.

Constructors

new JitterMatrix(planeCount?: number, dataType?: string, columns?: number, rows?: number);

Constructs a new instance of the JitterMatrix class

ParameterTypeDescription
optional planeCountnumber
optional dataTypestring
optional columnsnumber
optional rowsnumber

Example

var mymatrix = new JitterMatrix(4, "char", 320, 240);

Properties

adapt number

Matrix adaptation flag.

When this flag is set (1), the JitterMatrix will adapt to the incoming matrix planecount, type, and dimensions

dim [number, number]

Matrix data dimensions

dimstride [number, number]

Byte stride per dimension

dstdimend number[]

Destination dimension end position (default = all dim values minus 1).

dstdimstart number[]

Destination dimension start position (default = all 0).

interp number

Matrix interpolation flag (default = 0). When the flag is set, the input matrix will be interpolated when copied to the internal matrix.

name string

Name of the matrix (default = UID).

planecount number

Number of planes in the matrix data (default = 4).

planemap number[]

Maps input planes to output planes (default = 0 1 2 3 ...)

size number

Total byte size of matrix.

srcdimend number[]

Source dimension end position (default = all dim values minus 1).

srcdimstart number[]

Source dimension start position (default = all 0).

type string

The matrix data type (default = "char").

- "char": Char data (0-255) - "long": Long data - "float32": 32-bit floating point data - "float64": 64-bit floating point data

usedstdim number

destdim use flag (default = 0).

When the flag is set, the destination dimension's attributes are used when copying an input matrix to an internal matrix.

usesrcdim number

srcdim use flag (default = 0).

When the flag is set, the source dimension's attributes are used used when copying an input matrix to an internal matrix.

Methods

bang

Outputs the currently stored matrix

bang(): void;

clear

Sets all matrix values to zero

clear(): void;

copyarraytomatrix

Copy a tightly packed TypedArray to a JitterMatrix

This method is only available in the new v8 javascript engine objects. TypedArrays must match matrix type (Uint8 for char, Int32 for long, Float32 for float32 and Float64 for float64), and their size must match the tighly packed size of the matrix -- i.e. planecount * dim[0] * dim[1] ... * dim[n].

copyarraytomatrix(array: Uint8Array | Uint8ClampedArray | Int32Array | Float32Array | Float64Array): void;
NameTypeDescription
arrayUint8Array | Uint8ClampedArray | Int32Array | Float32Array | Float64Arraytightly packed TypedArray

copymatrixtoarray

Copy a JitterMatrix to a tightly packed TypedArray

This method is only available in the new v8 javascript engine objects. TypedArrays must match matrix type (Uint8 for char, Int32 for long, Float32 for float32 and Float64 for float64), and their size must match the tighly packed size of the matrix -- i.e. planecount * dim[0] * dim[1] ... * dim[n].

copymatrixtoarray(array: Uint8Array | Uint8ClampedArray | Int32Array | Float32Array | Float64Array): void;
NameTypeDescription
arrayUint8Array | Uint8ClampedArray | Int32Array | Float32Array | Float64Arraytightly packed TypedArray

exportimage

Export the current frame as an image file with the name specified

exportimage(filename: string, filetype?: string, useDialog?: number): void;
NameTypeDescription
filenamestringexported image filename
optional filetypestringexported image file type; can be "png", "bmp", "jpeg", "macpaint", "photoshop", "pict", "qtimage", "sgi", "tga", and "tiff" (default = "png")
optional useDialognumbera value of 1 will open a file dialog to enter image file settings

exportmovie

Export a matrix as a QuickTime movie

exportmovie(filename?: string, fps?: number, codec?: string, quality?: string, timescale?: number): void;
NameTypeDescription
optional filenamestringexported movie filename (default = file dialog will open)
optional fpsnumberframes per second (default = 30)
optional codecstringone of "raw", "cinepak", "graphics", "animation", "video", "componentvideo", "jpeg", "mjpegb", "sgi", "planarrgb", "macpaint", "gif", "photocd", "qdgx", "avrjpeg", "opendmljpeg", "bmp", "winraw", "vector", "qd", "h261", "h263", "dvntsc", "dvpal", "dvprontsc", "dvpropal", "flc", "targa", "png", "tiff", "componentvideosigned", "componentvideounsigned", "cmyk", "microsoft", "sorenson", "indeo4", "argb64", "rgb48", "alphagrey32", "grey16", "mpegyuv420", "yuv420", and "sorensonyuv9" (default = "raw")
optional qualitystringone of "lossless", "max", "min", "low", "normal", and "high" (default = "max"). Note that the minimum quality is, in many cases, the codec's default quality. Use "low" quality for consistent results.
optional timescalenumberunits per second (default = 600)

exprfill

Evaluate an expression to fill the matrix

If a plane argument is provided, the expression is applied to a single plane. Otherwise, it is applied to all planes in the matrix. See jit.expr for more information on expressions. Unlike the jit.expr object, there is no support for providing multiple expressions to fill multiple planes at once with different expressions. Call this method multiple times for each plane you wish to fill.

exprfill(plane: number, expression?: string): void;
NameTypeDescription
planenumbermatrix plane to apply to (default = all planes)
optional expressionstringexpression to apply

fillplane

Fill the specified plane with a single value

fillplane(plane: number, value: number): void;
NameTypeDescription
planenumberplane index
valuenumbervalue to fill with

float

Set all cells to the value specified by value(s) and output the data.

float(values: number | number[]): void;
NameTypeDescription
valuesnumber | number[]matrix value list whose length is equal to the dimcount

getcell

Sends the value(s) in the cell specified by position out the right outlet of the object as a list in the form "cell cell - position0 ... cell - positionN val plane0 - value ... planeN - value"

getcell(position: [number, number]): void;
NameTypeDescription
position[number, number]cell position

importmovie

Import a QuickTime movie into the matrix

importmovie(filename?: string, timeoffset?: number): void;
NameTypeDescription
optional filenamestringfilename of movie to import (default = file dialog)
optional timeoffsetnumberimport time offset (default = 0)

int

Set all cells to the value specified by value(s) and output the data.

int(values: number | number[]): void;
NameTypeDescription
valuesnumber | number[]matrix value list whose length is equal to the dimcount

jit_gl_texture

Copy a texture to the matrix

jit_gl_texture(texture_name: string): void;
NameTypeDescription
texture_namestringGL texture name

list

Set all cells to the value specified by value(s) and output the data.

list(values: number[]): void;
NameTypeDescription
valuesnumber[]matrix value list whose length is equal to the dimcount

op

Perform jit.op operations on the matrix

op(operator: string, args: any): void;
NameTypeDescription
operatorstringthe jit.op operator
argsanymatrix name or constant args for the operator

Example

var a = new JitterMatrix(4, "char", 320, 240);
var b = new JitterMatrix(4, "char", 320, 240);
b.setall(255, 255, 255, 255);
a.op("*", b);

read

Read Jitter binary data files (.jxf) into the matrix

read(filename?: string): void;
NameTypeDescription
optional filenamestringbinary data file to read (default = file dialog)

setall

Set all cells to the value(s) specified

setall(values: number | number[]): void;
NameTypeDescription
valuesnumber | number[]values to set

setcell

Set the cell specified to a value

Arguments are formatted like the setcell message to a jit.matrix in Max.

setcell(...args: any[]): void;
NameTypeDescription
argsany[]the position, plane, planeNumber, value/values to set

Example

Set cell (20, 30) to (0, 0, 255, 255):

mymatrix.setcell(20, 30, "val", 0, 0, 255, 255);

setcell1d

Set a cell in a 1D matrix

setcell1d(pos: number, ...values: number[]): void;
NameTypeDescription
posnumbercell position
valuesnumber[]values to set at given position

Example

Set cell (74) to (100, 100, 100, 0):

my1dmatrix.setcell1d(74, 100, 100, 100, 0);

setcell2d

Set a cell in a 2D matrix

setcell2d(posX: number, posY: number, ...values: number[]): void;
NameTypeDescription
posXnumberfirst dimension of cell's position
posYnumbersecond dimension of cell's position
valuesnumber[]values to set at given position

Example

Set cell (30, 20) to (255, 255, 0, 0):

my2dmatrix.setcell2d(30, 20, 255, 255, 0, 0);

setcell3d

Set a cell in a 3D matrix

setcell3d(posX: number, posY: number, posZ: number, ...values: number[]): void;
NameTypeDescription
posXnumberfirst coordinate of a cell's position
posYnumbersecond coordinate of a cell's position
posZnumberthird coordinate of a cell's position
valuesnumber[]values to set at given position

Example

Set cell (30, 20, 40) to (100, 200, 300, 0):

my3dmatrix.setcell3d(30, 20, 40, 100, 200, 300, 0);

setplane1d

Set a cell for a 1D matrix

setplane1d(pos: number, plane: number, value: number): void;
NameTypeDescription
posnumberfirst coordinate
planenumberplane number
valuenumbervalue to set

setplane2d

Set a cell for a 2D matrix

setplane2d(posX: number, posY: number, plane: number, value: number): void;
NameTypeDescription
posXnumberfirst coordinate
posYnumbersecond coordinate
planenumberplane number
valuenumbervalue to set

setplane3d

Set a cell for a 3D matrix

setplane3d(posX: number, posY: number, posZ: number, plane: number, value: number): void;
NameTypeDescription
posXnumberfirst coordinate
posYnumbersecond coordinate
posZnumberthird coordinate
planenumberplane number
valuenumbervalue to set

val

Set all cells to the value specified

val(value: number): void;
NameTypeDescription
valuenumbervalue to set

write

Write matrix set as a Jitter binary data file (.jxf)

write(filename?: string): void;
NameTypeDescription
optional filenamestringname of file to write to (default = file dialog)