source: trunk/macosx/CTGradient/CTGradientAdditions.m @ 5972

Last change on this file since 5972 was 5972, checked in by livings124, 14 years ago

pieces bar color adjustment; dead code removal

  • Property svn:keywords set to Date Rev Author Id
File size: 10.3 KB
Line 
1/******************************************************************************
2 * $Id: CTGradientAdditions.m 5972 2008-05-29 21:50:16Z livings124 $
3 *
4 * Copyright (c) 2007-2008 Transmission authors and contributors
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
23 *****************************************************************************/
24
25#import "CTGradientAdditions.h"
26
27@implementation CTGradient (ProgressBar)
28
29+ (CTGradient *)progressWhiteGradient
30{
31    CTGradient *newInstance = [[[self class] alloc] init];
32   
33    CTGradientElement color1;
34    color1.red = color1.green = color1.blue  = 0.95;
35    color1.alpha = 1.00;
36    color1.position = 0;
37   
38    CTGradientElement color2;
39    color2.red = color2.green = color2.blue  = 0.83;
40    color2.alpha = 1.00;
41    color2.position = 0.5;
42   
43    CTGradientElement color3;
44    color3.red = color3.green = color3.blue  = 0.95;
45    color3.alpha = 1.00;
46    color3.position = 0.5;
47   
48    CTGradientElement color4;
49    color4.red = color4.green = color4.blue  = 0.92;
50    color4.alpha = 1.00;
51    color4.position = 1;
52   
53    [newInstance addElement:&color1];
54    [newInstance addElement:&color2];
55    [newInstance addElement:&color3];
56    [newInstance addElement:&color4];
57   
58    return [newInstance autorelease];
59}
60
61+ (CTGradient *)progressGrayGradient
62{
63    CTGradient *newInstance = [[[self class] alloc] init];
64   
65    CTGradientElement color1;
66    color1.red = color1.green = color1.blue  = 0.7;
67    color1.alpha = 1.00;
68    color1.position = 0;
69   
70    CTGradientElement color2;
71    color2.red = color2.green = color2.blue  = 0.6;
72    color2.alpha = 1.00;
73    color2.position = 0.5;
74   
75    CTGradientElement color3;
76    color3.red = color3.green = color3.blue  = 0.7;
77    color3.alpha = 1.00;
78    color3.position = 0.5;
79   
80    CTGradientElement color4;
81    color4.red = color4.green = color4.blue  = 0.7;
82    color4.alpha = 1.00;
83    color4.position = 1;
84   
85    [newInstance addElement:&color1];
86    [newInstance addElement:&color2];
87    [newInstance addElement:&color3];
88    [newInstance addElement:&color4];
89   
90    return [newInstance autorelease];
91}
92
93+ (CTGradient *)progressLightGrayGradient
94{
95    CTGradient *newInstance = [[[self class] alloc] init];
96   
97    CTGradientElement color1;
98    color1.red = color1.green = color1.blue  = 0.87;
99    color1.alpha = 1.00;
100    color1.position = 0;
101   
102    CTGradientElement color2;
103    color2.red = color2.green = color2.blue  = 0.754;
104    color2.alpha = 1.00;
105    color2.position = 0.5;
106   
107    CTGradientElement color3;
108    color3.red = color3.green = color3.blue  = 0.87;
109    color3.alpha = 1.00;
110    color3.position = 0.5;
111   
112    CTGradientElement color4;
113    color4.red = color4.green = color4.blue  = 0.87;
114    color4.alpha = 1.00;
115    color4.position = 1;
116   
117    [newInstance addElement:&color1];
118    [newInstance addElement:&color2];
119    [newInstance addElement:&color3];
120    [newInstance addElement:&color4];
121   
122    return [newInstance autorelease];
123}
124
125+ (CTGradient *)progressBlueGradient
126{
127    CTGradient *newInstance = [[[self class] alloc] init];
128   
129    CTGradientElement color1;
130    color1.red = 0.416;
131    color1.green = 0.788;
132    color1.blue  = 0.97;
133    color1.alpha = 1.00;
134    color1.position = 0;
135   
136    CTGradientElement color2;
137    color2.red = 0.274;
138    color2.green = 0.52;
139    color2.blue  = 0.94;
140    color2.alpha = 1.00;
141    color2.position = 0.5;
142   
143    CTGradientElement color3;
144    color3.red = 0.372;
145    color3.green = 0.635;
146    color3.blue  = 0.98;
147    color3.alpha = 1.00;
148    color3.position = 0.5;
149   
150    CTGradientElement color4;
151    color4.red = 0.396;
152    color4.green = 0.66;
153    color4.blue  = 1.00;
154    color4.alpha = 1.00;
155    color4.position = 1;
156   
157    [newInstance addElement:&color1];
158    [newInstance addElement:&color2];
159    [newInstance addElement:&color3];
160    [newInstance addElement:&color4];
161   
162    return [newInstance autorelease];
163}
164
165+ (CTGradient *)progressDarkBlueGradient
166{
167    CTGradient *newInstance = [[[self class] alloc] init];
168   
169    CTGradientElement color1;
170    color1.red = 0.616;
171    color1.green = 0.722;
172    color1.blue  = 0.776;
173    color1.alpha = 1.00;
174    color1.position = 0;
175   
176    CTGradientElement color2;
177    color2.red = 0.525;
178    color2.green = 0.631;
179    color2.blue  = 0.737;
180    color2.alpha = 1.00;
181    color2.position = 0.5;
182   
183    CTGradientElement color3;
184    color3.red = 0.651;
185    color3.green = 0.725;
186    color3.blue  = 0.804;
187    color3.alpha = 1.00;
188    color3.position = 0.5;
189   
190    CTGradientElement color4;
191    color4.red = 0.659;
192    color4.green = 0.733;
193    color4.blue  = 0.800;
194    color4.alpha = 1.00;
195    color4.position = 1;
196   
197    [newInstance addElement:&color1];
198    [newInstance addElement:&color2];
199    [newInstance addElement:&color3];
200    [newInstance addElement:&color4];
201   
202    return [newInstance autorelease];
203}
204
205+ (CTGradient *)progressGreenGradient
206{
207    CTGradient *newInstance = [[[self class] alloc] init];
208   
209    CTGradientElement color1;
210    color1.red = 0.270;
211    color1.green = 0.89;
212    color1.blue  = 0.35;
213    color1.alpha = 1.00;
214    color1.position = 0;
215   
216    CTGradientElement color2;
217    color2.red = 0.180;
218    color2.green = 0.71;
219    color2.blue  = 0.23;
220    color2.alpha = 1.00;
221    color2.position = 0.5;
222   
223    CTGradientElement color3;
224    color3.red = 0.420;
225    color3.green = 0.86;
226    color3.blue  = 0.32;
227    color3.alpha = 1.00;
228    color3.position = 0.5;
229   
230    CTGradientElement color4;
231    color4.red = 0.466;
232    color4.green = 0.89;
233    color4.blue  = 0.34;
234    color4.alpha = 1.00;
235    color4.position = 1;
236   
237    [newInstance addElement:&color1];
238    [newInstance addElement:&color2];
239    [newInstance addElement:&color3];
240    [newInstance addElement:&color4];
241   
242    return [newInstance autorelease];
243}
244
245+ (CTGradient *)progressLightGreenGradient
246{
247    CTGradient *newInstance = [[[self class] alloc] init];
248   
249    CTGradientElement color1;
250    color1.red = 0.522;
251    color1.green = 0.894;
252    color1.blue  = 0.565;
253    color1.alpha = 1.00;
254    color1.position = 0;
255   
256    CTGradientElement color2;
257    color2.red = 0.373;
258    color2.green = 0.780;
259    color2.blue  = 0.408;
260    color2.alpha = 1.00;
261    color2.position = 0.5;
262   
263    CTGradientElement color3;
264    color3.red = 0.659;
265    color3.green = 0.918;
266    color3.blue  = 0.604;
267    color3.alpha = 1.00;
268    color3.position = 0.5;
269   
270    CTGradientElement color4;
271    color4.red = 0.678;
272    color4.green = 0.929;
273    color4.blue  = 0.608;
274    color4.alpha = 1.00;
275    color4.position = 1;
276   
277    [newInstance addElement:&color1];
278    [newInstance addElement:&color2];
279    [newInstance addElement:&color3];
280    [newInstance addElement:&color4];
281   
282    return [newInstance autorelease];
283}
284
285+ (CTGradient *)progressDarkGreenGradient
286{
287    CTGradient *newInstance = [[[self class] alloc] init];
288   
289    CTGradientElement color1;
290    color1.red = 0.627;
291    color1.green = 0.714;
292    color1.blue  = 0.639;
293    color1.alpha = 1.00;
294    color1.position = 0;
295   
296    CTGradientElement color2;
297    color2.red = 0.545;
298    color2.green = 0.635;
299    color2.blue  = 0.561;
300    color2.alpha = 1.00;
301    color2.position = 0.5;
302   
303    CTGradientElement color3;
304    color3.red = 0.690;
305    color3.green = 0.745;
306    color3.blue  = 0.675;
307    color3.alpha = 1.00;
308    color3.position = 0.5;
309   
310    CTGradientElement color4;
311    color4.red = 0.694;
312    color4.green = 0.741;
313    color4.blue  = 0.678;
314    color4.alpha = 1.00;
315    color4.position = 1;
316   
317    [newInstance addElement:&color1];
318    [newInstance addElement:&color2];
319    [newInstance addElement:&color3];
320    [newInstance addElement:&color4];
321   
322    return [newInstance autorelease];
323}
324
325+ (CTGradient *)progressRedGradient
326{
327    CTGradient *newInstance = [[[self class] alloc] init];
328   
329        CTGradientElement color1;
330    color1.red = 0.9;
331        color1.green = color1.blue  = 0.5;
332    color1.alpha = 1.00;
333    color1.position = 0;
334   
335    CTGradientElement color2;
336    color2.red = 0.9;
337        color2.green = color2.blue  = 0.4;
338    color2.alpha = 1.00;
339    color2.position = 0.5;
340   
341    CTGradientElement color3;
342    color3.red = 0.9;
343        color3.green = color3.blue  = 0.5;
344    color3.alpha = 1.00;
345    color3.position = 0.5;
346   
347    CTGradientElement color4;
348    color4.red = 0.9;
349        color4.green = color4.blue  = 0.5;
350    color4.alpha = 1.00;
351    color4.position = 1;
352   
353    [newInstance addElement:&color1];
354    [newInstance addElement:&color2];
355    [newInstance addElement:&color3];
356    [newInstance addElement:&color4];
357   
358    return [newInstance autorelease];
359
360}
361
362+ (CTGradient *)progressYellowGradient
363{
364    CTGradient *newInstance = [[[self class] alloc] init];
365   
366    CTGradientElement color1;
367    color1.red = 0.933;
368    color1.green = 0.831;
369    color1.blue  = 0.227;
370    color1.alpha = 1.00;
371    color1.position = 1;
372   
373    CTGradientElement color2;
374    color2.red = 0.965;
375    color2.green = 0.737;
376    color2.blue  = 0.086;
377    color2.alpha = 1.00;
378    color2.position = 0.5;
379   
380    CTGradientElement color3;
381    color3.red = 0.965;
382    color3.green = 0.831;
383    color3.blue  = 0.169;
384    color3.alpha = 1.00;
385    color3.position = 0.5;
386   
387    CTGradientElement color4;
388    color4.red = 0.965;
389    color4.green = 0.831;
390    color4.blue  = 0.169;
391    color4.alpha = 1.00;
392    color4.position = 0;
393   
394    [newInstance addElement:&color1];
395    [newInstance addElement:&color2];
396    [newInstance addElement:&color3];
397    [newInstance addElement:&color4];
398   
399    return [newInstance autorelease];
400}
401
402@end
Note: See TracBrowser for help on using the repository browser.