Class: CanvasPrepare

PIXI~CanvasPrepare

准备管理器提供了将内容上传到GPU的功能。

不能像WebGL中那样直接对Canvas进行此操作,但是可以通过将纹理绘制到脱机画布上来实现效果。 该绘制调用将强制将纹理移至GPU上。

此类的实例默认情况下会自动创建,可以在renderer.plugins.prepare中找到

new CanvasPrepare (renderer)

Name Type Description
renderer PIXI.CanvasRenderer

对当前渲染器的引用

Extends

Members

The limiter to be used to control how quickly items are prepared.

Reference to the renderer.

uploadHookHelper object protected inherited overrides

The only real difference between CanvasPrepare and Prepare is what they pass to upload hooks. That different parameter is stored here.

Methods

Manually add an item to the uploading queue.

Name Type Description
item PIXI.DisplayObject | PIXI.Container | PIXI.BaseTexture | PIXI.Texture | PIXI.Graphics | PIXI.Text | *

Object to add to the queue

Returns:
Type Description
this Instance of plugin for chaining.

销毁插件,此后请勿使用。

registerFindHook (addHook)this inherited overrides

Adds hooks for finding items.

Name Type Description
addHook function

Function call that takes two parameters: item:*, queue:Array function must return true if it was able to add item to the queue.

Returns:
Type Description
this Instance of plugin for chaining.

registerUploadHook (uploadHook)this inherited overrides

Adds hooks for uploading items.

Name Type Description
uploadHook function

Function call that takes two parameters: prepare:CanvasPrepare, item:* and function must return true if it was able to handle upload of item.

Returns:
Type Description
this Instance of plugin for chaining.

upload (item, done) inherited overrides

Upload all the textures and graphics to the GPU.

Name Type Description
item function | PIXI.DisplayObject | PIXI.Container | PIXI.BaseTexture | PIXI.Texture | PIXI.Graphics | PIXI.Text

Either the container or display object to search for items to upload, the items to upload themselves, or the callback function, if items have been added using prepare.add.

done function optional

Optional callback when all queued uploads have completed