Package | starling.textures |
Class | public class ConcreteTexture |
Inheritance | ConcreteTexture Texture Object |
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 also
Property | Defined By | ||
---|---|---|---|
asyncBitmapUploadEnabled : Boolean [static] Indicates if it should be attempted to upload bitmaps asynchronously when the async parameter
is supplied to supported methods. | Texture | ||
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 if it has one (see class description), otherwise null. | Texture | ||
frameHeight : Number [read-only] The width of the texture in points, taking into account the frame rectangle
(if there is one). | Texture | ||
frameWidth : Number [read-only] The height of the texture in points, taking into account the frame rectangle
(if there is one). | Texture | ||
height : Number [override] [read-only] The height of the texture in points. | ConcreteTexture | ||
isPotTexture : Boolean [read-only] Indicates if the base texture is a standard power-of-two dimensioned texture of type
flash.display3D.textures.Texture. | ConcreteTexture | ||
maxSize : int [static] [read-only] Returns the maximum size constraint (for both width and height) for uncompressed
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 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 | ||
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 | ||
transformationMatrix : Matrix [read-only] The matrix that is used to transform the texture coordinates into the coordinate
space of the parent texture, if there is one. | Texture | ||
transformationMatrixToRoot : Matrix [read-only] 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. | Texture | ||
width : Number [override] [read-only] The width of the texture in points. | ConcreteTexture |
Method | Defined By | ||
---|---|---|---|
attachCamera(camera:Camera, onComplete:Function = null):void Specifies a video stream from a camera to be rendered within the texture. | ConcreteTexture | ||
attachNetStream(netStream:NetStream, onComplete:Function = null):void Specifies a video stream to be rendered within the texture. | 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 | ||
empty(width:Number, height:Number, premultipliedAlpha:Boolean = true, mipMapping:Boolean = false, optimizeForRenderToTexture:Boolean = false, scale:Number = -1, format:String = bgra, forcePotTexture:Boolean = false):Texture [static] Creates an empty texture of a certain size. | Texture | ||
fromAtfData(data:ByteArray, scale:Number = 1, useMipMaps:Boolean = true, async:Function = null, premultipliedAlpha:Boolean = false):Texture [static] Creates a texture from ATF data (Adobe Texture Compression). | Texture | ||
fromBitmap(bitmap:Bitmap, generateMipMaps:Boolean = false, optimizeForRenderToTexture:Boolean = false, scale:Number = 1, format:String = bgra, forcePotTexture:Boolean = false, async:Function = null):Texture [static] Creates a texture object from a bitmap. | Texture | ||
fromBitmapData(data:BitmapData, generateMipMaps:Boolean = false, optimizeForRenderToTexture:Boolean = false, scale:Number = 1, format:String = bgra, forcePotTexture:Boolean = false, async:Function = null):Texture [static] Creates a texture object from bitmap data. | Texture | ||
fromCamera(camera:Camera, scale:Number = 1, onComplete:Function = null):Texture [static] Creates a video texture from a camera. | Texture | ||
fromColor(width:Number, height:Number, color:uint = 0xffffff, alpha:Number = 1.0, optimizeForRenderToTexture:Boolean = false, scale:Number = -1, format:String = bgra, forcePotTexture:Boolean = false):Texture [static] Creates a texture with a certain size and color. | Texture | ||
[static] Creates a texture from any of the supported data types, using the specified options. | Texture | ||
fromEmbeddedAsset(assetClass:Class, mipMapping:Boolean = false, optimizeForRenderToTexture:Boolean = false, scale:Number = 1, format:String = bgra, forcePotTexture:Boolean = false):Texture [static] Creates a texture object from an embedded asset class. | Texture | ||
fromNetStream(stream:NetStream, scale:Number = 1, onComplete:Function = null):Texture [static] Creates a video texture from a NetStream. | Texture | ||
fromTexture(texture:Texture, region:Rectangle = null, frame:Rectangle = null, rotated:Boolean = false, scaleModifier:Number = 1.0):Texture [static] Creates a texture that contains a region (in pixels) of another texture. | Texture | ||
fromTextureBase(base:TextureBase, width:int, height:int, options:TextureOptions = null):ConcreteTexture [static] Creates a texture from a TextureBase object. | Texture | ||
getMaxSize(textureFormat:String = bgra):int [static] Returns the maximum size constraint (for both width and height) for normal and
RectangleTextures with the given format in the current Context3D profile. | Texture | ||
getTexCoords(vertexData:VertexData, vertexID:int, attrName:String = texCoords, out:Point = null):Point Reads a pair of texture coordinates from the given VertexData instance and transforms
them into the current texture's coordinate system. | Texture | ||
globalToLocal(u:Number, v:Number, out:Point = null):Point Transforms the given texture coordinates from the root texture's coordinate system
to the local coordinate system. | Texture | ||
localToGlobal(u:Number, v:Number, out:Point = null):Point Transforms the given texture coordinates from the local coordinate system
into the root texture's coordinate system. | Texture | ||
setTexCoords(vertexData:VertexData, vertexID:int, attrName:String, u:Number, v:Number):void Writes the given texture coordinates to a VertexData instance after transforming
them into the root texture's coordinate system. | Texture | ||
setupTextureCoordinates(vertexData:VertexData, vertexID:int = 0, attrName:String = texCoords):void Sets up a VertexData instance with the correct texture coordinates for
4 vertices so that the texture is mapped to the complete quad. | Texture | ||
setupVertexPositions(vertexData:VertexData, vertexID:int = 0, attrName:String = position, bounds:Rectangle = null):void Sets up a VertexData instance with the correct positions for 4 vertices so that
the texture can be mapped onto it unscaled. | Texture | ||
uploadAtfData(data:ByteArray, offset:int = 0, async:* = null):void Uploads ATF data from a ByteArray to the texture. | ConcreteTexture | ||
uploadBitmap(bitmap:Bitmap, async:* = null):void Uploads a bitmap to the texture. | ConcreteTexture | ||
uploadBitmapData(data:BitmapData, async:* = null):void Uploads bitmap data to the texture. | ConcreteTexture |
Method | Defined By | ||
---|---|---|---|
createBase():TextureBase Recreates the underlying Stage3D texture object with the same dimensions and attributes
as the one that was passed to the constructor. | ConcreteTexture | ||
setDataUploaded():void Notifies the instance that the base texture may now be used for rendering. | ConcreteTexture |
base | property |
base:TextureBase
[read-only] [override] The Stage3D texture object the texture is based on.
public function get base():TextureBase
format | property |
format:String
[read-only] [override] The Context3DTextureFormat
of the underlying texture data.
public function get format():String
height | property |
height:Number
[read-only] [override] The height of the texture in points.
public function get height():Number
isPotTexture | property |
isPotTexture:Boolean
[read-only] Indicates if the base texture is a standard power-of-two dimensioned texture of type
flash.display3D.textures.Texture
.
public function get isPotTexture():Boolean
mipMapping | property |
mipMapping:Boolean
[read-only] [override] Indicates if the texture contains mip maps.
public function get mipMapping():Boolean
nativeHeight | property |
nativeHeight:Number
[read-only] [override] The height of the texture in pixels (without scale adjustment).
public function get nativeHeight():Number
nativeWidth | property |
nativeWidth:Number
[read-only] [override] The width of the texture in pixels (without scale adjustment).
public function get nativeWidth():Number
onRestore | property |
onRestore:Function
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()); };
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.
public function get optimizedForRenderTexture():Boolean
premultipliedAlpha | property |
premultipliedAlpha:Boolean
[read-only] [override] Indicates if the alpha values are premultiplied into the RGB values.
public function get premultipliedAlpha():Boolean
root | property |
root:ConcreteTexture
[read-only] [override] The concrete texture the texture is based on.
public function get root():ConcreteTexture
scale | property |
scale:Number
[read-only] [override] The scale factor, which influences width and height properties.
public function get scale():Number
width | property |
width:Number
[read-only] [override] The width of the texture in points.
public function get width():Number
attachCamera | () | method |
public function attachCamera(camera:Camera, onComplete:Function = null):void
Specifies a video stream from a camera to be rendered within the texture.
Parameters
camera:Camera | |
onComplete:Function (default = null )
|
attachNetStream | () | method |
public function attachNetStream(netStream:NetStream, onComplete:Function = null):void
Specifies a video stream to be rendered within the texture.
Parameters
netStream:NetStream | |
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.
Parameters
color:uint (default = 0x0 )
| |
alpha:Number (default = 0.0 )
|
createBase | () | method |
protected function createBase():TextureBase
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.
ReturnsTextureBase |
dispose | () | method |
override public function dispose():void
Disposes the TextureBase object.
recreateBase | () | method |
starling_internal function recreateBase():void
Recreates the underlying Stage3D texture. May be used to manually restore a texture. Beware that new data needs to be uploaded to the texture before it can be used.
setDataUploaded | () | method |
protected function setDataUploaded():void
Notifies the instance that the base texture may now be used for rendering.
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, async:* = null):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 or true
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:Texture, error:ErrorEvent):void;
The second parameter is optional and typically null
.
Parameters
bitmap:Bitmap | |
async:* (default = null )
|
uploadBitmapData | () | method |
public function uploadBitmapData(data:BitmapData, async:* = null):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 or true
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:Texture, error:ErrorEvent):void;
The second parameter is optional and typically null
.
Parameters
data:BitmapData | |
async:* (default = null )
|