Package | laya.webgl.resource |
Class | public class RenderTarget2D |
Inheritance | RenderTarget2D Texture EventDispatcher Object |
Implements | laya.resource.IDispose |
Property | Defined By | ||
---|---|---|---|
_atlasID : int = -1 | Texture | ||
bitmap : * 图片或者canvas 。 | Texture | ||
DEF_UV : Array [static] 默认 UV 信息。 | Texture | ||
depthStencilFormat : int [read-only] | RenderTarget2D | ||
_destroy : Boolean = false | RenderTarget2D | ||
height : Number 实际高度。 | Texture | ||
INV_UV : Array [static] 反转 UV 信息。 | Texture | ||
isLinearSampling : Boolean
获取当前纹理是否启用了线性采样。
| Texture | ||
loaded : Boolean [read-only]
表示是否加载成功,只能表示初次载入成功(通常包含下载和载入),并不能完全表示资源是否可立即使用(资源管理机制释放影响等)。
| Texture | ||
magFifter : int [read-only] | RenderTarget2D | ||
minFifter : int [read-only] | RenderTarget2D | ||
mipMap : Boolean [read-only] | RenderTarget2D | ||
offsetX : Number = 0 沿 X 轴偏移量。 | Texture | ||
offsetY : Number = 0 沿 Y 轴偏移量。 | Texture | ||
released : Boolean [read-only]
表示资源是否已释放。
| Texture | ||
repeat : Boolean
获取当前纹理是否启用了纹理平铺
| Texture | ||
source : * [override] [read-only] 返回RenderTarget的Texture | RenderTarget2D | ||
sourceHeight : Number = 0 原始高度(包括被裁剪的透明区域)。 | Texture | ||
sourceWidth : Number = 0 原始宽度(包括被裁剪的透明区域)。 | Texture | ||
surfaceFormat : int [read-only] | RenderTarget2D | ||
surfaceType : int [read-only] | RenderTarget2D | ||
url : String 图片地址 | Texture | ||
uv : Array UV信息。 | Texture | ||
width : Number 实际宽度。 | Texture |
Method | Defined 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 | ||
[static]
截取Texture的一部分区域,生成新的Texture,如果两个区域没有相交,则返回null。
| Texture | ||
destroy(foreDiposeTexture:Boolean = false):void [override] 彻底清理资源,注意会强制解锁清理 | RenderTarget2D | ||
dispose():void | RenderTarget2D | ||
end():void | RenderTarget2D | ||
event(type:String, data:* = null):Boolean
派发事件。
| EventDispatcher | ||
getData(x:Number, y:Number, width:Number, height:Number):Uint8Array | RenderTarget2D | ||
getPixels(x:Number, y:Number, width:Number, height:Number):Array
获取Texture上的某个区域的像素点
| Texture | ||
RenderTarget2D | |||
getType():int | RenderTarget2D | ||
hasListener(type:String):Boolean
检查 EventDispatcher 对象是否为特定事件类型注册了任何侦听器。
| EventDispatcher | ||
isMouseEvent(type:String):Boolean
检测指定事件类型是否是鼠标事件。
| EventDispatcher | ||
load(url:String):void
加载指定地址的图片。
| Texture | ||
moveUV(offsetX:Number, offsetY:Number, uv:Array):Array [static]
平移 UV。
| Texture | ||
off(type:String, caller:*, listener:Function, onceOnly:Boolean = false):EventDispatcher
从 EventDispatcher 对象中删除侦听器。
| EventDispatcher | ||
offAll(type:String = null):EventDispatcher
从 EventDispatcher 对象中删除指定事件类型的所有侦听器。
| EventDispatcher | ||
on(type:String, caller:*, listener:Function, args:Array = null):EventDispatcher
使用 EventDispatcher 对象注册指定类型的事件侦听器对象,以使侦听器能够接收事件通知。
| EventDispatcher | ||
once(type:String, caller:*, listener:Function, args:Array = null):EventDispatcher
使用 EventDispatcher 对象注册指定类型的事件侦听器对象,以使侦听器能够接收事件通知,此侦听事件响应一次后自动移除。
| EventDispatcher | ||
recycle():void | RenderTarget2D | ||
release():void | RenderTarget2D | ||
setTo(bitmap:Bitmap = null, uv:Array = null):void
设置此对象的位图资源、UV数据信息。
| Texture | ||
size(w:Number, h:Number):void | RenderTarget2D | ||
RenderTarget2D |
Constant | Defined By | ||
---|---|---|---|
TYPE2D : int = 1 [static] | RenderTarget2D | ||
TYPE3D : int = 2 [static] | RenderTarget2D |
_destroy | property |
public var _destroy:Boolean = false
depthStencilFormat | property |
depthStencilFormat:int
[read-only] public function get depthStencilFormat():int
magFifter | property |
magFifter:int
[read-only] public function get magFifter():int
minFifter | property |
minFifter:int
[read-only] public function get minFifter():int
mipMap | property |
mipMap:Boolean
[read-only] public function get mipMap():Boolean
source | property |
source:*
[read-only] [override] 返回RenderTarget的Texture
public function get source():*
surfaceFormat | property |
surfaceFormat:int
[read-only] public function get surfaceFormat():int
surfaceType | property |
surfaceType:int
[read-only] public function get surfaceType():int
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 )
|
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 )
|
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 |
Uint8Array |
getTexture | () | method |
getType | () | method |
public function getType():int
Returnsint |
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 |
TYPE2D | Constant |
public static const TYPE2D:int = 1
TYPE3D | Constant |
public static const TYPE3D:int = 2