GODPAPER | All Packages | All Classes | Index | Frames No Frames |
ConcreteTexture

Package | starling.textures
Class | public class ConcreteTexture
Inheritance | ConcreteTexture Texture Object

A ConcreteTexture wraps a Stage3D texture object, storing the properties of the texture.

Public Properties
Hide Inherited Public Properties
Show Inherited Public Properties

| Property | Defined By
--- | --- | ---
|  | base : TextureBase [override] [read-only] The Stage3D texture object the texture is based on. | ConcreteTexture
|  | format : String [override] [read-only] The Context3DTextureFormat of the underlying texture data. | ConcreteTexture
|  | frame : Rectangle [read-only] The texture frame (see class description). | Texture
|  | height : Number [override] [read-only] The height of the texture in points. | ConcreteTexture
|  | mipMapping : Boolean [override] [read-only] Indicates if the texture contains mip maps. | ConcreteTexture
|  | nativeHeight : Number [override] [read-only] The height of the texture in pixels (without scale adjustment). | ConcreteTexture
|  | nativeWidth : Number [override] [read-only] The width of the texture in pixels (without scale adjustment). | ConcreteTexture
|  | onRestore : Function If Starling's "handleLostContext" setting is enabled, the function that you provide here will be called after a context loss. | ConcreteTexture
|  | optimizedForRenderTexture : Boolean [read-only] Indicates if the base texture was optimized for being used in a render texture. | ConcreteTexture
|  | premultipliedAlpha : Boolean [override] [read-only] Indicates if the alpha values are premultiplied into the RGB values. | ConcreteTexture
|  | repeat : Boolean Indicates if the texture should repeat like a wallpaper or stretch the outermost pixels. | Texture
|  | root : ConcreteTexture [override] [read-only] The concrete (power-of-two) texture the texture is based on. | ConcreteTexture
|  | scale : Number [override] [read-only] The scale factor, which influences width and height properties. | ConcreteTexture
|  | width : Number [override] [read-only] The width of the texture in points. | ConcreteTexture

Public Methods
Hide Inherited Public Methods
Show Inherited Public Methods

| Method | Defined By
--- | --- | ---
|  | ConcreteTexture(base:TextureBase, format:String, width:int, height:int, mipMapping:Boolean, premultipliedAlpha:Boolean, optimizedForRenderTexture:Boolean = false, scale:Number = 1) Creates a ConcreteTexture object from a TextureBase, storing information about size, mip-mapping, and if the channels contain premultiplied alpha values. | ConcreteTexture
|  | adjustTexCoords(texCoords:Vector.<Number>, startIndex:int = 0, stride:int = 0, count:int = -1):void Converts texture coordinates into the format required for rendering. | Texture
|  | adjustVertexData(vertexData:VertexData, vertexID:int, count:int):void Converts texture coordinates and vertex positions of raw vertex data into the format required for rendering. | Texture
|  | clear(color:uint = 0x0, alpha:Number = 0.0):void Clears the texture with a certain color and alpha value. | ConcreteTexture
|  | dispose():void [override] Disposes the TextureBase object. | ConcreteTexture
|  | empty(width:Number, height:Number, premultipliedAlpha:Boolean = true, mipMapping:Boolean = true, optimizeForRenderToTexture:Boolean = false, scale:Number = -1, format:String = bgra):Texture [static] Creates an empty texture of a certain size. | Texture
|  | fromAtfData(data:ByteArray, scale:Number = 1, useMipMaps:Boolean = true, async:Function = null):Texture [static] Creates a texture from the compressed ATF format. | Texture
|  | fromBitmap(bitmap:Bitmap, generateMipMaps:Boolean = true, optimizeForRenderToTexture:Boolean = false, scale:Number = 1, format:String = bgra):Texture [static] Creates a texture object from a bitmap. | Texture
|  | fromBitmapData(data:BitmapData, generateMipMaps:Boolean = true, optimizeForRenderToTexture:Boolean = false, scale:Number = 1, format:String = bgra):Texture [static] Creates a texture object from bitmap data. | Texture
|  | fromColor(width:Number, height:Number, color:uint = 0xffffffff, optimizeForRenderToTexture:Boolean = false, scale:Number = -1, format:String = bgra):Texture [static] Creates a texture with a certain size and color. | Texture
|  | fromEmbeddedAsset(assetClass:Class, mipMapping:Boolean = true, optimizeForRenderToTexture:Boolean = false, scale:Number = 1, format:String = bgra):Texture [static] Creates a texture object from an embedded asset class. | Texture
|  | fromTexture(texture:Texture, region:Rectangle = null, frame:Rectangle = null):Texture [static] Creates a texture that contains a region (in pixels) of another texture. | Texture
|  | uploadAtfData(data:ByteArray, offset:int = 0, async:* = null):void Uploads ATF data from a ByteArray to the texture. | ConcreteTexture
|  | uploadBitmap(bitmap:Bitmap):void Uploads a bitmap to the texture. | ConcreteTexture
|  | uploadBitmapData(data:BitmapData):void Uploads bitmap data to the texture. | ConcreteTexture

