You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flex.apache.org by "Justin Mclean (JIRA)" <ji...@apache.org> on 2017/02/19 21:59:44 UTC
[jira] [Created] (FLEX-35272) [FlexJS] RGBA colour support needs
fixing
Justin Mclean created FLEX-35272:
------------------------------------
Summary: [FlexJS] RGBA colour support needs fixing
Key: FLEX-35272
URL: https://issues.apache.org/jira/browse/FLEX-35272
Project: Apache Flex
Issue Type: Bug
Components: FlexJS
Affects Versions: Apache FlexJS 0.8.0
Reporter: Justin Mclean
In SimpleCSSVAluesImpl parseStyle method this code:
{code}
if (value.charAt(0) == "#") {
obj[pieces[0]] = org.apache.flex.utils.CSSUtils.toColor(value);
}
{code}
Should be something like:
{code}
if (value.charAt(0) == "#" || value.indexOf("rgb") == 0) {
obj[pieces[0]] = org.apache.flex.utils.CSSUtils.toColor(value);
}
{code}
And in CSSUtils the parsing of rgba values is broken - this code;
{code}
} else if ((c = stringValue.indexOf("rgba(")) != -1) {
c2 = stringValue.indexOf(")");
stringValue = stringValue.substring(c + 4, c2);
var /** @type {Array} */ parts4 = stringValue.split(",");(org.apache.flex.utils.Language.uint(parts4[3]) << 24 + org.apache.flex.utils.Language.uint(parts3[0]) << 16 + org.apache.flex.utils.Language.uint(parts3[1]) << 8 + org.apache.flex.utils.Language.uint(parts3[2]));
{code}
Should be:
{code}
} else if ((c = stringValue.indexOf("rgba(")) != -1) {
c2 = stringValue.indexOf(")");
stringValue = stringValue.substring(c + 5, c2);
var /** @type {Array} */ parts4 = stringValue.split(",");(org.apache.flex.utils.Language.uint(parts4[3]*255) << 24 + org.apache.flex.utils.Language.uint(parts4[0]) << 16 + org.apache.flex.utils.Language.uint(parts4[1]) << 8 + org.apache.flex.utils.Language.uint(parts4[2]));
{code}
Note the c+5 rather than c+4, using the parts4 array rather than parts3 array and multiplying the parts4 by 255 as it is the range 0.1 to 1.0.
Also the value it gets is wrong - adding a few brackets seems to get the right answer and not overflow.
{code}
(org.apache.flex.utils.Language.uint(parts4[3]*255) << 24) + (org.apache.flex.utils.Language.uint(parts4[0]) << 16) + (org.apache.flex.utils.Language.uint(parts4[1]) << 8) + org.apache.flex.utils.Language.uint(parts4[2])
{code}
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)