UNPKG

starling-framework

Version:

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

53 lines 2.31 kB
import Texture from "./Texture"; import Rectangle from "openfl/geom/Rectangle"; declare namespace starling.textures { /** * A SubTexture represents a section of another texture. This is achieved solely by * * manipulation of texture coordinates, making the class very efficient. * * * * <p><em>Note that it is OK to create subtextures of subtextures.</em></p> * */ export class SubTexture extends Texture { /** * Creates a new SubTexture containing the specified region of a parent texture. * * * * @param parent The texture you want to create a SubTexture from. * * @param region The region of the parent texture that the SubTexture will show * * (in points). If <code>null</code>, the complete area of the parent. * * @param ownsParent If <code>true</code>, the parent texture will be disposed * * automatically when the SubTexture is disposed. * * @param frame If the texture was trimmed, the frame rectangle can be used to restore * * the trimmed area. * * @param rotated If true, the SubTexture will show the parent region rotated by * * 90 degrees (CCW). * * @param scaleModifier The scale factor of the SubTexture will be calculated by * * multiplying the parent texture's scale factor with this value. * */ constructor(parent: Texture, region?: Rectangle, ownsParent?: boolean, frame?: Rectangle, rotated?: boolean, scaleModifier?: number); /** * Disposes the parent texture if this texture owns it. */ override dispose(): void; /** * The texture which the SubTexture is based on. */ get parent(): Texture; /** * Indicates if the parent texture is disposed when this object is disposed. */ get ownsParent(): boolean; /** * If true, the SubTexture will show the parent region rotated by 90 degrees (CCW). */ get rotated(): boolean; /** * The region of the parent texture that the SubTexture is showing (in points). * * * * <p>CAUTION: not a copy, but the actual object! Do not modify!</p> */ get region(): Rectangle; } } export default starling.textures.SubTexture;