1 /* 2 * Copyright 2001-2006, Haiku. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * DarkWyrm <bpmagic@columbus.rr.com> 7 */ 8 #ifndef RGB_COLOR_H 9 #define RGB_COLOR_H 10 11 12 #include <GraphicsDefs.h> 13 14 15 class RGBColor { 16 public: 17 RGBColor(uint8 r, 18 uint8 g, 19 uint8 b, 20 uint8 a = 255); 21 RGBColor(int r, 22 int g, 23 int b, 24 int a = 255); 25 RGBColor(const rgb_color& color); 26 RGBColor(uint16 color); 27 RGBColor(uint8 color); 28 RGBColor(const RGBColor& color); 29 RGBColor(); 30 31 uint8 GetColor8() const; 32 uint16 GetColor15() const; 33 uint16 GetColor16() const; 34 rgb_color GetColor32() const; 35 36 void SetColor(uint8 r, 37 uint8 g, 38 uint8 b, 39 uint8 a = 255); 40 void SetColor(int r, 41 int g, 42 int b, 43 int a = 255); 44 void SetColor(uint16 color16); 45 void SetColor(uint8 color8); 46 void SetColor(const rgb_color& color); 47 void SetColor(const RGBColor& color); 48 49 const RGBColor& operator=(const RGBColor& color); 50 const RGBColor& operator=(const rgb_color& color); 51 52 bool operator==(const rgb_color& color) const; 53 bool operator==(const RGBColor& color) const; 54 bool operator!=(const rgb_color& color) const; 55 bool operator!=(const RGBColor& color) const; 56 57 bool IsTransparentMagic() const; 58 59 void PrintToStream() const; 60 61 protected: 62 rgb_color fColor32; 63 64 // caching 65 mutable uint16 fColor16; 66 mutable uint16 fColor15; 67 mutable uint8 fColor8; 68 mutable bool fUpdate8; 69 mutable bool fUpdate15; 70 mutable bool fUpdate16; 71 }; 72 73 #endif // RGB_COLOR_H 74