KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > java > swing > plaf > nimbus > SliderSliderThumbPainter


1 /*
2  * SliderSliderThumbPainter.java %E%
3  *
4  * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7 package com.sun.java.swing.plaf.nimbus;
8
9 import java.awt.*;
10 import java.awt.geom.*;
11 import java.awt.image.*;
12 import javax.swing.*;
13 import com.sun.java.swing.Painter;
14
15 /**
16  */

17 public final class SliderSliderThumbPainter extends AbstractRegionPainter {
18     //package private integers representing the available states that
19
//this painter will paint. These are used when creating a new instance
20
//of SliderSliderThumbPainter to determine which region/state is being painted
21
//by that instance.
22
static final int BACKGROUND_DISABLED = 1;
23     static final int BACKGROUND_ENABLED = 2;
24     static final int BACKGROUND_FOCUSED = 3;
25     static final int BACKGROUND_FOCUSED_MOUSEOVER = 4;
26     static final int BACKGROUND_FOCUSED_PRESSED = 5;
27     static final int BACKGROUND_MOUSEOVER = 6;
28     static final int BACKGROUND_PRESSED = 7;
29     static final int BACKGROUND_ENABLED_ARROWSHAPE = 8;
30     static final int BACKGROUND_DISABLED_ARROWSHAPE = 9;
31     static final int BACKGROUND_MOUSEOVER_ARROWSHAPE = 10;
32     static final int BACKGROUND_PRESSED_ARROWSHAPE = 11;
33     static final int BACKGROUND_FOCUSED_ARROWSHAPE = 12;
34     static final int BACKGROUND_FOCUSED_MOUSEOVER_ARROWSHAPE = 13;
35     static final int BACKGROUND_FOCUSED_PRESSED_ARROWSHAPE = 14;
36
37
38     private int state; //refers to one of the static final ints above
39
private PaintContext ctx;
40
41     //the following 4 variables are reused during the painting code of the layers
42
private Path2D path = new Path2D.Float();
43     private Rectangle2D rect = new Rectangle2D.Float(0, 0, 0, 0);
44     private RoundRectangle2D roundRect = new RoundRectangle2D.Float(0, 0, 0, 0, 0, 0);
45     private Ellipse2D ellipse = new Ellipse2D.Float(0, 0, 0, 0);
46
47     //All Colors used for painting are stored here. Ideally, only those colors being used
48
//by a particular instance of SliderSliderThumbPainter would be created. For the moment at least,
49
//however, all are created for each instance.
50
private Color color1 = decodeColor("nimbusBase", 0.021348298f, -0.5625436f, 0.25490195f, 0);
51     private Color color2 = decodeColor("nimbusBase", 0.015098333f, -0.55105823f, 0.19215685f, 0);
52     private Color color3 = decodeColor("nimbusBase", 0.021348298f, -0.5924243f, 0.35686272f, 0);
53     private Color color4 = decodeColor("nimbusBase", 0.021348298f, -0.56722116f, 0.3098039f, 0);
54     private Color color5 = decodeColor("nimbusBase", 0.021348298f, -0.56844974f, 0.32549018f, 0);
55     private Color color6 = decodeColor("nimbusBlueGrey", -0.003968239f, 0.0014736876f, -0.25490198f, -156);
56     private Color color7 = decodeColor("nimbusBase", 5.1498413E-4f, -0.34585923f, -0.007843137f, 0);
57     private Color color8 = decodeColor("nimbusBase", -0.0017285943f, -0.11571431f, -0.25490198f, 0);
58     private Color color9 = decodeColor("nimbusBase", -0.023096085f, -0.6238095f, 0.43921566f, 0);
59     private Color color10 = decodeColor("nimbusBase", 5.1498413E-4f, -0.43866998f, 0.24705881f, 0);
60     private Color color11 = decodeColor("nimbusBase", 5.1498413E-4f, -0.45714286f, 0.32941175f, 0);
61     private Color color12 = decodeColor("nimbusFocus", 0.0f, 0.0f, 0.0f, 0);
62     private Color color13 = decodeColor("nimbusBase", -0.0038217902f, -0.15532213f, -0.14901963f, 0);
63     private Color color14 = decodeColor("nimbusBase", -0.57865167f, -0.6357143f, -0.54509807f, 0);
64     private Color color15 = decodeColor("nimbusBase", 0.004681647f, -0.62780917f, 0.44313723f, 0);
65     private Color color16 = decodeColor("nimbusBase", 2.9569864E-4f, -0.4653107f, 0.32549018f, 0);
66     private Color color17 = decodeColor("nimbusBase", 5.1498413E-4f, -0.4563421f, 0.32549018f, 0);
67     private Color color18 = decodeColor("nimbusBase", -0.0017285943f, -0.4732143f, 0.39215684f, 0);
68     private Color color19 = decodeColor("nimbusBase", 0.0015952587f, -0.04875779f, -0.18823531f, 0);
69     private Color color20 = decodeColor("nimbusBase", 2.9569864E-4f, -0.44943976f, 0.25098038f, 0);
70     private Color color21 = decodeColor("nimbusBase", 0.0f, 0.0f, 0.0f, 0);
71     private Color color22 = decodeColor("nimbusBase", 8.9377165E-4f, -0.121094406f, 0.12156862f, 0);
72     private Color color23 = decodeColor("nimbusBlueGrey", 0.0f, -0.110526316f, 0.25490195f, -121);
73     private Color color24 = new Color(150, 156, 168, 146);
74     private Color color25 = decodeColor("nimbusBase", -0.0033828616f, -0.40608466f, -0.019607842f, 0);
75     private Color color26 = decodeColor("nimbusBase", 5.1498413E-4f, -0.17594418f, -0.20784315f, 0);
76     private Color color27 = decodeColor("nimbusBase", 0.0023007393f, -0.11332625f, -0.28627452f, 0);
77     private Color color28 = decodeColor("nimbusBase", -0.023096085f, -0.62376213f, 0.4352941f, 0);
78     private Color color29 = decodeColor("nimbusBase", 0.004681647f, -0.594392f, 0.39999998f, 0);
79     private Color color30 = decodeColor("nimbusBase", -0.0017285943f, -0.4454704f, 0.25490195f, 0);
80     private Color color31 = decodeColor("nimbusBase", 5.1498413E-4f, -0.4625541f, 0.35686272f, 0);
81     private Color color32 = decodeColor("nimbusBase", 5.1498413E-4f, -0.47442397f, 0.4235294f, 0);
82
83
84     //Array of current component colors, updated in each paint call
85
private Object JavaDoc[] componentColors;
86
87     public SliderSliderThumbPainter(PaintContext ctx, int state) {
88         super();
89         this.state = state;
90         this.ctx = ctx;
91     }
92
93     @Override JavaDoc
94     protected void doPaint(Graphics2D g, JComponent c, int width, int height, Object JavaDoc[] extendedCacheKeys) {
95         //populate componentColors array with colors calculated in getExtendedCacheKeys call
96
componentColors = extendedCacheKeys;
97         //generate this entire method. Each state/bg/fg/border combo that has
98
//been painted gets its own KEY and paint method.
99
switch(state) {
100             case BACKGROUND_DISABLED: paintBackgroundDisabled(g); break;
101             case BACKGROUND_ENABLED: paintBackgroundEnabled(g); break;
102             case BACKGROUND_FOCUSED: paintBackgroundFocused(g); break;
103             case BACKGROUND_FOCUSED_MOUSEOVER: paintBackgroundFocusedAndMouseOver(g); break;
104             case BACKGROUND_FOCUSED_PRESSED: paintBackgroundFocusedAndPressed(g); break;
105             case BACKGROUND_MOUSEOVER: paintBackgroundMouseOver(g); break;
106             case BACKGROUND_PRESSED: paintBackgroundPressed(g); break;
107             case BACKGROUND_ENABLED_ARROWSHAPE: paintBackgroundEnabledAndArrowShape(g); break;
108             case BACKGROUND_DISABLED_ARROWSHAPE: paintBackgroundDisabledAndArrowShape(g); break;
109             case BACKGROUND_MOUSEOVER_ARROWSHAPE: paintBackgroundMouseOverAndArrowShape(g); break;
110             case BACKGROUND_PRESSED_ARROWSHAPE: paintBackgroundPressedAndArrowShape(g); break;
111             case BACKGROUND_FOCUSED_ARROWSHAPE: paintBackgroundFocusedAndArrowShape(g); break;
112             case BACKGROUND_FOCUSED_MOUSEOVER_ARROWSHAPE: paintBackgroundFocusedAndMouseOverAndArrowShape(g); break;
113             case BACKGROUND_FOCUSED_PRESSED_ARROWSHAPE: paintBackgroundFocusedAndPressedAndArrowShape(g); break;
114
115         }
116     }
117         
118
119
120     @Override JavaDoc
121     protected final PaintContext getPaintContext() {
122         return ctx;
123     }
124
125     private void paintBackgroundDisabled(Graphics2D g) {
126         ellipse = decodeEllipse1();
127         g.setPaint(decodeGradient1(ellipse));
128         g.fill(ellipse);
129         ellipse = decodeEllipse2();
130         g.setPaint(decodeGradient2(ellipse));
131         g.fill(ellipse);
132
133     }
134
135     private void paintBackgroundEnabled(Graphics2D g) {
136         ellipse = decodeEllipse3();
137         g.setPaint(color6);
138         g.fill(ellipse);
139         ellipse = decodeEllipse1();
140         g.setPaint(decodeGradient3(ellipse));
141         g.fill(ellipse);
142         ellipse = decodeEllipse2();
143         g.setPaint(decodeGradient4(ellipse));
144         g.fill(ellipse);
145
146     }
147
148     private void paintBackgroundFocused(Graphics2D g) {
149         ellipse = decodeEllipse4();
150         g.setPaint(color12);
151         g.fill(ellipse);
152         ellipse = decodeEllipse1();
153         g.setPaint(decodeGradient3(ellipse));
154         g.fill(ellipse);
155         ellipse = decodeEllipse2();
156         g.setPaint(decodeGradient4(ellipse));
157         g.fill(ellipse);
158
159     }
160
161     private void paintBackgroundFocusedAndMouseOver(Graphics2D g) {
162         ellipse = decodeEllipse4();
163         g.setPaint(color12);
164         g.fill(ellipse);
165         ellipse = decodeEllipse1();
166         g.setPaint(decodeGradient5(ellipse));
167         g.fill(ellipse);
168         ellipse = decodeEllipse2();
169         g.setPaint(decodeGradient6(ellipse));
170         g.fill(ellipse);
171
172     }
173
174     private void paintBackgroundFocusedAndPressed(Graphics2D g) {
175         ellipse = decodeEllipse4();
176         g.setPaint(color12);
177         g.fill(ellipse);
178         ellipse = decodeEllipse1();
179         g.setPaint(decodeGradient7(ellipse));
180         g.fill(ellipse);
181         ellipse = decodeEllipse2();
182         g.setPaint(decodeGradient8(ellipse));
183         g.fill(ellipse);
184
185     }
186
187     private void paintBackgroundMouseOver(Graphics2D g) {
188         ellipse = decodeEllipse3();
189         g.setPaint(color6);
190         g.fill(ellipse);
191         ellipse = decodeEllipse1();
192         g.setPaint(decodeGradient5(ellipse));
193         g.fill(ellipse);
194         ellipse = decodeEllipse2();
195         g.setPaint(decodeGradient6(ellipse));
196         g.fill(ellipse);
197
198     }
199
200     private void paintBackgroundPressed(Graphics2D g) {
201         ellipse = decodeEllipse3();
202         g.setPaint(color23);
203         g.fill(ellipse);
204         ellipse = decodeEllipse1();
205         g.setPaint(decodeGradient7(ellipse));
206         g.fill(ellipse);
207         ellipse = decodeEllipse2();
208         g.setPaint(decodeGradient8(ellipse));
209         g.fill(ellipse);
210
211     }
212
213     private void paintBackgroundEnabledAndArrowShape(Graphics2D g) {
214         path = decodePath1();
215         g.setPaint(color24);
216         g.fill(path);
217         path = decodePath2();
218         g.setPaint(decodeGradient9(path));
219         g.fill(path);
220         path = decodePath3();
221         g.setPaint(decodeGradient10(path));
222         g.fill(path);
223
224     }
225
226     private void paintBackgroundDisabledAndArrowShape(Graphics2D g) {
227         path = decodePath2();
228         g.setPaint(decodeGradient11(path));
229         g.fill(path);
230         path = decodePath3();
231         g.setPaint(decodeGradient12(path));
232         g.fill(path);
233
234     }
235
236     private void paintBackgroundMouseOverAndArrowShape(Graphics2D g) {
237         path = decodePath1();
238         g.setPaint(color24);
239         g.fill(path);
240         path = decodePath2();
241         g.setPaint(decodeGradient13(path));
242         g.fill(path);
243         path = decodePath3();
244         g.setPaint(decodeGradient14(path));
245         g.fill(path);
246
247     }
248
249     private void paintBackgroundPressedAndArrowShape(Graphics2D g) {
250         path = decodePath1();
251         g.setPaint(color24);
252         g.fill(path);
253         path = decodePath2();
254         g.setPaint(decodeGradient15(path));
255         g.fill(path);
256         path = decodePath3();
257         g.setPaint(decodeGradient16(path));
258         g.fill(path);
259
260     }
261
262     private void paintBackgroundFocusedAndArrowShape(Graphics2D g) {
263         path = decodePath4();
264         g.setPaint(color12);
265         g.fill(path);
266         path = decodePath2();
267         g.setPaint(decodeGradient9(path));
268         g.fill(path);
269         path = decodePath3();
270         g.setPaint(decodeGradient17(path));
271         g.fill(path);
272
273     }
274
275     private void paintBackgroundFocusedAndMouseOverAndArrowShape(Graphics2D g) {
276         path = decodePath4();
277         g.setPaint(color12);
278         g.fill(path);
279         path = decodePath2();
280         g.setPaint(decodeGradient13(path));
281         g.fill(path);
282         path = decodePath3();
283         g.setPaint(decodeGradient14(path));
284         g.fill(path);
285
286     }
287
288     private void paintBackgroundFocusedAndPressedAndArrowShape(Graphics2D g) {
289         path = decodePath4();
290         g.setPaint(color12);
291         g.fill(path);
292         path = decodePath2();
293         g.setPaint(decodeGradient15(path));
294         g.fill(path);
295         path = decodePath3();
296         g.setPaint(decodeGradient16(path));
297         g.fill(path);
298
299     }
300
301
302
303     private Ellipse2D decodeEllipse1() {
304         ellipse.setFrame(decodeX(0.4f), //x
305
decodeY(0.4f), //y
306
decodeX(2.6f) - decodeX(0.4f), //width
307
decodeY(2.6f) - decodeY(0.4f)); //height
308
return ellipse;
309     }
310
311     private Ellipse2D decodeEllipse2() {
312         ellipse.setFrame(decodeX(0.6f), //x
313
decodeY(0.6f), //y
314
decodeX(2.4f) - decodeX(0.6f), //width
315
decodeY(2.4f) - decodeY(0.6f)); //height
316
return ellipse;
317     }
318
319     private Ellipse2D decodeEllipse3() {
320         ellipse.setFrame(decodeX(0.4f), //x
321
decodeY(0.6f), //y
322
decodeX(2.6f) - decodeX(0.4f), //width
323
decodeY(2.8f) - decodeY(0.6f)); //height
324
return ellipse;
325     }
326
327     private Ellipse2D decodeEllipse4() {
328         ellipse.setFrame(decodeX(0.120000005f), //x
329
decodeY(0.120000005f), //y
330
decodeX(2.8799999f) - decodeX(0.120000005f), //width
331
decodeY(2.8799999f) - decodeY(0.120000005f)); //height
332
return ellipse;
333     }
334
335     private Path2D decodePath1() {
336         path.reset();
337         path.moveTo(decodeX(0.8166667f), decodeY(0.5007576f));
338         path.curveTo(decodeAnchorX(0.8166667222976685f, 1.5643268796105616f), decodeAnchorY(0.5007575750350952f, -0.309751314021121f), decodeAnchorX(2.7925455570220947f, 0.058173584548962154f), decodeAnchorY(1.6116883754730225f, -0.46476349119779314f), decodeX(2.7925456f), decodeY(1.6116884f));
339         path.curveTo(decodeAnchorX(2.7925455570220947f, -0.34086855855797005f), decodeAnchorY(1.6116883754730225f, 2.723285191092547f), decodeAnchorX(0.7006363868713379f, 4.56812791706229f), decodeAnchorY(2.7693636417388916f, -0.006014915148298883f), decodeX(0.7006364f), decodeY(2.7693636f));
340         path.curveTo(decodeAnchorX(0.7006363868713379f, -3.523395559100149f), decodeAnchorY(2.7693636417388916f, 0.004639302074426865f), decodeAnchorX(0.8166667222976685f, -1.8635255186676325f), decodeAnchorY(0.5007575750350952f, 0.3689954354443423f), decodeX(0.8166667f), decodeY(0.5007576f));
341         path.closePath();
342         return path;
343     }
344
345     private Path2D decodePath2() {
346         path.reset();
347         path.moveTo(decodeX(0.6155303f), decodeY(2.5954547f));
348         path.curveTo(decodeAnchorX(0.6155303120613098f, 0.9098089454358838f), decodeAnchorY(2.595454692840576f, 1.3154241785830862f), decodeAnchorX(2.6151516437530518f, 0.014588808096503314f), decodeAnchorY(1.611201286315918f, 0.9295520709665155f), decodeX(2.6151516f), decodeY(1.6112013f));
349         path.curveTo(decodeAnchorX(2.6151516437530518f, -0.013655180248463239f), decodeAnchorY(1.611201286315918f, -0.8700642982905453f), decodeAnchorX(0.6092391610145569f, 0.9729934749047704f), decodeAnchorY(0.4071640372276306f, -1.424864396720248f), decodeX(0.60923916f), decodeY(0.40716404f));
350         path.curveTo(decodeAnchorX(0.6092391610145569f, -0.7485208875763871f), decodeAnchorY(0.4071640372276306f, 1.0961437978948614f), decodeAnchorX(0.6155303120613098f, -0.7499879392488253f), decodeAnchorY(2.595454692840576f, -1.0843510320300886f), decodeX(0.6155303f), decodeY(2.5954547f));
351         path.closePath();
352         return path;
353     }
354
355     private Path2D decodePath3() {
356         path.reset();
357         path.moveTo(decodeX(0.8055606f), decodeY(0.6009697f));
358         path.curveTo(decodeAnchorX(0.8055605888366699f, 0.508208945236218f), decodeAnchorY(0.600969672203064f, -0.8490880998025481f), decodeAnchorX(2.3692727088928223f, 0.0031846066137877216f), decodeAnchorY(1.613116979598999f, -0.6066882577419275f), decodeX(2.3692727f), decodeY(1.613117f));
359         path.curveTo(decodeAnchorX(2.3692727088928223f, -0.0038901961210928704f), decodeAnchorY(1.613116979598999f, 0.7411076447438294f), decodeAnchorX(0.7945454716682434f, 0.38709738141524763f), decodeAnchorY(2.393272876739502f, 1.240782009971129f), decodeX(0.7945455f), decodeY(2.3932729f));
360         path.curveTo(decodeAnchorX(0.7945454716682434f, -0.3863658307342148f), decodeAnchorY(2.393272876739502f, -1.2384371350947134f), decodeAnchorX(0.8055605888366699f, -0.9951540091537732f), decodeAnchorY(0.600969672203064f, 1.6626496533832493f), decodeX(0.8055606f), decodeY(0.6009697f));
361         path.closePath();
362         return path;
363     }
364
365     private Path2D decodePath4() {
366         path.reset();
367         path.moveTo(decodeX(0.60059524f), decodeY(0.11727543f));
368         path.curveTo(decodeAnchorX(0.600595235824585f, 1.5643268796105612f), decodeAnchorY(0.1172754317522049f, -0.3097513140211208f), decodeAnchorX(2.7925455570220947f, 0.004405844009975013f), decodeAnchorY(1.6116883754730225f, -1.1881161542467655f), decodeX(2.7925456f), decodeY(1.6116884f));
369         path.curveTo(decodeAnchorX(2.7925455570220947f, -0.007364540661274788f), decodeAnchorY(1.6116883754730225f, 1.9859826422490698f), decodeAnchorX(0.7006363868713379f, 2.7716863466452586f), decodeAnchorY(2.869363784790039f, -0.008974581987587271f), decodeX(0.7006364f), decodeY(2.8693638f));
370         path.curveTo(decodeAnchorX(0.7006363868713379f, -3.75489914400509f), decodeAnchorY(2.869363784790039f, 0.012158175929172899f), decodeAnchorX(0.600595235824585f, -1.8635255186676323f), decodeAnchorY(0.1172754317522049f, 0.3689954354443423f), decodeX(0.60059524f), decodeY(0.11727543f));
371         path.closePath();
372         return path;
373     }
374
375
376
377     private Paint decodeGradient1(Shape s) {
378         Rectangle2D bounds = s.getBounds2D();
379         float x = (float)bounds.getX();
380         float y = (float)bounds.getY();
381         float w = (float)bounds.getWidth();
382         float h = (float)bounds.getHeight();
383         return decodeGradient((0.5106101f * w) + x, (-4.553649E-18f * h) + y, (0.49933687f * w) + x, (1.0039787f * h) + y,
384                 new float[] { 0.0f,0.5f,1.0f },
385                 new Color[] { color1,
386                             decodeColor(color1,color2,0.5f),
387                             color2});
388     }
389
390     private Paint decodeGradient2(Shape s) {
391         Rectangle2D bounds = s.getBounds2D();
392         float x = (float)bounds.getX();
393         float y = (float)bounds.getY();
394         float w = (float)bounds.getWidth();
395         float h = (float)bounds.getHeight();
396         return decodeGradient((0.5023511f * w) + x, (0.0015673981f * h) + y, (0.5023511f * w) + x, (1.0f * h) + y,
397                 new float[] { 0.0f,0.21256684f,0.42513368f,0.71256685f,1.0f },
398                 new Color[] { color3,
399                             decodeColor(color3,color4,0.5f),
400                             color4,
401                             decodeColor(color4,color5,0.5f),
402                             color5});
403     }
404
405     private Paint decodeGradient3(Shape s) {
406         Rectangle2D bounds = s.getBounds2D();
407         float x = (float)bounds.getX();
408         float y = (float)bounds.getY();
409         float w = (float)bounds.getWidth();
410         float h = (float)bounds.getHeight();
411         return decodeGradient((0.51f * w) + x, (-4.553649E-18f * h) + y, (0.51f * w) + x, (1.0039787f * h) + y,
412                 new float[] { 0.0f,0.5f,1.0f },
413                 new Color[] { color7,
414                             decodeColor(color7,color8,0.5f),
415                             color8});
416     }
417
418     private Paint decodeGradient4(Shape s) {
419         Rectangle2D bounds = s.getBounds2D();
420         float x = (float)bounds.getX();
421         float y = (float)bounds.getY();
422         float w = (float)bounds.getWidth();
423         float h = (float)bounds.getHeight();
424         return decodeGradient((0.5f * w) + x, (0.0015673981f * h) + y, (0.5f * w) + x, (1.0f * h) + y,
425                 new float[] { 0.0f,0.21256684f,0.42513368f,0.56149733f,0.69786096f,0.8489305f,1.0f },
426                 new Color[] { color9,
427                             decodeColor(color9,color10,0.5f),
428                             color10,
429                             decodeColor(color10,color10,0.5f),
430                             color10,
431                             decodeColor(color10,color11,0.5f),
432                             color11});
433     }
434
435     private Paint decodeGradient5(Shape s) {
436         Rectangle2D bounds = s.getBounds2D();
437         float x = (float)bounds.getX();
438         float y = (float)bounds.getY();
439         float w = (float)bounds.getWidth();
440         float h = (float)bounds.getHeight();
441         return decodeGradient((0.5106101f * w) + x, (-4.553649E-18f * h) + y, (0.49933687f * w) + x, (1.0039787f * h) + y,
442                 new float[] { 0.0f,0.5f,1.0f },
443                 new Color[] { color13,
444                             decodeColor(color13,color14,0.5f),
445                             color14});
446     }
447
448     private Paint decodeGradient6(Shape s) {
449         Rectangle2D bounds = s.getBounds2D();
450         float x = (float)bounds.getX();
451         float y = (float)bounds.getY();
452         float w = (float)bounds.getWidth();
453         float h = (float)bounds.getHeight();
454         return decodeGradient((0.5023511f * w) + x, (0.0015673981f * h) + y, (0.5023511f * w) + x, (1.0f * h) + y,
455                 new float[] { 0.0f,0.21256684f,0.42513368f,0.56149733f,0.69786096f,0.8489305f,1.0f },
456                 new Color[] { color15,
457                             decodeColor(color15,color16,0.5f),
458                             color16,
459                             decodeColor(color16,color17,0.5f),
460                             color17,
461                             decodeColor(color17,color18,0.5f),
462                             color18});
463     }
464
465     private Paint decodeGradient7(Shape s) {
466         Rectangle2D bounds = s.getBounds2D();
467         float x = (float)bounds.getX();
468         float y = (float)bounds.getY();
469         float w = (float)bounds.getWidth();
470         float h = (float)bounds.getHeight();
471         return decodeGradient((0.5106101f * w) + x, (-4.553649E-18f * h) + y, (0.49933687f * w) + x, (1.0039787f * h) + y,
472                 new float[] { 0.0f,0.5f,1.0f },
473                 new Color[] { color14,
474                             decodeColor(color14,color19,0.5f),
475                             color19});
476     }
477
478     private Paint decodeGradient8(Shape s) {
479         Rectangle2D bounds = s.getBounds2D();
480         float x = (float)bounds.getX();
481         float y = (float)bounds.getY();
482         float w = (float)bounds.getWidth();
483         float h = (float)bounds.getHeight();
484         return decodeGradient((0.5023511f * w) + x, (0.0015673981f * h) + y, (0.5023511f * w) + x, (1.0f * h) + y,
485                 new float[] { 0.0f,0.23796791f,0.47593582f,0.5360962f,0.5962567f,0.79812837f,1.0f },
486                 new Color[] { color20,
487                             decodeColor(color20,color21,0.5f),
488                             color21,
489                             decodeColor(color21,color21,0.5f),
490                             color21,
491                             decodeColor(color21,color22,0.5f),
492                             color22});
493     }
494
495     private Paint decodeGradient9(Shape s) {
496         Rectangle2D bounds = s.getBounds2D();
497         float x = (float)bounds.getX();
498         float y = (float)bounds.getY();
499         float w = (float)bounds.getWidth();
500         float h = (float)bounds.getHeight();
501         return decodeGradient((0.5f * w) + x, (0.0f * h) + y, (0.5f * w) + x, (1.0f * h) + y,
502                 new float[] { 0.0f,0.24032257f,0.48064515f,0.7403226f,1.0f },
503                 new Color[] { color25,
504                             decodeColor(color25,color26,0.5f),
505                             color26,
506                             decodeColor(color26,color27,0.5f),
507                             color27});
508     }
509
510     private Paint decodeGradient10(Shape s) {
511         Rectangle2D bounds = s.getBounds2D();
512         float x = (float)bounds.getX();
513         float y = (float)bounds.getY();
514         float w = (float)bounds.getWidth();
515         float h = (float)bounds.getHeight();
516         return decodeGradient((0.5f * w) + x, (0.0f * h) + y, (0.5f * w) + x, (1.0f * h) + y,
517                 new float[] { 0.061290324f,0.1016129f,0.14193548f,0.3016129f,0.46129033f,0.5983871f,0.7354839f,0.7935484f,0.8516129f },
518                 new Color[] { color28,
519                             decodeColor(color28,color29,0.5f),
520                             color29,
521                             decodeColor(color29,color30,0.5f),
522                             color30,
523                             decodeColor(color30,color31,0.5f),
524                             color31,
525                             decodeColor(color31,color32,0.5f),
526                             color32});
527     }
528
529     private Paint decodeGradient11(Shape s) {
530         Rectangle2D bounds = s.getBounds2D();
531         float x = (float)bounds.getX();
532         float y = (float)bounds.getY();
533         float w = (float)bounds.getWidth();
534         float h = (float)bounds.getHeight();
535         return decodeGradient((0.5f * w) + x, (0.0f * h) + y, (0.5f * w) + x, (1.0f * h) + y,
536                 new float[] { 0.0f,0.5f,1.0f },
537                 new Color[] { color1,
538                             decodeColor(color1,color2,0.5f),
539                             color2});
540     }
541
542     private Paint decodeGradient12(Shape s) {
543         Rectangle2D bounds = s.getBounds2D();
544         float x = (float)bounds.getX();
545         float y = (float)bounds.getY();
546         float w = (float)bounds.getWidth();
547         float h = (float)bounds.getHeight();
548         return decodeGradient((0.5f * w) + x, (0.0f * h) + y, (0.5f * w) + x, (1.0f * h) + y,
549                 new float[] { 0.0f,0.21256684f,0.42513368f,0.71256685f,1.0f },
550                 new Color[] { color3,
551                             decodeColor(color3,color4,0.5f),
552                             color4,
553                             decodeColor(color4,color5,0.5f),
554                             color5});
555     }
556
557     private Paint decodeGradient13(Shape s) {
558         Rectangle2D bounds = s.getBounds2D();
559         float x = (float)bounds.getX();
560         float y = (float)bounds.getY();
561         float w = (float)bounds.getWidth();
562         float h = (float)bounds.getHeight();
563         return decodeGradient((0.5f * w) + x, (0.0f * h) + y, (0.5f * w) + x, (1.0f * h) + y,
564                 new float[] { 0.0f,0.5f,1.0f },
565                 new Color[] { color13,
566                             decodeColor(color13,color14,0.5f),
567                             color14});
568     }
569
570     private Paint decodeGradient14(Shape s) {
571         Rectangle2D bounds = s.getBounds2D();
572         float x = (float)bounds.getX();
573         float y = (float)bounds.getY();
574         float w = (float)bounds.getWidth();
575         float h = (float)bounds.getHeight();
576         return decodeGradient((0.5f * w) + x, (0.0f * h) + y, (0.5f * w) + x, (1.0f * h) + y,
577                 new float[] { 0.0f,0.21256684f,0.42513368f,0.56149733f,0.69786096f,0.8489305f,1.0f },
578                 new Color[] { color15,
579                             decodeColor(color15,color16,0.5f),
580                             color16,
581                             decodeColor(color16,color17,0.5f),
582                             color17,
583                             decodeColor(color17,color18,0.5f),
584                             color18});
585     }
586
587     private Paint decodeGradient15(Shape s) {
588         Rectangle2D bounds = s.getBounds2D();
589         float x = (float)bounds.getX();
590         float y = (float)bounds.getY();
591         float w = (float)bounds.getWidth();
592         float h = (float)bounds.getHeight();
593         return decodeGradient((0.5f * w) + x, (0.0f * h) + y, (0.5f * w) + x, (1.0f * h) + y,
594                 new float[] { 0.0f,0.5f,1.0f },
595                 new Color[] { color14,
596                             decodeColor(color14,color19,0.5f),
597                             color19});
598     }
599
600     private Paint decodeGradient16(Shape s) {
601         Rectangle2D bounds = s.getBounds2D();
602         float x = (float)bounds.getX();
603         float y = (float)bounds.getY();
604         float w = (float)bounds.getWidth();
605         float h = (float)bounds.getHeight();
606         return decodeGradient((0.5f * w) + x, (0.0f * h) + y, (0.5f * w) + x, (1.0f * h) + y,
607                 new float[] { 0.0f,0.23796791f,0.47593582f,0.5360962f,0.5962567f,0.79812837f,1.0f },
608                 new Color[] { color20,
609                             decodeColor(color20,color21,0.5f),
610                             color21,
611                             decodeColor(color21,color21,0.5f),
612                             color21,
613                             decodeColor(color21,color22,0.5f),
614                             color22});
615     }
616
617     private Paint decodeGradient17(Shape s) {
618         Rectangle2D bounds = s.getBounds2D();
619         float x = (float)bounds.getX();
620         float y = (float)bounds.getY();
621         float w = (float)bounds.getWidth();
622         float h = (float)bounds.getHeight();
623         return decodeGradient((0.4925773f * w) + x, (0.082019866f * h) + y, (0.4925773f * w) + x, (0.91798013f * h) + y,
624                 new float[] { 0.061290324f,0.1016129f,0.14193548f,0.3016129f,0.46129033f,0.5983871f,0.7354839f,0.7935484f,0.8516129f },
625                 new Color[] { color28,
626                             decodeColor(color28,color29,0.5f),
627                             color29,
628                             decodeColor(color29,color30,0.5f),
629                             color30,
630                             decodeColor(color30,color31,0.5f),
631                             color31,
632                             decodeColor(color31,color32,0.5f),
633                             color32});
634     }
635
636
637 }
638
Popular Tags