Property Detail

base | property

`base:TextureBase` [read-only] [override]

The Stage3D texture object the texture is based on.

Implementation
`public function get base():TextureBase`

format | property |

`format:String` [read-only] [override]

The `Context3DTextureFormat` of the underlying texture data.

Implementation
`public function get format():String`

height | property |

`height:Number` [read-only] [override]

The height of the texture in points.

Implementation
`public function get height():Number`

mipMapping | property |

`mipMapping:Boolean` [read-only] [override]

Indicates if the texture contains mip maps.

Implementation
`public function get mipMapping():Boolean`

nativeHeight | property |

`nativeHeight:Number` [read-only] [override]

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

Implementation
`public function get nativeHeight():Number`

nativeWidth | property |

`nativeWidth:Number` [read-only] [override]

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

Implementation
`public function get nativeWidth():Number`

onRestore | property |

`onRestore:Function`

If Starling's "handleLostContext" setting is enabled, 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 callbacks to restore the actual texture data.

Implementation
`public function get onRestore():Function`
`public function set onRestore(value:Function):void`

optimizedForRenderTexture | property |

`optimizedForRenderTexture:Boolean` [read-only]

Indicates if the base texture was optimized for being used in a render texture.

Implementation
`public function get optimizedForRenderTexture():Boolean`

premultipliedAlpha | property |

`premultipliedAlpha:Boolean` [read-only] [override]

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

Implementation
`public function get premultipliedAlpha():Boolean`

root | property |

`root:ConcreteTexture` [read-only] [override]

The concrete (power-of-two) texture the texture is based on.

Implementation
`public function get root():ConcreteTexture`

scale | property |

`scale:Number` [read-only] [override]

The scale factor, which influences width and height properties.

Implementation
`public function get scale():Number`

width | property |

`width:Number` [read-only] [override]

The width of the texture in points.

Implementation
`public function get width():Number`
Constructor Detail

ConcreteTexture | () | Constructor

`public function ConcreteTexture(base:TextureBase, format:String, width:int, height:int, mipMapping:Boolean, premultipliedAlpha:Boolean, optimizedForRenderTexture:Boolean = false, scale:Number = 1)`

Creates a ConcreteTexture object from a TextureBase, storing information about size, mip-mapping, and if the channels contain premultiplied alpha values.

Parameters

| `base:TextureBase`
| `format:String`
| `width:int`
| `height:int`
| `mipMapping:Boolean`
| `premultipliedAlpha:Boolean`
| `optimizedForRenderTexture:Boolean` (default = `false`)``
| `scale:Number` (default = `1`)``

Method Detail

clear | () | method

`public function clear(color:uint = 0x0, alpha:Number = 0.0):void`

Clears the texture with a certain color and alpha value. The previous contents of the texture is wiped out. Beware: this method resets the render target to the back buffer; don't call it from within a render method.

Parameters

| `color:uint` (default = `0x0`)``
| `alpha:Number` (default = `0.0`)``

createBase | () | method |

`starling_internal function createBase():void`

Recreates the underlying Stage3D texture object with the same dimensions and attributes as the one that was passed to the constructor. You have to upload new data before the texture becomes usable again. Beware: this method does not dispose the current base.

dispose | () | method |

`override public function dispose():void`

Disposes the TextureBase object.

uploadAtfData | () | method |

`public function uploadAtfData(data:ByteArray, offset:int = 0, async:* = null):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 may be either a boolean value or a callback function. If it's `false` or `null`, the texture will be decoded synchronously and will be visible right away. If it's `true` or 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:Texture):void;`

Parameters

| `data:ByteArray`
| `offset:int` (default = `0`)``
| `async:*` (default = `null`)``

uploadBitmap | () | method |

`public function uploadBitmap(bitmap:Bitmap):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

Parameters

| `bitmap:Bitmap`

uploadBitmapData | () | method |

`public function uploadBitmapData(data:BitmapData):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

Parameters

| `data:BitmapData`

Thu Jan 16 2014, 01:11 PM +08:00