StarlingGraphics / Starling-Extension-Graphics

flash.display.Graphics style extension for the Starling Flash GPU rendering framework
https://github.com/StarlingGraphics/Starling-Extension-Graphics/wiki
MIT License
285 stars 88 forks source link

#lineStyle does not produce expected colour #33

Closed philostler closed 11 years ago

philostler commented 11 years ago

I'm using the following snippet to create squares with rounded corners and a stroke of a given colour...

var shape:Shape = new Shape();
shape.graphics.lineStyle(2, 0x0084b5);
shape.graphics.beginFill(0xffffff);
shape.graphics.drawRoundRectComplex(0, 0, width, height, radiuses[0], radiuses[1], radiuses[2], radiuses[3]);
shape.graphics.endFill();

However, the resulting stroke is not the colour I expected. Instead of 0x0084b5 it is 0x134680.

If I create the stroke from a texture I get the correct colour...

var lineTexture:Texture = Texture.fromColor(1, 1, 0xff0084b5);
shape.graphics.lineTexture(2, lineTexture);

lineStyle

jonathanrpace commented 11 years ago

Well spotted! It turns out I was applying the color to both the material and the vertex color - which get multiple together in the fragment shader. Hence it the resulting colour would always appear darker.

I've just checked in a fix https://github.com/unwrong/Starling-Extension-Graphics/commit/434e09b3edc3f8c7cbda3312f5485ae9f896c3fc

Thanks for reporting this.

philostler commented 11 years ago

:+1: excellent... thanks for the fix!