import Polygon from "../geom/Polygon"; import DisplayObjectContainer from "./DisplayObjectContainer"; import DisplayObject from "./DisplayObject"; import Point from "openfl/geom/Point"; import IGraphicsData from "openfl/display/IGraphicsData"; import Vector from "openfl/Vector"; declare namespace starling.display { /** * A display object supporting basic vector drawing functionality. In its current state, * * the main use of this class is to provide a range of forms that can be used as masks. * */ export class Canvas extends DisplayObjectContainer { /** * Creates a new (empty) Canvas. Call one or more of the 'draw' methods to add content. */ constructor(); /** * @inheritDoc */ override dispose(): void; /** * @inheritDoc */ override hitTest(localPoint: Point): DisplayObject; /** * Draws a circle. * * * * @param x x-coordinate of center point * * @param y y-coordinate of center point * * @param radius radius of circle * * @param numSides the number of lines used to draw the circle. * * If you don't pass anything, Starling will pick a reasonable value. * */ drawCircle(x: number, y: number, radius: number, numSides?: number): void; /** * Draws an ellipse. * * * * @param x x-coordinate of bounding box * * @param y y-coordinate of bounding box * * @param width width of the ellipse * * @param height height of the ellipse * * @param numSides the number of lines used to draw the ellipse. * * If you don't pass anything, Starling will pick a reasonable value. * */ drawEllipse(x: number, y: number, width: number, height: number, numSides?: number): void; /** * Draws a rectangle. */ drawRectangle(x: number, y: number, width: number, height: number): void; drawRoundRectangle(x: number, y: number, width: number, height: number, ellipseWidth: number, ellipseHeight?: number): void; /** * Specifies a simple one-color fill that subsequent calls to drawing methods * * (such as drawCircle()) will use. */ beginFill(color?: number, alpha?: number): void; /** * Resets the color to 'white' and alpha to '1'. */ endFill(): void; /** * Moves the current drawing position to (x, y). * * * * @param x A Float that indicates the horizontal position relative to the registration point of the parent display object (in pixels). * * @param y A Float that indicates the vertical position relative to the registration point of the parent display object (in pixels). * */ moveTo(x: number, y: number): void; /** * Draws a line using the current line style from the current drawing position to (x, y); the current drawing position is then set to (x, y). * * * * @param x A Float that indicates the horizontal position relative to the registration point of the parent display object (in pixels). * * @param y A Float that indicates the vertical position relative to the registration point of the parent display object (in pixels). * */ lineTo(x: number, y: number): void; /** * Draws a quadratic Bezier curve using the current line style from the current drawing position to (anchorX, anchorY) and using the control point that (controlX, controlY) specifies. * * * * @param controlX A Float that specifies the horizontal position of the control point relative to the registration point of the parent display object. * * @param controlY A Float that specifies the vertical position of the control point relative to the registration point of the parent display object. * * @param anchorX A Float that specifies the horizontal position of the next anchor point relative to the registration point of the parent display object. * * @param anchorY A Float that specifies the vertical position of the next anchor point relative to the registration point of the parent display object. * */ curveTo(controlX: number, controlY: number, anchorX: number, anchorY: number): void; /** * Submits a series of IGraphicsData instances for drawing. * * * * @param graphicsData A Vector containing graphics objects, each of which much implement the flash.display.IGraphicsData interface. * */ drawGraphicsData(graphicsData: Vector): void; /** * Removes all existing vertices. */ clear(): void; /** * Draws an arbitrary polygon. */ drawPolygon(polygon: Polygon): void; } } export default starling.display.Canvas;