@nmmty/lazycanvas
Version:
A simple way to interact with @napi-rs/canvas in an advanced way!
26 lines (25 loc) • 1.15 kB
TypeScript
import { BaseLayer } from "./BaseLayer";
import { IImageLayer, IImageLayerProps, ScaleType } from "../../types";
import { Canvas, SKRSContext2D } from "@napi-rs/canvas";
import { LayersManager } from "../managers/LayersManager";
export declare class ImageLayer extends BaseLayer<IImageLayerProps> {
props: IImageLayerProps;
constructor(props?: IImageLayerProps);
/**
* @description Sets the source of the image, it can be like link to website or path to file.
* @param src {string} - The `src` of the image.
*/
setSrc(src: string): this;
/**
* @description Set the size of the image. You can use `numbers`, `percentages`, `px`, `vw`, `vh`, `vmin`, `vmax`.
* @param width {ScaleType} - The `width` of the image.
* @param height {ScaleType} - The `height` of the image.
* @param radius {ScaleType} - The `radius` of the image. (optional)
*/
setSize(width: ScaleType, height: ScaleType, radius?: ScaleType): this;
draw(ctx: SKRSContext2D, canvas: Canvas, manager: LayersManager, debug: boolean): Promise<void>;
/**
* @returns {IImageLayer}
*/
toJSON(): IImageLayer;
}