5 #ifndef __COLOR_H_INCLUDED__
6 #define __COLOR_H_INCLUDED__
18 return (
u16)((a & 0x80) << 8 |
46 ( color & 0x00F80000) >> 9 |
47 ( color & 0x0000F800) >> 6 |
48 ( color & 0x000000F8) >> 3);
55 return (
u16)(( color & 0x80000000) >> 16|
56 ( color & 0x00F80000) >> 9 |
57 ( color & 0x0000F800) >> 6 |
58 ( color & 0x000000F8) >> 3);
65 return (
u16)(( color & 0x00F80000) >> 8 |
66 ( color & 0x0000FC00) >> 5 |
67 ( color & 0x000000F8) >> 3);
75 return ( (( -( (
s32) color & 0x00008000 ) >> (
s32) 31 ) & 0xFF000000 ) |
76 (( color & 0x00007C00 ) << 9) | (( color & 0x00007000 ) << 4) |
77 (( color & 0x000003E0 ) << 6) | (( color & 0x00000380 ) << 1) |
78 (( color & 0x0000001F ) << 3) | (( color & 0x0000001C ) >> 2)
87 ((color & 0xF800) << 8)|
88 ((color & 0x07E0) << 5)|
89 ((color & 0x001F) << 3);
96 return 0x8000 | (((color & 0xFFC0) >> 1) | (color & 0x1F));
103 return (((color & 0x7FE0) << 1) | (color & 0x1F));
113 return ((color >> 15)&0x1);
121 return ((color >> 10)&0x1F);
129 return ((color >> 5)&0x1F);
137 return (color & 0x1F);
168 :
color(((a & 0xff)<<24) | ((r & 0xff)<<16) | ((g & 0xff)<<8) | (b & 0xff)) {}
265 color = (((a & 0xff)<<24) | ((r & 0xff)<<16) | ((g & 0xff)<<8) | (b & 0xff));
299 const f32 inv = 1.0f - d;
314 const f32 inv = 1.f - d;
315 const f32 mul0 = inv * inv;
316 const f32 mul1 = 2.f * d * inv;
317 const f32 mul2 = d * d;
367 const f32 inv = 1.0f / 255.0f;
407 const f32 inv = 1.0f - d;
409 other.
g*inv +
g*d, other.
b*inv +
b*d, other.
a*inv +
a*d);
421 const f32 inv = 1.f - d;
422 const f32 mul0 = inv * inv;
423 const f32 mul1 = 2.f * d * inv;
424 const f32 mul2 = d * d;
426 return SColorf (
r * mul0 + c1.
r * mul1 + c2.
r * mul2,
427 g * mul0 + c1.
g * mul1 + c2.
g * mul2,
428 b * mul0 + c1.
b * mul1 + c2.
b * mul2,
429 a * mul0 + c1.
a * mul1 + c2.
a * mul2);
438 case 0:
r = value;
break;
439 case 1:
g = value;
break;
440 case 2:
b = value;
break;
441 case 3:
a = value;
break;
496 const f32 maxVal = (
f32)maxValInt;
506 const f32 delta = maxVal-minVal;
516 if (maxValInt == color.
getRed())
518 else if (maxValInt == color.
getGreen())
555 color.
setBlue ( toRGB1(rm1, rm2,
Hue - (120.0f * core::DEGTORAD) ) );
559 inline u32 SColorHSL::toRGB1(
f32 rm1,
f32 rm2,
f32 rh)
const
568 rm1 = rm1 + (rm2 - rm1) * rh / (60.0f * core::DEGTORAD);
569 else if (rh < 180.0f * core::DEGTORAD )
571 else if (rh < 240.0f * core::DEGTORAD )
572 rm1 = rm1 + (rm2 - rm1) * ( ( 240.0f * core::DEGTORAD ) - rh) /
573 (60.0f * core::DEGTORAD);