Packagestarling.textures
Classpublic class SubTexture
InheritanceSubTexture Inheritance Texture Inheritance Object
Subclasses RenderTexture

A SubTexture represents a section of another texture. This is achieved solely by manipulation of texture coordinates, making the class very efficient.

Note that it is OK to create subtextures of subtextures.



Public Properties
 PropertyDefined By
 InheritedasyncBitmapUploadEnabled : 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.
SubTexture
  format : String
[override] [read-only] The Context3DTextureFormat of the underlying texture data.
SubTexture
  frame : Rectangle
[override] [read-only] The texture frame if it has one (see class description), otherwise null.
SubTexture
 InheritedframeHeight : Number
[read-only] The width of the texture in points, taking into account the frame rectangle (if there is one).
Texture
 InheritedframeWidth : 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.
SubTexture
 InheritedmaxSize : 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.
SubTexture
  nativeHeight : Number
[override] [read-only] The height of the texture in pixels (without scale adjustment).
SubTexture
  nativeWidth : Number
[override] [read-only] The width of the texture in pixels (without scale adjustment).
SubTexture
  ownsParent : Boolean
[read-only] Indicates if the parent texture is disposed when this object is disposed.
SubTexture
  parent : Texture
[read-only] The texture which the SubTexture is based on.
SubTexture
  premultipliedAlpha : Boolean
[override] [read-only] Indicates if the alpha values are premultiplied into the RGB values.
SubTexture
  region : Rectangle
[read-only] The region of the parent texture that the SubTexture is showing (in points).
SubTexture
  root : ConcreteTexture
[override] [read-only] The concrete texture the texture is based on.
SubTexture
  rotated : Boolean
[read-only] If true, the SubTexture will show the parent region rotated by 90 degrees (CCW).
SubTexture
  scale : Number
[override] [read-only] The scale factor, which influences width and height properties.
SubTexture
  transformationMatrix : Matrix
[override] [read-only] The matrix that is used to transform the texture coordinates into the coordinate space of the parent texture, if there is one.
SubTexture
  transformationMatrixToRoot : Matrix
[override] [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.
SubTexture
  width : Number
[override] [read-only] The width of the texture in points.
SubTexture
Public Methods
 MethodDefined By
  
SubTexture(parent:Texture, region:Rectangle = null, ownsParent:Boolean = false, frame:Rectangle = null, rotated:Boolean = false, scaleModifier:Number = 1)
Creates a new SubTexture containing the specified region of a parent texture.
SubTexture
  
dispose():void
[override] Disposes the parent texture if this texture owns it.
SubTexture
 Inherited
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
 Inherited
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
 Inherited
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
 Inherited
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
 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 = 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
 Inherited
fromData(data:Object, options:TextureOptions = null):Texture
[static] Creates a texture from any of the supported data types, using the specified options.
Texture
 Inherited
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
 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, scaleModifier:Number = 1.0):Texture
[static] Creates a texture that contains a region (in pixels) of another texture.
Texture
 Inherited
fromTextureBase(base:TextureBase, width:int, height:int, options:TextureOptions = null):ConcreteTexture
[static] Creates a texture from a TextureBase object.
Texture
 Inherited
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
 Inherited
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
 Inherited
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
 Inherited
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
 Inherited
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
 Inherited
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
 Inherited
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
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
frameproperty 
frame:Rectangle  [read-only] [override]

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

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


Implementation
    public function get frame():Rectangle
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
ownsParentproperty 
ownsParent:Boolean  [read-only]

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


Implementation
    public function get ownsParent():Boolean
parentproperty 
parent:Texture  [read-only]

The texture which the SubTexture is based on.


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

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


Implementation
    public function get premultipliedAlpha():Boolean
regionproperty 
region:Rectangle  [read-only]

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

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


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

The concrete texture the texture is based on.


Implementation
    public function get root():ConcreteTexture
rotatedproperty 
rotated:Boolean  [read-only]

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


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

The scale factor, which influences width and height properties.


Implementation
    public function get scale():Number
transformationMatrixproperty 
transformationMatrix:Matrix  [read-only] [override]

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


Implementation
    public function get transformationMatrix():Matrix
transformationMatrixToRootproperty 
transformationMatrixToRoot:Matrix  [read-only] [override]

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.


Implementation
    public function get transformationMatrixToRoot():Matrix
widthproperty 
width:Number  [read-only] [override]

The width of the texture in points.


Implementation
    public function get width():Number
Constructor Detail
SubTexture()Constructor
public function SubTexture(parent:Texture, region:Rectangle = null, ownsParent:Boolean = false, frame:Rectangle = null, rotated:Boolean = false, scaleModifier:Number = 1)

Creates a new SubTexture containing the specified region of a parent texture.

Parameters
parent:Texture — The texture you want to create a SubTexture from.
 
region:Rectangle (default = null) — The region of the parent texture that the SubTexture will show (in points). If null, the complete area of the parent.
 
ownsParent:Boolean (default = false) — If true, the parent texture will be disposed automatically when the SubTexture is disposed.
 
frame:Rectangle (default = null) — If the texture was trimmed, the frame rectangle can be used to restore the trimmed area.
 
rotated:Boolean (default = false) — If true, the SubTexture will show the parent region rotated by 90 degrees (CCW).
 
scaleModifier:Number (default = 1) — The scale factor of the SubTexture will be calculated by multiplying the parent texture's scale factor with this value.
Method Detail
dispose()method
override public function dispose():void

Disposes the parent texture if this texture owns it.