3 <TITLE>RGBColor.htm
</TITLE>
4 <style type=
"text/css">
6 .Default {background-color: rgb
(255,255,255); color: rgb
(0,0,0); font-family: 'Dutch801 Rm BT'; font-size: 12pt}
7 .OBOS-Function-Def {background-color: rgb
(255,255,255); color: rgb
(0,0,0); font-family: 'Dutch801 Rm BT'; font-size: 16pt}
8 .OBOS-Title {background-color: rgb
(255,255,255); color: rgb
(0,128,0); font-family: 'Dutch801 Rm BT'; font-size: 24pt}
9 .Text-Background {background-color: rgb
(255,255,255)}
14 .WP-Default {text-align: left
; text-indent: 0px; margin-left: 0px; margin-right: 0px}
18 <BODY BGCOLOR=
"#ffffff">
19 <DIV class=
"sheet" id=
"Sheet 1">
20 <P class=
"Body" style=
"margin: 0px"><span class=
"OBOS-Title">RGBColor class
</span><span style=
"color: rgb(0,0,0); font-size: 24pt"></span></P>
21 <P class=
"Body" style=
"margin: 0px"><BR>
23 <P class=
"Body" style=
"margin: 0px">RGBColor objects provide a simplified interface to colors for the app_server, especially the DisplayDriver class
</P>
24 <P class=
"Body" style=
"margin: 0px"><BR>
28 <P class=
"Body" style=
"margin: 0px"><BR>
30 <P class=
"Body" style=
"margin: 0px"><BR>
32 <TABLE WIDTH=
617 HEIGHT=
264 BORDER=
1 CELLPADDING=
1 CELLSPACING=
2>
34 <TD WIDTH=
203 HEIGHT=
32>
35 <P class=
"Body" style=
"margin: 0px">RGBColor(uint8 r, uint8 g, uint8 b, uint8 a=
255)
</P>
37 <TD WIDTH=
260 HEIGHT=
32>
38 <P class=
"Body" style=
"margin: 0px">RGBColor(rgb_color col)
</P>
42 <TD WIDTH=
203 HEIGHT=
17>
43 <P class=
"Body" style=
"margin: 0px">RGBColor(uint16 color16)
</P>
45 <TD WIDTH=
260 HEIGHT=
17>
46 <P class=
"Body" style=
"margin: 0px">RGBColor(uint8 color8)
</P>
50 <TD WIDTH=
203 HEIGHT=
17>
51 <P class=
"Body" style=
"margin: 0px">RGBColor(const RGBColor
&color)
</P>
53 <TD WIDTH=
260 HEIGHT=
17>
54 <P class=
"Body" style=
"margin: 0px">RGBColor(void)
</P>
58 <TD WIDTH=
203 HEIGHT=
17>
59 <P class=
"Body" style=
"margin: 0px">void PrintToStream(void)
</P>
61 <TD WIDTH=
260 HEIGHT=
17>
62 <P class=
"Body" style=
"margin: 0px">uint8 GetColor8(void)
</P>
66 <TD WIDTH=
203 HEIGHT=
17>
67 <P class=
"Body" style=
"margin: 0px">uint16 GetColor16(void)
</P>
69 <TD WIDTH=
260 HEIGHT=
17>
70 <P class=
"Body" style=
"margin: 0px">rgb_color GetColor32(void)
</P>
74 <TD WIDTH=
203 HEIGHT=
32>
75 <P class=
"Body" style=
"margin: 0px">void SetColor(uint8 r, uint8 g, uint8 b, uint8 a=
255)
</P>
77 <TD WIDTH=
260 HEIGHT=
32>
78 <P class=
"Body" style=
"margin: 0px">void SetColor(uint16 color16)
</P>
82 <TD WIDTH=
203 HEIGHT=
17>
83 <P class=
"Body" style=
"margin: 0px">void SetColor(uint8 color
8)
</P>
85 <TD WIDTH=
260 HEIGHT=
17>
86 <P class=
"Body" style=
"margin: 0px">void SetColor(rgb_color color)
</P>
90 <TD WIDTH=
203 HEIGHT=
17>
91 <P class=
"Body" style=
"margin: 0px">void SetColor(const RGBColor
&col)
</P>
93 <TD WIDTH=
260 HEIGHT=
17>
94 <P class=
"Body" style=
"margin: 0px">Operators: =,==,!=
</P>
98 <TD WIDTH=
203 HEIGHT=
32>
99 <P class=
"Body" style=
"margin: 0px">RGBColor MakeBlendColor( RGBColor c, float position)
</P>
101 <TD WIDTH=
260 HEIGHT=
32>
106 <P class=
"Body" style=
"margin: 0px"><BR>
110 <P class=
"Body" style=
"margin: 0px"><span class=
"OBOS-Function-Def">RGBColor(uint8 r, uint8 g, uint8 b, uint8 a=
255)
</span><span style=
"font-size: 16pt"></span></P>
111 <P class=
"Body" style=
"margin: 0px"><span class=
"OBOS-Function-Def">RGBColor(rgb_color col)
</span><span style=
"font-size: 16pt"></span></P>
112 <P class=
"Body" style=
"margin: 0px"><span class=
"OBOS-Function-Def">RGBColor(uint16 color16)
</span><span style=
"font-size: 16pt"></span></P>
113 <P class=
"Body" style=
"margin: 0px"><span class=
"OBOS-Function-Def">RGBColor(uint8 color8)
</span><span style=
"font-size: 16pt"></span></P>
114 <P class=
"Body" style=
"margin: 0px"><span class=
"OBOS-Function-Def">RGBColor(const RGBColor
&color)
</span><span style=
"font-size: 16pt"></span></P>
115 <P class=
"Body" style=
"margin: 0px"><span class=
"OBOS-Function-Def">RGBColor(void)
</span><span style=
"font-size: 16pt"></span></P>
116 <P class=
"Body" style=
"margin: 0px"><BR>
117 1) In all cases, extract the color data by calling SetColor. Void version sets to (
0,
0,
0,
0)
</P>
118 <P class=
"Body" style=
"margin: 0px"><BR>
120 <span class=
"OBOS-Function-Def">void PrintToStream(void)
</span></P>
121 <P class=
"Body" style=
"margin: 0px"><BR>
122 Prints the color values of the color32 member via printf()
</P>
123 <P class=
"Body" style=
"margin: 0px"><BR>
124 <span class=
"OBOS-Function-Def">uint8 GetColor8(void)
</span><span style=
"font-size: 16pt"></span></P>
125 <P class=
"Body" style=
"margin: 0px"><span class=
"OBOS-Function-Def">uint16 GetColor16(void)
</span><span style=
"font-size: 16pt"></span></P>
126 <P class=
"Body" style=
"margin: 0px"><span class=
"OBOS-Function-Def">rgb_color GetColor32(void)
</span><span style=
"font-size: 16pt"></span></P>
127 <P class=
"Body" style=
"margin: 0px"><BR>
128 These are for obtaining space-specific versions of the color assigned to the object.
</P>
129 <P class=
"Body" style=
"margin: 0px"><BR>
130 1) In all cases, return the internal color storage members
</P>
131 <P class=
"Body" style=
"margin: 0px"><BR>
133 <span class=
"OBOS-Function-Def">void SetColor(const RGBColor
&color)
</span><span style=
"font-size: 16pt"></span></P>
134 <P class=
"Body" style=
"margin: 0px"><span class=
"Default"><BR>
135 Copy all internal members to the current object.
</span></P>
136 <P class=
"Body" style=
"margin: 0px"><span class=
"Default"><BR>
138 </span><span class=
"OBOS-Function-Def">void SetColor(uint8 r, uint8 g, uint8 b, uint8 a=
255)
</span><span style=
"font-size: 16pt"></span></P>
139 <P class=
"Body" style=
"margin: 0px"><span class=
"OBOS-Function-Def">void SetColor(rgb_color col)
</span><span style=
"font-size: 16pt"></span></P>
140 <P class=
"Body" style=
"margin: 0px"><span class=
"Default"><BR>
141 </span><span class=
"Default">1) Assign parameters to internal rgb_color
</span></P>
142 <P class=
"Body" style=
"margin: 0px"><span class=
"Default">2) call SetRGBAColor15()
</span></P>
143 <P class=
"Body" style=
"margin: 0px"><span class=
"Default">3) call SystemPalette::FindClosestColor()
</span></P>
144 <P class=
"Body" style=
"margin: 0px"><span class=
"Default"><BR>
145 </span><span class=
"Default"><BR>
146 </span><span class=
"OBOS-Function-Def">void SetColor(uint16 color16)
</span><span style=
"font-size: 16pt"></span></P>
147 <P class=
"Body" style=
"margin: 0px"><span class=
"Default"><BR>
148 1) Assign parameter to internal uint16
</span></P>
149 <P class=
"Body" style=
"margin: 0px"><span class=
"Default">2) call SetRGBAColor32()
</span></P>
150 <P class=
"Body" style=
"margin: 0px"><span class=
"Default">3) call SystemPalette::FindClosestColor()
</span></P>
151 <P class=
"Body" style=
"margin: 0px"><span style=
"font-size: 16pt"><BR>
153 </span><span class=
"OBOS-Function-Def">void SetColor(uint8 color8)
</span><span style=
"font-size: 16pt"></span></P>
154 <P class=
"Body" style=
"margin: 0px"><span style=
"font-size: 16pt"><BR>
155 </span><span class=
"Default">1) Assign parameter to internal uint8
</span></P>
156 <P class=
"Body" style=
"margin: 0px"><span class=
"Default">2) Get the
32-bit value from the palette and assign it to the internal rgb_color
</span></P>
157 <P class=
"Body" style=
"margin: 0px"><span class=
"Default">3) call SetRGBAColor16()
</span></P>
158 <P class=
"Body" style=
"margin: 0px"><span style=
"font-size: 16pt"><BR>
160 </span><span class=
"OBOS-Function-Def">RGBColor
& operator=(const RGBColor
&from)
</span><span style=
"font-size: 16pt"></span></P>
161 <P class=
"Body" style=
"margin: 0px"><span class=
"Default"><BR>
162 Copy all data members over and return the value of this (return *this;)
</span></P>
163 <P class=
"Body" style=
"margin: 0px"><span class=
"Default"><BR>
164 </span><span class=
"OBOS-Function-Def">bool operator==(const RGBColor
&from)
</span><span style=
"font-size: 16pt"></span></P>
165 <P class=
"Body" style=
"margin: 0px"><span class=
"Default"><BR>
166 </span><span class=
"Default">Compare rgb_colors and if all members are equal, return true. Otherwise, return false.
</span></P>
167 <P class=
"Body" style=
"margin: 0px"><span class=
"Default"><BR>
168 </span><span class=
"OBOS-Function-Def">bool operator!=(const RGBColor
&from)
</span><span style=
"font-size: 16pt"></span></P>
169 <P class=
"Body" style=
"margin: 0px"><BR>
170 Compare rgb_colors and if all are equal, return false.
<span class=
"Default">Otherwise, return true.
</span></P>
171 <P class=
"Body" style=
"margin: 0px"><BR>
172 <span class=
"OBOS-Function-Def">RGBColor MakeBlendColor(RGBColor c, float position)
</span></P>
173 <P class=
"Body" style=
"margin: 0px"><BR>
174 Returns a color which is (position *
100) of the way from the current color to the one passed to it. This would be an easy way to generate color gradients, for example, but with more control.
</P>
175 <P class=
"Body" style=
"margin: 0px"><BR>
176 1) Clip position to the range
0<=position
<=
1</P>
177 <P class=
"Body" style=
"margin: 0px">2) For each color component,
</P>
178 <P class=
"Body" style=
"margin: 0px"> a) calculate the delta (delta=int16(c.component-thiscolor.component))
</P>
179 <P class=
"Body" style=
"margin: 0px"> b) calculate the modifier (mod=thiscolor.component+(delta * position))
</P>
180 <P class=
"Body" style=
"margin: 0px"> c) clip modifier to the range
0 <= modifier
<=
255</P>
181 <P class=
"Body" style=
"margin: 0px"> d) assign modifier to the component (thiscolor.component=int8(mod))
</P>
182 <P class=
"Body" style=
"margin: 0px">3) return a new RGBColor constructed around the new color
</P>
183 <P class=
"Body" style=
"margin: 0px"><BR>
185 <DIV class=
"layer" id=
"Layer 1">