I'm not surprised that RGBA has bugs, so please fix if you know how.

One thing I learned about #RRGGBBAA is that regular Flex didn't support
#RGB so keep in mind that you can specify #ffffff as #fff

Thanks,
-Alex

On 2/18/17, 7:03 PM, "Justin Mclean" <jus...@classsoftware.com> wrote:

>Hi,
>
>Looking deeper into this issue is seems FlexJS has support for rgb and
>rgba values but it’s a little broken.
>
>In SimpleCSSVAluesImpl parseStyle method this code:
>
>if (value.charAt(0) == "#") {
>         obj[pieces[0]] = org.apache.flex.utils.CSSUtils.toColor(value);
>       }
>
>Should be something like:
>if (value.charAt(0) == "#" || value.indexOf("rgb") == 0) {
>         obj[pieces[0]] = org.apache.flex.utils.CSSUtils.toColor(value);
>       }
>
>(Ignoring hsl colour support for now).
>
>Unless I guess that assuming that simple CSS should support rgb or rgba
>colour values?
>
>And in CSSUtils the parsing of rgba values is broken - this 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]));
>
>Should be:
>} 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]));
>
>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.
>
>(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])
>
>Thanks,
>Justin

Reply via email to