diff --git a/README.md b/README.md index ffdb4c8..b3e4079 100644 --- a/README.md +++ b/README.md @@ -75,6 +75,7 @@ ### Resources ### +- Learning Pixi - a brilliant guide [here](https://github.com/kittykatattack/learningPixi) - API Documentation is [here](http://pixijs.github.io/docs). - Feature Examples are [here](https://pixijs.github.io/examples). - The Pixi.js Forum is [here](http://www.html5gamedevs.com/forum/15-pixijs). diff --git a/README.md b/README.md index ffdb4c8..b3e4079 100644 --- a/README.md +++ b/README.md @@ -75,6 +75,7 @@ ### Resources ### +- Learning Pixi - a brilliant guide [here](https://github.com/kittykatattack/learningPixi) - API Documentation is [here](http://pixijs.github.io/docs). - Feature Examples are [here](https://pixijs.github.io/examples). - The Pixi.js Forum is [here](http://www.html5gamedevs.com/forum/15-pixijs). diff --git a/src/core/graphics/Graphics.js b/src/core/graphics/Graphics.js index 8a20733..313a716 100644 --- a/src/core/graphics/Graphics.js +++ b/src/core/graphics/Graphics.js @@ -5,12 +5,15 @@ Sprite = require('../sprites/Sprite'), math = require('../math'), CONST = require('../const'), + utils = require('../utils'), Bounds = require('../display/Bounds'), bezierCurveTo = require('./utils/bezierCurveTo'), CanvasRenderer = require('../renderers/canvas/CanvasRenderer'), canvasRenderer, tempMatrix = new math.Matrix(), - tempPoint = new math.Point(); + tempPoint = new math.Point(), + tempColor1 = new Float32Array(4), + tempColor2 = new Float32Array(4); /** * The Graphics class contains methods used to draw primitive shapes such as lines, circles and @@ -736,7 +739,18 @@ this._spriteRect = new Sprite(Graphics._SPRITE_TEXTURE); } - this._spriteRect.tint = this.graphicsData[0].fillColor; + if (this.tint === 0xffffff) { + this._spriteRect.tint = this.graphicsData[0].fillColor; + } else { + var t1 = tempColor1; + var t2 = tempColor2; + utils.hex2rgb(this.graphicsData[0].fillColor, t1); + utils.hex2rgb(this.tint, t2); + t1[0] *= t2[0]; + t1[1] *= t2[1]; + t1[2] *= t2[2]; + this._spriteRect.tint = utils.rgb2hex(t1); + } this._spriteRect.alpha = this.graphicsData[0].fillAlpha; this._spriteRect.worldAlpha = this.worldAlpha * this._spriteRect.alpha;