Allow for color and alpha overrides

This commit is contained in:
Richard Davey 2019-06-11 16:44:55 +01:00
parent 4f36fe15fa
commit eb73b51cd8
2 changed files with 9 additions and 5 deletions

View file

@ -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);

View file

@ -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);