A RenderTexture is a any texture onto which you can draw any display object.

After creating a render texture, just call the `draw` method to render an object directly onto the texture. The object will be drawn onto the texture at its current position, adhering its current rotation, scale and alpha properties.

Drawing is done very efficiently, as it is happening directly in graphics memory. After you have drawn objects onto the texture, the performance will be just like that of a normal texture — no matter how many objects you have drawn.

If you draw lots of objects at once, it is recommended to bundle the drawing calls in a block via the `drawBundled` method, like shown below. That will speed it up immensely, allowing you to draw hundreds of objects very quickly.

    <pre>

renderTexture.drawBundled(function():void { for (i?:number; i<numDrawings; ++i) { image.rotation = (2 * Math.PI / numDrawings) * i; renderTexture.draw(image); } });

To erase parts of a render texture, you can use any display object like a "rubber" by setting its blending mode to `BlendMode.ERASE`. To wipe it completely clean, use the `clear` method.

Persistence

Older devices may require double buffering to support persistent render textures. Thus, you should disable the `persistent` parameter in the constructor if you only need to make one draw operation on the texture. The static `useDoubleBuffering` property allows you to customize if new textures will be created with or without double buffering.

Context Loss

Unfortunately, render textures are wiped clean when the render context is lost. This means that you need to manually recreate all their contents in such a case. One way to do that is by using the `root.onRestore` callback, like here:

    						renderTexture.root.onRestore = function():void
    						{
    						quad:Quad = new Quad(100, 100, 0xff00ff);
    						renderTexture.clear(); // required on texture restoration
    						renderTexture.draw(quad);
    					});

For example, a drawing app would need to store information about all draw operations when they occur, and then recreate them inside `onRestore` on a context loss (preferably using `drawBundled` instead).

However, there is one problem: when that callback is executed, it's very likely that not all of your textures are already available, since they need to be restored, too (and that might take a while). You probably loaded your textures with the "AssetManager". In that case, you can listen to its `TEXTURES_RESTORED` event instead:

    						assetManager.addEventListener(Event.TEXTURES_RESTORED, function():void
    						{
    						brush:Image = new Image(assetManager.getTexture("brush"));
    						renderTexture.draw(brush);
    					});

[Note that this time, there is no need to call `clear`, because that's the default behavior of `onRestore`, anyway — and we didn't modify that.]

### Hierarchy

- SubTexture
  - RenderTexture

## Index

### Constructors

- constructor

### Properties

- base
- format
- frame
- frameHeight
- frameWidth
- height
- isPersistent
- mipMapping
- nativeHeight
- nativeWidth
- ownsParent
- parent
- premultipliedAlpha
- region
- root
- rotated
- scale
- transformationMatrix
- transformationMatrixToRoot
- width
- asyncBitmapUploadEnabled
- maxSize
- useDoubleBuffering

### Methods

- clear
- dispose
- draw
- drawBundled
- getTexCoords
- get_base
- get_format
- get_frame
- get_frameHeight
- get_frameWidth
- get_height
- get_isPersistent
- get_mipMapping
- get_nativeHeight
- get_nativeWidth
- get_ownsParent
- get_parent
- get_premultipliedAlpha
- get_region
- get_root
- get_rotated
- get_scale
- get_transformationMatrix
- get_transformationMatrixToRoot
- get_width
- globalToLocal
- localToGlobal
- setTexCoords
- setupTextureCoordinates
- setupVertexPositions
- empty
- fromAtfData
- fromBitmap
- fromBitmapData
- fromColor
- fromData
- fromEmbeddedAsset
- fromNetStream
- fromTexture
- fromTextureBase
- getMaxSize
- get_asyncBitmapUploadEnabled
- get_maxSize
- get_useDoubleBuffering
- set_asyncBitmapUploadEnabled
- set_useDoubleBuffering

## Constructors

### constructor

- new RenderTexture(width: number, height: number, persistent?: boolean, scale?: number, format?: string): RenderTexture

- Overrides SubTexture.constructor

  - Defined in lib/starling/textures/RenderTexture.d.ts:85

  Creates a new RenderTexture with a certain size (in points). If the texture is persistent, its contents remains intact after each draw call, allowing you to use the texture just like a canvas. If it is not, it will be cleared before each draw call.

  Non-persistent textures can be used more efficiently on older devices; on modern hardware, it does not make a difference. For more information, have a look at the documentation of the `useDoubleBuffering` property.

  #### Parameters

  - ##### width: number

  - ##### height: number

  - ##### Optional persistent: boolean

  - ##### Optional scale: number

  - ##### Optional format: string

  #### Returns RenderTexture

