UNPKG

starling-framework

Version:

A fast, productive library for 2D cross-platform development.

70 lines 2.3 kB
import Polygon from "../geom/Polygon"; import DisplayObjectContainer from "./DisplayObjectContainer"; import DisplayObject from "./DisplayObject"; import Point from "openfl/geom/Point"; 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; /** * Draws an arbitrary polygon. */ drawPolygon(polygon: Polygon): void; /** * Specifies a simple one-color fill that subsequent calls to drawing methods * * (such as <code>drawCircle()</code>) will use. */ beginFill(color?: number, alpha?: number): void; /** * Resets the color to 'white' and alpha to '1'. */ endFill(): void; /** * Removes all existing vertices. */ clear(): void; } } export default starling.display.Canvas;