import { DisplayObject } from "./DisplayObject"; import { ASObject } from "../../avm2/nat/ASObject"; import { ASArray } from "../../avm2/nat/ASArray"; import { Bounds } from "../../base/utilities"; import { ShapeData } from "@awayjs/graphics"; import { BitmapData } from "./BitmapData"; import { Matrix } from "../geom/Matrix"; import { GenericVector } from "../../avm2/natives/GenericVector"; import { IRemotable } from "../../base/remoting"; import { LoaderInfo } from "./LoaderInfo"; export declare class Graphics extends ASObject implements IRemotable { static classInitializer: any; constructor(); static FromData(data: any, loaderInfo: LoaderInfo): Graphics; getGraphicsData(): ShapeData; getUsedTextures(): BitmapData[]; _id: number; private _graphicsData; private _textures; private _lastX; private _lastY; private _boundsIncludeLastCoordinates; /** * Determine by how much the lineBounds are larger than the fillBounds. */ private _topLeftStrokeWidth; private _bottomRightStrokeWidth; /** * Indicates whether this graphics object has changed since the last time it was synchronized. */ _isDirty: boolean; /** * Flash special-cases lines that are 1px and 3px wide. * They're offset by 0.5px to the bottom-right. */ private _setStrokeWidth; /** * Bounding box excluding strokes. */ private _fillBounds; /** * Bounding box including strokes. */ private _lineBounds; /** * Back reference to the display object that references this graphics object. This is * needed so that we can propagate invalid / dirty bits whenever the graphics object * changes. */ _parent: DisplayObject; _setParent(parent: DisplayObject): void; _invalidate(): void; _getContentBounds(includeStrokes?: boolean): Bounds; clear(): void; /** * Sets a solid color and opacity as the fill for subsequent drawing commands. * * @see http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/Graphics.html#beginFill%28%29 * @param color * @param alpha While any Number is a valid input, the value is clamped to [0,1] and then scaled * to an integer in the interval [0,0xff]. */ beginFill(color: number, alpha?: number): void; beginGradientFill(type: string, colors: ASArray, alphas: ASArray, ratios: ASArray, matrix?: Matrix, spreadMethod?: string, interpolationMethod?: string, focalPointRatio?: number): void; beginBitmapFill(bitmap: BitmapData, matrix?: Matrix, repeat?: boolean, smooth?: boolean): void; endFill(): void; lineStyle(thickness: number, color?: number, alpha?: number, pixelHinting?: boolean, scaleMode?: string, caps?: string, joints?: string, miterLimit?: number): void; lineGradientStyle(type: string, colors: ASArray, alphas: ASArray, ratios: ASArray, matrix?: Matrix, spreadMethod?: string, interpolationMethod?: string, focalPointRatio?: number): void; lineBitmapStyle(bitmap: BitmapData, matrix?: Matrix, repeat?: boolean, smooth?: boolean): 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; /** * Here x and y are the top-left coordinates of the bounding box of the * ellipse not the center as is the case for circles. */ drawEllipse(x: number, y: number, width: number, height: 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; copyFrom(sourceGraphics: Graphics): void; drawPath(commands: GenericVector, data: GenericVector, winding?: string): void; drawTriangles(vertices: GenericVector, indices?: GenericVector, uvtData?: GenericVector, culling?: string): void; drawGraphicsData(graphicsData: GenericVector): void; /** * Tests if the specified point is within this graphics path. */ _containsPoint(x: number, y: number, includeLines: boolean, ratio: number): boolean; private _fillContainsPoint; private _linesContainsPoint; /** * Bitmaps are specified the same for fills and strokes, so we only need to serialize them * once. The Parameter `pathCommand` is treated as the actual command to serialize, and must * be one of PathCommand.BeginBitmapFill and PathCommand.LineStyleBitmap. * * This method doesn't actually write anything if the `skipWrite` argument is true. In that * case, it only does arguments checks so the right exceptions are thrown. */ private _writeBitmapStyle; /** * Gradients are specified the same for fills and strokes, so we only need to serialize them * once. The Parameter `pathCommand` is treated as the actual command to serialize, and must * be one of PathCommand.BeginGradientFill and PathCommand.LineStyleGradient. * * This method doesn't actually write anything if the `skipWrite` argument is true. In that * case, it only does arguments checks so the right exceptions are thrown. */ private _writeGradientStyle; private _extendBoundsByPoint; private _extendBoundsByX; private _extendBoundsByY; private _applyLastCoordinates; }