## Properties

### base

base: TextureBase

Inherited from Texture.base

- Defined in lib/starling/textures/Texture.d.ts:446

The Stage3D texture object the texture is based on.

### format

format: Context3DTextureFormat

Inherited from Texture.format

- Defined in lib/starling/textures/Texture.d.ts:454

The `Context3DTextureFormat` of the underlying texture data.

### frame

frame: Rectangle

Inherited from Texture.frame

- Defined in lib/starling/textures/Texture.d.ts:412

The texture frame if it has one (see class description), otherwise `null`.

CAUTION: not a copy, but the actual object! Do not modify!

### frameHeight

frameHeight: number

Inherited from Texture.frameHeight

- Defined in lib/starling/textures/Texture.d.ts:422

The width of the texture in points, taking into account the frame rectangle (if there is one).

### frameWidth

frameWidth: number

Inherited from Texture.frameWidth

- Defined in lib/starling/textures/Texture.d.ts:417

The height of the texture in points, taking into account the frame rectangle (if there is one).

### height

height: number

Inherited from Texture.height

- Defined in lib/starling/textures/Texture.d.ts:430

The height of the texture in points.

### isPersistent

isPersistent: boolean

- Defined in lib/starling/textures/RenderTexture.d.ts:140

Indicates if the texture is persistent over multiple draw calls.

### mipMapping

mipMapping: boolean

Inherited from Texture.mipMapping

- Defined in lib/starling/textures/Texture.d.ts:458

Indicates if the texture contains mip maps.

### nativeHeight

nativeHeight: number

Inherited from Texture.nativeHeight

- Defined in lib/starling/textures/Texture.d.ts:438

The height of the texture in pixels (without scale adjustment).

### nativeWidth

nativeWidth: number

Inherited from Texture.nativeWidth

- Defined in lib/starling/textures/Texture.d.ts:434

The width of the texture in pixels (without scale adjustment).

### ownsParent

ownsParent: boolean

Inherited from SubTexture.ownsParent

- Defined in lib/starling/textures/SubTexture.d.ts:40

Indicates if the parent texture is disposed when this object is disposed.

### parent

parent: Texture

Inherited from SubTexture.parent

- Defined in lib/starling/textures/SubTexture.d.ts:36

The texture which the SubTexture is based on.

### premultipliedAlpha

premultipliedAlpha: boolean

Inherited from Texture.premultipliedAlpha

- Defined in lib/starling/textures/Texture.d.ts:462

Indicates if the alpha values are premultiplied into the RGB values.

### region

region: Rectangle

Inherited from SubTexture.region

- Defined in lib/starling/textures/SubTexture.d.ts:50

The region of the parent texture that the SubTexture is showing (in points).

CAUTION: not a copy, but the actual object! Do not modify!

### root

root: ConcreteTexture

Inherited from Texture.root

- Defined in lib/starling/textures/Texture.d.ts:450

The concrete texture the texture is based on.

### rotated

rotated: boolean

Inherited from SubTexture.rotated

- Defined in lib/starling/textures/SubTexture.d.ts:44

If true, the SubTexture will show the parent region rotated by 90 degrees (CCW).

### scale

scale: number

Inherited from Texture.scale

- Defined in lib/starling/textures/Texture.d.ts:442

The scale factor, which influences width and height properties.

### transformationMatrix

transformationMatrix: Matrix

Inherited from Texture.transformationMatrix

- Defined in lib/starling/textures/Texture.d.ts:469

The matrix that is used to transform the texture coordinates into the coordinate space of the parent texture, if there is one. @default null

CAUTION: not a copy, but the actual object! Never modify this matrix!

### transformationMatrixToRoot

transformationMatrixToRoot: Matrix

Inherited from Texture.transformationMatrixToRoot

- Defined in lib/starling/textures/Texture.d.ts:476

The matrix that is used to transform the texture coordinates into the coordinate space of the root texture, if this instance is not the root. @default null

CAUTION: not a copy, but the actual object! Never modify this matrix!

