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, uint8 g, uint8 b, uint8 a = 255); 18 RGBColor(int r, int g, int b, int a = 255); 19 RGBColor(const rgb_color &col); 20 RGBColor(uint16 col); 21 RGBColor(uint8 col); 22 RGBColor(const RGBColor &col); 23 RGBColor(); 24 25 uint8 GetColor8() const; 26 uint16 GetColor15() const; 27 uint16 GetColor16() const; 28 rgb_color GetColor32() const; 29 30 void SetColor(uint8 r, uint8 g, uint8 b, uint8 a = 255); 31 void SetColor(int r, int g, int b, int a = 255); 32 void SetColor(uint16 color16); 33 void SetColor(uint8 color8); 34 void SetColor(const rgb_color &color); 35 void SetColor(const RGBColor &col); 36 37 const RGBColor & operator=(const RGBColor &color); 38 const RGBColor & operator=(const rgb_color &color); 39 bool operator==(const rgb_color &color) const; 40 bool operator==(const RGBColor &color) const; 41 bool operator!=(const rgb_color &color) const; 42 bool operator!=(const RGBColor &color) const; 43 44 bool IsTransparentMagic() const; 45 46 void PrintToStream() const; 47 48 protected: 49 rgb_color fColor32; 50 51 // caching 52 mutable uint16 fColor16; 53 mutable uint16 fColor15; 54 mutable uint8 fColor8; 55 mutable bool fUpdate8; 56 mutable bool fUpdate15; 57 mutable bool fUpdate16; 58 }; 59 60 #endif // RGB_COLOR_H 61