import Rectangle from "../geom/Rectangle"; import BitmapData from "./BitmapData"; import Vector from "../Vector"; declare namespace openfl.display { /** * The Tileset class lets you specify logical rectangles within a larger * BitmapData object, to be rendered using a Tilemap instance. * * The `Tileset()` constructor allows you to create a Tileset * object that contains a reference to a BitmapData object. After you create a * Tileset object, use the `addRect()` method to specify rectangles to be used * for tile rendering. * */ export class Tileset { /** * Creates a new Tileset instance. * * @param bitmapData A BitmapData object to reference * @param rects An optional array of rectangles to define with the referenced BitmapData * */ constructor(bitmapData: BitmapData, rects?: Array); /** * The BitmapData object being referenced. * */ get bitmapData(): BitmapData; set bitmapData(value: BitmapData) /** * The rectangles contained in this Tileset, structured as a Vector object. * * You can use the Tileset `rectData` property alongside the Graphics * `drawQuads` method as a convenient way of re-using a list of rectangles. * */ rectData: Vector; /** * Returns the number of rectangles defined in this Tileset. * */ get numRects(): number; /** * Adds a new rectangle to this Tilemap object. * * @param rect A Rectangle represented a part of the referenced BitmapData object * @returns The assigned ID value for this new rectangle * */ addRect(rect: Rectangle): number; /** * Duplicates an instance of a Tileset subclass. * * @return A new Tileset object that is identical to the original. * */ clone(): Tileset; /** * Returns whether the current Tileset already has a rectangle * defined that matches the dimensions of a specific rectangle * object. * * @param rect A Rectangle object to compare against * @returns Whether the Tileset already contains the value of this rectangle * */ hasRect(rect: Rectangle): boolean; /** * Get the rectangle value associated with a specific tile ID. * * If the ID is invalid, then a `null` value will be returned. * * @param id A tile ID * @return A new Rectangle containing the tile source rectangle, or `null` if the * tile ID does not exist in this Tileset * */ getRect(id: number): Rectangle; /** * Gets the tile ID associated with a specified rectangle * value, if it is defined in the Tileset. This will return * `null` if the rectangle value is not defined in the Tileset. * * @param rect A Rectangle object to compare against * @returns The defined tile ID, or `null` if the rectangle * value is not present in this Tileset * */ getRectID(rect: Rectangle): number; } } export default openfl.display.Tileset;