Jimcpp 2.1.0
Jimcpp is a high-performance c++ graphics engine.
Loading...
Searching...
No Matches
SColor.hpp
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 jimcpp/jimcpp.hpp
4
5#ifndef JPP_S_COLOR_HPP_INCLUDED
6#define JPP_S_COLOR_HPP_INCLUDED
7
8#include <jimcpp/core/engine/jpp_types.hpp>
9#include <jimcpp/core/engine/irrMath.hpp>
10
11namespace jpp
12{
13namespace video
14{
16
134
137 {
138 "A1R5G5B5",
139 "R5G6B5",
140 "R8G8B8",
141 "A8R8G8B8",
142 "DXT1",
143 "DXT2",
144 "DXT3",
145 "DXT4",
146 "DXT5",
147 "PVRTC_RGB2",
148 "PVRTC_ARGB2",
149 "PVRTC_RGB4",
150 "PVRTC_ARGB4",
151 "PVRTC2_ARGB2",
152 "PVRTC2_ARGB4",
153 "ETC1",
154 "ETC2_RGB",
155 "ETC2_ARGB",
156 "R16F",
157 "G16R16F",
158 "A16B16G16R16F",
159 "R32F",
160 "G32R32F",
161 "A32B32G32R32F",
162 "R8",
163 "R8G8",
164 "R16",
165 "R16G16",
166 "D16",
167 "D32",
168 "D24S8",
169 "UNKNOWN",
170 0
171 };
172
173
175 inline u16 RGBA16(u32 r, u32 g, u32 b, u32 a=0xFF)
176 {
177 return (u16)((a & 0x80) << 8 |
178 (r & 0xF8) << 7 |
179 (g & 0xF8) << 2 |
180 (b & 0xF8) >> 3);
181 }
182
183
185 inline u16 RGB16(u32 r, u32 g, u32 b)
186 {
187 return RGBA16(r,g,b);
188 }
189
190
192 inline u16 RGB16from16(u16 r, u16 g, u16 b)
193 {
194 return (0x8000 |
195 (r & 0x1F) << 10 |
196 (g & 0x1F) << 5 |
197 (b & 0x1F));
198 }
199
200
203 {
204 return (u16)(0x8000 |
205 ( color & 0x00F80000) >> 9 |
206 ( color & 0x0000F800) >> 6 |
207 ( color & 0x000000F8) >> 3);
208 }
209
210
213 {
214 return (u16)(( color & 0x80000000) >> 16|
215 ( color & 0x00F80000) >> 9 |
216 ( color & 0x0000F800) >> 6 |
217 ( color & 0x000000F8) >> 3);
218 }
219
220
223 {
224 return (u16)(( color & 0x00F80000) >> 8 |
225 ( color & 0x0000FC00) >> 5 |
226 ( color & 0x000000F8) >> 3);
227 }
228
229
231
233 {
234 return ( (( -( (s32) color & 0x00008000 ) >> (s32) 31 ) & 0xFF000000 ) |
235 (( color & 0x00007C00 ) << 9) | (( color & 0x00007000 ) << 4) |
236 (( color & 0x000003E0 ) << 6) | (( color & 0x00000380 ) << 1) |
237 (( color & 0x0000001F ) << 3) | (( color & 0x0000001C ) >> 2)
238 );
239 }
240
241
244 {
245 return 0xFF000000 |
246 ((color & 0xF800) << 8)|
247 ((color & 0x07E0) << 5)|
248 ((color & 0x001F) << 3);
249 }
250
251
254 {
255 return 0x8000 | (((color & 0xFFC0) >> 1) | (color & 0x1F));
256 }
257
258
261 {
262 return (((color & 0x7FE0) << 1) | (color & 0x1F));
263 }
264
265
266
268
270 inline u32 getAlpha(u16 color)
271 {
272 return ((color >> 15)&0x1);
273 }
274
275
277
278 inline u32 getRed(u16 color)
279 {
280 return ((color >> 10)&0x1F);
281 }
282
283
285
286 inline u32 getGreen(u16 color)
287 {
288 return ((color >> 5)&0x1F);
289 }
290
291
293
294 inline u32 getBlue(u16 color)
295 {
296 return (color & 0x1F);
297 }
298
299
301 inline s32 getAverage(s16 color)
302 {
303 return ((getRed(color)<<3) + (getGreen(color)<<3) + (getBlue(color)<<3)) / 3;
304 }
305
306
308
316 class SColor
317 {
318 public:
319
321
323
325
326 SColor (u32 a, u32 r, u32 g, u32 b)
327 : color(((a & 0xff)<<24) | ((r & 0xff)<<16) | ((g & 0xff)<<8) | (b & 0xff)) {}
328
331 : color(clr) {}
332
334
336 u32 getAlpha() const { return color>>24; }
337
339
341 u32 getRed() const { return (color>>16) & 0xff; }
342
344
346 u32 getGreen() const { return (color>>8) & 0xff; }
347
349
351 u32 getBlue() const { return color & 0xff; }
352
355 {
357 }
358
361 {
362 return 0.3f*getRed() + 0.59f*getGreen() + 0.11f*getBlue();
363 }
364
367 {
368 return ( getRed() + getGreen() + getBlue() ) / 3;
369 }
370
372
374 void setAlpha(u32 a) { color = ((a & 0xff)<<24) | (color & 0x00ffffff); }
375
377
379 void setRed(u32 r) { color = ((r & 0xff)<<16) | (color & 0xff00ffff); }
380
382
384 void setGreen(u32 g) { color = ((g & 0xff)<<8) | (color & 0xffff00ff); }
385
387
389 void setBlue(u32 b) { color = (b & 0xff) | (color & 0xffffff00); }
390
392
394
396
399 void toOpenGLColor(u8* dest) const
400 {
401 *dest = (u8)getRed();
402 *++dest = (u8)getGreen();
403 *++dest = (u8)getBlue();
404 *++dest = (u8)getAlpha();
405 }
406
408
422 void set(u32 a, u32 r, u32 g, u32 b)
423 {
424 color = (((a & 0xff)<<24) | ((r & 0xff)<<16) | ((g & 0xff)<<8) | (b & 0xff));
425 }
426 void set(u32 col) { color = col; }
427
429
430 bool operator==(const SColor& other) const { return other.color == color; }
431
433
434 bool operator!=(const SColor& other) const { return other.color != color; }
435
437
438 bool operator<(const SColor& other) const { return (color < other.color); }
439
441
443 SColor operator+(const SColor& other) const
444 {
445 return SColor(core::min_(getAlpha() + other.getAlpha(), 255u),
446 core::min_(getRed() + other.getRed(), 255u),
447 core::min_(getGreen() + other.getGreen(), 255u),
448 core::min_(getBlue() + other.getBlue(), 255u));
449 }
450
452
455 SColor getInterpolated(const SColor &other, f32 d) const
456 {
457 d = core::clamp(d, 0.f, 1.f);
458 const f32 inv = 1.0f - d;
459 return SColor((u32)core::round32(other.getAlpha()*inv + getAlpha()*d),
460 (u32)core::round32(other.getRed()*inv + getRed()*d),
461 (u32)core::round32(other.getGreen()*inv + getGreen()*d),
462 (u32)core::round32(other.getBlue()*inv + getBlue()*d));
463 }
464
466
469 SColor getInterpolated_quadratic(const SColor& c1, const SColor& c2, f32 d) const
470 {
471 // this*(1-d)*(1-d) + 2 * c1 * (1-d) + c2 * d * d;
472 d = core::clamp(d, 0.f, 1.f);
473 const f32 inv = 1.f - d;
474 const f32 mul0 = inv * inv;
475 const f32 mul1 = 2.f * d * inv;
476 const f32 mul2 = d * d;
477
478 return SColor(
479 core::clamp( core::floor32(
480 getAlpha() * mul0 + c1.getAlpha() * mul1 + c2.getAlpha() * mul2 ), 0, 255 ),
481 core::clamp( core::floor32(
482 getRed() * mul0 + c1.getRed() * mul1 + c2.getRed() * mul2 ), 0, 255 ),
483 core::clamp ( core::floor32(
484 getGreen() * mul0 + c1.getGreen() * mul1 + c2.getGreen() * mul2 ), 0, 255 ),
485 core::clamp ( core::floor32(
486 getBlue() * mul0 + c1.getBlue() * mul1 + c2.getBlue() * mul2 ), 0, 255 ));
487 }
488
490
493 void setData(const void *data, ECOLOR_FORMAT format)
494 {
495 switch (format)
496 {
497 case ECF_A1R5G5B5:
498 color = A1R5G5B5toA8R8G8B8(*(u16*)data);
499 break;
500 case ECF_R5G6B5:
501 color = R5G6B5toA8R8G8B8(*(u16*)data);
502 break;
503 case ECF_A8R8G8B8:
504 color = *(u32*)data;
505 break;
506 case ECF_R8G8B8:
507 {
508 const u8* p = (u8*)data;
509 set(255, p[0],p[1],p[2]);
510 }
511 break;
512 default:
513 color = 0xffffffff;
514 break;
515 }
516 }
517
519
522 void getData(void *data, ECOLOR_FORMAT format) const
523 {
524 switch(format)
525 {
526 case ECF_A1R5G5B5:
527 {
528 u16 * dest = (u16*)data;
530 }
531 break;
532
533 case ECF_R5G6B5:
534 {
535 u16 * dest = (u16*)data;
537 }
538 break;
539
540 case ECF_R8G8B8:
541 {
542 u8* dest = (u8*)data;
543 dest[0] = (u8)getRed();
544 dest[1] = (u8)getGreen();
545 dest[2] = (u8)getBlue();
546 }
547 break;
548
549 case ECF_A8R8G8B8:
550 {
551 u32 * dest = (u32*)data;
552 *dest = color;
553 }
554 break;
555
556 default:
557 break;
558 }
559 }
560
563 };
564
565
567
574 {
575 public:
577
578 SColorf() : r(0.0f), g(0.0f), b(0.0f), a(1.0f) {}
579
581
591 SColorf(f32 r, f32 g, f32 b, f32 a = 1.0f) : r(r), g(g), b(b), a(a) {}
592
594
597 {
598 const f32 inv = 1.0f / 255.0f;
599 r = c.getRed() * inv;
600 g = c.getGreen() * inv;
601 b = c.getBlue() * inv;
602 a = c.getAlpha() * inv;
603 }
604
607 {
608 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));
609 }
610
612
618 void set(f32 rr, f32 gg, f32 bb) {r = rr; g =gg; b = bb; }
619
621
629 void set(f32 aa, f32 rr, f32 gg, f32 bb) {a = aa; r = rr; g =gg; b = bb; }
630
632
635 SColorf getInterpolated(const SColorf &other, f32 d) const
636 {
637 d = core::clamp(d, 0.f, 1.f);
638 const f32 inv = 1.0f - d;
639 return SColorf(other.r*inv + r*d,
640 other.g*inv + g*d, other.b*inv + b*d, other.a*inv + a*d);
641 }
642
644
648 f32 d) const
649 {
650 d = core::clamp(d, 0.f, 1.f);
651 // this*(1-d)*(1-d) + 2 * c1 * (1-d) + c2 * d * d;
652 const f32 inv = 1.f - d;
653 const f32 mul0 = inv * inv;
654 const f32 mul1 = 2.f * d * inv;
655 const f32 mul2 = d * d;
656
657 return SColorf (r * mul0 + c1.r * mul1 + c2.r * mul2,
658 g * mul0 + c1.g * mul1 + c2.g * mul2,
659 b * mul0 + c1.b * mul1 + c2.b * mul2,
660 a * mul0 + c1.a * mul1 + c2.a * mul2);
661 }
662
663
665 void setColorComponentValue(s32 index, f32 value)
666 {
667 switch(index)
668 {
669 case 0: r = value; break;
670 case 1: g = value; break;
671 case 2: b = value; break;
672 case 3: a = value; break;
673 }
674 }
675
677 f32 getAlpha() const { return a; }
678
680 f32 getRed() const { return r; }
681
683 f32 getGreen() const { return g; }
684
686 f32 getBlue() const { return b; }
687
690
693
696
699 };
700
701
703
708 {
709 public:
710 SColorHSL ( f32 h = 0.f, f32 s = 0.f, f32 l = 0.f )
711 : Hue ( h ), Saturation ( s ), Luminance ( l ) {}
712
713 void fromRGB(const SColorf &color);
714 void toRGB(SColorf &color) const;
715
716 f32 Hue;
717 f32 Saturation;
718 f32 Luminance;
719
720 private:
721 inline f32 toRGB1(f32 rm1, f32 rm2, f32 rh) const;
722
723 };
724
725 inline void SColorHSL::fromRGB(const SColorf &color)
726 {
727 const f32 maxVal = core::max_(color.getRed(), color.getGreen(), color.getBlue());
728 const f32 minVal = (f32)core::min_(color.getRed(), color.getGreen(), color.getBlue());
729 Luminance = (maxVal+minVal)*50;
730 if (core::equals(maxVal, minVal))
731 {
732 Hue=0.f;
733 Saturation=0.f;
734 return;
735 }
736
737 const f32 delta = maxVal-minVal;
738 if ( Luminance <= 50 )
739 {
740 Saturation = (delta)/(maxVal+minVal);
741 }
742 else
743 {
744 Saturation = (delta)/(2-maxVal-minVal);
745 }
746 Saturation *= 100;
747
748 if (core::equals(maxVal, color.getRed()))
749 Hue = (color.getGreen()-color.getBlue())/delta;
750 else if (core::equals(maxVal, color.getGreen()))
751 Hue = 2+((color.getBlue()-color.getRed())/delta);
752 else // blue is max
753 Hue = 4+((color.getRed()-color.getGreen())/delta);
754
755 Hue *= 60.0f;
756 while ( Hue < 0.f )
757 Hue += 360;
758 }
759
760
761 inline void SColorHSL::toRGB(SColorf &color) const
762 {
763 const f32 l = Luminance/100;
764 if (core::iszero(Saturation)) // grey
765 {
766 color.set(l, l, l);
767 return;
768 }
769
770 f32 rm2;
771
772 if ( Luminance <= 50 )
773 {
774 rm2 = l + l * (Saturation/100);
775 }
776 else
777 {
778 rm2 = l + (1 - l) * (Saturation/100);
779 }
780
781 const f32 rm1 = 2.0f * l - rm2;
782
783 const f32 h = Hue / 360.0f;
784 color.set( toRGB1(rm1, rm2, h + 1.f/3.f),
785 toRGB1(rm1, rm2, h),
786 toRGB1(rm1, rm2, h - 1.f/3.f)
787 );
788 }
789
790
791 // algorithm from Foley/Van-Dam
792 inline f32 SColorHSL::toRGB1(f32 rm1, f32 rm2, f32 rh) const
793 {
794 if (rh<0)
795 rh += 1;
796 if (rh>1)
797 rh -= 1;
798
799 if (rh < 1.f/6.f)
800 rm1 = rm1 + (rm2 - rm1) * rh*6.f;
801 else if (rh < 0.5f)
802 rm1 = rm2;
803 else if (rh < 2.f/3.f)
804 rm1 = rm1 + (rm2 - rm1) * ((2.f/3.f)-rh)*6.f;
805
806 return rm1;
807 }
808
809} // end namespace video
810} // end namespace jpp
811
812#endif
Class representing a color in HSL format.
Definition SColor.hpp:708
Class representing a 32 bit ARGB color.
Definition SColor.hpp:317
u32 getAverage() const
Get average intensity of the color in the range [0,255].
Definition SColor.hpp:366
f32 getLuminance() const
Get luminance of the color in the range [0,255].
Definition SColor.hpp:360
SColor getInterpolated(const SColor &other, f32 d) const
Interpolates the color with a f32 value to another color.
Definition SColor.hpp:455
u32 getBlue() const
Returns the blue component of the color.
Definition SColor.hpp:351
void set(u32 a, u32 r, u32 g, u32 b)
Sets all four components of the color at once.
Definition SColor.hpp:422
SColor getInterpolated_quadratic(const SColor &c1, const SColor &c2, f32 d) const
Returns interpolated color. ( quadratic )
Definition SColor.hpp:469
SColor(u32 clr)
Constructs the color from a 32 bit value. Could be another color.
Definition SColor.hpp:330
void setAlpha(u32 a)
Sets the alpha component of the Color.
Definition SColor.hpp:374
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.hpp:326
void getData(void *data, ECOLOR_FORMAT format) const
Write the color to data in the defined format.
Definition SColor.hpp:522
void setRed(u32 r)
Sets the red component of the Color.
Definition SColor.hpp:379
u32 getGreen() const
Returns the green component of the color.
Definition SColor.hpp:346
bool operator==(const SColor &other) const
Compares the color to another color.
Definition SColor.hpp:430
bool operator!=(const SColor &other) const
Compares the color to another color.
Definition SColor.hpp:434
u32 color
color in A8R8G8B8 Format
Definition SColor.hpp:562
void setGreen(u32 g)
Sets the green component of the Color.
Definition SColor.hpp:384
u32 getAlpha() const
Returns the alpha component of the color.
Definition SColor.hpp:336
bool operator<(const SColor &other) const
comparison operator
Definition SColor.hpp:438
void setData(const void *data, ECOLOR_FORMAT format)
set the color by expecting data in the given format
Definition SColor.hpp:493
void setBlue(u32 b)
Sets the blue component of the Color.
Definition SColor.hpp:389
SColor operator+(const SColor &other) const
Adds two colors, result is clamped to 0..255 values.
Definition SColor.hpp:443
SColor()
Constructor of the Color. Does nothing.
Definition SColor.hpp:322
f32 getLightness() const
Get lightness of the color in the range [0,255].
Definition SColor.hpp:354
u16 toA1R5G5B5() const
Calculates a 16 bit A1R5G5B5 value of this color.
Definition SColor.hpp:393
u32 getRed() const
Returns the red component of the color.
Definition SColor.hpp:341
void toOpenGLColor(u8 *dest) const
Converts color to OpenGL color format.
Definition SColor.hpp:399
Class representing a color with four floats.
Definition SColor.hpp:574
SColorf(SColor c)
Constructs a color from 32 bit Color.
Definition SColor.hpp:596
f32 g
green color component
Definition SColor.hpp:692
f32 b
blue component
Definition SColor.hpp:695
void set(f32 rr, f32 gg, f32 bb)
Sets three color components to new values at once.
Definition SColor.hpp:618
f32 getGreen() const
Returns the green component of the color in the range 0.0 to 1.0.
Definition SColor.hpp:683
SColorf getInterpolated(const SColorf &other, f32 d) const
Interpolates the color with a f32 value to another color.
Definition SColor.hpp:635
f32 getBlue() const
Returns the blue component of the color in the range 0.0 to 1.0.
Definition SColor.hpp:686
SColor toSColor() const
Converts this color to a SColor without floats.
Definition SColor.hpp:606
f32 r
red color component
Definition SColor.hpp:689
f32 getAlpha() const
Returns the alpha component of the color in the range 0.0 (transparent) to 1.0 (opaque)
Definition SColor.hpp:677
f32 a
alpha color component
Definition SColor.hpp:698
void set(f32 aa, f32 rr, f32 gg, f32 bb)
Sets all four color components to new values at once.
Definition SColor.hpp:629
SColorf getInterpolated_quadratic(const SColorf &c1, const SColorf &c2, f32 d) const
Returns interpolated color. ( quadratic )
Definition SColor.hpp:647
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.hpp:591
void setColorComponentValue(s32 index, f32 value)
Sets a color component by index. R=0, G=1, B=2, A=3.
Definition SColor.hpp:665
SColorf()
Default constructor for SColorf.
Definition SColor.hpp:578
f32 getRed() const
Returns the red component of the color in the range 0.0 to 1.0.
Definition SColor.hpp:680
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.hpp:135
const T clamp(const T &value, const T &low, const T &high)
clamps a value between low and high
Definition irrMath.hpp:164
bool equals(const T a, const T b, const T tolerance=roundingError< T >())
returns if a equals b, taking possible rounding errors into account
Definition irrMath.hpp:243
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.hpp:121
bool iszero(const f64 a, const f64 tolerance=ROUNDING_ERROR_f64)
returns if a equals zero, taking rounding errors into account
Definition irrMath.hpp:304
u32 getBlue(u16 color)
Returns the blue component from A1R5G5B5 color.
Definition SColor.hpp:294
u16 RGB16from16(u16 r, u16 g, u16 b)
Creates a 16bit A1R5G5B5 color, based on 16bit input values.
Definition SColor.hpp:192
u16 RGBA16(u32 r, u32 g, u32 b, u32 a=0xFF)
Creates a 16 bit A1R5G5B5 color.
Definition SColor.hpp:175
u32 getAlpha(u16 color)
Returns the alpha component from A1R5G5B5 color.
Definition SColor.hpp:270
u16 A8R8G8B8toA1R5G5B5(u32 color)
Converts a 32bit (A8R8G8B8) color to a 16bit A1R5G5B5 color.
Definition SColor.hpp:212
u32 getRed(u16 color)
Returns the red component from A1R5G5B5 color.
Definition SColor.hpp:278
u16 A1R5G5B5toR5G6B5(u16 color)
Returns R5G6B5 Color from A1R5G5B5 color.
Definition SColor.hpp:260
ECOLOR_FORMAT
An enum for the color format of textures used by the Jimcpp Engine.
Definition SColor.hpp:21
@ ECF_PVRTC2_ARGB2
PVRTC2 ARGB 2bpp.
Definition SColor.hpp:70
@ ECF_ETC2_RGB
ETC2 RGB.
Definition SColor.hpp:79
@ ECF_R16
16 bit format using 16 bits for the red channel.
Definition SColor.hpp:115
@ ECF_PVRTC_RGB2
PVRTC RGB 2bpp.
Definition SColor.hpp:58
@ ECF_D32
32 bit format using 32 bits for depth.
Definition SColor.hpp:126
@ ECF_PVRTC_ARGB4
PVRTC ARGB 4bpp.
Definition SColor.hpp:67
@ ECF_PVRTC_ARGB2
PVRTC ARGB 2bpp.
Definition SColor.hpp:61
@ ECF_R16G16
32 bit format using 16 bits for the red and green channels.
Definition SColor.hpp:118
@ ECF_DXT5
DXT5 color format.
Definition SColor.hpp:55
@ ECF_R32F
32 bit format using 32 bits for the red channel.
Definition SColor.hpp:98
@ ECF_DXT4
DXT4 color format.
Definition SColor.hpp:52
@ ECF_A32B32G32R32F
128 bit format using 32 bits for the red, green, blue and alpha channels.
Definition SColor.hpp:104
@ ECF_D24S8
32 bit format using 24 bits for depth and 8 bits for stencil.
Definition SColor.hpp:129
@ ECF_PVRTC2_ARGB4
PVRTC2 ARGB 4bpp.
Definition SColor.hpp:73
@ ECF_DXT2
DXT2 color format.
Definition SColor.hpp:46
@ ECF_DXT1
DXT1 color format.
Definition SColor.hpp:43
@ ECF_R8
8 bit format using 8 bits for the red channel.
Definition SColor.hpp:109
@ ECF_R5G6B5
Standard 16 bit color format.
Definition SColor.hpp:29
@ ECF_A16B16G16R16F
64 bit format using 16 bits for the red, green, blue and alpha channels.
Definition SColor.hpp:95
@ ECF_R8G8
16 bit format using 8 bits for the red and green channels.
Definition SColor.hpp:112
@ ECF_D16
16 bit format using 16 bits for depth.
Definition SColor.hpp:123
@ ECF_PVRTC_RGB4
PVRTC RGB 4bpp.
Definition SColor.hpp:64
@ ECF_UNKNOWN
Unknown color format:
Definition SColor.hpp:132
@ ECF_G16R16F
32 bit format using 16 bits for the red and green channels.
Definition SColor.hpp:92
@ ECF_R8G8B8
Definition SColor.hpp:34
@ ECF_A8R8G8B8
Definition SColor.hpp:38
@ ECF_ETC1
ETC1 RGB.
Definition SColor.hpp:76
@ ECF_DXT3
DXT3 color format.
Definition SColor.hpp:49
@ ECF_R16F
16 bit format using 16 bits for the red channel.
Definition SColor.hpp:89
@ ECF_G32R32F
64 bit format using 32 bits for the red and green channels.
Definition SColor.hpp:101
@ ECF_ETC2_ARGB
ETC2 ARGB.
Definition SColor.hpp:82
@ ECF_A1R5G5B5
16 bit color format used by the software driver.
Definition SColor.hpp:26
const c8 *const ColorFormatNames[ECF_UNKNOWN+2]
Names for ECOLOR_FORMAT types.
Definition SColor.hpp:136
s32 getAverage(s16 color)
Returns the average from a 16 bit A1R5G5B5 color.
Definition SColor.hpp:301
u16 R5G6B5toA1R5G5B5(u16 color)
Returns A1R5G5B5 Color from R5G6B5 color.
Definition SColor.hpp:253
u32 getGreen(u16 color)
Returns the green component from A1R5G5B5 color.
Definition SColor.hpp:286
u16 A8R8G8B8toR5G6B5(u32 color)
Converts a 32bit (A8R8G8B8) color to a 16bit R5G6B5 color.
Definition SColor.hpp:222
u32 A1R5G5B5toA8R8G8B8(u16 color)
Convert A8R8G8B8 Color from A1R5G5B5 color.
Definition SColor.hpp:232
u32 R5G6B5toA8R8G8B8(u16 color)
Returns A8R8G8B8 Color from R5G6B5 color.
Definition SColor.hpp:243
u16 RGB16(u32 r, u32 g, u32 b)
Creates a 16 bit A1R5G5B5 color.
Definition SColor.hpp:185
u16 X8R8G8B8toA1R5G5B5(u32 color)
Converts a 32bit (X8R8G8B8) color to a 16bit A1R5G5B5 color.
Definition SColor.hpp:202
As of Jimcpp 1.6, position2d is a synonym for vector2d.
Definition vector3d.hpp:11
signed int s32
32 bit signed variable.
Definition irrTypes.hpp:72
signed short s16
16 bit signed variable.
Definition irrTypes.hpp:54
unsigned char u8
8 bit unsigned variable.
Definition irrTypes.hpp:24
unsigned int u32
32 bit unsigned variable.
Definition irrTypes.hpp:64
unsigned short u16
16 bit unsigned variable.
Definition irrTypes.hpp:46
float f32
32 bit floating point variable.
Definition irrTypes.hpp:110
char c8
8 bit character variable.
Definition irrTypes.hpp:37

Jimcpp    @cppfx.xyz

K