### width

width: number

Inherited from Texture.width

- Defined in lib/starling/textures/Texture.d.ts:426

The width of the texture in points.

### Static asyncBitmapUploadEnabled

asyncBitmapUploadEnabled: boolean

Inherited from Texture.asyncBitmapUploadEnabled

- Defined in lib/starling/textures/Texture.d.ts:493

Indicates if it should be attempted to upload bitmaps asynchronously when the `async` parameter is supplied to supported methods. Since this feature is still not 100% reliable in AIR 26 (especially on Android), it defaults to 'false' for now.

If the feature is disabled or not available in the current AIR/Flash runtime, the async callback will still be executed; however, the upload itself will be made synchronously.

### Static maxSize

maxSize: number

Inherited from Texture.maxSize

- Defined in lib/starling/textures/Texture.d.ts:481

Returns the maximum size constraint (for both width and height) for uncompressed textures in the current Context3D profile.

### Static useDoubleBuffering

useDoubleBuffering: boolean

- Defined in lib/starling/textures/RenderTexture.d.ts:152

Indicates if new persistent textures should use double buffering. Single buffering is faster and requires less memory, but is not supported on all hardware.

By default, applications running with the profile "baseline" or "baselineConstrained" will use double buffering; all others use just a single buffer. You can override this behavior, though, by assigning a different value at runtime.

@default true for "baseline" and "baselineConstrained", false otherwise

## Methods

### clear

- clear(color?: number, alpha?: number): void

- - Defined in lib/starling/textures/RenderTexture.d.ts:135

  Clears the render texture with a certain color and alpha value. Call without any arguments to restore full transparency.

  #### Parameters

  - ##### Optional color: number

  - ##### Optional alpha: number

  #### Returns void

### dispose

- dispose(): void

- Overrides SubTexture.dispose

  - Defined in lib/starling/textures/RenderTexture.d.ts:98
  inheritdoc

  #### Returns void

### draw

- draw(object: DisplayObject, matrix?: Matrix, alpha?: number, antiAliasing?: number, cameraPos?: Vector3D): void

- - Defined in lib/starling/textures/RenderTexture.d.ts:114

  Draws an object into the texture.

  @param object The object to draw. @param matrix If 'matrix' is null, the object will be drawn adhering its properties for position, scale, and rotation. If it is not null, the object will be drawn in the orientation depicted by the matrix. @param alpha The object's alpha value will be multiplied with this value. @param antiAliasing Values range from 0 (no antialiasing) to 4 (best quality). Beginning with AIR 22, this feature is supported on all platforms (except for software rendering mode). @param cameraPos When drawing a 3D object, you can optionally pass in a custom camera position. If left empty, the camera will be placed with its default settings (centered over the texture, fov = 1.0).

  #### Parameters

  - ##### object: DisplayObject

  - ##### Optional matrix: Matrix

  - ##### Optional alpha: number

  - ##### Optional antiAliasing: number

  - ##### Optional cameraPos: Vector3D

  #### Returns void

### drawBundled

- drawBundled(drawingBlock: function, antiAliasing?: number, cameraPos?: Vector3D): void

- - Defined in lib/starling/textures/RenderTexture.d.ts:130

  Bundles several calls to `draw` together in a block. This avoids buffer switches and allows you to draw multiple objects into a non-persistent texture. Note that the 'antiAliasing' setting provided here overrides those provided in individual 'draw' calls.

  @param drawingBlock a callback with the form:

      function():void;

  @param antiAliasing Values range from 0 (no antialiasing) to 4 (best quality). Beginning with AIR 22, this feature is supported on all platforms (except for software rendering mode). @param cameraPos When drawing a 3D object, you can optionally pass in a custom camera position. If left empty, the camera will be placed with its default settings (centered over the texture, fov = 1.0).

  #### Parameters

  - ##### drawingBlock: function

    - - (): void

      - #### Returns void

  - ##### Optional antiAliasing: number

  - ##### Optional cameraPos: Vector3D

  #### Returns void

### getTexCoords

- getTexCoords(vertexData: VertexData, vertexID: number, attrName?: string, out?: Point): Point

