mirror of
https://github.com/photonstorm/phaser
synced 2024-11-23 05:03:37 +00:00
Allow for color and alpha overrides
This commit is contained in:
parent
4f36fe15fa
commit
eb73b51cd8
2 changed files with 9 additions and 5 deletions
|
@ -13,11 +13,13 @@
|
|||
*
|
||||
* @param {CanvasRenderingContext2D} ctx - The context to set the fill style on.
|
||||
* @param {Phaser.GameObjects.Shape} src - The Game Object to set the fill style from.
|
||||
* @param {number} [altColor] - An alternative color to render with.
|
||||
* @param {number} [altAlpha] - An alternative alpha to render with.
|
||||
*/
|
||||
var FillStyleCanvas = function (ctx, src, altColor)
|
||||
var FillStyleCanvas = function (ctx, src, altColor, altAlpha)
|
||||
{
|
||||
var fillColor = (altColor) ? altColor : src.fillColor;
|
||||
var fillAlpha = src.fillAlpha;
|
||||
var fillAlpha = (altAlpha) ? altAlpha : src.fillAlpha;
|
||||
|
||||
var red = ((fillColor & 0xFF0000) >>> 16);
|
||||
var green = ((fillColor & 0xFF00) >>> 8);
|
||||
|
|
|
@ -13,11 +13,13 @@
|
|||
*
|
||||
* @param {CanvasRenderingContext2D} ctx - The context to set the stroke style on.
|
||||
* @param {Phaser.GameObjects.Shape} src - The Game Object to set the stroke style from.
|
||||
* @param {number} [altColor] - An alternative color to render with.
|
||||
* @param {number} [altAlpha] - An alternative alpha to render with.
|
||||
*/
|
||||
var LineStyleCanvas = function (ctx, src)
|
||||
var LineStyleCanvas = function (ctx, src, altColor, altAlpha)
|
||||
{
|
||||
var strokeColor = src.strokeColor;
|
||||
var strokeAlpha = src.strokeAlpha;
|
||||
var strokeColor = (altColor) ? altColor : src.strokeColor;
|
||||
var strokeAlpha = (altAlpha) ? altAlpha : src.strokeAlpha;
|
||||
|
||||
var red = ((strokeColor & 0xFF0000) >>> 16);
|
||||
var green = ((strokeColor & 0xFF00) >>> 8);
|
||||
|
|
Loading…
Reference in a new issue