tav-media
Version:
Cross platform media editing framework
62 lines (61 loc) • 1.98 kB
TypeScript
import { AlphaType, ColorType, PAGScaleMode } from './types';
import { Matrix } from './core/matrix';
export declare class PAGImage {
/**
* Create pag image from image file.
*/
static fromFile(data: File): Promise<PAGImage>;
/**
* Create pag image from image source or video source.
* Make sure the target pixel is shown on the screen.
* Like
* ``` javascript
* Image.onload = async () => {
* return await PAGImage.fromSource(Image)
* }
* ```
*/
static fromSource(source: TexImageSource): PAGImage;
/**
* Creates a PAGImage object from an array of pixel data, return null if it's not valid pixels.
*/
static fromPixels(pixels: Uint8Array, width: number, height: number, colorType: ColorType, alphaType: AlphaType): PAGImage;
/**
* Creates a PAGImage object from the specified backend texture, return null if the texture is
* invalid.
*/
static fromTexture(textureID: number, width: number, height: number, flipY: boolean): PAGImage;
wasmIns: any;
isDestroyed: boolean;
constructor(wasmIns: any);
/**
* Returns the width in pixels.
*/
width(): number;
/**
* Returns the height in pixels.
*/
height(): number;
/**
* Returns the current scale mode. The default value is PAGScaleMode::LetterBox.
*/
scaleMode(): PAGScaleMode;
/**
* Specifies the rule of how to scale the content to fit the image layer's original size.
* The matrix changes when this method is called.
*/
setScaleMode(scaleMode: PAGScaleMode): void;
/**
* Returns a copy of current matrix.
*/
matrix(): Matrix;
/**
* Set the transformation which will be applied to the content.
* The scaleMode property will be set to PAGScaleMode::None when this method is called.
*/
setMatrix(matrix: Matrix): void;
/**
* Destroy the pag image.
*/
destroy(): void;
}