- Inherited from Texture.getTexCoords

  - Defined in lib/starling/textures/Texture.d.ts:405

  Reads a pair of texture coordinates from the given VertexData instance and transforms them into the current texture's coordinate system. (Remember, the VertexData instance will always contain the coordinates in the root texture's coordinate system!)

  #### Parameters

  - ##### vertexData: VertexData

  - ##### vertexID: number

  - ##### Optional attrName: string

  - ##### Optional out: Point

  #### Returns Point

### Protected get_base

- get_base(): TextureBase

- Inherited from Texture.get_base

  - Defined in lib/starling/textures/Texture.d.ts:447

  #### Returns TextureBase

### Protected get_format

- get_format(): Context3DTextureFormat

- Inherited from Texture.get_format

  - Defined in lib/starling/textures/Texture.d.ts:455

  #### Returns Context3DTextureFormat

### Protected get_frame

- get_frame(): Rectangle

- Inherited from Texture.get_frame

  - Defined in lib/starling/textures/Texture.d.ts:413

  #### Returns Rectangle

### Protected get_frameHeight

- get_frameHeight(): number

- Inherited from Texture.get_frameHeight

  - Defined in lib/starling/textures/Texture.d.ts:423

  #### Returns number

### Protected get_frameWidth

- get_frameWidth(): number

- Inherited from Texture.get_frameWidth

  - Defined in lib/starling/textures/Texture.d.ts:418

  #### Returns number

### Protected get_height

- get_height(): number

- Inherited from Texture.get_height

  - Defined in lib/starling/textures/Texture.d.ts:431

  #### Returns number

### Protected get_isPersistent

- get_isPersistent(): boolean

- - Defined in lib/starling/textures/RenderTexture.d.ts:141

  #### Returns boolean

### Protected get_mipMapping

- get_mipMapping(): boolean

- Inherited from Texture.get_mipMapping

  - Defined in lib/starling/textures/Texture.d.ts:459

  #### Returns boolean

### Protected get_nativeHeight

- get_nativeHeight(): number

- Inherited from Texture.get_nativeHeight

  - Defined in lib/starling/textures/Texture.d.ts:439

  #### Returns number

### Protected get_nativeWidth

- get_nativeWidth(): number

- Inherited from Texture.get_nativeWidth

  - Defined in lib/starling/textures/Texture.d.ts:435

  #### Returns number

### Protected get_ownsParent

- get_ownsParent(): boolean

- Inherited from SubTexture.get_ownsParent

  - Defined in lib/starling/textures/SubTexture.d.ts:41

  #### Returns boolean

### Protected get_parent

- get_parent(): Texture

- Inherited from SubTexture.get_parent

  - Defined in lib/starling/textures/SubTexture.d.ts:37

  #### Returns Texture

### Protected get_premultipliedAlpha

- get_premultipliedAlpha(): boolean

- Inherited from Texture.get_premultipliedAlpha

  - Defined in lib/starling/textures/Texture.d.ts:463

  #### Returns boolean

### Protected get_region

- get_region(): Rectangle

- Inherited from SubTexture.get_region

  - Defined in lib/starling/textures/SubTexture.d.ts:51

  #### Returns Rectangle

### Protected get_root

- get_root(): ConcreteTexture

- Inherited from Texture.get_root

  - Defined in lib/starling/textures/Texture.d.ts:451

  #### Returns ConcreteTexture

### Protected get_rotated

- get_rotated(): boolean

- Inherited from SubTexture.get_rotated

  - Defined in lib/starling/textures/SubTexture.d.ts:45

  #### Returns boolean

### Protected get_scale

- get_scale(): number

- Inherited from Texture.get_scale

  - Defined in lib/starling/textures/Texture.d.ts:443

  #### Returns number

### Protected get_transformationMatrix

- get_transformationMatrix(): Matrix

- Inherited from Texture.get_transformationMatrix

  - Defined in lib/starling/textures/Texture.d.ts:470

  #### Returns Matrix

### Protected get_transformationMatrixToRoot

- get_transformationMatrixToRoot(): Matrix

- Inherited from Texture.get_transformationMatrixToRoot

  - Defined in lib/starling/textures/Texture.d.ts:477

  #### Returns Matrix

### Protected get_width

- get_width(): number

- Inherited from Texture.get_width

  - Defined in lib/starling/textures/Texture.d.ts:427

  #### Returns number

### globalToLocal

- globalToLocal(u: number, v: number, out?: Point): Point

