import Texture from "./Texture"; import ByteArray from "openfl/utils/ByteArray"; import NetStream from "openfl/net/NetStream"; import TextureBase from "openfl/display3D/textures/TextureBase"; import BitmapData from "openfl/display/BitmapData"; import Bitmap from "openfl/display/Bitmap"; declare namespace starling.textures { /** * A ConcreteTexture wraps a Stage3D texture object, storing the properties of the texture * * and providing utility methods for data upload, etc. * * * *

This class cannot be instantiated directly; create instances using * * Texture.fromTextureBase instead. However, that's only necessary when * * you need to wrap a TextureBase object in a Starling texture; * * the preferred way of creating textures is to use one of the other * * Texture.from... factory methods in the Texture class.

* * * * @see Texture * */ export class ConcreteTexture extends Texture { /** * @private * * * * Creates a ConcreteTexture object from a TextureBase, storing information about size, * * mip-mapping, and if the channels contain premultiplied alpha values. May only be * * called from subclasses. * * * *

Note that width and height are expected in pixels, * * i.e. they do not take the scale factor into account.

* */ protected constructor(base: TextureBase, format: string, width: number, height: number, mipMapping: boolean, premultipliedAlpha: boolean, optimizedForRenderTexture?: boolean, scale?: number); /** * Disposes the TextureBase object. */ override dispose(): void; /** * Uploads a bitmap to the texture. The existing contents will be replaced. * * If the size of the bitmap does not match the size of the texture, the bitmap will be * * cropped or filled up with transparent pixels. * * * *

Pass a callback function to attempt asynchronous texture upload. * * If the current platform or runtime version does not support asynchronous texture loading, * * the callback will still be executed.

* * * *

This is the expected function definition: * * function(texture:ConcreteTexture):Void; * */ uploadBitmap(bitmap: Bitmap, async?: (arg0: ConcreteTexture) => void): void; /** * Uploads bitmap data to the texture. The existing contents will be replaced. * * If the size of the bitmap does not match the size of the texture, the bitmap will be * * cropped or filled up with transparent pixels. * * * *

Pass a callback function to attempt asynchronous texture upload. * * If the current platform or runtime version does not support asynchronous texture loading, * * the callback will still be executed.

* * * *

This is the expected function definition: * * function(texture:ConcreteTexture):Void; * */ uploadBitmapData(data: BitmapData, async?: (arg0: ConcreteTexture) => void): void; /** * Uploads ATF data from a ByteArray to the texture. Note that the size of the * * ATF-encoded data must be exactly the same as the original texture size. * * * *

The 'async' parameter is a callback function. * * If it's null, the texture will be decoded synchronously and will be visible right away. * * If it's a function, the data will be decoded asynchronously. The texture will remain unchanged until the * * upload is complete, at which time the callback function will be executed. This is the * * expected function definition: function(texture:ConcreteTexture):Void;

* */ uploadAtfData(data: ByteArray, offset?: number, async?: (arg0: ConcreteTexture) => void): void; /** * Specifies a video stream to be rendered within the texture. */ attachNetStream(netStream: NetStream, onComplete?: (arg0: ConcreteTexture) => void): void; /** * Clears the texture with a certain color and alpha value. The previous contents of the * * texture is wiped out. */ clear(color?: number, alpha?: number): void; /** * Indicates if the base texture was optimized for being used in a render texture. */ get optimizedForRenderTexture(): boolean; /** * Indicates if the base texture is a standard power-of-two dimensioned texture of type * * flash.display3D.textures.Texture. */ get isPotTexture(): boolean; /** * The function that you provide here will be called after a context loss. * * On execution, a new base texture will already have been created; however, * * it will be empty. Call one of the "upload..." methods from within the callback * * to restore the actual texture data. * * * * * * var texture:Texture = Texture.fromBitmap(new EmbeddedBitmap()); * * texture.root.onRestore = function():void * * { * * texture.root.uploadFromBitmap(new EmbeddedBitmap()); * * }; * */ get onRestore(): (arg0: ConcreteTexture) => void; set onRestore(value: (arg0: ConcreteTexture) => void) } } export default starling.textures.ConcreteTexture;