Way back in 2011, a developer asked to be able to get a colour number value from RGBA codes.
Someone somewhere had done the calculations which I put together on a google sheet. @ 45 developers have since accessed the sheet.
Maybe you didn't know that you can use a number instead of the colour blocks to set the colour of a component in AI2?
The above will produce Black.
Finally got around to creating an app to do the same thing!
It is in the Gallery as Android Colour Number Finder
Hopefully has a use in some situations ;)
--
You are right! No obvious logic there:
make color = 4278190080 = -16777216
but it works. I guess the make color block is feeding the minus value to the background, whilst displaying the result
--
Here is the logic:
The value of the color in hex is FF000000 (255 alpha, 0 rgb). This value in decimal is 4278190080. In YAIL, the values are stored as long (64-bit) or Java Bignums (if they're larger than 2^63), which can represent this large positive value. However, when the value is passed to the Android runtime, it is passed as a Java int, which is a signed 32-bit value. When FF000000 is interpreted as a 32-bit signed integer, it's value is -16777216.
So at the bit representation they are equivalent, it's all in how the bits are interpreted.
Thanks Evan ;)
--
in this post other examples of color.
--
댓글 없음:
댓글 쓰기