1RGBColor class
2##############
3
4RGBColor objects provide a simplified interface to colors for the
5app_server, especially the DisplayDriver class
6
7Member Functions
8================
9
10RGBColor(uint8 r, uint8 g, uint8 b, uint8 a=255)
11------------------------------------------------
12
13RGBColor(rgb_color col)
14-----------------------
15
16RGBColor(uint16 color16)
17------------------------
18
19RGBColor(uint8 color8)
20----------------------
21
22RGBColor(const RGBColor &color)
23-------------------------------
24
25RGBColor(void)
26--------------
27
28In all cases, extract the color data by calling SetColor. Void version sets to (0,0,0,0)
29
30void PrintToStream(void)
31------------------------
32
33Prints the color values of the color32 member via printf()
34
35uint8 GetColor8(void)
36---------------------
37
38uint16 GetColor16(void)
39-----------------------
40
41rgb_color GetColor32(void)
42--------------------------
43
44
45These are for obtaining space-specific versions of the color assigned
46to the object.
47
48
491) In all cases, return the internal color storage members
50
51
52void SetColor(const RGBColor &color)
53------------------------------------
54
55Copy all internal members to the current object.
56
57void SetColor(uint8 r, uint8 g, uint8 b, uint8 a=255)
58-----------------------------------------------------
59
60void SetColor(rgb_color col)
61----------------------------
62
631. Assign parameters to internal rgb_color
642. call SetRGBAColor15()
653. call SystemPalette::FindClosestColor()
66
67void SetColor(uint16 color16)
68-----------------------------
69
701. Assign parameter to internal uint16
712. call SetRGBAColor32()
723. call SystemPalette::FindClosestColor()
73
74void SetColor(uint8 color8)
75---------------------------
76
771. Assign parameter to internal uint8
782. Get the 32-bit value from the palette and assign it to the internal rgb_color
793. call SetRGBAColor16()
80
81RGBColor & operator=(const RGBColor &from)
82------------------------------------------
83
84Copy all data members over and return the value of this (return \*this;)
85
86bool operator==(const RGBColor &from)
87-------------------------------------
88
89Compare rgb_colors and if all members are equal, return true. Otherwise,
90return false.
91
92bool operator!=(const RGBColor &from)
93-------------------------------------
94
95
96Compare rgb_colors and if all are equal, return false. Otherwise,
97return true.
98
99
100RGBColor MakeBlendColor(RGBColor c, float position)
101---------------------------------------------------
102
103Returns a color which is (position \* 100) of the way from the current
104color to the one passed to it. This would be an easy way to generate
105color gradients, for example, but with more control.
106
107
1081) Clip position to the range 0<=position<=1
1092) For each color component,
110
111   a) calculate the delta (delta=int16(c.component-thiscolor.component))
112   b) calculate the modifier (mod=thiscolor.component+(delta \* position))
113   c) clip modifier to the range 0 <= modifier <= 255
114   d) assign modifier to the component (thiscolor.component=int8(mod))
115
1163) return a new RGBColor constructed around the new color
117
118