@nmmty/lazycanvas
Version:
A simple way to interact with @napi-rs/canvas in an advanced way!
40 lines (39 loc) • 1.84 kB
TypeScript
import { BaseLayer } from "./BaseLayer";
import { ColorType, ILineLayer, ILineLayerProps, ScaleType } from "../../types/";
import { Canvas, SKRSContext2D } from "@napi-rs/canvas";
import { LayersManager } from "../managers/LayersManager";
export declare class LineLayer extends BaseLayer<ILineLayerProps> {
props: ILineLayerProps;
constructor(props?: ILineLayerProps);
/**
* @description Sets the end point of the line layer. You can use `numbers`, `percentages`, `px`, `vw`, `vh`, `vmin`, `vmax`.
* @param x {ScaleType} - The end `x` of the line layer.
* @param y {ScaleType} - The end `y` of the line 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): {
xs: number;
ys: number;
xe: number;
ye: number;
width: number;
height: number;
};
draw(ctx: SKRSContext2D, canvas: Canvas, manager: LayersManager, debug: boolean): Promise<void>;
toJSON(): ILineLayer;
}