Skylicht Engine
Loading...
Searching...
No Matches
SColor.h
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __COLOR_H_INCLUDED__
6#define __COLOR_H_INCLUDED__
7
8#include "irrTypes.h"
9#include "irrMath.h"
10
11namespace irr
12{
13namespace video
14{
16
140
141
143 inline u16 RGBA16(u32 r, u32 g, u32 b, u32 a=0xFF)
144 {
145 return (u16)((a & 0x80) << 8 |
146 (r & 0xF8) << 7 |
147 (g & 0xF8) << 2 |
148 (b & 0xF8) >> 3);
149 }
150
151
153 inline u16 RGB16(u32 r, u32 g, u32 b)
154 {
155 return RGBA16(r,g,b);
156 }
157
158
160 inline u16 RGB16from16(u16 r, u16 g, u16 b)
161 {
162 return (0x8000 |
163 (r & 0x1F) << 10 |
164 (g & 0x1F) << 5 |
165 (b & 0x1F));
166 }
167
168
171 {
172 return (u16)(0x8000 |
173 ( color & 0x00F80000) >> 9 |
174 ( color & 0x0000F800) >> 6 |
175 ( color & 0x000000F8) >> 3);
176 }
177
178
181 {
182 return (u16)(( color & 0x80000000) >> 16|
183 ( color & 0x00F80000) >> 9 |
184 ( color & 0x0000F800) >> 6 |
185 ( color & 0x000000F8) >> 3);
186 }
187
188
191 {
192 return (u16)(( color & 0x00F80000) >> 8 |
193 ( color & 0x0000FC00) >> 5 |
194 ( color & 0x000000F8) >> 3);
195 }
196
197
199
201 {
202 return ( (( -( (s32) color & 0x00008000 ) >> (s32) 31 ) & 0xFF000000 ) |
203 (( color & 0x00007C00 ) << 9) | (( color & 0x00007000 ) << 4) |
204 (( color & 0x000003E0 ) << 6) | (( color & 0x00000380 ) << 1) |
205 (( color & 0x0000001F ) << 3) | (( color & 0x0000001C ) >> 2)
206 );
207 }
208
209
212 {
213 return 0xFF000000 |
214 ((color & 0xF800) << 8)|
215 ((color & 0x07E0) << 5)|
216 ((color & 0x001F) << 3);
217 }
218
219
222 {
223 return 0x8000 | (((color & 0xFFC0) >> 1) | (color & 0x1F));
224 }
225
226
229 {
230 return (((color & 0x7FE0) << 1) | (color & 0x1F));
231 }
232
233
234
236
238 inline u32 getAlpha(u16 color)
239 {
240 return ((color >> 15)&0x1);
241 }
242
243
245
246 inline u32 getRed(u16 color)
247 {
248 return ((color >> 10)&0x1F);
249 }
250
251
253
254 inline u32 getGreen(u16 color)
255 {
256 return ((color >> 5)&0x1F);
257 }
258
259
261
262 inline u32 getBlue(u16 color)
263 {
264 return (color & 0x1F);
265 }
266
267
269 inline s32 getAverage(s16 color)
270 {
271 return ((getRed(color)<<3) + (getGreen(color)<<3) + (getBlue(color)<<3)) / 3;
272 }
273
274
276
284 class SColor
285 {
286 public:
287
289
291
293
294 SColor (u32 a, u32 r, u32 g, u32 b)
295 : color(((a & 0xff)<<24) | ((b & 0xff)<<16) | ((g & 0xff)<<8) | (r & 0xff)) {}
296
299 : color(clr) {}
300
302
304 u32 getAlpha() const { return color>>24; }
305
307
309 u32 getBlue() const { return (color>>16) & 0xff; }
310
312
314 u32 getGreen() const { return (color>>8) & 0xff; }
315
317
319 u32 getRed() const { return color & 0xff; }
320
323 {
325 }
326
329 {
330 return 0.3f*getRed() + 0.59f*getGreen() + 0.11f*getBlue();
331 }
332
335 {
336 return ( getRed() + getGreen() + getBlue() ) / 3;
337 }
338
340
342 void setAlpha(u32 a) { color = ((a & 0xff)<<24) | (color & 0x00ffffff); }
343
345
347 void setBlue(u32 r) { color = ((r & 0xff)<<16) | (color & 0xff00ffff); }
348
350
352 void setGreen(u32 g) { color = ((g & 0xff)<<8) | (color & 0xffff00ff); }
353
355
357 void setRed(u32 b) { color = (b & 0xff) | (color & 0xffffff00); }
358
360
362
364
367 void toOpenGLColor(u8* dest) const
368 {
369 *dest = (u8)getRed();
370 *++dest = (u8)getGreen();
371 *++dest = (u8)getBlue();
372 *++dest = (u8)getAlpha();
373 }
374
376
390 void set(u32 a, u32 r, u32 g, u32 b)
391 {
392 color = (((a & 0xff)<<24) | ((b & 0xff)<<16) | ((g & 0xff)<<8) | (r & 0xff));
393 }
394 void set(u32 col) { color = col; }
395
397
398 bool operator==(const SColor& other) const { return other.color == color; }
399
401
402 bool operator!=(const SColor& other) const { return other.color != color; }
403
405
406 bool operator<(const SColor& other) const { return (color < other.color); }
407
409
411 SColor operator+(const SColor& other) const
412 {
413 return SColor(core::min_(getAlpha() + other.getAlpha(), 255u),
414 core::min_(getRed() + other.getRed(), 255u),
415 core::min_(getGreen() + other.getGreen(), 255u),
416 core::min_(getBlue() + other.getBlue(), 255u));
417 }
418
420
423 SColor getInterpolated(const SColor &other, f32 d) const
424 {
425 d = core::clamp(d, 0.f, 1.f);
426 const f32 inv = 1.0f - d;
427 return SColor((u32)core::round32(other.getAlpha()*inv + getAlpha()*d),
428 (u32)core::round32(other.getRed()*inv + getRed()*d),
429 (u32)core::round32(other.getGreen()*inv + getGreen()*d),
430 (u32)core::round32(other.getBlue()*inv + getBlue()*d));
431 }
432
434
437 SColor getInterpolated_quadratic(const SColor& c1, const SColor& c2, f32 d) const
438 {
439 // this*(1-d)*(1-d) + 2 * c1 * (1-d) + c2 * d * d;
440 d = core::clamp(d, 0.f, 1.f);
441 const f32 inv = 1.f - d;
442 const f32 mul0 = inv * inv;
443 const f32 mul1 = 2.f * d * inv;
444 const f32 mul2 = d * d;
445
446 return SColor(
447 core::clamp( core::floor32(
448 getAlpha() * mul0 + c1.getAlpha() * mul1 + c2.getAlpha() * mul2 ), 0, 255 ),
449 core::clamp( core::floor32(
450 getRed() * mul0 + c1.getRed() * mul1 + c2.getRed() * mul2 ), 0, 255 ),
451 core::clamp ( core::floor32(
452 getGreen() * mul0 + c1.getGreen() * mul1 + c2.getGreen() * mul2 ), 0, 255 ),
453 core::clamp ( core::floor32(
454 getBlue() * mul0 + c1.getBlue() * mul1 + c2.getBlue() * mul2 ), 0, 255 ));
455 }
456
458
461 void setData(const void *data, ECOLOR_FORMAT format)
462 {
463 switch (format)
464 {
465 case ECF_A1R5G5B5:
466 color = A1R5G5B5toA8R8G8B8(*(u16*)data);
467 break;
468 case ECF_R5G6B5:
469 color = R5G6B5toA8R8G8B8(*(u16*)data);
470 break;
471 case ECF_A8R8G8B8:
472 color = *(u32*)data;
473 break;
474 case ECF_R8G8B8:
475 {
476 u8* p = (u8*)data;
477 set(255, p[0],p[1],p[2]);
478 }
479 break;
480 default:
481 color = 0xffffffff;
482 break;
483 }
484 }
485
487
490 void getData(void *data, ECOLOR_FORMAT format)
491 {
492 switch(format)
493 {
494 case ECF_A1R5G5B5:
495 {
496 u16 * dest = (u16*)data;
498 }
499 break;
500
501 case ECF_R5G6B5:
502 {
503 u16 * dest = (u16*)data;
505 }
506 break;
507
508 case ECF_R8G8B8:
509 {
510 u8* dest = (u8*)data;
511 dest[0] = (u8)getRed();
512 dest[1] = (u8)getGreen();
513 dest[2] = (u8)getBlue();
514 }
515 break;
516
517 case ECF_A8R8G8B8:
518 {
519 u32 * dest = (u32*)data;
520 *dest = color;
521 }
522 break;
523
524 default:
525 break;
526 }
527 }
528
531 };
532
533
535
542 {
543 public:
545
546 SColorf() : r(0.0f), g(0.0f), b(0.0f), a(1.0f) {}
547
549
559 SColorf(f32 r, f32 g, f32 b, f32 a = 1.0f) : r(r), g(g), b(b), a(a) {}
560
562
565 {
566 const f32 inv = 1.0f / 255.0f;
567 r = c.getRed() * inv;
568 g = c.getGreen() * inv;
569 b = c.getBlue() * inv;
570 a = c.getAlpha() * inv;
571 }
572
575 {
576 return SColor((u32)core::round32(a*255.0f), (u32)core::round32(r*255.0f), (u32)core::round32(g*255.0f), (u32)core::round32(b*255.0f));
577 }
578
580
586 void set(f32 rr, f32 gg, f32 bb) {r = rr; g =gg; b = bb; }
587
589
597 void set(f32 aa, f32 rr, f32 gg, f32 bb) {a = aa; r = rr; g =gg; b = bb; }
598
600
603 SColorf getInterpolated(const SColorf &other, f32 d) const
604 {
605 d = core::clamp(d, 0.f, 1.f);
606 const f32 inv = 1.0f - d;
607 return SColorf(other.r*inv + r*d,
608 other.g*inv + g*d, other.b*inv + b*d, other.a*inv + a*d);
609 }
610
612
616 f32 d) const
617 {
618 d = core::clamp(d, 0.f, 1.f);
619 // this*(1-d)*(1-d) + 2 * c1 * (1-d) + c2 * d * d;
620 const f32 inv = 1.f - d;
621 const f32 mul0 = inv * inv;
622 const f32 mul1 = 2.f * d * inv;
623 const f32 mul2 = d * d;
624
625 return SColorf (r * mul0 + c1.r * mul1 + c2.r * mul2,
626 g * mul0 + c1.g * mul1 + c2.g * mul2,
627 b * mul0 + c1.b * mul1 + c2.b * mul2,
628 a * mul0 + c1.a * mul1 + c2.a * mul2);
629 }
630
631
633 void setColorComponentValue(s32 index, f32 value)
634 {
635 switch(index)
636 {
637 case 0: r = value; break;
638 case 1: g = value; break;
639 case 2: b = value; break;
640 case 3: a = value; break;
641 }
642 }
643
645 f32 getAlpha() const { return a; }
646
648 f32 getRed() const { return r; }
649
651 f32 getGreen() const { return g; }
652
654 f32 getBlue() const { return b; }
655
658
661
664
667 };
668
669
671
675 class SColorHSL
676 {
677 public:
678 SColorHSL ( f32 h = 0.f, f32 s = 0.f, f32 l = 0.f )
679 : Hue ( h ), Saturation ( s ), Luminance ( l ) {}
680
681 void fromRGB(const SColorf &color);
682 void toRGB(SColorf &color) const;
683
684 f32 Hue;
685 f32 Saturation;
686 f32 Luminance;
687
688 private:
689 inline f32 toRGB1(f32 rm1, f32 rm2, f32 rh) const;
690
691 };
692
693 inline void SColorHSL::fromRGB(const SColorf &color)
694 {
695 const f32 maxVal = core::max_(color.getRed(), color.getGreen(), color.getBlue());
696 const f32 minVal = (f32)core::min_(color.getRed(), color.getGreen(), color.getBlue());
697 Luminance = (maxVal+minVal)*50;
698 if (core::equals(maxVal, minVal))
699 {
700 Hue=0.f;
701 Saturation=0.f;
702 return;
703 }
704
705 const f32 delta = maxVal-minVal;
706 if ( Luminance <= 50 )
707 {
708 Saturation = (delta)/(maxVal+minVal);
709 }
710 else
711 {
712 Saturation = (delta)/(2-maxVal-minVal);
713 }
714 Saturation *= 100;
715
716 if (core::equals(maxVal, color.getRed()))
717 Hue = (color.getGreen()-color.getBlue())/delta;
718 else if (core::equals(maxVal, color.getGreen()))
719 Hue = 2+((color.getBlue()-color.getRed())/delta);
720 else // blue is max
721 Hue = 4+((color.getRed()-color.getGreen())/delta);
722
723 Hue *= 60.0f;
724 while ( Hue < 0.f )
725 Hue += 360;
726 }
727
728
729 inline void SColorHSL::toRGB(SColorf &color) const
730 {
731 const f32 l = Luminance/100;
732 if (core::iszero(Saturation)) // grey
733 {
734 color.set(l, l, l);
735 return;
736 }
737
738 f32 rm2;
739
740 if ( Luminance <= 50 )
741 {
742 rm2 = l + l * (Saturation/100);
743 }
744 else
745 {
746 rm2 = l + (1 - l) * (Saturation/100);
747 }
748
749 const f32 rm1 = 2.0f * l - rm2;
750
751 const f32 h = Hue / 360.0f;
752 color.set( toRGB1(rm1, rm2, h + 1.f/3.f),
753 toRGB1(rm1, rm2, h),
754 toRGB1(rm1, rm2, h - 1.f/3.f)
755 );
756 }
757
758
759 // algorithm from Foley/Van-Dam
760 inline f32 SColorHSL::toRGB1(f32 rm1, f32 rm2, f32 rh) const
761 {
762 if (rh<0)
763 rh += 1;
764 if (rh>1)
765 rh -= 1;
766
767 if (rh < 1.f/6.f)
768 rm1 = rm1 + (rm2 - rm1) * rh*6.f;
769 else if (rh < 0.5f)
770 rm1 = rm2;
771 else if (rh < 2.f/3.f)
772 rm1 = rm1 + (rm2 - rm1) * ((2.f/3.f)-rh)*6.f;
773
774 return rm1;
775 }
776
777} // end namespace video
778} // end namespace irr
779
780#endif
Class representing a 32 bit ARGB color.
Definition SColor.h:285
u32 color
color in A8R8G8B8 Format
Definition SColor.h:530
u32 getGreen() const
Returns the green component of the color.
Definition SColor.h:314
SColor getInterpolated(const SColor &other, f32 d) const
Interpolates the color with a f32 value to another color.
Definition SColor.h:423
bool operator!=(const SColor &other) const
Compares the color to another color.
Definition SColor.h:402
void setData(const void *data, ECOLOR_FORMAT format)
set the color by expecting data in the given format
Definition SColor.h:461
SColor operator+(const SColor &other) const
Adds two colors, result is clamped to 0..255 values.
Definition SColor.h:411
void toOpenGLColor(u8 *dest) const
Converts color to OpenGL color format.
Definition SColor.h:367
SColor(u32 clr)
Constructs the color from a 32 bit value. Could be another color.
Definition SColor.h:298
u32 getAverage() const
Get average intensity of the color in the range [0,255].
Definition SColor.h:334
bool operator==(const SColor &other) const
Compares the color to another color.
Definition SColor.h:398
u32 getRed() const
Returns the blue component of the color.
Definition SColor.h:319
f32 getLuminance() const
Get luminance of the color in the range [0,255].
Definition SColor.h:328
void setAlpha(u32 a)
Sets the alpha component of the Color.
Definition SColor.h:342
void getData(void *data, ECOLOR_FORMAT format)
Write the color to data in the defined format.
Definition SColor.h:490
u32 getAlpha() const
Returns the alpha component of the color.
Definition SColor.h:304
void set(u32 a, u32 r, u32 g, u32 b)
Sets all four components of the color at once.
Definition SColor.h:390
f32 getLightness() const
Get lightness of the color in the range [0,255].
Definition SColor.h:322
SColor(u32 a, u32 r, u32 g, u32 b)
Constructs the color from 4 values representing the alpha, red, green and blue component.
Definition SColor.h:294
u16 toA1R5G5B5() const
Calculates a 16 bit A1R5G5B5 value of this color.
Definition SColor.h:361
SColor()
Constructor of the Color. Does nothing.
Definition SColor.h:290
void setRed(u32 b)
Sets the red component of the Color.
Definition SColor.h:357
void setBlue(u32 r)
Sets the blue component of the Color.
Definition SColor.h:347
SColor getInterpolated_quadratic(const SColor &c1, const SColor &c2, f32 d) const
Returns interpolated color. ( quadratic ).
Definition SColor.h:437
bool operator<(const SColor &other) const
comparison operator
Definition SColor.h:406
void setGreen(u32 g)
Sets the green component of the Color.
Definition SColor.h:352
u32 getBlue() const
Returns the red component of the color.
Definition SColor.h:309
Class representing a color with four floats.
Definition SColor.h:542
f32 getRed() const
Returns the red component of the color in the range 0.0 to 1.0.
Definition SColor.h:648
SColorf getInterpolated(const SColorf &other, f32 d) const
Interpolates the color with a f32 value to another color.
Definition SColor.h:603
f32 getGreen() const
Returns the green component of the color in the range 0.0 to 1.0.
Definition SColor.h:651
SColorf()
Default constructor for SColorf.
Definition SColor.h:546
f32 getBlue() const
Returns the blue component of the color in the range 0.0 to 1.0.
Definition SColor.h:654
SColorf(SColor c)
Constructs a color from 32 bit Color.
Definition SColor.h:564
void setColorComponentValue(s32 index, f32 value)
Sets a color component by index. R=0, G=1, B=2, A=3.
Definition SColor.h:633
f32 b
blue component
Definition SColor.h:663
void set(f32 rr, f32 gg, f32 bb)
Sets three color components to new values at once.
Definition SColor.h:586
f32 getAlpha() const
Returns the alpha component of the color in the range 0.0 (transparent) to 1.0 (opaque).
Definition SColor.h:645
f32 r
red color component
Definition SColor.h:657
f32 g
green color component
Definition SColor.h:660
SColor toSColor() const
Converts this color to a SColor without floats.
Definition SColor.h:574
SColorf(f32 r, f32 g, f32 b, f32 a=1.0f)
Constructs a color from up to four color values: red, green, blue, and alpha.
Definition SColor.h:559
f32 a
alpha color component
Definition SColor.h:666
void set(f32 aa, f32 rr, f32 gg, f32 bb)
Sets all four color components to new values at once.
Definition SColor.h:597
SColorf getInterpolated_quadratic(const SColorf &c1, const SColorf &c2, f32 d) const
Returns interpolated color. ( quadratic ).
Definition SColor.h:615
const T & max_(const T &a, const T &b)
returns maximum of two values. Own implementation to get rid of the STL (VS6 problems)
Definition irrMath.h:137
const T clamp(const T &value, const T &low, const T &high)
clamps a value between low and high
Definition irrMath.h:166
const T & min_(const T &a, const T &b)
returns minimum of two values. Own implementation to get rid of the STL (VS6 problems)
Definition irrMath.h:123
bool equals(const f64 a, const f64 b, const f64 tolerance=ROUNDING_ERROR_f64)
returns if a equals b, taking possible rounding errors into account
Definition irrMath.h:185
bool iszero(const f64 a, const f64 tolerance=ROUNDING_ERROR_f64)
returns if a equals zero, taking rounding errors into account
Definition irrMath.h:270
The video namespace contains classes for accessing the video driver. All 2d and 3d rendering is done ...
Definition EDriverFeatures.h:11
u16 A8R8G8B8toR5G6B5(u32 color)
Converts a 32bit (A8R8G8B8) color to a 16bit R5G6B5 color.
Definition SColor.h:190
ECOLOR_FORMAT
An enum for the color format of textures used by the Irrlicht Engine.
Definition SColor.h:18
@ ECT_PVRTC2_RGBA4444
PVRTC2 RGBA 4444.
Definition SColor.h:70
@ ECF_A1R5G5B5
16 bit color format used by the software driver.
Definition SColor.h:23
@ ECF_D16
16 bit format using 16 bits for depth.
Definition SColor.h:115
@ ECF_DXT5
DXT5 color format.
Definition SColor.h:49
@ ECT_PVRTC2_RGB565
ECT_PVRTC2_RGB 565.
Definition SColor.h:73
@ ECF_UNKNOWN
Unknown color format:
Definition SColor.h:138
@ ECF_A32B32G32R32F
128 bit format using 32 bits for the red, green, blue and alpha channels.
Definition SColor.h:110
@ ECF_D24S8
32 bit format using 24 bits for depth and 8 bits for stencil.
Definition SColor.h:121
@ ECF_R8G8B8
24 bit color, no alpha channel, but 8 bit for red, green and blue.
Definition SColor.h:29
@ ECF_R5G6B5
Standard 16 bit color format.
Definition SColor.h:26
@ ECF_DXT3
DXT3 color format.
Definition SColor.h:43
@ ECF_A8R8G8B8
Default 32 bit color format. 8 bits are used for every component: red, green, blue and alpha.
Definition SColor.h:32
@ ECT_PVRTC2_RGB888
ECT_PVRTC2_RGB 888.
Definition SColor.h:76
@ ECF_R8
8 bit format using 8 bits for the red channel.
Definition SColor.h:126
@ ECF_ETC2_RGB
ETC2 RGB.
Definition SColor.h:85
@ ECF_PVRTC2_ARGB4
PVRTC2 ARGB 4bpp.
Definition SColor.h:67
@ ECF_ETC1
ETC1 RGB.
Definition SColor.h:82
@ ECT_PVRTC2_RGBA8888
ECT_PVRTC2_RGBA 8888.
Definition SColor.h:79
@ ECF_R16
16 bit format using 16 bits for the red channel.
Definition SColor.h:132
@ ECF_ETC2_ARGB
ETC2 ARGB.
Definition SColor.h:88
@ ECF_A16B16G16R16F
64 bit format using 16 bits for the red, green, blue and alpha channels.
Definition SColor.h:101
@ ECF_G32R32F
64 bit format using 32 bits for the red and green channels.
Definition SColor.h:107
@ ECF_PVRTC_RGB2
PVRTC RGB 2bpp.
Definition SColor.h:52
@ ECF_R16G16
32 bit format using 16 bits for the red and green channels.
Definition SColor.h:135
@ ECF_PVRTC_RGB4
PVRTC RGB 4bpp.
Definition SColor.h:58
@ ECF_DXT2
DXT2 color format.
Definition SColor.h:40
@ ECF_R16F
16 bit format using 16 bits for the red channel.
Definition SColor.h:95
@ ECF_PVRTC_ARGB4
PVRTC ARGB 4bpp.
Definition SColor.h:61
@ ECF_D32
32 bit format using 32 bits for depth.
Definition SColor.h:118
@ ECF_PVRTC2_ARGB2
PVRTC2 ARGB 2bpp.
Definition SColor.h:64
@ ECF_DXT1
DXT1 color format.
Definition SColor.h:37
@ ECF_R8G8
16 bit format using 8 bits for the red and green channels.
Definition SColor.h:129
@ ECF_DXT4
DXT4 color format.
Definition SColor.h:46
@ ECF_R32F
32 bit format using 32 bits for the red channel.
Definition SColor.h:104
@ ECF_PVRTC_ARGB2
PVRTC ARGB 2bpp.
Definition SColor.h:55
@ ECF_G16R16F
32 bit format using 16 bits for the red and green channels.
Definition SColor.h:98
u16 RGB16from16(u16 r, u16 g, u16 b)
Creates a 16bit A1R5G5B5 color, based on 16bit input values.
Definition SColor.h:160
u32 getAlpha(u16 color)
Returns the alpha component from A1R5G5B5 color.
Definition SColor.h:238
u32 getGreen(u16 color)
Returns the green component from A1R5G5B5 color.
Definition SColor.h:254
u32 R5G6B5toA8R8G8B8(u16 color)
Returns A8R8G8B8 Color from R5G6B5 color.
Definition SColor.h:211
u16 A1R5G5B5toR5G6B5(u16 color)
Returns R5G6B5 Color from A1R5G5B5 color.
Definition SColor.h:228
u16 RGB16(u32 r, u32 g, u32 b)
Creates a 16 bit A1R5G5B5 color.
Definition SColor.h:153
u16 RGBA16(u32 r, u32 g, u32 b, u32 a=0xFF)
Creates a 16 bit A1R5G5B5 color.
Definition SColor.h:143
u16 X8R8G8B8toA1R5G5B5(u32 color)
Converts a 32bit (X8R8G8B8) color to a 16bit A1R5G5B5 color.
Definition SColor.h:170
u32 A1R5G5B5toA8R8G8B8(u16 color)
Convert A8R8G8B8 Color from A1R5G5B5 color.
Definition SColor.h:200
u16 A8R8G8B8toA1R5G5B5(u32 color)
Converts a 32bit (A8R8G8B8) color to a 16bit A1R5G5B5 color.
Definition SColor.h:180
u32 getRed(u16 color)
Returns the red component from A1R5G5B5 color.
Definition SColor.h:246
u16 R5G6B5toA1R5G5B5(u16 color)
Returns A1R5G5B5 Color from R5G6B5 color.
Definition SColor.h:221
s32 getAverage(s16 color)
Returns the average from a 16 bit A1R5G5B5 color.
Definition SColor.h:269
u32 getBlue(u16 color)
Returns the blue component from A1R5G5B5 color.
Definition SColor.h:262
Everything in the Irrlicht Engine can be found in this namespace.
Definition Skylicht.h:33
float f32
32 bit floating point variable.
Definition irrTypes.h:104
unsigned int u32
32 bit unsigned variable.
Definition irrTypes.h:58
signed short s16
16 bit signed variable.
Definition irrTypes.h:48
unsigned char u8
8 bit unsigned variable.
Definition irrTypes.h:18
signed int s32
32 bit signed variable.
Definition irrTypes.h:66
unsigned short u16
16 bit unsigned variable.
Definition irrTypes.h:40