API: moved functions to files to make it easier to import to other projects
This commit is contained in:
+23
@@ -0,0 +1,23 @@
|
||||
#include "utils.h"
|
||||
|
||||
unsigned long
|
||||
u32to_u64(const unsigned int clr)
|
||||
{
|
||||
unsigned long mask = 0;
|
||||
unsigned long alpha = DECODE_A(clr);
|
||||
unsigned long red = DECODE_R(clr);
|
||||
unsigned long green = DECODE_G(clr);
|
||||
unsigned long blue = DECODE_B(clr);
|
||||
return (alpha << 48) | (red << 32) | (green << 16) | (blue);
|
||||
}
|
||||
|
||||
unsigned int
|
||||
u64to_u32(const unsigned long clr, const unsigned long u64_div)
|
||||
{
|
||||
unsigned int a = ((clr >> 48) & LONG_BYTE);
|
||||
unsigned int r = ((clr >> 32) & LONG_BYTE);
|
||||
unsigned int g = ((clr >> 16) & LONG_BYTE);
|
||||
unsigned int b = (clr & LONG_BYTE);
|
||||
return ENCODE_ARGB((a / u64_div), (r / u64_div), (g / u64_div),
|
||||
(b / u64_div));
|
||||
}
|
||||
Reference in New Issue
Block a user