headers/bsd: Add sys/queue.h.
[haiku.git] / src / servers / app / RGBColor.h
blob8d008e5e33a06792fed8452f44a78511d41c2a9f
1 /*
2 * Copyright 2001-2006, Haiku.
3 * Distributed under the terms of the MIT License.
5 * Authors:
6 * DarkWyrm <bpmagic@columbus.rr.com>
7 */
8 #ifndef RGB_COLOR_H
9 #define RGB_COLOR_H
12 #include <GraphicsDefs.h>
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();
31 uint8 GetColor8() const;
32 uint16 GetColor15() const;
33 uint16 GetColor16() const;
34 rgb_color GetColor32() const;
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);
49 const RGBColor& operator=(const RGBColor& color);
50 const RGBColor& operator=(const rgb_color& color);
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;
57 // conversion to rgb_color
58 operator rgb_color() const
59 { return fColor32; }
61 bool IsTransparentMagic() const;
63 void PrintToStream() const;
65 protected:
66 rgb_color fColor32;
68 // caching
69 mutable uint16 fColor16;
70 mutable uint16 fColor15;
71 mutable uint8 fColor8;
72 mutable bool fUpdate8;
73 mutable bool fUpdate15;
74 mutable bool fUpdate16;
77 #endif // RGB_COLOR_H