KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * ComboBoxPainter.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 ComboBoxPainter 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 ComboBoxPainter to determine which region/state is being painted
21
//by that instance.
22
static final int BACKGROUND_DISABLED = 1;
23     static final int BACKGROUND_DISABLED_PRESSED = 2;
24     static final int BACKGROUND_ENABLED = 3;
25     static final int BACKGROUND_FOCUSED = 4;
26     static final int BACKGROUND_MOUSEOVER_FOCUSED = 5;
27     static final int BACKGROUND_MOUSEOVER = 6;
28     static final int BACKGROUND_PRESSED_FOCUSED = 7;
29     static final int BACKGROUND_PRESSED = 8;
30     static final int BACKGROUND_ENABLED_SELECTED = 9;
31     static final int BACKGROUND_DISABLED_EDITABLE = 10;
32     static final int BACKGROUND_ENABLED_EDITABLE = 11;
33     static final int BACKGROUND_FOCUSED_EDITABLE = 12;
34     static final int BACKGROUND_MOUSEOVER_EDITABLE = 13;
35     static final int BACKGROUND_PRESSED_EDITABLE = 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 ComboBoxPainter would be created. For the moment at least,
49
//however, all are created for each instance.
50
private Color color1 = decodeColor("nimbusBlueGrey", -0.6111111f, -0.110526316f, -0.74509805f, -247);
51     private Color color2 = decodeColor("nimbusBase", 0.032459438f, -0.5928571f, 0.2745098f, 0);
52     private Color color3 = decodeColor("nimbusBase", 0.032459438f, -0.590029f, 0.2235294f, 0);
53     private Color color4 = decodeColor("nimbusBase", 0.032459438f, -0.60996324f, 0.36470586f, 0);
54     private Color color5 = decodeColor("nimbusBase", 0.040395975f, -0.60474086f, 0.33725488f, 0);
55     private Color color6 = decodeColor("nimbusBase", 0.032459438f, -0.5953556f, 0.32549018f, 0);
56     private Color color7 = decodeColor("nimbusBase", 0.032459438f, -0.5957143f, 0.3333333f, 0);
57     private Color color8 = decodeColor("nimbusBase", 0.021348298f, -0.56289876f, 0.2588235f, 0);
58     private Color color9 = decodeColor("nimbusBase", 0.010237217f, -0.55799407f, 0.20784312f, 0);
59     private Color color10 = decodeColor("nimbusBase", 0.021348298f, -0.59223604f, 0.35294116f, 0);
60     private Color color11 = decodeColor("nimbusBase", 0.02391243f, -0.5774183f, 0.32549018f, 0);
61     private Color color12 = decodeColor("nimbusBase", 0.021348298f, -0.56722116f, 0.3098039f, 0);
62     private Color color13 = decodeColor("nimbusBase", 0.021348298f, -0.567841f, 0.31764704f, 0);
63     private Color color14 = decodeColor("nimbusBlueGrey", 0.0f, 0.0f, -0.22f, -176);
64     private Color color15 = decodeColor("nimbusBase", 0.032459438f, -0.5787523f, 0.07058823f, 0);
65     private Color color16 = decodeColor("nimbusBase", 0.032459438f, -0.5399696f, -0.18039218f, 0);
66     private Color color17 = decodeColor("nimbusBase", 0.08801502f, -0.63174605f, 0.43921566f, 0);
67     private Color color18 = decodeColor("nimbusBase", 0.040395975f, -0.6054113f, 0.35686272f, 0);
68     private Color color19 = decodeColor("nimbusBase", 0.032459438f, -0.5998577f, 0.4352941f, 0);
69     private Color color20 = decodeColor("nimbusBase", 5.1498413E-4f, -0.34585923f, -0.007843137f, 0);
70     private Color color21 = decodeColor("nimbusBase", 5.1498413E-4f, -0.095173776f, -0.25882354f, 0);
71     private Color color22 = decodeColor("nimbusBase", 0.004681647f, -0.6197143f, 0.43137252f, 0);
72     private Color color23 = decodeColor("nimbusBase", -0.0028941035f, -0.4800539f, 0.28235292f, 0);
73     private Color color24 = decodeColor("nimbusBase", 5.1498413E-4f, -0.43866998f, 0.24705881f, 0);
74     private Color color25 = decodeColor("nimbusBase", 5.1498413E-4f, -0.4625541f, 0.35686272f, 0);
75     private Color color26 = decodeColor("nimbusFocus", 0.0f, 0.0f, 0.0f, 0);
76     private Color color27 = decodeColor("nimbusBase", 0.032459438f, -0.54616207f, -0.02352941f, 0);
77     private Color color28 = decodeColor("nimbusBase", 0.032459438f, -0.41349208f, -0.33725494f, 0);
78     private Color color29 = decodeColor("nimbusBase", 0.08801502f, -0.6317773f, 0.4470588f, 0);
79     private Color color30 = decodeColor("nimbusBase", 0.032459438f, -0.6113241f, 0.41568625f, 0);
80     private Color color31 = decodeColor("nimbusBase", 0.032459438f, -0.5985242f, 0.39999998f, 0);
81     private Color color32 = decodeColor("nimbusBase", 0.0f, -0.6357143f, 0.45098037f, 0);
82     private Color color33 = decodeColor("nimbusBase", 0.0013483167f, -0.1769987f, -0.12156865f, 0);
83     private Color color34 = decodeColor("nimbusBase", 0.059279382f, 0.3642857f, -0.43529415f, 0);
84     private Color color35 = decodeColor("nimbusBase", 0.004681647f, -0.6198413f, 0.43921566f, 0);
85     private Color color36 = decodeColor("nimbusBase", -8.738637E-4f, -0.50527954f, 0.35294116f, 0);
86     private Color color37 = decodeColor("nimbusBase", 5.1498413E-4f, -0.4555341f, 0.3215686f, 0);
87     private Color color38 = decodeColor("nimbusBase", 5.1498413E-4f, -0.4757143f, 0.43137252f, 0);
88     private Color color39 = decodeColor("nimbusBase", 0.08801502f, 0.3642857f, -0.52156866f, 0);
89     private Color color40 = decodeColor("nimbusBase", 0.032459438f, -0.5246032f, -0.12549022f, 0);
90     private Color color41 = decodeColor("nimbusBase", 0.027408898f, -0.5847884f, 0.2980392f, 0);
91     private Color color42 = decodeColor("nimbusBase", 0.026611507f, -0.53623784f, 0.19999999f, 0);
92     private Color color43 = decodeColor("nimbusBase", 0.029681683f, -0.52701867f, 0.17254901f, 0);
93     private Color color44 = decodeColor("nimbusBase", 0.03801495f, -0.5456242f, 0.3215686f, 0);
94     private Color color45 = decodeColor("nimbusBase", -0.57865167f, -0.6357143f, -0.54901963f, 0);
95     private Color color46 = decodeColor("nimbusBase", -3.528595E-5f, 0.018606722f, -0.23137257f, 0);
96     private Color color47 = decodeColor("nimbusBase", -4.2033195E-4f, -0.38050595f, 0.20392156f, 0);
97     private Color color48 = decodeColor("nimbusBase", 4.081726E-4f, -0.12922078f, 0.054901958f, 0);
98     private Color color49 = decodeColor("nimbusBase", 0.0f, -0.00895375f, 0.007843137f, 0);
99     private Color color50 = decodeColor("nimbusBase", -0.0015907288f, -0.1436508f, 0.19215685f, 0);
100     private Color color51 = decodeColor("nimbusBlueGrey", 0.0f, -0.110526316f, 0.25490195f, -83);
101     private Color color52 = decodeColor("nimbusBlueGrey", 0.0f, -0.110526316f, 0.25490195f, -88);
102     private Color color53 = decodeColor("nimbusBlueGrey", 0.0f, -0.005263157f, -0.52156866f, -191);
103
104
105     //Array of current component colors, updated in each paint call
106
private Object JavaDoc[] componentColors;
107
108     public ComboBoxPainter(PaintContext ctx, int state) {
109         super();
110         this.state = state;
111         this.ctx = ctx;
112     }
113
114     @Override JavaDoc
115     protected void doPaint(Graphics2D g, JComponent c, int width, int height, Object JavaDoc[] extendedCacheKeys) {
116         //populate componentColors array with colors calculated in getExtendedCacheKeys call
117
componentColors = extendedCacheKeys;
118         //generate this entire method. Each state/bg/fg/border combo that has
119
//been painted gets its own KEY and paint method.
120
switch(state) {
121             case BACKGROUND_DISABLED: paintBackgroundDisabled(g); break;
122             case BACKGROUND_DISABLED_PRESSED: paintBackgroundDisabledAndPressed(g); break;
123             case BACKGROUND_ENABLED: paintBackgroundEnabled(g); break;
124             case BACKGROUND_FOCUSED: paintBackgroundFocused(g); break;
125             case BACKGROUND_MOUSEOVER_FOCUSED: paintBackgroundMouseOverAndFocused(g); break;
126             case BACKGROUND_MOUSEOVER: paintBackgroundMouseOver(g); break;
127             case BACKGROUND_PRESSED_FOCUSED: paintBackgroundPressedAndFocused(g); break;
128             case BACKGROUND_PRESSED: paintBackgroundPressed(g); break;
129             case BACKGROUND_ENABLED_SELECTED: paintBackgroundEnabledAndSelected(g); break;
130             case BACKGROUND_DISABLED_EDITABLE: paintBackgroundDisabledAndEditable(g); break;
131             case BACKGROUND_ENABLED_EDITABLE: paintBackgroundEnabledAndEditable(g); break;
132             case BACKGROUND_FOCUSED_EDITABLE: paintBackgroundFocusedAndEditable(g); break;
133             case BACKGROUND_MOUSEOVER_EDITABLE: paintBackgroundMouseOverAndEditable(g); break;
134             case BACKGROUND_PRESSED_EDITABLE: paintBackgroundPressedAndEditable(g); break;
135
136         }
137     }
138         
139     protected Object JavaDoc[] getExtendedCacheKeys(JComponent c) {
140         Object JavaDoc[] extendedCacheKeys = null;
141         switch(state) {
142             case BACKGROUND_ENABLED:
143                 extendedCacheKeys = new Object JavaDoc[] {
144                      getComponentColor(c, "background", color17, -0.63174605f, 0.43921566f, 0),
145                      getComponentColor(c, "background", color18, -0.6054113f, 0.35686272f, 0),
146                      getComponentColor(c, "background", color6, -0.5953556f, 0.32549018f, 0),
147                      getComponentColor(c, "background", color19, -0.5998577f, 0.4352941f, 0),
148                      getComponentColor(c, "background", color22, -0.6197143f, 0.43137252f, 0),
149                      getComponentColor(c, "background", color23, -0.4800539f, 0.28235292f, 0),
150                      getComponentColor(c, "background", color24, -0.43866998f, 0.24705881f, 0),
151                      getComponentColor(c, "background", color25, -0.4625541f, 0.35686272f, 0)};
152                 break;
153             case BACKGROUND_FOCUSED:
154                 extendedCacheKeys = new Object JavaDoc[] {
155                      getComponentColor(c, "background", color17, -0.63174605f, 0.43921566f, 0),
156                      getComponentColor(c, "background", color18, -0.6054113f, 0.35686272f, 0),
157                      getComponentColor(c, "background", color6, -0.5953556f, 0.32549018f, 0),
158                      getComponentColor(c, "background", color19, -0.5998577f, 0.4352941f, 0),
159                      getComponentColor(c, "background", color22, -0.6197143f, 0.43137252f, 0),
160                      getComponentColor(c, "background", color23, -0.4800539f, 0.28235292f, 0),
161                      getComponentColor(c, "background", color24, -0.43866998f, 0.24705881f, 0),
162                      getComponentColor(c, "background", color25, -0.4625541f, 0.35686272f, 0)};
163                 break;
164             case BACKGROUND_MOUSEOVER_FOCUSED:
165                 extendedCacheKeys = new Object JavaDoc[] {
166                      getComponentColor(c, "background", color29, -0.6317773f, 0.4470588f, 0),
167                      getComponentColor(c, "background", color30, -0.6113241f, 0.41568625f, 0),
168                      getComponentColor(c, "background", color31, -0.5985242f, 0.39999998f, 0),
169                      getComponentColor(c, "background", color32, -0.6357143f, 0.45098037f, 0),
170                      getComponentColor(c, "background", color35, -0.6198413f, 0.43921566f, 0),
171                      getComponentColor(c, "background", color36, -0.50527954f, 0.35294116f, 0),
172                      getComponentColor(c, "background", color37, -0.4555341f, 0.3215686f, 0),
173                      getComponentColor(c, "background", color25, -0.4625541f, 0.35686272f, 0),
174                      getComponentColor(c, "background", color38, -0.4757143f, 0.43137252f, 0)};
175                 break;
176             case BACKGROUND_MOUSEOVER:
177                 extendedCacheKeys = new Object JavaDoc[] {
178                      getComponentColor(c, "background", color29, -0.6317773f, 0.4470588f, 0),
179                      getComponentColor(c, "background", color30, -0.6113241f, 0.41568625f, 0),
180                      getComponentColor(c, "background", color31, -0.5985242f, 0.39999998f, 0),
181                      getComponentColor(c, "background", color32, -0.6357143f, 0.45098037f, 0),
182                      getComponentColor(c, "background", color35, -0.6198413f, 0.43921566f, 0),
183                      getComponentColor(c, "background", color36, -0.50527954f, 0.35294116f, 0),
184                      getComponentColor(c, "background", color37, -0.4555341f, 0.3215686f, 0),
185                      getComponentColor(c, "background", color25, -0.4625541f, 0.35686272f, 0),
186                      getComponentColor(c, "background", color38, -0.4757143f, 0.43137252f, 0)};
187                 break;
188             case BACKGROUND_PRESSED_FOCUSED:
189                 extendedCacheKeys = new Object JavaDoc[] {
190                      getComponentColor(c, "background", color41, -0.5847884f, 0.2980392f, 0),
191                      getComponentColor(c, "background", color42, -0.53623784f, 0.19999999f, 0),
192                      getComponentColor(c, "background", color43, -0.52701867f, 0.17254901f, 0),
193                      getComponentColor(c, "background", color44, -0.5456242f, 0.3215686f, 0),
194                      getComponentColor(c, "background", color47, -0.38050595f, 0.20392156f, 0),
195                      getComponentColor(c, "background", color48, -0.12922078f, 0.054901958f, 0),
196                      getComponentColor(c, "background", color49, -0.00895375f, 0.007843137f, 0),
197                      getComponentColor(c, "background", color50, -0.1436508f, 0.19215685f, 0)};
198                 break;
199             case BACKGROUND_PRESSED:
200                 extendedCacheKeys = new Object JavaDoc[] {
201                      getComponentColor(c, "background", color41, -0.5847884f, 0.2980392f, 0),
202                      getComponentColor(c, "background", color42, -0.53623784f, 0.19999999f, 0),
203                      getComponentColor(c, "background", color43, -0.52701867f, 0.17254901f, 0),
204                      getComponentColor(c, "background", color44, -0.5456242f, 0.3215686f, 0),
205                      getComponentColor(c, "background", color47, -0.38050595f, 0.20392156f, 0),
206                      getComponentColor(c, "background", color48, -0.12922078f, 0.054901958f, 0),
207                      getComponentColor(c, "background", color49, -0.00895375f, 0.007843137f, 0),
208                      getComponentColor(c, "background", color50, -0.1436508f, 0.19215685f, 0)};
209                 break;
210             case BACKGROUND_ENABLED_SELECTED:
211                 extendedCacheKeys = new Object JavaDoc[] {
212                      getComponentColor(c, "background", color41, -0.5847884f, 0.2980392f, 0),
213                      getComponentColor(c, "background", color42, -0.53623784f, 0.19999999f, 0),
214                      getComponentColor(c, "background", color43, -0.52701867f, 0.17254901f, 0),
215                      getComponentColor(c, "background", color44, -0.5456242f, 0.3215686f, 0),
216                      getComponentColor(c, "background", color47, -0.38050595f, 0.20392156f, 0),
217                      getComponentColor(c, "background", color48, -0.12922078f, 0.054901958f, 0),
218                      getComponentColor(c, "background", color49, -0.00895375f, 0.007843137f, 0),
219                      getComponentColor(c, "background", color50, -0.1436508f, 0.19215685f, 0)};
220                 break;
221         }
222         return extendedCacheKeys;
223     }
224
225     @Override JavaDoc
226     protected final PaintContext getPaintContext() {
227         return ctx;
228     }
229
230     private void paintBackgroundDisabled(Graphics2D g) {
231         path = decodePath1();
232         g.setPaint(color1);
233         g.fill(path);
234         path = decodePath2();
235         g.setPaint(decodeGradient1(path));
236         g.fill(path);
237         path = decodePath3();
238         g.setPaint(decodeGradient2(path));
239         g.fill(path);
240         path = decodePath4();
241         g.setPaint(decodeGradient3(path));
242         g.fill(path);
243         path = decodePath5();
244         g.setPaint(decodeGradient4(path));
245         g.fill(path);
246
247     }
248
249     private void paintBackgroundDisabledAndPressed(Graphics2D g) {
250         path = decodePath1();
251         g.setPaint(color1);
252         g.fill(path);
253         path = decodePath2();
254         g.setPaint(decodeGradient1(path));
255         g.fill(path);
256         path = decodePath3();
257         g.setPaint(decodeGradient2(path));
258         g.fill(path);
259         path = decodePath4();
260         g.setPaint(decodeGradient3(path));
261         g.fill(path);
262         path = decodePath5();
263         g.setPaint(decodeGradient4(path));
264         g.fill(path);
265
266     }
267
268     private void paintBackgroundEnabled(Graphics2D g) {
269         path = decodePath1();
270         g.setPaint(color14);
271         g.fill(path);
272         path = decodePath2();
273         g.setPaint(decodeGradient5(path));
274         g.fill(path);
275         path = decodePath3();
276         g.setPaint(decodeGradient6(path));
277         g.fill(path);
278         path = decodePath4();
279         g.setPaint(decodeGradient7(path));
280         g.fill(path);
281         path = decodePath5();
282         g.setPaint(decodeGradient8(path));
283         g.fill(path);
284
285     }
286
287     private void paintBackgroundFocused(Graphics2D g) {
288         roundRect = decodeRoundRect1();
289         g.setPaint(color26);
290         g.fill(roundRect);
291         path = decodePath2();
292         g.setPaint(decodeGradient5(path));
293         g.fill(path);
294         path = decodePath3();
295         g.setPaint(decodeGradient6(path));
296         g.fill(path);
297         path = decodePath4();
298         g.setPaint(decodeGradient7(path));
299         g.fill(path);
300         path = decodePath5();
301         g.setPaint(decodeGradient8(path));
302         g.fill(path);
303
304     }
305
306     private void paintBackgroundMouseOverAndFocused(Graphics2D g) {
307         roundRect = decodeRoundRect1();
308         g.setPaint(color26);
309         g.fill(roundRect);
310         path = decodePath2();
311         g.setPaint(decodeGradient9(path));
312         g.fill(path);
313         path = decodePath3();
314         g.setPaint(decodeGradient6(path));
315         g.fill(path);
316         path = decodePath4();
317         g.setPaint(decodeGradient10(path));
318         g.fill(path);
319         path = decodePath5();
320         g.setPaint(decodeGradient8(path));
321         g.fill(path);
322
323     }
324
325     private void paintBackgroundMouseOver(Graphics2D g) {
326         path = decodePath1();
327         g.setPaint(color14);
328         g.fill(path);
329         path = decodePath2();
330         g.setPaint(decodeGradient9(path));
331         g.fill(path);
332         path = decodePath3();
333         g.setPaint(decodeGradient6(path));
334         g.fill(path);
335         path = decodePath4();
336         g.setPaint(decodeGradient10(path));
337         g.fill(path);
338         path = decodePath5();
339         g.setPaint(decodeGradient8(path));
340         g.fill(path);
341
342     }
343
344     private void paintBackgroundPressedAndFocused(Graphics2D g) {
345         roundRect = decodeRoundRect1();
346         g.setPaint(color26);
347         g.fill(roundRect);
348         path = decodePath2();
349         g.setPaint(decodeGradient11(path));
350         g.fill(path);
351         path = decodePath3();
352         g.setPaint(decodeGradient6(path));
353         g.fill(path);
354         path = decodePath4();
355         g.setPaint(decodeGradient12(path));
356         g.fill(path);
357         path = decodePath5();
358         g.setPaint(decodeGradient8(path));
359         g.fill(path);
360
361     }
362
363     private void paintBackgroundPressed(Graphics2D g) {
364         path = decodePath1();
365         g.setPaint(color51);
366         g.fill(path);
367         path = decodePath2();
368         g.setPaint(decodeGradient11(path));
369         g.fill(path);
370         path = decodePath3();
371         g.setPaint(decodeGradient6(path));
372         g.fill(path);
373         path = decodePath4();
374         g.setPaint(decodeGradient12(path));
375         g.fill(path);
376         path = decodePath5();
377         g.setPaint(decodeGradient8(path));
378         g.fill(path);
379
380     }
381
382     private void paintBackgroundEnabledAndSelected(Graphics2D g) {
383         path = decodePath1();
384         g.setPaint(color52);
385         g.fill(path);
386         path = decodePath2();
387         g.setPaint(decodeGradient11(path));
388         g.fill(path);
389         path = decodePath3();
390         g.setPaint(decodeGradient6(path));
391         g.fill(path);
392         path = decodePath4();
393         g.setPaint(decodeGradient12(path));
394         g.fill(path);
395         path = decodePath5();
396         g.setPaint(decodeGradient8(path));
397         g.fill(path);
398
399     }
400
401     private void paintBackgroundDisabledAndEditable(Graphics2D g) {
402         rect = decodeRect1();
403         g.setPaint(color53);
404         g.fill(rect);
405
406     }
407
408     private void paintBackgroundEnabledAndEditable(Graphics2D g) {
409         rect = decodeRect1();
410         g.setPaint(color53);
411         g.fill(rect);
412
413     }
414
415     private void paintBackgroundFocusedAndEditable(Graphics2D g) {
416         path = decodePath6();
417         g.setPaint(color26);
418         g.fill(path);
419
420     }
421
422     private void paintBackgroundMouseOverAndEditable(Graphics2D g) {
423         rect = decodeRect2();
424         g.setPaint(color53);
425         g.fill(rect);
426
427     }
428
429     private void paintBackgroundPressedAndEditable(Graphics2D g) {
430         rect = decodeRect2();
431         g.setPaint(color53);
432         g.fill(rect);
433
434     }
435
436
437
438     private Path2D decodePath1() {
439         path.reset();
440         path.moveTo(decodeX(0.22222222f), decodeY(2.0f));
441         path.lineTo(decodeX(0.22222222f), decodeY(2.25f));
442         path.curveTo(decodeAnchorX(0.2222222238779068f, 0.0f), decodeAnchorY(2.25f, 3.0f), decodeAnchorX(0.7777777910232544f, -3.0f), decodeAnchorY(2.875f, 0.0f), decodeX(0.7777778f), decodeY(2.875f));
443         path.lineTo(decodeX(2.631579f), decodeY(2.875f));
444         path.curveTo(decodeAnchorX(2.6315789222717285f, 3.0f), decodeAnchorY(2.875f, 0.0f), decodeAnchorX(2.8947367668151855f, 0.0f), decodeAnchorY(2.25f, 3.0f), decodeX(2.8947368f), decodeY(2.25f));
445         path.lineTo(decodeX(2.8947368f), decodeY(2.0f));
446         path.lineTo(decodeX(0.22222222f), decodeY(2.0f));
447         path.closePath();
448         return path;
449     }
450
451     private Path2D decodePath2() {
452         path.reset();
453         path.moveTo(decodeX(0.22222222f), decodeY(0.875f));
454         path.lineTo(decodeX(0.22222222f), decodeY(2.125f));
455         path.curveTo(decodeAnchorX(0.2222222238779068f, 0.0f), decodeAnchorY(2.125f, 3.0f), decodeAnchorX(0.7777777910232544f, -3.0f), decodeAnchorY(2.75f, 0.0f), decodeX(0.7777778f), decodeY(2.75f));
456         path.lineTo(decodeX(2.0f), decodeY(2.75f));
457         path.lineTo(decodeX(2.0f), decodeY(0.25f));
458         path.lineTo(decodeX(0.7777778f), decodeY(0.25f));
459         path.curveTo(decodeAnchorX(0.7777777910232544f, -3.0f), decodeAnchorY(0.25f, 0.0f), decodeAnchorX(0.2222222238779068f, 0.0f), decodeAnchorY(0.875f, -3.0f), decodeX(0.22222222f), decodeY(0.875f));
460         path.closePath();
461         return path;
462     }
463
464     private Path2D decodePath3() {
465         path.reset();
466         path.moveTo(decodeX(0.8888889f), decodeY(0.375f));
467         path.lineTo(decodeX(2.0f), decodeY(0.375f));
468         path.lineTo(decodeX(2.0f), decodeY(2.625f));
469         path.lineTo(decodeX(0.8888889f), decodeY(2.625f));
470         path.curveTo(decodeAnchorX(0.8888888955116272f, -4.0f), decodeAnchorY(2.625f, 0.0f), decodeAnchorX(0.3333333432674408f, 0.0f), decodeAnchorY(2.0f, 4.0f), decodeX(0.33333334f), decodeY(2.0f));
471         path.lineTo(decodeX(0.33333334f), decodeY(0.875f));
472         path.curveTo(decodeAnchorX(0.3333333432674408f, 0.0f), decodeAnchorY(0.875f, -3.0f), decodeAnchorX(0.8888888955116272f, -4.0f), decodeAnchorY(0.375f, 0.0f), decodeX(0.8888889f), decodeY(0.375f));
473         path.closePath();
474         return path;
475     }
476
477     private Path2D decodePath4() {
478         path.reset();
479         path.moveTo(decodeX(2.0f), decodeY(0.25f));
480         path.lineTo(decodeX(2.631579f), decodeY(0.25f));
481         path.curveTo(decodeAnchorX(2.6315789222717285f, 3.0f), decodeAnchorY(0.25f, 0.0f), decodeAnchorX(2.8947367668151855f, 0.0f), decodeAnchorY(0.875f, -3.0f), decodeX(2.8947368f), decodeY(0.875f));
482         path.lineTo(decodeX(2.8947368f), decodeY(2.125f));
483         path.curveTo(decodeAnchorX(2.8947367668151855f, 0.0f), decodeAnchorY(2.125f, 3.0f), decodeAnchorX(2.6315789222717285f, 3.0f), decodeAnchorY(2.75f, 0.0f), decodeX(2.631579f), decodeY(2.75f));
484         path.lineTo(decodeX(2.0f), decodeY(2.75f));
485         path.lineTo(decodeX(2.0f), decodeY(0.25f));
486         path.closePath();
487         return path;
488     }
489
490     private Path2D decodePath5() {
491         path.reset();
492         path.moveTo(decodeX(2.0131578f), decodeY(0.375f));
493         path.lineTo(decodeX(2.5789473f), decodeY(0.375f));
494         path.curveTo(decodeAnchorX(2.5789473056793213f, 4.0f), decodeAnchorY(0.375f, 0.0f), decodeAnchorX(2.8421053886413574f, 0.0f), decodeAnchorY(1.0f, -4.0f), decodeX(2.8421054f), decodeY(1.0f));
495         path.lineTo(decodeX(2.8421054f), decodeY(2.0f));
496         path.curveTo(decodeAnchorX(2.8421053886413574f, 0.0f), decodeAnchorY(2.0f, 4.0f), decodeAnchorX(2.5789473056793213f, 4.0f), decodeAnchorY(2.625f, 0.0f), decodeX(2.5789473f), decodeY(2.625f));
497         path.lineTo(decodeX(2.0131578f), decodeY(2.625f));
498         path.lineTo(decodeX(2.0131578f), decodeY(0.375f));
499         path.closePath();
500         return path;
501     }
502
503     private RoundRectangle2D decodeRoundRect1() {
504         roundRect.setRoundRect(decodeX(0.06666667f), //x
505
decodeY(0.075f), //y
506
decodeX(2.9684212f) - decodeX(0.06666667f), //width
507
decodeY(2.925f) - decodeY(0.075f), //height
508
13.0f, 13.0f); //rounding
509
return roundRect;
510     }
511
512     private Rectangle2D decodeRect1() {
513             rect.setRect(decodeX(1.4385965f), //x
514
decodeY(1.4444444f), //y
515
decodeX(1.4385965f) - decodeX(1.4385965f), //width
516
decodeY(1.4444444f) - decodeY(1.4444444f)); //height
517
return rect;
518     }
519
520     private Path2D decodePath6() {
521         path.reset();
522         path.moveTo(decodeX(0.120000005f), decodeY(0.120000005f));
523         path.lineTo(decodeX(1.9954545f), decodeY(0.120000005f));
524         path.curveTo(decodeAnchorX(1.9954545497894287f, 3.0f), decodeAnchorY(0.12000000476837158f, 0.0f), decodeAnchorX(2.8799986839294434f, 0.0f), decodeAnchorY(1.0941176414489746f, -2.9999999999999996f), decodeX(2.8799987f), decodeY(1.0941176f));
525         path.lineTo(decodeX(2.8799987f), decodeY(1.964706f));
526         path.curveTo(decodeAnchorX(2.8799986839294434f, 0.0f), decodeAnchorY(1.9647059440612793f, 3.0f), decodeAnchorX(1.9954545497894287f, 3.0f), decodeAnchorY(2.879999876022339f, 0.0f), decodeX(1.9954545f), decodeY(2.8799999f));
527         path.lineTo(decodeX(0.120000005f), decodeY(2.8799999f));
528         path.lineTo(decodeX(0.120000005f), decodeY(0.120000005f));
529         path.closePath();
530         return path;
531     }
532
533     private Rectangle2D decodeRect2() {
534             rect.setRect(decodeX(1.4385965f), //x
535
decodeY(1.5f), //y
536
decodeX(1.4385965f) - decodeX(1.4385965f), //width
537
decodeY(1.5f) - decodeY(1.5f)); //height
538
return rect;
539     }
540
541
542
543     private Paint decodeGradient1(Shape s) {
544         Rectangle2D bounds = s.getBounds2D();
545         float x = (float)bounds.getX();
546         float y = (float)bounds.getY();
547         float w = (float)bounds.getWidth();
548         float h = (float)bounds.getHeight();
549         return decodeGradient((0.5f * w) + x, (0.0f * h) + y, (0.5f * w) + x, (1.0f * h) + y,
550                 new float[] { 0.0f,0.5f,1.0f },
551                 new Color[] { color2,
552                             decodeColor(color2,color3,0.5f),
553                             color3});
554     }
555
556     private Paint decodeGradient2(Shape s) {
557         Rectangle2D bounds = s.getBounds2D();
558         float x = (float)bounds.getX();
559         float y = (float)bounds.getY();
560         float w = (float)bounds.getWidth();
561         float h = (float)bounds.getHeight();
562         return decodeGradient((0.5f * w) + x, (0.0f * h) + y, (0.5f * w) + x, (1.0f * h) + y,
563                 new float[] { 0.0f,0.2002841f,0.4005682f,0.5326705f,0.66477275f,0.8323864f,1.0f },
564                 new Color[] { color4,
565                             decodeColor(color4,color5,0.5f),
566                             color5,
567                             decodeColor(color5,color6,0.5f),
568                             color6,
569                             decodeColor(color6,color7,0.5f),
570                             color7});
571     }
572
573     private Paint decodeGradient3(Shape s) {
574         Rectangle2D bounds = s.getBounds2D();
575         float x = (float)bounds.getX();
576         float y = (float)bounds.getY();
577         float w = (float)bounds.getWidth();
578         float h = (float)bounds.getHeight();
579         return decodeGradient((0.5f * w) + x, (0.0f * h) + y, (0.5f * w) + x, (1.0f * h) + y,
580                 new float[] { 0.0f,0.5f,1.0f },
581                 new Color[] { color8,
582                             decodeColor(color8,color9,0.5f),
583                             color9});
584     }
585
586     private Paint decodeGradient4(Shape s) {
587         Rectangle2D bounds = s.getBounds2D();
588         float x = (float)bounds.getX();
589         float y = (float)bounds.getY();
590         float w = (float)bounds.getWidth();
591         float h = (float)bounds.getHeight();
592         return decodeGradient((0.5f * w) + x, (0.0f * h) + y, (0.5f * w) + x, (1.0f * h) + y,
593                 new float[] { 0.0f,0.171875f,0.34375f,0.4815341f,0.6193182f,0.8096591f,1.0f },
594                 new Color[] { color10,
595                             decodeColor(color10,color11,0.5f),
596                             color11,
597                             decodeColor(color11,color12,0.5f),
598                             color12,
599                             decodeColor(color12,color13,0.5f),
600                             color13});
601     }
602
603     private Paint decodeGradient5(Shape s) {
604         Rectangle2D bounds = s.getBounds2D();
605         float x = (float)bounds.getX();
606         float y = (float)bounds.getY();
607         float w = (float)bounds.getWidth();
608         float h = (float)bounds.getHeight();
609         return decodeGradient((0.5f * w) + x, (0.0f * h) + y, (0.5f * w) + x, (1.0f * h) + y,
610                 new float[] { 0.0f,0.5f,1.0f },
611                 new Color[] { color15,
612                             decodeColor(color15,color16,0.5f),
613                             color16});
614     }
615
616     private Paint decodeGradient6(Shape s) {
617         Rectangle2D bounds = s.getBounds2D();
618         float x = (float)bounds.getX();
619         float y = (float)bounds.getY();
620         float w = (float)bounds.getWidth();
621         float h = (float)bounds.getHeight();
622         return decodeGradient((0.5f * w) + x, (0.0f * h) + y, (0.5f * w) + x, (1.0f * h) + y,
623                 new float[] { 0.0f,0.2002841f,0.4005682f,0.5326705f,0.66477275f,0.8323864f,1.0f },
624                 new Color[] { (Color)componentColors[0],
625                             decodeColor((Color)componentColors[0],(Color)componentColors[1],0.5f),
626                             (Color)componentColors[1],
627                             decodeColor((Color)componentColors[1],(Color)componentColors[2],0.5f),
628                             (Color)componentColors[2],
629                             decodeColor((Color)componentColors[2],(Color)componentColors[3],0.5f),
630                             (Color)componentColors[3]});
631     }
632
633     private Paint decodeGradient7(Shape s) {
634         Rectangle2D bounds = s.getBounds2D();
635         float x = (float)bounds.getX();
636         float y = (float)bounds.getY();
637         float w = (float)bounds.getWidth();
638         float h = (float)bounds.getHeight();
639         return decodeGradient((0.5f * w) + x, (0.0f * h) + y, (0.5f * w) + x, (1.0f * h) + y,
640                 new float[] { 0.0f,0.5f,1.0f },
641                 new Color[] { color20,
642                             decodeColor(color20,color21,0.5f),
643                             color21});
644     }
645
646     private Paint decodeGradient8(Shape s) {
647         Rectangle2D bounds = s.getBounds2D();
648         float x = (float)bounds.getX();
649         float y = (float)bounds.getY();
650         float w = (float)bounds.getWidth();
651         float h = (float)bounds.getHeight();
652         return decodeGradient((0.5f * w) + x, (0.0f * h) + y, (0.5f * w) + x, (1.0f * h) + y,
653                 new float[] { 0.0f,0.171875f,0.34375f,0.4815341f,0.6193182f,0.8096591f,1.0f },
654                 new Color[] { (Color)componentColors[4],
655                             decodeColor((Color)componentColors[4],(Color)componentColors[5],0.5f),
656                             (Color)componentColors[5],
657                             decodeColor((Color)componentColors[5],(Color)componentColors[6],0.5f),
658                             (Color)componentColors[6],
659                             decodeColor((Color)componentColors[6],(Color)componentColors[7],0.5f),
660                             (Color)componentColors[7]});
661     }
662
663     private Paint decodeGradient9(Shape s) {
664         Rectangle2D bounds = s.getBounds2D();
665         float x = (float)bounds.getX();
666         float y = (float)bounds.getY();
667         float w = (float)bounds.getWidth();
668         float h = (float)bounds.getHeight();
669         return decodeGradient((0.5f * w) + x, (0.0f * h) + y, (0.5f * w) + x, (1.0f * h) + y,
670                 new float[] { 0.0f,0.5f,1.0f },
671                 new Color[] { color27,
672                             decodeColor(color27,color28,0.5f),
673                             color28});
674     }
675
676     private Paint decodeGradient10(Shape s) {
677         Rectangle2D bounds = s.getBounds2D();
678         float x = (float)bounds.getX();
679         float y = (float)bounds.getY();
680         float w = (float)bounds.getWidth();
681         float h = (float)bounds.getHeight();
682         return decodeGradient((0.5f * w) + x, (0.0f * h) + y, (0.5f * w) + x, (1.0f * h) + y,
683                 new float[] { 0.0f,0.5f,1.0f },
684                 new Color[] { color33,
685                             decodeColor(color33,color34,0.5f),
686                             color34});
687     }
688
689     private Paint decodeGradient11(Shape s) {
690         Rectangle2D bounds = s.getBounds2D();
691         float x = (float)bounds.getX();
692         float y = (float)bounds.getY();
693         float w = (float)bounds.getWidth();
694         float h = (float)bounds.getHeight();
695         return decodeGradient((0.5f * w) + x, (0.0f * h) + y, (0.5f * w) + x, (1.0f * h) + y,
696                 new float[] { 0.0f,0.5f,1.0f },
697                 new Color[] { color39,
698                             decodeColor(color39,color40,0.5f),
699                             color40});
700     }
701
702     private Paint decodeGradient12(Shape s) {
703         Rectangle2D bounds = s.getBounds2D();
704         float x = (float)bounds.getX();
705         float y = (float)bounds.getY();
706         float w = (float)bounds.getWidth();
707         float h = (float)bounds.getHeight();
708         return decodeGradient((0.5f * w) + x, (0.0f * h) + y, (0.5f * w) + x, (1.0f * h) + y,
709                 new float[] { 0.0f,0.5f,1.0f },
710                 new Color[] { color45,
711                             decodeColor(color45,color46,0.5f),
712                             color46});
713     }
714
715
716 }
717
Popular Tags