forked from phaserjs/phaser
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLineStyleCanvas.js
More file actions
30 lines (26 loc) · 976 Bytes
/
Copy pathLineStyleCanvas.js
File metadata and controls
30 lines (26 loc) · 976 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/**
* @author Richard Davey <rich@photonstorm.com>
* @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
/**
* Sets the strokeStyle and lineWidth on the target context based on the given Shape.
*
* @method Phaser.GameObjects.Shape#LineStyleCanvas
* @since 3.13.0
* @private
*
* @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.
*/
var LineStyleCanvas = function (ctx, src)
{
var strokeColor = src.strokeColor;
var strokeAlpha = src.strokeAlpha;
var red = ((strokeColor & 0xFF0000) >>> 16);
var green = ((strokeColor & 0xFF00) >>> 8);
var blue = (strokeColor & 0xFF);
ctx.strokeStyle = 'rgba(' + red + ',' + green + ',' + blue + ',' + strokeAlpha + ')';
ctx.lineWidth = src.lineWidth;
};
module.exports = LineStyleCanvas;