- Inherited from Texture.globalToLocal

  - Defined in lib/starling/textures/Texture.d.ts:394

  Transforms the given texture coordinates from the root texture's coordinate system to the local coordinate system.

  #### Parameters

  - ##### u: number

  - ##### v: number

  - ##### Optional out: Point

  #### Returns Point

### localToGlobal

- localToGlobal(u: number, v: number, out?: Point): Point

- Inherited from Texture.localToGlobal

  - Defined in lib/starling/textures/Texture.d.ts:390

  Transforms the given texture coordinates from the local coordinate system into the root texture's coordinate system.

  #### Parameters

  - ##### u: number

  - ##### v: number

  - ##### Optional out: Point

  #### Returns Point

### setTexCoords

- setTexCoords(vertexData: VertexData, vertexID: number, attrName: string, u: number, v: number): void

- Inherited from Texture.setTexCoords

  - Defined in lib/starling/textures/Texture.d.ts:399

  Writes the given texture coordinates to a VertexData instance after transforming them into the root texture's coordinate system. That way, the texture coordinates can be used directly to sample the texture in the fragment shader.

  #### Parameters

  - ##### vertexData: VertexData

  - ##### vertexID: number

  - ##### attrName: string

  - ##### u: number

  - ##### v: number

  #### Returns void

### setupTextureCoordinates

- setupTextureCoordinates(vertexData: VertexData, vertexID?: number, attrName?: string): void

- Inherited from Texture.setupTextureCoordinates

  - Defined in lib/starling/textures/Texture.d.ts:385

  Sets up a VertexData instance with the correct texture coordinates for 4 vertices so that the texture is mapped to the complete quad.

  @param vertexData the vertex data to which the texture coordinates will be written. @param vertexID the start position within the VertexData instance. @param attrName the attribute name referencing the vertex positions.

  #### Parameters

  - ##### vertexData: VertexData

  - ##### Optional vertexID: number

  - ##### Optional attrName: string

  #### Returns void

### setupVertexPositions

- setupVertexPositions(vertexData: VertexData, vertexID?: number, attrName?: string, bounds?: Rectangle): void

- Inherited from Texture.setupVertexPositions

  - Defined in lib/starling/textures/Texture.d.ts:374

  Sets up a VertexData instance with the correct positions for 4 vertices so that the texture can be mapped onto it unscaled. If the texture has a `frame`, the vertices will be offset accordingly.

  @param vertexData the VertexData instance to which the positions will be written. @param vertexID the start position within the VertexData instance. @param attrName the attribute name referencing the vertex positions. @param bounds useful only for textures with a frame. This will position the vertices at the correct position within the given bounds, distorted appropriately.

  #### Parameters

  - ##### vertexData: VertexData

  - ##### Optional vertexID: number

  - ##### Optional attrName: string

  - ##### Optional bounds: Rectangle

  #### Returns void

### Static empty

- empty(width: number, height: number, premultipliedAlpha?: boolean, mipMapping?: boolean, optimizeForRenderToTexture?: boolean, scale?: number, format?: string, forcePotTexture?: boolean): Texture

- Inherited from Texture.empty

  - Defined in lib/starling/textures/Texture.d.ts:341

  Creates an empty texture of a certain size. Beware that the texture can only be used after you either upload some color data ("texture.root.upload...") or clear the texture ("texture.root.clear()").

  @param width in points; number of pixels depends on scale parameter @param height in points; number of pixels depends on scale parameter @param premultipliedAlpha the PMA format you will use the texture with. If you will use the texture for bitmap data, use "true"; for ATF data, use "false". @param mipMapping indicates if mipmaps should be used for this texture. When you upload bitmap data, this decides if mipmaps will be created; when you upload ATF data, this decides if mipmaps inside the ATF file will be displayed. @param optimizeForRenderToTexture indicates if this texture will be used as render target @param scale if you omit this parameter, 'Starling.contentScaleFactor' will be used. @param format the context3D texture format to use. Pass one of the packed or compressed formats to save memory (at the price of reduced image quality). @param forcePotTexture indicates if the underlying Stage3D texture should be created as the power-of-two based "Texture" class instead of the more memory efficient "RectangleTexture".

  #### Parameters

  - ##### width: number

  - ##### height: number

  - ##### Optional premultipliedAlpha: boolean

  - ##### Optional mipMapping: boolean

  - ##### Optional optimizeForRenderToTexture: boolean

  - ##### Optional scale: number

  - ##### Optional format: string

  - ##### Optional forcePotTexture: boolean

  #### Returns Texture

