diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index 621d5b7..ad83954 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -865,6 +865,9 @@ this.shader = new Shader(s.program, uniforms); } + // apply the tint.. + hex2rgb(this.tint, this.shader.uniforms.tint); + this.shader.uniforms.translationMatrix = this.transform.worldTransform;// .toArray(true); // the first draw call, we can set the uniforms of the shader directly here. diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index 621d5b7..ad83954 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -865,6 +865,9 @@ this.shader = new Shader(s.program, uniforms); } + // apply the tint.. + hex2rgb(this.tint, this.shader.uniforms.tint); + this.shader.uniforms.translationMatrix = this.transform.worldTransform;// .toArray(true); // the first draw call, we can set the uniforms of the shader directly here. diff --git a/packages/graphics/src/GraphicsGeometry.js b/packages/graphics/src/GraphicsGeometry.js index 9ced2c6..3400f47 100644 --- a/packages/graphics/src/GraphicsGeometry.js +++ b/packages/graphics/src/GraphicsGeometry.js @@ -7,6 +7,7 @@ import buildPoly from './utils/buildPoly'; import buildRectangle from './utils/buildRectangle'; import buildRoundedRectangle from './utils/buildRoundedRectangle'; +import { premultiplyTint } from '@pixi/utils'; const BATCH_POOL = []; const DRAW_CALL_POOL = []; @@ -826,14 +827,13 @@ addColors(colors, color, alpha, size) { // TODO use the premultiply bits Ivan added - const tRGB = ((color >> 16) * alpha) - + ((color & 0xff00) * alpha) - + (((color & 0xff) << 16) * alpha) - + (alpha * 255 << 24); + const rgb = (color >> 16) + (color & 0xff00) + ((color & 0xff) << 16); + + const rgba = premultiplyTint(rgb, 0.5); while (size-- > 0) { - colors.push(tRGB); + colors.push(rgba); } }