MsMaterialColor.fromRGBO constructor
Create a MsMaterialColor from red, green, blue, and opacity, similar to rgba()
in CSS.
r
is red, from 0 to 255.g
is green, from 0 to 255.b
is blue, from 0 to 255.opacity
is alpha channel of this color as a double, with 0.0 being transparent and 1.0 being fully opaque.
Out of range values are brought into range using modulo 255.
Implementation
factory MsMaterialColor.fromRGBO(int r, int g, int b, double opacity) =>
MsMaterialColor(((((opacity * 0xff ~/ 1) & 0xff) << 24) |
((r & 0xff) << 16) |
((g & 0xff) << 8) |
((b & 0xff) << 0)) &
0xFFFFFFFF);