### Static fromAtfData

- fromAtfData(data: ByteArray, scale?: number, useMipMaps?: boolean, async?: function, premultipliedAlpha?: boolean): Texture

- Inherited from Texture.fromAtfData

  - Defined in lib/starling/textures/Texture.d.ts:244

  Creates a texture from ATF data (Adobe Texture Compression). Beware: you must not dispose 'data' if Starling should handle a lost device context; alternatively, you can handle restoration yourself via "texture.root.onRestore".

  @param data the raw data from an ATF file. @param scale the scale factor of the created texture. This affects the reported width and height of the texture object. @param useMipMaps If the ATF data contains mipmaps, this parameter controls if they are used; if it does not, this parameter has no effect. @param async If you pass a callback function, the texture will be decoded asynchronously, which allows a smooth framerate even during the loading process. However, don't use the texture before the callback has been executed. This is the expected definition: `function(texture:Texture):void;` @param premultipliedAlpha Indicates if the ATF data contains pixels in PMA format. This is "false" for most ATF files, but can be customized in some tools.

  #### Parameters

  - ##### data: ByteArray

  - ##### Optional scale: number

  - ##### Optional useMipMaps: boolean

  - ##### Optional async: function

    - - (Texture: any): void

      - #### Parameters

        - ##### Texture: any

        #### Returns void

  - ##### Optional premultipliedAlpha: boolean

  #### Returns Texture

### Static fromBitmap

- fromBitmap(bitmap: Bitmap, generateMipMaps?: boolean, optimizeForRenderToTexture?: boolean, scale?: number, format?: Context3DTextureFormat, forcePotTexture?: boolean, async?: function): Texture

- Inherited from Texture.fromBitmap

  - Defined in lib/starling/textures/Texture.d.ts:191

  Creates a texture object from a bitmap. Beware: you must not dispose the bitmap's data if Starling should handle a lost device context (except if you handle restoration yourself via "texture.root.onRestore").

  @param bitmap the texture will be created with the bitmap data of this object. @param generateMipMaps indicates if mipMaps will be created. @param optimizeForRenderToTexture indicates if this texture will be used as render target @param scale the scale factor of the created texture. This affects the reported width and height of the texture object. @param format the context3D texture format to use. Pass one of the packed or compressed formats to save memory (at the price of reduced image quality). @param forcePotTexture indicates if the underlying Stage3D texture should be created as the power-of-two based "Texture" class instead of the more memory efficient "RectangleTexture". @param async If you pass a callback function, the texture will be uploaded asynchronously, which allows smooth rendering even during the loading process. However, don't use the texture before the callback has been executed. This is the expected definition: `function(texture:Texture, error:ErrorEvent):void;` The second parameter is optional and typically `null`.

  #### Parameters

  - ##### bitmap: Bitmap

  - ##### Optional generateMipMaps: boolean

  - ##### Optional optimizeForRenderToTexture: boolean

  - ##### Optional scale: number

  - ##### Optional format: Context3DTextureFormat

  - ##### Optional forcePotTexture: boolean

  - ##### Optional async: function

    - - (Texture: any): void

      - #### Parameters

        - ##### Texture: any

        #### Returns void

  #### Returns Texture

### Static fromBitmapData

- fromBitmapData(data: BitmapData, generateMipMaps?: boolean, optimizeForRenderToTexture?: boolean, scale?: number, format?: Context3DTextureFormat, forcePotTexture?: boolean, async?: function): Texture

