mirror of
https://github.com/photonstorm/phaser
synced 2025-02-16 22:18:29 +00:00
Render Texture snapshot methods now work across WebGL and Canvas
This commit is contained in:
parent
2df5335991
commit
907d0dd4f2
1 changed files with 24 additions and 3 deletions
|
@ -1095,7 +1095,14 @@ var RenderTexture = new Class({
|
|||
*/
|
||||
snapshotArea: function (x, y, width, height, callback, type, encoderOptions)
|
||||
{
|
||||
this.renderer.snapshotFramebuffer(this.framebuffer, this.width, this.height, callback, false, x, y, width, height, type, encoderOptions);
|
||||
if (this.gl)
|
||||
{
|
||||
this.renderer.snapshotFramebuffer(this.framebuffer, this.width, this.height, callback, false, x, y, width, height, type, encoderOptions);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.renderer.snapshotCanvas(this.canvas, callback, false, x, y, width, height, type, encoderOptions);
|
||||
}
|
||||
|
||||
return this;
|
||||
},
|
||||
|
@ -1123,7 +1130,14 @@ var RenderTexture = new Class({
|
|||
*/
|
||||
snapshot: function (callback, type, encoderOptions)
|
||||
{
|
||||
this.renderer.snapshotFramebuffer(this.framebuffer, this.width, this.height, callback, false, 0, 0, this.width, this.height, type, encoderOptions);
|
||||
if (this.gl)
|
||||
{
|
||||
this.renderer.snapshotFramebuffer(this.framebuffer, this.width, this.height, callback, false, 0, 0, this.width, this.height, type, encoderOptions);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.renderer.snapshotCanvas(this.canvas, callback, false, 0, 0, this.width, this.height, type, encoderOptions);
|
||||
}
|
||||
|
||||
return this;
|
||||
},
|
||||
|
@ -1150,7 +1164,14 @@ var RenderTexture = new Class({
|
|||
*/
|
||||
snapshotPixel: function (x, y, callback)
|
||||
{
|
||||
this.renderer.snapshotFramebuffer(this.framebuffer, this.width, this.height, callback, true, x, y);
|
||||
if (this.gl)
|
||||
{
|
||||
this.renderer.snapshotFramebuffer(this.framebuffer, this.width, this.height, callback, true, x, y);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.renderer.snapshotCanvas(this.canvas, callback, true, x, y);
|
||||
}
|
||||
|
||||
return this;
|
||||
},
|
||||
|
|
Loading…
Add table
Reference in a new issue