mirror of
https://github.com/photonstorm/phaser
synced 2024-11-25 22:20:44 +00:00
getPixels defaults to 0x0
This commit is contained in:
parent
de195fe820
commit
9e9d264973
2 changed files with 7 additions and 3 deletions
|
@ -103,6 +103,7 @@
|
||||||
* The `WebAudioSoundManager` will now remove the document touch handlers even if the Promise fails, preventing it from throwing a rejection handler error.
|
* The `WebAudioSoundManager` will now remove the document touch handlers even if the Promise fails, preventing it from throwing a rejection handler error.
|
||||||
* `GameObjectFactory.remove` is a new static function that will remove a custom Game Object factory type.
|
* `GameObjectFactory.remove` is a new static function that will remove a custom Game Object factory type.
|
||||||
* `GameObjectCreator.remove` is a new static function that will remove a custom Game Object creator type.
|
* `GameObjectCreator.remove` is a new static function that will remove a custom Game Object creator type.
|
||||||
|
* `CanvasTexture.getPixels` now defaults to 0x0 by width x height as the default area, allowing you to call the method with no arguments to get all the pixels for the canvas.
|
||||||
|
|
||||||
### Bug Fixes
|
### Bug Fixes
|
||||||
|
|
||||||
|
|
|
@ -417,15 +417,18 @@ var CanvasTexture = new Class({
|
||||||
* @method Phaser.Textures.CanvasTexture#getPixels
|
* @method Phaser.Textures.CanvasTexture#getPixels
|
||||||
* @since 3.16.0
|
* @since 3.16.0
|
||||||
*
|
*
|
||||||
* @param {integer} x - The x coordinate of the top-left of the region. Must lay within the dimensions of this CanvasTexture and be an integer.
|
* @param {integer} [x=0] - The x coordinate of the top-left of the region. Must lay within the dimensions of this CanvasTexture and be an integer.
|
||||||
* @param {integer} y - The y coordinate of the top-left of the region. Must lay within the dimensions of this CanvasTexture and be an integer.
|
* @param {integer} [y=0] - The y coordinate of the top-left of the region. Must lay within the dimensions of this CanvasTexture and be an integer.
|
||||||
* @param {integer} width - The width of the region to get. Must be an integer.
|
* @param {integer} [width] - The width of the region to get. Must be an integer. Defaults to the canvas width if not given.
|
||||||
* @param {integer} [height] - The height of the region to get. Must be an integer. If not given will be set to the `width`.
|
* @param {integer} [height] - The height of the region to get. Must be an integer. If not given will be set to the `width`.
|
||||||
*
|
*
|
||||||
* @return {Phaser.Types.Textures.PixelConfig[]} An array of Pixel objects.
|
* @return {Phaser.Types.Textures.PixelConfig[]} An array of Pixel objects.
|
||||||
*/
|
*/
|
||||||
getPixels: function (x, y, width, height)
|
getPixels: function (x, y, width, height)
|
||||||
{
|
{
|
||||||
|
if (x === undefined) { x = 0; }
|
||||||
|
if (y === undefined) { y = 0; }
|
||||||
|
if (width === undefined) { width = this.width; }
|
||||||
if (height === undefined) { height = width; }
|
if (height === undefined) { height = width; }
|
||||||
|
|
||||||
x = Math.abs(Math.round(x));
|
x = Math.abs(Math.round(x));
|
||||||
|
|
Loading…
Reference in a new issue