weimingtom / nekonme

Automatically exported from code.google.com/p/nekonme
0 stars 0 forks source link

Issue when drawing stuff with alpha outside of [0;1] range with HTML5 target #248

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Use Graphics.beginFill() with an alpha value < 0 or > 1.

What is the expected output? What do you see instead?
 - On other targets, the alpha value is being clamped to 0 or 1.
 - On HTML5 target, the shape is drawn black (no fill style is being attributed to the shape).

Suggested fix
 - See attached patch which clamps the alpha value to the [0;1] range.
 - Another solution would be to remove the range condition from jeash/graphics/Graphics.hx and let the browser deal with it, but it doesn't seems the proper way to do it, because the HTML5 Canvas specifications from the W3C regarding global context alpha value on Compositing says that in such cases, the alpha value shouldn't be set at all (and keep its previous value), which is not consistent with what NME does in other targets. See http://dev.w3.org/html5/2dcontext/#dom-context-2d-globalalpha.

Original issue reported on code.google.com by tyn...@gmail.com on 8 Jul 2012 at 8:31

GoogleCodeExporter commented 8 years ago
Attached patch:
 - Removes the range condition on alpha value, and clamp it in [0;1] range.

Original comment by tyn...@gmail.com on 8 Jul 2012 at 8:32

Attachments:

GoogleCodeExporter commented 8 years ago
Added! Thank you

Original comment by joshuagr...@gmail.com on 10 Jul 2012 at 12:18