- Inherited from Texture.fromBitmapData

  - Defined in lib/starling/textures/Texture.d.ts:220

  Creates a texture object from bitmap data. Beware: you must not dispose 'data' if Starling should handle a lost device context (except if you handle restoration yourself via "texture.root.onRestore").

  @param data the bitmap data to upload to the texture. @param generateMipMaps indicates if mipMaps will be created. @param optimizeForRenderToTexture indicates if this texture will be used as render target @param scale the scale factor of the created texture. This affects the reported width and height of the texture object. @param format the context3D texture format to use. Pass one of the packed or compressed formats to save memory (at the price of reduced image quality). @param forcePotTexture indicates if the underlying Stage3D texture should be created as the power-of-two based "Texture" class instead of the more memory efficient "RectangleTexture". @param async If you pass a callback function, the texture will be uploaded asynchronously, which allows smooth rendering even during the loading process. However, don't use the texture before the callback has been executed. This is the expected definition: `function(texture:Texture, error:ErrorEvent):void;` The second parameter is optional and typically `null`.

  #### Parameters

  - ##### data: BitmapData

  - ##### Optional generateMipMaps: boolean

  - ##### Optional optimizeForRenderToTexture: boolean

  - ##### Optional scale: number

  - ##### Optional format: Context3DTextureFormat

  - ##### Optional forcePotTexture: boolean

  - ##### Optional async: function

    - - (Texture: any): void

      - #### Parameters

        - ##### Texture: any

        #### Returns void

  #### Returns Texture

### Static fromColor

- fromColor(width: number, height: number, color?: number, alpha?: number, optimizeForRenderToTexture?: boolean, scale?: number, format?: string, forcePotTexture?: boolean): Texture

- Inherited from Texture.fromColor

  - Defined in lib/starling/textures/Texture.d.ts:316

  Creates a texture with a certain size and color.

  @param width in points; number of pixels depends on scale parameter @param height in points; number of pixels depends on scale parameter @param color the RGB color the texture will be filled up @param alpha the alpha value that will be used for every pixel @param optimizeForRenderToTexture indicates if this texture will be used as render target @param scale if you omit this parameter, 'Starling.contentScaleFactor' will be used. @param format the context3D texture format to use. Pass one of the packed or compressed formats to save memory. @param forcePotTexture indicates if the underlying Stage3D texture should be created as the power-of-two based "Texture" class instead of the more memory efficient "RectangleTexture".

  #### Parameters

  - ##### width: number

  - ##### height: number

  - ##### Optional color: number

  - ##### Optional alpha: number

  - ##### Optional optimizeForRenderToTexture: boolean

  - ##### Optional scale: number

  - ##### Optional format: string

  - ##### Optional forcePotTexture: boolean

  #### Returns Texture

### Static fromData

- fromData(data: any, options?: TextureOptions): Texture

- Inherited from Texture.fromData

  - Defined in lib/starling/textures/Texture.d.ts:133

  Creates a texture from any of the supported data types, using the specified options.

  @param data Either an embedded asset class, a Bitmap, BitmapData, or a ByteArray with ATF data. @param options Specifies options about the texture settings, e.g. the scale factor. If left empty, the default options will be used.

  #### Parameters

  - ##### data: any

  - ##### Optional options: TextureOptions

  #### Returns Texture

### Static fromEmbeddedAsset

- fromEmbeddedAsset(assetClass: any, mipMapping?: boolean, optimizeForRenderToTexture?: boolean, scale?: number, format?: Context3DTextureFormat, forcePotTexture?: boolean): Texture

- Inherited from Texture.fromEmbeddedAsset

  - Defined in lib/starling/textures/Texture.d.ts:163

  Creates a texture object from an embedded asset class. Textures created with this method will be restored directly from the asset class in case of a context loss, which guarantees a very economic memory usage.

  @param assetClass must contain either a Bitmap or a ByteArray with ATF data. @param mipMapping for Bitmaps, indicates if mipMaps will be created; for ATF data, indicates if the contained mipMaps will be used. @param optimizeForRenderToTexture indicates if this texture will be used as render target. @param scale the scale factor of the created texture. @param format the context3D texture format to use. Ignored for ATF data. @param forcePotTexture indicates if the underlying Stage3D texture should be created as the power-of-two based "Texture" class instead of the more memory efficient "RectangleTexture". (Only applicable to bitmaps; ATF textures are always POT-textures, anyway.)

  #### Parameters

  - ##### assetClass: any

  - ##### Optional mipMapping: boolean

  - ##### Optional optimizeForRenderToTexture: boolean

  - ##### Optional scale: number

  - ##### Optional format: Context3DTextureFormat

  - ##### Optional forcePotTexture: boolean

  #### Returns Texture

### Static fromNetStream

- fromNetStream(stream: NetStream, scale?: number, onComplete?: function): Texture

