My favorites | Sign in
Project Home Downloads Source
Checkout   Browse   Changes    
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
topic "Color";
[2 $$0,0#00000000000000000000000000000000:Default]
[i448;a25;kKO9;2 $$1,0#37138531426314131252341829483380:class]
[l288;2 $$2,0#27521748481378242620020725143825:desc]
[0 $$3,0#96390100711032703541132217272105:end]
[H6;0 $$4,0#05600065144404261032431302351956:begin]
[i448;a25;kKO9;2 $$5,0#37138531426314131252341829483370:item]
[l288;a4;*@5;1 $$6,6#70004532496200323422659154056402:requirement]
[l288;i1121;b17;O9;~~~.1408;2 $$7,0#10431211400427159095818037425705:param]
[i448;b42;O9;2 $$8,8#61672508125594000341940100500538:tparam]
[b42;2 $$9,9#13035079074754324216151401829390:normal]
[{_}%EN-US
[ {{10000@(113.42.0) [s0; [*@(229)4 Color]]}}&]
[s3;%- &]
[s1;:Color`:`:class:%- [@(0.0.255)3 class][3 _][*3 Color][3 _:_][@(0.0.255)3 private][3 _][*@3;3 Ass
ignValueTypeNo][@(0.0.255)3 <][*3 Color][3 , COLOR`_V, ][_^Moveable^3 Moveable][@(0.0.255)3 <
][*3 Color][@(0.0.255)3 >][3 _>_]&]
[s9; [* Color] type representing RGB color. All components are in the
range 0 through 255. Null value is defined for Color. Color is
Value compatible as a Rich`-Value type (supports Value comparison,
serialization etc.).&]
[s3; &]
[s0;%- &]
[ {{10000F(128)G(128)@1 [s0; [* Constructor Detail]]}}&]
[s3; &]
[s5;:Color`:`:Color`(`):%- [* Color]()&]
[s2; Default constructor. Leaves component values uninitialized.&]
[s3; &]
[s4;%- &]
[s5;:Color`:`:Color`(int`,int`,int`):%- [* Color]([@(0.0.255) int]_[*@3 r],
[@(0.0.255) int]_[*@3 g], [@(0.0.255) int]_[*@3 b])&]
[s2; Constructor.&]
[s7; [%-*C@3 r]-|Red channel.&]
[s7; [%-*C@3 g]-|Green channel.&]
[s7; [%-*C@3 b]-|Blue channel.&]
[s3; &]
[s4;%- &]
[s5;:Color`:`:Color`(const Nuller`&`):%- [* Color]([@(0.0.255) const]_[_^Nuller^ Nuller][@(0.0.255) `&
])&]
[s2; Null constructor.&]
[s3; &]
[s4;%- &]
[s5;:Color`:`:Color`(const Value`&`):%- [* Color]([@(0.0.255) const]_[_^Value^ Value][@(0.0.255) `&
]_[*@3 q])&]
[s2; Conversion from Value.&]
[s7; [%-*@3 q]-|Value.&]
[s3; &]
[s4;%- &]
[s5;:Color`:`:Color`(Color`(`*`)`(`)`):%- [* Color]([* Color]_(`*[*@3 fn])())&]
[s2; This constructor allows using a pointer to a function returning
Colors instead of Colors in many places. Global functions returning
Color are needed instead of global Color constants on many platforms,
because often global variables are not allowed when using dynamic
libraries.&]
[s7; [%-*@3 fn]-|Pointer to a function returning Color.&]
[s0; &]
[s4;%- &]
[s5;:Color`:`:Color`(RGBA`):%- [* Color]([_^RGBA^ RGBA]_[*@3 rgba])&]
[s2; Conversion from a RGBA structure [%-*@3 rgba].&]
[s3; &]
[s4;%- &]
[s5;:Color`:`:Color`(int`,int`):%- [* Color]([@(0.0.255) int]_[*@3 n],
[@(0.0.255) int])&]
[s2; Constructs a Color from an integer representation of that colors
RGB code.&]
[s3; &]
[s0;%- &]
[ {{10000F(128)G(128)@1 [s0; [* Public Member List]]}}&]
[s3; &]
[s5;:Color`:`:operator Value`(`)const:%- [* operator_Value]()_[@(0.0.255) const]&]
[s2; Conversion to Value.&]
[s7; [*/ Return value]-|Value.&]
[s3; &]
[s4;%- &]
[s5;:Color`:`:GetRaw`(`)const:%- [_^dword^ dword]_[* GetRaw]()_[@(0.0.255) const]&]
[s7; [*/ Return value]-|Platform specific dword representing the color.&]
[s3; &]
[s4;%- &]
[s5;:Color`:`:GetR`(`)const:%- [@(0.0.255) int]_[* GetR]()_[@(0.0.255) const]&]
[s7; [*/ Return value]-|The red component.&]
[s3; &]
[s4;%- &]
[s5;:Color`:`:GetG`(`)const:%- [@(0.0.255) int]_[* GetG]()_[@(0.0.255) const]&]
[s7; [*/ Return value]-|The green component.&]
[s3; &]
[s4;%- &]
[s5;:Color`:`:GetB`(`)const:%- [@(0.0.255) int]_[* GetB]()_[@(0.0.255) const]&]
[s7; [*/ Return value]-|The blue component.&]
[s3; &]
[s4;%- &]
[s5;:Color`:`:SetNull`(`):%- [@(0.0.255) void]_[* SetNull]()&]
[s2; Sets the Color to Null.&]
[s3;%- &]
[s4;%- &]
[s5;:Color`:`:IsNullInstance`(`)const:%- [@(0.0.255) bool]_[* IsNullInstance]()_[@(0.0.255) c
onst]&]
[s7; [*/ Return value]-|True if Color is Null. Used to implement IsNull
for Color.&]
[s3; &]
[s4;%- &]
[s5;:Color`:`:GetHashValue`(`)const:%- [@(0.0.255) unsigned]_[* GetHashValue]()_[@(0.0.255) c
onst]&]
[s7; [*/ Return value]-|Hash`-value for Color.&]
[s3; &]
[s4;%- &]
[s5;:Color`:`:operator`=`=`(Color`)const:%- [@(0.0.255) bool]_[* operator`=`=]([_^Color^ Co
lor]_[*@3 c])_[@(0.0.255) const]&]
[s7; [%-*C@3 c]-|Color to compare with.&]
[s7; [*/ Return value]-|True if Color is equal to [@3 c].&]
[s3; &]
[s4;%- &]
[s5;:Color`:`:operator`!`=`(Color`)const:%- [@(0.0.255) bool]_[* operator!`=]([_^Color^ Col
or]_[*@3 c])_[@(0.0.255) const]&]
[s7; [%-*C@3 c]-|Color to compare with.&]
[s7; [*/ Return value]-|True if Color is not equal to [@3 c].&]
[s3; &]
[s4;%- &]
[s5;:Color`:`:Serialize`(Stream`&`):%- [@(0.0.255) void]_[* Serialize]([_^Stream^ Stream][@(0.0.255) `&
]_[*@3 s])&]
[s2; Serializes the color to the [^topic`:`/`/Core`/src`/Stream`$en`-us`#Stream`:`:class^ S
tream] [%-*@3 s].&]
[s3; &]
[s4;%- &]
[s5;:Color`:`:FromRaw`(dword`):%- [@(0.0.255) static] [_^Color^ Color]_[* FromRaw]([_^dword^ d
word]_[*@3 co])&]
[s2; Creates a Color based on a platform specific raw dword value.&]
[s7; [%-*C@3 co]-|Raw dword value.&]
[s7; [*/ Return value]-|Color.&]
[s3; &]
[s4;%- &]
[s5;:Color`:`:operator COLORREF`(`)const:%- [* operator_COLORREF]()_[@(0.0.255) const]&]
[s6;%- Win32 specific.&]
[s2; Return COLORREF for Color.&]
[s7; [*/ Return value]-|COLORREF.&]
[s3; &]
[s4;%- &]
[s5;:Color`:`:FromCR`(COLORREF`):%- [@(0.0.255) static] [_^Color^ Color]_[* FromCR](COLORRE
F_[*@3 cr])&]
[s6; Win32 specific.&]
[s2; Creates Color from COLORREF.&]
[s7; [%-*C@3 cr]-|COLORREF.&]
[s7; [*/ Return value]-|Color.&]
[s3; &]
[s4;%- &]
[s5;:Color`:`:operator dword`(`)const:%- [* operator_dword]()_[@(0.0.255) const]&]
[s6;%- Not available on Win32&]
[s7; [*/ Return value]-|[^topic`:`/`/Core`/src`/Color`$en`-us`#Color`:`:GetRaw`(`)const^ G
etRaw]().&]
[s3; &]
[s4;%- &]
[s5;:Color`:`:operator RGBA`(`)const:%- [* operator_RGBA]()_[@(0.0.255) const]&]
[s2; Returns a RGBA structure containing the color information.&]
[s3;%- &]
[s0; &]
[s0; &]
[s0;%- &]
[ {{10000@(113.42.0) [s0; [*@(229)4 Utility functions]]}}&]
[s3;%- &]
[s5;:GetRValue`(dword`):%- [@(0.0.255) int]_[* GetRValue]([_^dword^ dword]_[*@3 c])&]
[s2; Returns red component from a platform specific value.&]
[s7; [%-*C@3 c]-|Platform specific value.&]
[s7; [*/ Return value]-|Red component.&]
[s3; &]
[s4;%- &]
[s5;:GetGValue`(dword`):%- [@(0.0.255) int]_[* GetGValue]([_^dword^ dword]_[*@3 c])&]
[s2; Returns green component from a platform specific value.&]
[s7; [%-*C@3 c]-|Platform specific value.&]
[s7; [*/ Return value]-|Green component.&]
[s3; &]
[s4;%- &]
[s5;:GetBValue`(dword`):%- [@(0.0.255) int]_[* GetBValue]([_^dword^ dword]_[*@3 c])&]
[s2; Returns blue component from a platform specific value.&]
[s7; [%-*C@3 c]-|Platform specific value.&]
[s7; [*/ Return value]-|Blue component.&]
[s3; &]
[s4;%- &]
[s5;:RGB`(byte`,byte`,byte`):%- [_^dword^ dword]_[* RGB]([_^byte^ byte]_[*@3 r],
[_^byte^ byte]_[*@3 g], [_^byte^ byte]_[*@3 b])&]
[s2; Calculates platform specific value from components.&]
[s7; [%-*C@3 r]-|Red component.&]
[s7; [%-*C@3 g]-|Green component.&]
[s7; [%-*C@3 b]-|Blue component.&]
[s7; [*/ Return value]-|Platform specific value.&]
[s3; &]
[s4;%- &]
[s5;:GetHashValue`(Color`):%- [@(0.0.255) unsigned]_[* GetHashValue]([_^Color^ Color]_[*@3 c])
&]
[s2; Returns a hash value for the color.&]
[s7; [%-*C@3 c]-|Color.&]
[s7; [*/ Return value]-|Hash value.&]
[s3; &]
[s4;%- &]
[s5;:Nvl`(Color`,Color`):%- [_^Color^ Color]_[* Nvl]([_^Color^ Color]_[*@3 a],
[_^Color^ Color]_[*@3 b])&]
[s2; Returns first parameter if it is not Null, second otherwise.&]
[s7; [%-*C@3 a]-|Color.&]
[s7; [%-*C@3 b]-|Color.&]
[s7; [*/ Return value]-|a if not Null, b otherwise.&]
[s3; &]
[s4;%- &]
[s5;:AsString`(const Color`&`):%- [@(0.0.255) template]_<>_[_^String^ String]_[* AsString](
[@(0.0.255) const]_[_^Color^ Color][@(0.0.255) `&]_[*@3 c])&]
[s2; Converts Color to textual form.&]
[s7; [%-*C@3 c]-|Color.&]
[s7; [*/ Return value]-|Textual form.&]
[s3; &]
[s4;%- &]
[s5;:RGBtoHSV`(double`,double`,double`,double`&`,double`&`,double`&`):%- [@(0.0.255) vo
id]_[* RGBtoHSV]([@(0.0.255) double]_[*@3 r], [@(0.0.255) double]_[*@3 g],
[@(0.0.255) double]_[*@3 b], [@(0.0.255) double`&]_[*@3 h], [@(0.0.255) double`&]_[*@3 s],
[@(0.0.255) double`&]_[*@3 v])&]
[s2; Transforms an `[R,G,B`] color triplet (each of the components
is supposed to be in the range `[0..1`]) into an `[H,S,V`] triplet
(again all components are in the range `[0..1`]). This effectively
transforms the RGB cube to a cone in which color selection more
intuitively matches our our visual perception ([/ hue] corresponds
to the tint of the color, [/ saturation] to the richness of the
color hue and [/ value] corresponds to luminance or brightness).
&]
[s2; &]
[s2; The mathematical formula used to convert between the two color
spaces are:&]
[s2; &]
[s2; v `= max(r, g, b)&]
[s2; s `= 1 `- min(r, g, b) / v&]
[s2; h `= (x `- min(r, g, b)) / (max(r, g, b) `- min(r, g, b))&]
[s2; &]
[s2; where [/ x] is the color component which is neither minimum nor
maximum. There are six combinations for this, in every even h
is taken, in every odd 1`-h. The six combinations correspond
to six points on the color wheel forming the base of the HSV
cone `- pure red, yellow, green, cyan, blue, and magenta. The
color component ranges along the circumference are the following
(capital letters denote maximum component value, minuscule letters
minimum): Rgb `-> RGb `-> rGb `-> rGB `-> rgB `-> RgB.&]
[s2; &]
[s2; An easy way to visualize the HSV transform based on the RGB
cube is: imagine a slight deformation of the cube where the tip
of the cone corresponds to the black RBG cube vertex, the opposite
(white) RGB cube vertex corresponds to the center of the base
circle of the HSV cone and the remaining six RGB cube vertices
get projected on the circumference of the cone base as explained
in the preceding paragraph.&]
[s2; &]
[s7; [%-*C@3 r]-|input red component `[0..1`]&]
[s7; [%-*C@3 g]-|input green component `[0..1`]&]
[s7; [%-*C@3 b]-|input blue component `[0..1`]&]
[s7; [%-*C@3 h]-|output hue `[0..1`], i.e. color tint&]
[s7; [%-*C@3 s]-|output saturation `[0..1`]. Maximum saturation (1)
corresponds to the `"purest`" basic color (one of the six), whereas
minimum saturation (0) is gray or white.&]
[s7; [%-*C@3 v]-|output brightness `[0..1`].&]
[s3; &]
[s4;%- &]
[s5;:HSVtoRGB`(double`,double`,double`,double`&`,double`&`,double`&`):%- [@(0.0.255) vo
id]_[* HSVtoRGB]([@(0.0.255) double]_[*@3 h], [@(0.0.255) double]_[*@3 s],
[@(0.0.255) double]_[*@3 v], [@(0.0.255) double`&]_[*@3 r], [@(0.0.255) double`&]_[*@3 g],
[@(0.0.255) double`&]_[*@3 b])&]
[s2; Transformes an HSV triplet (each of the components is supposed
to lie in the interval `[0..1`]) into an RGB triplet (again with
component ranges `[0..1`]). This projects the HSV cone (as explained
in the preceding section) back onto the RGB cube.&]
[s7; [%-*C@3 h]-|input hue, i.e. color tint `[0..1`]&]
[s7; [%-*C@3 s]-|input saturation, i.e. color `"purity`" `[0..1`]&]
[s7; [%-*C@3 v]-|value `- luminance or brightness `[0..1`]&]
[s7; [%-*C@3 r]-|output red component `[0..1`]&]
[s7; [%-*C@3 g]-|output green component `[0..1`]&]
[s7; [%-*C@3 b]-|output blue component `[0..1`]&]
[s3; &]
[s4;%- &]
[s5;:HsvColorf`(double`,double`,double`):%- [_^Color^ Color]_[* HsvColorf]([@(0.0.255) doub
le]_[*@3 h], [@(0.0.255) double]_[*@3 s], [@(0.0.255) double]_[*@3 v])&]
[s2; Converts an HSV color triplet into a [* Color] object. The H,
S, and V components are supposed to be in the range `[0..1`].&]
[s7; [%-*C@3 h]-|input hue `[0..1`]&]
[s7; [%-*C@3 s]-|input saturation `[0..1`]&]
[s7; [%-*C@3 v]-|input value aka brightness `[0..1`]&]
[s7; [*/ Return value]-|the [* Color] object with the given HSV components&]
[s3; &]
[s4;%- &]
[s5;:Blend`(Color`,Color`,int`):%- [_^Color^ Color]_[* Blend]([_^Color^ Color]_[*@3 c1],
[_^Color^ Color]_[*@3 c2], [@(0.0.255) int]_[*@3 alpha]_`=_[@3 128])&]
[s2; Blends two colors.&]
[s7; [%-*C@3 c1]-|First color.&]
[s7; [%-*C@3 c2]-|Second color.&]
[s7; [%-*C@3 alpha]-|Blending factor in the range 0..255.&]
[s7; [*/ Return value]-|Blended color `- (255 `- alpha) / 255.0 `* c1
`+ alpha / 255.0 `* c2.&]
[s3; &]
[s4;%- &]
[s5;:ColorToHtml`(Color`):%- [_^String^ String]_[* ColorToHtml]([_^Color^ Color]_[*@3 color])
&]
[s2; Converts Color to the textual format used in HTML (into hexadecimal
form like #ffffff for white).&]
[s7; [%-*C@3 color]-|Color.&]
[s7; [*/ Return value]-|HTML text.&]
[s3; &]
[s4;%- &]
[s5;:GrayColor`(int`):%- [_^Color^ Color]_[* GrayColor]([@(0.0.255) int]_[*@3 a]_`=_[@3 128])&]
[s2; Returns a gray color of intensity [%-*@3 a].&]
[s3; &]
[s4;%- &]
[s5;:Grayscale`(const Color`&`):%- [@(0.0.255) int]_[* Grayscale]([@(0.0.255) const]_[_^Color^ C
olor][@(0.0.255) `&]_[*@3 c])&]
[s2; Converts a color [%-*@3 c][%- to grayscale].&]
[s3; &]
[s4;%- &]
[s5;:IsDark`(Color`):%- [@(0.0.255) bool]_[* IsDark]([_^Color^ Color]_[*@3 c])&]
[s2; True if [%-*@3 c] grayscale level is lower than 80.&]
[s3; &]
[s4;%- &]
[s5;:IsLight`(Color`):%- [@(0.0.255) bool]_[* IsLight]([_^Color^ Color]_[*@3 c])&]
[s2; True if [%-*@3 c] grayscale is higher than 175 (255 `- 80).&]
[s3; &]
[s4;%- &]
[s5;:StraightColor`(RGBA`):%- [_^Color^ Color]_[* StraightColor]([_^RGBA^ RGBA]_[*@3 rgba])&]
[s2; Converts a RGBA structure [%-*@3 rgba] to a [* Color].&]
[s3; &]
[s0;3 &]
[ {{10000@(113.42.0) [s0; [*@(229)4 Color constants]]}}&]
[s3; &]
[s9; Predefined colors are represented by functions that return the
predefined color value.&]
[s3; &]
[s0; &]
[s5;:Black`(`):%- [_^Color^ Color]_[* Black]()&]
[s2; Black.&]
[s3;%- &]
[s4;%- &]
[s5;:Gray`(`):%- [_^Color^ Color]_[* Gray]()&]
[s2; Gray.&]
[s3;%- &]
[s4;%- &]
[s5;:LtGray`(`):%- [_^Color^ Color]_[* LtGray]()&]
[s2; Light gray.&]
[s3;%- &]
[s4;%- &]
[s5;:WhiteGray`(`):%- [_^Color^ Color]_[* WhiteGray]()&]
[s2; White gray.&]
[s3;%- &]
[s4;%- &]
[s5;:White`(`):%- [_^Color^ Color]_[* White]()&]
[s2; White.&]
[s3;%- &]
[s4;%- &]
[s5;:Red`(`):%- [_^Color^ Color]_[* Red]()&]
[s2; Red.&]
[s3;%- &]
[s4;%- &]
[s5;:Green`(`):%- [_^Color^ Color]_[* Green]()&]
[s2; Green.&]
[s3;%- &]
[s4;%- &]
[s5;:Brown`(`):%- [_^Color^ Color]_[* Brown]()&]
[s2; Brown.&]
[s3;%- &]
[s4;%- &]
[s5;:Blue`(`):%- [_^Color^ Color]_[* Blue]()&]
[s2; Blue.&]
[s3;%- &]
[s4;%- &]
[s5;:Magenta`(`):%- [_^Color^ Color]_[* Magenta]()&]
[s2; Magenta.&]
[s3;%- &]
[s4;%- &]
[s5;:Cyan`(`):%- [_^Color^ Color]_[* Cyan]()&]
[s2; Cyan.&]
[s3;%- &]
[s4;%- &]
[s5;:Yellow`(`):%- [_^Color^ Color]_[* Yellow]()&]
[s2; Yellow.&]
[s3; &]
[s4;%- &]
[s5;:LtRed`(`):%- [_^Color^ Color]_[* LtRed]()&]
[s2; Light red.&]
[s3;%- &]
[s4;%- &]
[s5;:LtGreen`(`):%- [_^Color^ Color]_[* LtGreen]()&]
[s2; Light green.&]
[s3;%- &]
[s4;%- &]
[s5;:LtYellow`(`):%- [_^Color^ Color]_[* LtYellow]()&]
[s2; Light yellow.&]
[s3;%- &]
[s4;%- &]
[s5;:LtBlue`(`):%- [_^Color^ Color]_[* LtBlue]()&]
[s2; Light blue.&]
[s3;%- &]
[s4;%- &]
[s5;:LtMagenta`(`):%- [_^Color^ Color]_[* LtMagenta]()&]
[s2; Light magenta.&]
[s3;%- &]
[s4;%- &]
[s5;:LtCyan`(`):%- [_^Color^ Color]_[* LtCyan]()&]
[s2; Light cyan.&]
[s3;%- &]
[s0; ]

Change log

r4391 by koldo on Jan 10, 2012   Diff
.Core: Added a bit of doc
Go to: 
Project members, sign in to write a code review

Older revisions

r3370 by cxl on Apr 25, 2011   Diff
theide: Assist for #include
r1984 by cbpporter on Jan 29, 2010   Diff
Documentation update
r1004 by cbpporter on Mar 23, 2009   Diff
CtrlLib documentation update
All revisions of this file

File info

Size: 15055 bytes, 397 lines

File properties

svn:eol-style
native
Powered by Google Project Hosting