Packagelaya.webgl.resource
Classpublic class RenderTarget2D
InheritanceRenderTarget2D Inheritance Texture Inheritance EventDispatcher Inheritance Object
Implements laya.resource.IDispose



Public Properties
 PropertyDefined By
 Inherited_atlasID : int = -1
Texture
 Inheritedbitmap : *
图片或者canvas 。
Texture
 InheritedDEF_UV : Array
[static] 默认 UV 信息。
Texture
  depthStencilFormat : int
[read-only]
RenderTarget2D
  _destroy : Boolean = false
RenderTarget2D
 Inheritedheight : Number
实际高度。
Texture
 InheritedINV_UV : Array
[static] 反转 UV 信息。
Texture
 InheritedisLinearSampling : Boolean
获取当前纹理是否启用了线性采样。
Texture
 Inheritedloaded : Boolean
[read-only] 表示是否加载成功,只能表示初次载入成功(通常包含下载和载入),并不能完全表示资源是否可立即使用(资源管理机制释放影响等)。
Texture
  magFifter : int
[read-only]
RenderTarget2D
  minFifter : int
[read-only]
RenderTarget2D
  mipMap : Boolean
[read-only]
RenderTarget2D
 InheritedoffsetX : Number = 0
沿 X 轴偏移量。
Texture
 InheritedoffsetY : Number = 0
沿 Y 轴偏移量。
Texture
 Inheritedreleased : Boolean
[read-only] 表示资源是否已释放。
Texture
 Inheritedrepeat : Boolean
获取当前纹理是否启用了纹理平铺
Texture
  source : *
[override] [read-only] 返回RenderTarget的Texture
RenderTarget2D
 InheritedsourceHeight : Number = 0
原始高度(包括被裁剪的透明区域)。
Texture
 InheritedsourceWidth : Number = 0
原始宽度(包括被裁剪的透明区域)。
Texture
  surfaceFormat : int
[read-only]
RenderTarget2D
  surfaceType : int
[read-only]
RenderTarget2D
 Inheritedurl : String
图片地址
Texture
 Inheriteduv : Array
UV信息。
Texture
 Inheritedwidth : Number
实际宽度。
Texture
Public Methods
 MethodDefined By
  
RenderTarget2D(width:int, height:int, surfaceFormat:int, surfaceType:int, depthStencilFormat:int, mipMap:Boolean = false, repeat:Boolean = false, minFifter:int = -1, magFifter:int = -1)
RenderTarget2D
  
clear(r:Number = 0.0, g:Number = 0.0, b:Number = 0.0, a:Number = 1.0):void
RenderTarget2D
  
create(w:int, h:int, surfaceFormat:int, surfaceType:int, depthStencilFormat:int, mipMap:Boolean = false, repeat:Boolean = false, minFifter:int = -1, magFifter:int = -1):RenderTarget2D
[static]
RenderTarget2D
 Inherited
createFromTexture(texture:Texture, x:Number, y:Number, width:Number, height:Number):Texture
[static] 截取Texture的一部分区域,生成新的Texture,如果两个区域没有相交,则返回null。
Texture
  
destroy(foreDiposeTexture:Boolean = false):void
[override] 彻底清理资源,注意会强制解锁清理
RenderTarget2D
  
dispose():void
RenderTarget2D
  
end():void
RenderTarget2D
 Inherited
event(type:String, data:* = null):Boolean
派发事件。
EventDispatcher
  
getData(x:Number, y:Number, width:Number, height:Number):Uint8Array
RenderTarget2D
 Inherited
getPixels(x:Number, y:Number, width:Number, height:Number):Array
获取Texture上的某个区域的像素点
Texture
  
RenderTarget2D
  
getType():int
RenderTarget2D
 Inherited
hasListener(type:String):Boolean
检查 EventDispatcher 对象是否为特定事件类型注册了任何侦听器。
EventDispatcher
 Inherited
isMouseEvent(type:String):Boolean
检测指定事件类型是否是鼠标事件。
EventDispatcher
 Inherited
load(url:String):void
加载指定地址的图片。
Texture
 Inherited
moveUV(offsetX:Number, offsetY:Number, uv:Array):Array
[static] 平移 UV。
Texture
 Inherited
off(type:String, caller:*, listener:Function, onceOnly:Boolean = false):EventDispatcher
从 EventDispatcher 对象中删除侦听器。
EventDispatcher
 Inherited
offAll(type:String = null):EventDispatcher
从 EventDispatcher 对象中删除指定事件类型的所有侦听器。
EventDispatcher
 Inherited
