@nmmty/lazycanvas
Version:
A simple way to interact with @napi-rs/canvas in an advanced way!
59 lines (58 loc) • 2.41 kB
TypeScript
import { BaseLayer } from "./BaseLayer";
import { ColorType, IBezierLayer, IBezierLayerProps, ScaleType } from "../../types";
import { Canvas, SKRSContext2D } from "@napi-rs/canvas";
import { LayersManager } from "../managers/LayersManager";
export declare class BezierLayer extends BaseLayer<IBezierLayerProps> {
props: IBezierLayerProps;
constructor(props?: IBezierLayerProps);
/**
* @description Sets the control points of the bezier layer. You can use `numbers`, `percentages`, `px`, `vw`, `vh`, `vmin`, `vmax`.
* @param controlPoints {Array<{ x: ScaleType, y: ScaleType }>} - The `controlPoints` of the bezier layer.
*/
setControlPoints(...controlPoints: {
x: ScaleType;
y: ScaleType;
}[]): this;
/**
* @description Sets the end point of the bezier layer. You can use `numbers`, `percentages`, `px`, `vw`, `vh`, `vmin`, `vmax`.
* @param x {ScaleType} - The end `x` of the bezier layer.
* @param y {ScaleType} - The end `y` of the bezier 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 {IBezierLayer}
*/
toJSON(): IBezierLayer;
}