Packagestarling.textures
Classpublic class ConcreteTexture
InheritanceConcreteTexture Inheritance Texture Inheritance Object

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



Public Properties
 PropertyDefined 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
 Inheritedframe : Rectangle
[read-only] The texture frame if it has one (see class description), otherwise null.
Texture
  height : Number
[override] [read-only] The height of the texture in points.
ConcreteTexture
 InheritedmaxSize : int
[static] [read-only] Returns the maximum size constraint (for both width and height) for textures in the current Context3D profile.
Texture
  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
[override] [read-only] Indicates if the texture should repeat like a wallpaper or stretch the outermost pixels.
ConcreteTexture
  root : ConcreteTexture
[override] [read-only] The concrete 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
 MethodDefined By
  
ConcreteTexture(base:TextureBase, format:String, width:int, height:int, mipMapping:Boolean, premultipliedAlpha:Boolean, optimizedForRenderTexture:Boolean = false, scale:Number = 1, repeat:Boolean = false)
Creates a ConcreteTexture object from a TextureBase, storing information about size, mip-mapping, and if the channels contain premultiplied alpha values.
ConcreteTexture
 Inherited
adjustTexCoords(texCoords:Vector.<Number>, startIndex:int = 0, stride:int = 0, count:int = -1):void
Converts texture coordinates into the format required for rendering.
Texture
 Inherited
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
  
attachCamera(camera:Camera, onComplete:Function = null):void
ConcreteTexture
  
attachNetStream(netStream:NetStream, onComplete:Function = null):void
ConcreteTexture
  
attachVideo(type:String, attachment:Object, onComplete:Function = null):void
ConcreteTexture
  
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
 Inherited
empty(width:Number, height:Number, premultipliedAlpha:Boolean = true, mipMapping:Boolean = true, optimizeForRenderToTexture:Boolean = false, scale:Number = -1, format:String = bgra, repeat:Boolean = false):Texture
[static] Creates an empty texture of a certain size.
Texture
 Inherited
fromAtfData(data:ByteArray, scale:Number = 1, useMipMaps:Boolean = true, async:Function = null, repeat:Boolean = false):Texture
[static] Creates a texture from the compressed ATF format.
Texture
 Inherited
fromBitmap(bitmap:Bitmap, generateMipMaps:Boolean = true, optimizeForRenderToTexture:Boolean = false, scale:Number = 1, format:String = bgra, repeat:Boolean = false):Texture
[static] Creates a texture object from a bitmap.
Texture
 Inherited
fromBitmapData(data:BitmapData, generateMipMaps:Boolean = true, optimizeForRenderToTexture:Boolean = false, scale:Number = 1, format:String = bgra, repeat:Boolean = false):Texture
[static] Creates a texture object from bitmap data.
Texture
 Inherited
fromCamera(camera:Camera, scale:Number = 1, onComplete:Function = null):Texture
[static] Creates a video texture from a camera.
Texture
 Inherited
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
 Inherited
fromData(data:Object, options:TextureOptions = null):Texture
[static] Creates a texture object from any of the supported data types, using the specified options.
Texture
 Inherited
fromEmbeddedAsset(assetClass:Class, mipMapping:Boolean = true, optimizeForRenderToTexture:Boolean = false, scale:Number = 1, format:String = bgra, repeat:Boolean = false):Texture
[static] Creates a texture object from an embedded asset class.
Texture
 Inherited
fromNetStream(stream:NetStream, scale:Number = 1, onComplete:Function = null):Texture
[static] Creates a video texture from a NetStream.
Texture
 Inherited
fromTexture(texture:Texture, region:Rectangle = null, frame:Rectangle = null, rotated:Boolean = false):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
baseproperty
base:TextureBase  [read-only] [override]

The Stage3D texture object the texture is based on.


Implementation
    public function get base():TextureBase
formatproperty 
format:String  [read-only] [override]

The Context3DTextureFormat of the underlying texture data.


Implementation
    public function get format():String
heightproperty 
height:Number  [read-only] [override]

The height of the texture in points.


Implementation
    public function get height():Number
mipMappingproperty 
mipMapping:Boolean  [read-only] [override]

Indicates if the texture contains mip maps.


Implementation
    public function get mipMapping():Boolean
nativeHeightproperty 
nativeHeight:Number  [read-only] [override]

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


Implementation
    public function get nativeHeight():Number
nativeWidthproperty 
nativeWidth:Number  [read-only] [override]

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


Implementation
    public function get nativeWidth():Number
onRestoreproperty 
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
optimizedForRenderTextureproperty 
optimizedForRenderTexture:Boolean  [read-only]

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


Implementation
    public function get optimizedForRenderTexture():Boolean
premultipliedAlphaproperty 
premultipliedAlpha:Boolean  [read-only] [override]

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


Implementation
    public function get premultipliedAlpha():Boolean
repeatproperty 
repeat:Boolean  [read-only] [override]

Indicates if the texture should repeat like a wallpaper or stretch the outermost pixels. Note: this only works in textures with sidelengths that are powers of two and that are not loaded from a texture atlas (i.e. no subtextures).


Implementation
    public function get repeat():Boolean
rootproperty 
root:ConcreteTexture  [read-only] [override]

The concrete texture the texture is based on.


Implementation
    public function get root():ConcreteTexture
scaleproperty 
scale:Number  [read-only] [override]

The scale factor, which influences width and height properties.


Implementation
    public function get scale():Number
widthproperty 
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, repeat:Boolean = false)

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)
 
repeat:Boolean (default = false)
Method Detail
attachCamera()method
public function attachCamera(camera:Camera, onComplete:Function = null):void

Parameters

camera:Camera
 
onComplete:Function (default = null)

attachNetStream()method 
public function attachNetStream(netStream:NetStream, onComplete:Function = null):void

Parameters

netStream:NetStream
 
onComplete:Function (default = null)

attachVideo()method 
public function attachVideo(type:String, attachment:Object, onComplete:Function = null):void

Parameters

type:String
 
attachment:Object
 
onComplete:Function (default = null)

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