better to_rgba() macro
This commit is contained in:
parent
78e2c64da6
commit
9aa0d58d68
6 changed files with 45 additions and 25 deletions
|
|
@ -192,3 +192,13 @@ macro Point Point.min(Point a, Point b)
|
|||
struct Color{
|
||||
char r, g, b, a;
|
||||
}
|
||||
|
||||
macro Color uint.to_rgba(uint u)
|
||||
{
|
||||
return Color{
|
||||
.r = (char)((u >> 24) & 0xff),
|
||||
.g = (char)((u >> 16) & 0xff),
|
||||
.b = (char)((u >> 8) & 0xff),
|
||||
.a = (char)((u >> 0) & 0xff)
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue