UNPKG

tav-media

Version:

Cross platform media editing framework

216 lines (215 loc) 7.72 kB
import { MatrixIndex } from '../types'; export declare class Matrix { /** * Sets Matrix to: * * | scaleX skewX transX | * | skewY scaleY transY | * | pers0 pers1 pers2 | * * @param scaleX horizontal scale factor * @param skewX horizontal skew factor * @param transX horizontal translation * @param skewY vertical skew factor * @param scaleY vertical scale factor * @param transY vertical translation * @param pers0 input x-axis perspective factor * @param pers1 input y-axis perspective factor * @param pers2 perspective scale factor * @return Matrix constructed from parameters */ static makeAll(scaleX: number, skewX: number, transX: number, skewY: number, scaleY: number, transY: number, pers0?: number, pers1?: number, pers2?: number): Matrix; /** * Sets Matrix to scale by (sx, sy). Returned matrix is: * * | sx 0 0 | * | 0 sy 0 | * | 0 0 1 | * * @param scaleX horizontal scale factor * @param scaleY [optionals] vertical scale factor, default equal scaleX. * @return Matrix with scale */ static makeScale(scaleX: number, scaleY?: number): Matrix; /** * Sets Matrix to translate by (dx, dy). Returned matrix is: * * | 1 0 dx | * | 0 1 dy | * | 0 0 1 | * * @param dx horizontal translation * @param dy vertical translation * @return Matrix with translation */ static makeTrans(dx: number, dy: number): Matrix; wasmIns: any; isDestroyed: boolean; constructor(wasmIns: any); /** * scaleX; horizontal scale factor to store */ get a(): number; set a(value: number); /** * skewY; vertical skew factor to store */ get b(): number; set b(value: number); /** * skewX; horizontal skew factor to store */ get c(): number; set c(value: number); /** * scaleY; vertical scale factor to store */ get d(): number; set d(value: number); /** * transX; horizontal translation to store */ get tx(): number; set tx(value: number); /** * transY; vertical translation to store */ get ty(): number; set ty(value: number); /** * Returns one matrix value. */ get(index: MatrixIndex): number; /** * Sets Matrix value. */ set(index: MatrixIndex, value: number): void; /** * Sets all values from parameters. Sets matrix to: * * | scaleX skewX transX | * | skewY scaleY transY | * | persp0 persp1 persp2 | * * @param scaleX horizontal scale factor to store * @param skewX horizontal skew factor to store * @param transX horizontal translation to store * @param skewY vertical skew factor to store * @param scaleY vertical scale factor to store * @param transY vertical translation to store * @param persp0 input x-axis values perspective factor to store * @param persp1 input y-axis values perspective factor to store * @param persp2 perspective scale factor to store */ setAll(scaleX: number, skewX: number, transX: number, skewY: number, scaleY: number, transY: number, pers0?: number, pers1?: number, pers2?: number): void; setAffine(a: number, b: number, c: number, d: number, tx: number, ty: number): void; /** * Sets Matrix to identity; which has no effect on mapped Point. Sets Matrix to: * * | 1 0 0 | * | 0 1 0 | * | 0 0 1 | * * Also called setIdentity(); use the one that provides better inline documentation. */ reset(): void; /** * Sets Matrix to translate by (dx, dy). * @param dx horizontal translation * @param dy vertical translation */ setTranslate(dx: number, dy: number): void; /** * Sets Matrix to scale by sx and sy, about a pivot point at (px, py). The pivot point is * unchanged when mapped with Matrix. * @param sx horizontal scale factor * @param sy vertical scale factor * @param px pivot on x-axis * @param py pivot on y-axis */ setScale(sx: number, sy: number, px?: number, py?: number): void; /** * Sets Matrix to rotate by degrees about a pivot point at (px, py). The pivot point is * unchanged when mapped with Matrix. Positive degrees rotates clockwise. * @param degrees angle of axes relative to upright axes * @param px pivot on x-axis * @param py pivot on y-axis */ setRotate(degrees: number, px?: number, py?: number): void; /** * Sets Matrix to rotate by sinValue and cosValue, about a pivot point at (px, py). * The pivot point is unchanged when mapped with Matrix. * Vector (sinValue, cosValue) describes the angle of rotation relative to (0, 1). * Vector length specifies scale. */ setSinCos(sinV: number, cosV: number, px?: number, py?: number): void; /** * Sets Matrix to skew by kx and ky, about a pivot point at (px, py). The pivot point is * unchanged when mapped with Matrix. * @param kx horizontal skew factor * @param ky vertical skew factor * @param px pivot on x-axis * @param py pivot on y-axis */ setSkew(kx: number, ky: number, px?: number, py?: number): void; /** * Sets Matrix to Matrix a multiplied by Matrix b. Either a or b may be this. * * Given: * * | A B C | | J K L | * a = | D E F |, b = | M N O | * | G H I | | P Q R | * * sets Matrix to: * * | A B C | | J K L | | AJ+BM+CP AK+BN+CQ AL+BO+CR | * a * b = | D E F | * | M N O | = | DJ+EM+FP DK+EN+FQ DL+EO+FR | * | G H I | | P Q R | | GJ+HM+IP GK+HN+IQ GL+HO+IR | * * @param a Matrix on left side of multiply expression * @param b Matrix on right side of multiply expression */ setConcat(a: Matrix, b: Matrix): void; /** * Preconcats the matrix with the specified scale. M' = M * S(sx, sy) */ preTranslate(dx: number, dy: number): void; /** * Postconcats the matrix with the specified scale. M' = S(sx, sy, px, py) * M */ preScale(sx: number, sy: number, px?: number, py?: number): void; /** * Preconcats the matrix with the specified rotation. M' = M * R(degrees, px, py) */ preRotate(degrees: number, px?: number, py?: number): void; /** * Preconcats the matrix with the specified skew. M' = M * K(kx, ky, px, py) */ preSkew(kx: number, ky: number, px?: number, py?: number): void; /** * Preconcats the matrix with the specified matrix. M' = M * other */ preConcat(other: Matrix): void; /** * Postconcats the matrix with the specified translation. M' = T(dx, dy) * M */ postTranslate(dx: number, dy: number): void; /** * Postconcats the matrix with the specified scale. M' = S(sx, sy, px, py) * M */ postScale(sx: number, sy: number, px?: number, py?: number): void; /** * Postconcats the matrix with the specified rotation. M' = R(degrees, px, py) * M */ postRotate(degrees: number, px?: number, py?: number): void; /** * Postconcats the matrix with the specified skew. M' = K(kx, ky, px, py) * M */ postSkew(kx: number, ky: number, px?: number, py?: number): void; /** * Postconcats the matrix with the specified matrix. M' = other * M */ postConcat(other: Matrix): void; destroy(): void; }