UNPKG

@flashport/flashport

Version:

FlashPort is a TypeScript 2D graphics library that largely replicates the Flash ActionScript 3.0 library

66 lines (65 loc) 3.55 kB
import { IGraphicsData } from "./IGraphicsData"; import { GraphicsGradientFill } from "./GraphicsGradientFill"; import { GraphicsStroke } from "./GraphicsStroke"; import { IGraphicsFill } from "./IGraphicsFill"; import { BitmapData } from "./BitmapData"; import { ColorTransform } from "../geom/ColorTransform"; import { Matrix } from "../geom/Matrix"; import { Rectangle } from "../geom/Rectangle"; import { Canvas, Paint, Path } from "canvaskit-wasm"; import { BitmapFilter } from "../filters"; export declare class Graphics extends Object { static debug: boolean; graphicsData: IGraphicsData[]; gradientFills: Array<GraphicsGradientFill>; lastStroke: GraphicsStroke; lastFill: IGraphicsFill; private pathPool; private pathPoolPos; private lastPath; private lastHalfThickness; private _bound; private _rect; private lockBound; _worldMatrix: Matrix; graphicsGroup: Path; graphicsGroupPaint: Paint; constructor(); clear: () => void; beginFill: (color: number, alpha?: number) => void; beginGradientFill: (type: string, colors: any[], alphas: any[], ratios: any[], matrix?: Matrix, spreadMethod?: string, interpolationMethod?: string, focalPointRatio?: number) => void; beginBitmapFill: (bitmap: BitmapData, matrix?: Matrix, repeat?: boolean, smooth?: boolean) => void; endStrokAndFill: () => void; lineGradientStyle: (type: string, colors: any[], alphas: any[], ratios: any[], matrix?: any, spreadMethod?: string, interpolationMethod?: string, focalPointRatio?: number) => void; lineStyle: (thickness?: number, color?: number, alpha?: number, pixelHinting?: boolean, scaleMode?: string, caps?: string, joints?: string, miterLimit?: number) => void; drawRect: (x: number, y: number, width: number, height: number) => void; drawRoundRect: (x: number, y: number, width: number, height: number, ellipseWidth: number, ellipseHeight?: number) => void; drawRoundRectComplex: (x: number, y: number, width: number, height: number, topLeftRadius: number, topRightRadius: number, bottomLeftRadius: number, bottomRightRadius: number) => void; drawCircle: (x: number, y: number, radius: number) => void; drawEllipse: (x: number, y: number, w: number, h: number) => void; moveTo: (x: number, y: number) => void; lineTo: (x: number, y: number) => void; curveTo: (controlX: number, controlY: number, anchorX: number, anchorY: number) => void; cubicCurveTo: (controlX1: number, controlY1: number, controlX2: number, controlY2: number, anchorX: number, anchorY: number) => void; private inflateBound; private makePath; endFill: () => void; copyFrom: (g: Graphics) => void; lineBitmapStyle: (bitmap: BitmapData, matrix?: Matrix, repeat?: boolean, smooth?: boolean) => void; drawPath: (commands: any[], data: any[], winding?: string) => void; drawTriangles(vertices: number[], indices?: number[], uvtData?: number[], culling?: string): void; private drawPathObject; private beginFillObject; private beginStrokeObject; drawGraphicsData: (graphicsData: IGraphicsData[]) => void; readGraphicsData: (recurse?: boolean) => IGraphicsData[]; /** * returns rectangle of drawn graphics not including strokes */ get rect(): Rectangle; /** * returns rectangle of drawn graphics including strokes */ get bound(): Rectangle; draw: (ctx: CanvasRenderingContext2D | Canvas, m: Matrix, blendMode: string, colorTransform: ColorTransform, filters: BitmapFilter[]) => void; }