- Inherited from Texture.fromNetStream

  - Defined in lib/starling/textures/Texture.d.ts:275

  Creates a video texture from a NetStream.

  Below, you'll find a minimal sample showing how to stream a video from a file. Note that `ns.play()` is called only after creating the texture, and outside the `onComplete`-callback. It's recommended to always make the calls in this order; otherwise, playback won't start on some platforms.

      									nc:NetConnection = new NetConnection();
      									nc.connect(null);
      									ns:NetStream = new NetStream(nc);
      									texture:Texture = Texture.fromNetStream(ns, 1, function():void
      									{
      									addChild(new Image(texture));
      									});
      									file:File = File.applicationDirectory.resolvePath("bugs-bunny.m4v");
      								ns.play(file.url);

  @param stream the NetStream from which the video data is streamed. Beware that 'play' should be called only after the method returns, and outside the `onComplete` callback. @param scale the scale factor of the created texture. This affects the reported width and height of the texture object. @param onComplete will be executed when the texture is ready. Contains a parameter of type 'Texture'.

  #### Parameters

  - ##### stream: NetStream

  - ##### Optional scale: number

  - ##### Optional onComplete: function

    - - (Texture: any): void

      - #### Parameters

        - ##### Texture: any

        #### Returns void

  #### Returns Texture

### Static fromTexture

- fromTexture(texture: Texture, region?: Rectangle, frame?: Rectangle, rotated?: boolean, scaleModifier?: number): Texture

- Inherited from Texture.fromTexture

  - Defined in lib/starling/textures/Texture.d.ts:359

  Creates a texture that contains a region (in pixels) of another texture. The new texture will reference the base texture; no data is duplicated.

  @param texture The texture you want to create a SubTexture from. @param region The region of the parent texture that the SubTexture will show (in points). @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 new texture will be calculated by multiplying the parent texture's scale factor with this value.

  #### Parameters

  - ##### texture: Texture

  - ##### Optional region: Rectangle

  - ##### Optional frame: Rectangle

  - ##### Optional rotated: boolean

  - ##### Optional scaleModifier: number

  #### Returns Texture

### Static fromTextureBase

- fromTextureBase(base: TextureBase, width: number, height: number, options?: TextureOptions): ConcreteTexture

- Inherited from Texture.fromTextureBase

  - Defined in lib/starling/textures/Texture.d.ts:144

  Creates a texture from a `TextureBase` object.

  @param base a Stage3D texture object created through the current context. @param width the width of the texture in pixels (not points!). @param height the height of the texture in pixels (not points!). @param options specifies options about the texture settings, e.g. the scale factor. If left empty, the default options will be used. Note that not all options are supported by all texture types.

  #### Parameters

  - ##### base: TextureBase

  - ##### width: number

  - ##### height: number

  - ##### Optional options: TextureOptions

  #### Returns ConcreteTexture

### Static getMaxSize

- getMaxSize(textureFormat?: Context3DTextureFormat): number

- Inherited from Texture.getMaxSize

  - Defined in lib/starling/textures/Texture.d.ts:484

  #### Parameters

  - ##### Optional textureFormat: Context3DTextureFormat

  #### Returns number

### Static Protected get_asyncBitmapUploadEnabled

- get_asyncBitmapUploadEnabled(): boolean

- Inherited from Texture.get_asyncBitmapUploadEnabled

  - Defined in lib/starling/textures/Texture.d.ts:494

  #### Returns boolean

### Static Protected get_maxSize

- get_maxSize(): number

- Inherited from Texture.get_maxSize

  - Defined in lib/starling/textures/Texture.d.ts:482

  #### Returns number

### Static Protected get_useDoubleBuffering

- get_useDoubleBuffering(): boolean

- - Defined in lib/starling/textures/RenderTexture.d.ts:153

  #### Returns boolean

### Static Protected set_asyncBitmapUploadEnabled

- set_asyncBitmapUploadEnabled(value: boolean): boolean

- Inherited from Texture.set_asyncBitmapUploadEnabled

  - Defined in lib/starling/textures/Texture.d.ts:495

  #### Parameters

  - ##### value: boolean

  #### Returns boolean

### Static Protected set_useDoubleBuffering

- set_useDoubleBuffering(value: boolean): boolean

- - Defined in lib/starling/textures/RenderTexture.d.ts:154

  #### Parameters

  - ##### value: boolean

  #### Returns boolean

Generated using TypeDoc