Package | starling.textures |
Class | public class SubTexture |
Inheritance | SubTexture Texture Object |
Subclasses | RenderTexture |
Note that it is OK to create subtextures of subtextures.
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. | 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 | ||
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. | SubTexture | ||
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. | 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 |
Method | Defined 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 | ||
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 |
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
frame | property |
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!
public function get frame():Rectangle
height | property |
height:Number
[read-only] [override] The height of the texture in points.
public function get height():Number
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
ownsParent | property |
ownsParent:Boolean
[read-only] Indicates if the parent texture is disposed when this object is disposed.
public function get ownsParent():Boolean
parent | property |
parent:Texture
[read-only] The texture which the SubTexture is based on.
public function get parent():Texture
premultipliedAlpha | property |
premultipliedAlpha:Boolean
[read-only] [override] Indicates if the alpha values are premultiplied into the RGB values.
public function get premultipliedAlpha():Boolean
region | property |
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!
public function get region():Rectangle
root | property |
root:ConcreteTexture
[read-only] [override] The concrete texture the texture is based on.
public function get root():ConcreteTexture
rotated | property |
rotated:Boolean
[read-only] If true, the SubTexture will show the parent region rotated by 90 degrees (CCW).
public function get rotated():Boolean
scale | property |
scale:Number
[read-only] [override] The scale factor, which influences width and height properties.
public function get scale():Number
transformationMatrix | property |
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.
public function get transformationMatrix():Matrix
transformationMatrixToRoot | property |
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.
public function get transformationMatrixToRoot():Matrix
width | property |
width:Number
[read-only] [override] The width of the texture in points.
public function get width():Number
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.
Parametersparent: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.
|
dispose | () | method |
override public function dispose():void
Disposes the parent texture if this texture owns it.