@nmmty/lazycanvas
Version:
A simple way to interact with @napi-rs/canvas in an advanced way!
57 lines (56 loc) • 2.43 kB
TypeScript
import { BaseLayer } from "./BaseLayer";
import { IQuadraticLayerProps, IQuadraticLayer, ColorType, ScaleType } from "../../types";
import { Canvas, SKRSContext2D } from "@napi-rs/canvas";
import { LayersManager } from "../managers/LayersManager";
export declare class QuadraticLayer extends BaseLayer<IQuadraticLayerProps> {
props: IQuadraticLayerProps;
constructor(props?: IQuadraticLayerProps);
/**
* @description Sets the control point of the quadratic layer. You can use `numbers`, `percentages`, `px`, `vw`, `vh`, `vmin`, `vmax`.
* @param x {ScaleType} - The control `x` of the quadratic layer.
* @param y {ScaleType} - The control `y` of the quadratic layer.
*/
setControlPoint(x: ScaleType, y: ScaleType): this;
/**
* @description Sets the end point of the quadratic layer. You can use `numbers`, `percentages`, `px`, `vw`, `vh`, `vmin`, `vmax`.
* @param x {ScaleType} - The end `x` of the quadratic layer.
* @param y {ScaleType} - The end `y` of the quadratic layer.
*/
setEndPosition(x: ScaleType, y: ScaleType): this;
/**
* @description Sets the color of the layer. You can use `hex`, `rgb`, `rgba`, `hsl`, `hsla`, and `Gradient`color.
* @param color {string} - The `color` of the layer.
*/
setColor(color: ColorType): this;
/**
* @description Sets the stroke of the layer.
* @param width {number} - The `width` of the stroke.
* @param cap {string} - The `cap` of the stroke.
* @param join {string} - The `join` of the stroke.
* @param dash {number[]} - The `dash` of the stroke.
* @param dashOffset {number} - The `dashOffset` of the stroke.
* @param miterLimit {number} - The `miterLimit` of the stroke.
*/
setStroke(width: number, cap?: CanvasLineCap, join?: CanvasLineJoin, dash?: number[], dashOffset?: number, miterLimit?: number): this;
getBoundingBox(ctx: SKRSContext2D, canvas: Canvas, manager: LayersManager): {
max: {
x: number;
y: number;
};
min: {
x: number;
y: number;
};
center: {
x: number;
y: number;
};
width: number;
height: number;
};
draw(ctx: SKRSContext2D, canvas: Canvas, manager: LayersManager, debug: boolean): Promise<void>;
/**
* @returns {IQuadraticLayer}
*/
toJSON(): IQuadraticLayer;
}