on(type:String, caller:*, listener:Function, args:Array = null):EventDispatcher
使用 EventDispatcher 对象注册指定类型的事件侦听器对象,以使侦听器能够接收事件通知。
EventDispatcher
 Inherited
once(type:String, caller:*, listener:Function, args:Array = null):EventDispatcher
使用 EventDispatcher 对象注册指定类型的事件侦听器对象,以使侦听器能够接收事件通知,此侦听事件响应一次后自动移除。
EventDispatcher
  
recycle():void
RenderTarget2D
  
release():void
RenderTarget2D
 Inherited
setTo(bitmap:Bitmap = null, uv:Array = null):void
设置此对象的位图资源、UV数据信息。
Texture
  
size(w:Number, h:Number):void
RenderTarget2D
  
RenderTarget2D
Events
 Event Summary Defined By
 Inherited资源加载完成后调度。Texture
Public Constants
 ConstantDefined By
  TYPE2D : int = 1
[static]
RenderTarget2D
  TYPE3D : int = 2
[static]
RenderTarget2D
Property Detail
_destroyproperty
public var _destroy:Boolean = false

depthStencilFormatproperty 
depthStencilFormat:int  [read-only]


Implementation
    public function get depthStencilFormat():int
magFifterproperty 
magFifter:int  [read-only]


Implementation
    public function get magFifter():int
minFifterproperty 
minFifter:int  [read-only]


Implementation
    public function get minFifter():int
mipMapproperty 
mipMap:Boolean  [read-only]


Implementation
    public function get mipMap():Boolean
sourceproperty 
source:*  [read-only] [override]

返回RenderTarget的Texture


Implementation
    public function get source():*
surfaceFormatproperty 
surfaceFormat:int  [read-only]


Implementation
    public function get surfaceFormat():int
surfaceTypeproperty 
surfaceType:int  [read-only]


Implementation
    public function get surfaceType():int
Constructor Detail
RenderTarget2D()Constructor
public function RenderTarget2D(width:int, height:int, surfaceFormat:int, surfaceType:int, depthStencilFormat:int, mipMap:Boolean = false, repeat:Boolean = false, minFifter:int = -1, magFifter:int = -1)

Parameters
width:int
 
height:int
 
surfaceFormat:int (default = NaN)
 
surfaceType:int (default = NaN) — RGB ,R,RGBA......
 
depthStencilFormat:int (default = NaN) — WebGLContext.UNSIGNED_BYTE 数据类型
 
mipMap:Boolean (default = false) — WebGLContext.DEPTH_COMPONENT16 数据类型等
 
repeat:Boolean (default = false)
 
minFifter:int (default = -1)
 
magFifter:int (default = -1)
Method Detail
clear()method
public function clear(r:Number = 0.0, g:Number = 0.0, b:Number = 0.0, a:Number = 1.0):void

Parameters

r:Number (default = 0.0)
 
g:Number (default = 0.0)
 
b:Number (default = 0.0)
 
a:Number (default = 1.0)

create()method 
public static function create(w:int, h:int, surfaceFormat:int, surfaceType:int, depthStencilFormat:int, mipMap:Boolean = false, repeat:Boolean = false, minFifter:int = -1, magFifter:int = -1):RenderTarget2D

Parameters

w:int
 
h:int
 
surfaceFormat:int (default = NaN)
 
surfaceType:int (default = NaN)
 
depthStencilFormat:int (default = NaN)
 
mipMap:Boolean (default = false)
 
repeat:Boolean (default = false)
 
minFifter:int (default = -1)
 
magFifter:int (default = -1)

Returns
RenderTarget2D
destroy()method 
override public function destroy(foreDiposeTexture:Boolean = false):void

彻底清理资源,注意会强制解锁清理

Parameters

foreDiposeTexture:Boolean (default = false)

dispose()method 
public function dispose():void

end()method 
public function end():void

getData()method 
public function getData(x:Number, y:Number, width:Number, height:Number):Uint8Array

Parameters

x:Number
 
y:Number
 
width:Number
 
height:Number

Returns
Uint8Array
getTexture()method 
public function getTexture():Texture

Returns
Texture
getType()method 
public function getType():int

Returns
int
recycle()method 
public function recycle():void

release()method 
public function release():void

size()method 
public function size(w:Number, h:Number):void

Parameters

w:Number
 
h:Number

start()method 
public function start():RenderTarget2D

Returns
RenderTarget2D
Constant Detail
TYPE2DConstant
public static const TYPE2D:int = 1

TYPE3DConstant 
public static const TYPE3D:int = 2