5 #ifndef __COLOR_H_INCLUDED__
6 #define __COLOR_H_INCLUDED__
62 return (
u16)((a & 0x80) << 8 |
90 ( color & 0x00F80000) >> 9 |
91 ( color & 0x0000F800) >> 6 |
92 ( color & 0x000000F8) >> 3);
99 return (
u16)(( color & 0x80000000) >> 16|
100 ( color & 0x00F80000) >> 9 |
101 ( color & 0x0000F800) >> 6 |
102 ( color & 0x000000F8) >> 3);
109 return (
u16)(( color & 0x00F80000) >> 8 |
110 ( color & 0x0000FC00) >> 5 |
111 ( color & 0x000000F8) >> 3);
119 return ( (( -( (
s32) color & 0x00008000 ) >> (
s32) 31 ) & 0xFF000000 ) |
120 (( color & 0x00007C00 ) << 9) | (( color & 0x00007000 ) << 4) |
121 (( color & 0x000003E0 ) << 6) | (( color & 0x00000380 ) << 1) |
122 (( color & 0x0000001F ) << 3) | (( color & 0x0000001C ) >> 2)
131 ((color & 0xF800) << 8)|
132 ((color & 0x07E0) << 5)|
133 ((color & 0x001F) << 3);
140 return 0x8000 | (((color & 0xFFC0) >> 1) | (color & 0x1F));
147 return (((color & 0x7FE0) << 1) | (color & 0x1F));
157 return ((color >> 15)&0x1);
165 return ((color >> 10)&0x1F);
173 return ((color >> 5)&0x1F);
181 return (color & 0x1F);
212 :
color(((a & 0xff)<<24) | ((r & 0xff)<<16) | ((g & 0xff)<<8) | (b & 0xff)) {}
309 color = (((a & 0xff)<<24) | ((r & 0xff)<<16) | ((g & 0xff)<<8) | (b & 0xff));
343 const f32 inv = 1.0f - d;
358 const f32 inv = 1.f - d;
359 const f32 mul0 = inv * inv;
360 const f32 mul1 = 2.f * d * inv;
361 const f32 mul2 = d * d;
394 set(255, p[0],p[1],p[2]);
427 u8* dest = (
u8*)data;
483 const f32 inv = 1.0f / 255.0f;
523 const f32 inv = 1.0f - d;
525 other.
g*inv +
g*d, other.
b*inv +
b*d, other.
a*inv +
a*d);
537 const f32 inv = 1.f - d;
538 const f32 mul0 = inv * inv;
539 const f32 mul1 = 2.f * d * inv;
540 const f32 mul2 = d * d;
542 return SColorf (
r * mul0 + c1.
r * mul1 + c2.
r * mul2,
543 g * mul0 + c1.
g * mul1 + c2.
g * mul2,
544 b * mul0 + c1.
b * mul1 + c2.
b * mul2,
545 a * mul0 + c1.
a * mul1 + c2.
a * mul2);
554 case 0:
r = value;
break;
555 case 1:
g = value;
break;
556 case 2:
b = value;
break;
557 case 3:
a = value;
break;
622 const f32 delta = maxVal-minVal;
666 const f32 rm1 = 2.0f * l - rm2;
668 const f32 h =
Hue / 360.0f;
669 color.
set( toRGB1(rm1, rm2, h + 1.f/3.f),
671 toRGB1(rm1, rm2, h - 1.f/3.f)
677 inline f32 SColorHSL::toRGB1(
f32 rm1,
f32 rm2,
f32 rh)
const
685 rm1 = rm1 + (rm2 - rm1) * rh*6.f;
688 else if (rh < 2.f/3.f)
689 rm1 = rm1 + (rm2 - rm1) * ((2.f/3.f)-rh)*6.f;