mirror of
https://github.com/photonstorm/phaser
synced 2024-09-21 15:01:57 +00:00
commit
3cbda52ca5
1 changed files with 7 additions and 7 deletions
|
@ -22,31 +22,31 @@ Phaser.Color = {
|
||||||
* @param {number} g - The green color component, in the range 0 - 255.
|
* @param {number} g - The green color component, in the range 0 - 255.
|
||||||
* @param {number} b - The blue color component, in the range 0 - 255.
|
* @param {number} b - The blue color component, in the range 0 - 255.
|
||||||
* @param {number} a - The alpha color component, in the range 0 - 255.
|
* @param {number} a - The alpha color component, in the range 0 - 255.
|
||||||
* @return {number} The packed color
|
* @return {number} The packed color as uint32
|
||||||
*/
|
*/
|
||||||
packPixel: function (r, g, b, a) {
|
packPixel: function (r, g, b, a) {
|
||||||
|
|
||||||
if (Phaser.Device.LITTLE_ENDIAN)
|
if (Phaser.Device.LITTLE_ENDIAN)
|
||||||
{
|
{
|
||||||
return (a << 24) | (b << 16) | (g << 8) | r;
|
return ( (a << 24) | (b << 16) | (g << 8) | r ) >>> 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return (r << 24) | (g << 16) | (b << 8) | a;
|
return ( (r << 24) | (g << 16) | (b << 8) | a ) >>> 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unpacks the r, g, b, a components into the specified color object, or a new
|
* Unpacks the r, g, b, a components into the specified color object, or a new
|
||||||
* object, for use with Int32Array. If little endian, then ABGR order is used when
|
* object, for use with Int32Array. If little endian, then ABGR order is used when
|
||||||
* unpacking, otherwise, RGBA order is used. The resulting color object has the
|
* unpacking, otherwise, RGBA order is used. The resulting color object has the
|
||||||
* `r, g, b, a` properties which are unrelated to endianness.
|
* `r, g, b, a` properties which are unrelated to endianness.
|
||||||
*
|
*
|
||||||
* Note that the integer is assumed to be packed in the correct endianness. On little-endian
|
* Note that the integer is assumed to be packed in the correct endianness. On little-endian
|
||||||
* the format is 0xAABBGGRR and on big-endian the format is 0xRRGGBBAA. If you want a
|
* the format is 0xAABBGGRR and on big-endian the format is 0xRRGGBBAA. If you want a
|
||||||
* endian-independent method, use fromRGBA(rgba) and toRGBA(r, g, b, a).
|
* endian-independent method, use fromRGBA(rgba) and toRGBA(r, g, b, a).
|
||||||
*
|
*
|
||||||
* @author Matt DesLauriers (@mattdesl)
|
* @author Matt DesLauriers (@mattdesl)
|
||||||
* @method Phaser.Color.unpackPixel
|
* @method Phaser.Color.unpackPixel
|
||||||
* @static
|
* @static
|
||||||
|
@ -76,7 +76,7 @@ Phaser.Color = {
|
||||||
out.b = ((rgba & 0x0000ff00) >>> 8);
|
out.b = ((rgba & 0x0000ff00) >>> 8);
|
||||||
out.a = ((rgba & 0x000000ff));
|
out.a = ((rgba & 0x000000ff));
|
||||||
}
|
}
|
||||||
|
|
||||||
out.color = rgba;
|
out.color = rgba;
|
||||||
out.rgba = 'rgba(' + out.r + ',' + out.g + ',' + out.b + ',' + (out.a / 255) + ')';
|
out.rgba = 'rgba(' + out.r + ',' + out.g + ',' + out.b + ',' + (out.a / 255) + ')';
|
||||||
|
|
||||||
|
@ -673,7 +673,7 @@ Phaser.Color = {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interpolates the two given colours based on the supplied step and currentStep properties.
|
* Interpolates the two given colours based on the supplied step and currentStep properties.
|
||||||
*
|
*
|
||||||
* @method Phaser.Color.interpolateColorWithRGB
|
* @method Phaser.Color.interpolateColorWithRGB
|
||||||
* @static
|
* @static
|
||||||
* @param {number} color - The first color value.
|
* @param {number} color - The first color value.
|
||||||
|
|
Loading…
Reference in a new issue