KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * InternalFrameInternalFrameTitlePaneInternalFrameTitlePaneIconifyButtonPainter.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 InternalFrameInternalFrameTitlePaneInternalFrameTitlePaneIconifyButtonPainter 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 InternalFrameInternalFrameTitlePaneInternalFrameTitlePaneIconifyButtonPainter to determine which region/state is being painted
21
//by that instance.
22
static final int BACKGROUND_ENABLED = 1;
23     static final int BACKGROUND_DISABLED = 2;
24     static final int BACKGROUND_MOUSEOVER = 3;
25     static final int BACKGROUND_PRESSED = 4;
26     static final int BACKGROUND_ENABLED_WINDOWNOTFOCUSED = 5;
27     static final int BACKGROUND_MOUSEOVER_WINDOWNOTFOCUSED = 6;
28     static final int BACKGROUND_PRESSED_WINDOWNOTFOCUSED = 7;
29
30
31     private int state; //refers to one of the static final ints above
32
private PaintContext ctx;
33
34     //the following 4 variables are reused during the painting code of the layers
35
private Path2D path = new Path2D.Float();
36     private Rectangle2D rect = new Rectangle2D.Float(0, 0, 0, 0);
37     private RoundRectangle2D roundRect = new RoundRectangle2D.Float(0, 0, 0, 0, 0, 0);
38     private Ellipse2D ellipse = new Ellipse2D.Float(0, 0, 0, 0);
39
40     //All Colors used for painting are stored here. Ideally, only those colors being used
41
//by a particular instance of InternalFrameInternalFrameTitlePaneInternalFrameTitlePaneIconifyButtonPainter would be created. For the moment at least,
42
//however, all are created for each instance.
43
private Color color1 = decodeColor("nimbusBlueGrey", 0.0055555105f, -0.0029994324f, -0.38039216f, -185);
44     private Color color2 = decodeColor("nimbusOrange", -0.08377897f, 0.02094239f, -0.40392157f, 0);
45     private Color color3 = decodeColor("nimbusOrange", 0.0f, 0.0f, 0.0f, 0);
46     private Color color4 = decodeColor("nimbusOrange", -4.4563413E-4f, -0.48364475f, 0.10588235f, 0);
47     private Color color5 = decodeColor("nimbusOrange", 0.0f, -0.0050992966f, 0.0039215684f, 0);
48     private Color color6 = decodeColor("nimbusOrange", 0.0f, -0.12125945f, 0.10588235f, 0);
49     private Color color7 = decodeColor("nimbusOrange", -0.08377897f, 0.02094239f, -0.40392157f, -106);
50     private Color color8 = decodeColor("nimbusBlueGrey", 0.0f, -0.110526316f, 0.25490195f, 0);
51     private Color color9 = decodeColor("nimbusOrange", 0.5203877f, -0.9376068f, 0.007843137f, 0);
52     private Color color10 = decodeColor("nimbusOrange", 0.5273321f, -0.8903002f, -0.086274505f, 0);
53     private Color color11 = decodeColor("nimbusOrange", 0.5273321f, -0.93313926f, 0.019607842f, 0);
54     private Color color12 = decodeColor("nimbusOrange", 0.53526866f, -0.8995122f, -0.058823526f, 0);
55     private Color color13 = decodeColor("nimbusOrange", 0.5233639f, -0.8971863f, -0.07843137f, 0);
56     private Color color14 = decodeColor("nimbusBlueGrey", -0.0808081f, 0.015910469f, -0.40392157f, -216);
57     private Color color15 = decodeColor("nimbusBlueGrey", -0.003968239f, -0.03760965f, 0.007843137f, 0);
58     private Color color16 = new Color(255, 200, 0, 255);
59     private Color color17 = decodeColor("nimbusOrange", -0.08377897f, 0.02094239f, -0.31764707f, 0);
60     private Color color18 = decodeColor("nimbusOrange", -0.02758849f, 0.02094239f, -0.062745094f, 0);
61     private Color color19 = decodeColor("nimbusOrange", -4.4563413E-4f, -0.5074419f, 0.1490196f, 0);
62     private Color color20 = decodeColor("nimbusOrange", 9.745359E-6f, -0.11175901f, 0.07843137f, 0);
63     private Color color21 = decodeColor("nimbusOrange", 0.0f, -0.09280169f, 0.07843137f, 0);
64     private Color color22 = decodeColor("nimbusOrange", 0.0f, -0.19002807f, 0.18039215f, 0);
65     private Color color23 = decodeColor("nimbusOrange", -0.025772434f, 0.02094239f, 0.05098039f, 0);
66     private Color color24 = decodeColor("nimbusOrange", -0.08377897f, 0.02094239f, -0.4f, 0);
67     private Color color25 = decodeColor("nimbusOrange", -0.053104125f, 0.02094239f, -0.109803915f, 0);
68     private Color color26 = decodeColor("nimbusOrange", -0.017887495f, -0.33726656f, 0.039215684f, 0);
69     private Color color27 = decodeColor("nimbusOrange", -0.018038228f, 0.02094239f, -0.043137252f, 0);
70     private Color color28 = decodeColor("nimbusOrange", -0.015844189f, 0.02094239f, -0.027450979f, 0);
71     private Color color29 = decodeColor("nimbusOrange", -0.010274701f, 0.02094239f, 0.015686274f, 0);
72     private Color color30 = decodeColor("nimbusOrange", -0.08377897f, 0.02094239f, -0.14509803f, -91);
73     private Color color31 = decodeColor("nimbusOrange", 0.5273321f, -0.87971985f, -0.15686274f, 0);
74     private Color color32 = decodeColor("nimbusOrange", 0.5273321f, -0.842694f, -0.31764707f, 0);
75     private Color color33 = decodeColor("nimbusOrange", 0.516221f, -0.9567362f, 0.12941176f, 0);
76     private Color color34 = decodeColor("nimbusOrange", 0.5222816f, -0.9229352f, 0.019607842f, 0);
77     private Color color35 = decodeColor("nimbusOrange", 0.5273321f, -0.91751915f, 0.015686274f, 0);
78     private Color color36 = decodeColor("nimbusOrange", 0.5273321f, -0.9193561f, 0.039215684f, 0);
79     private Color color37 = decodeColor("nimbusBlueGrey", -0.01111114f, -0.017933726f, -0.32156864f, 0);
80
81
82     //Array of current component colors, updated in each paint call
83
private Object JavaDoc[] componentColors;
84
85     public InternalFrameInternalFrameTitlePaneInternalFrameTitlePaneIconifyButtonPainter(PaintContext ctx, int state) {
86         super();
87         this.state = state;
88         this.ctx = ctx;
89     }
90
91     @Override JavaDoc
92     protected void doPaint(Graphics2D g, JComponent c, int width, int height, Object JavaDoc[] extendedCacheKeys) {
93         //populate componentColors array with colors calculated in getExtendedCacheKeys call
94
componentColors = extendedCacheKeys;
95         //generate this entire method. Each state/bg/fg/border combo that has
96
//been painted gets its own KEY and paint method.
97
switch(state) {
98             case BACKGROUND_ENABLED: paintBackgroundEnabled(g); break;
99             case BACKGROUND_DISABLED: paintBackgroundDisabled(g); break;
100             case BACKGROUND_MOUSEOVER: paintBackgroundMouseOver(g); break;
101             case BACKGROUND_PRESSED: paintBackgroundPressed(g); break;
102             case BACKGROUND_ENABLED_WINDOWNOTFOCUSED: paintBackgroundEnabledAndWindowNotFocused(g); break;
103             case BACKGROUND_MOUSEOVER_WINDOWNOTFOCUSED: paintBackgroundMouseOverAndWindowNotFocused(g); break;
104             case BACKGROUND_PRESSED_WINDOWNOTFOCUSED: paintBackgroundPressedAndWindowNotFocused(g); break;
105
106         }
107     }
108         
109
110
111     @Override JavaDoc
112     protected final PaintContext getPaintContext() {
113         return ctx;
114     }
115
116     private void paintBackgroundEnabled(Graphics2D g) {
117         roundRect = decodeRoundRect1();
118         g.setPaint(color1);
119         g.fill(roundRect);
120         roundRect = decodeRoundRect2();
121         g.setPaint(decodeGradient1(roundRect));
122         g.fill(roundRect);
123         roundRect = decodeRoundRect3();
124         g.setPaint(decodeGradient2(roundRect));
125         g.fill(roundRect);
126         rect = decodeRect1();
127         g.setPaint(color7);
128         g.fill(rect);
129         rect = decodeRect2();
130         g.setPaint(color8);
131         g.fill(rect);
132
133     }
134
135     private void paintBackgroundDisabled(Graphics2D g) {
136         roundRect = decodeRoundRect1();
137         g.setPaint(color1);
138         g.fill(roundRect);
139         roundRect = decodeRoundRect2();
140         g.setPaint(decodeGradient3(roundRect));
141         g.fill(roundRect);
142         roundRect = decodeRoundRect3();
143         g.setPaint(decodeGradient4(roundRect));
144         g.fill(roundRect);
145         rect = decodeRect1();
146         g.setPaint(color14);
147         g.fill(rect);
148         rect = decodeRect2();
149         g.setPaint(color15);
150         g.fill(rect);
151         rect = decodeRect3();
152         g.setPaint(color16);
153         g.fill(rect);
154         rect = decodeRect3();
155         g.setPaint(color16);
156         g.fill(rect);
157         rect = decodeRect3();
158         g.setPaint(color16);
159         g.fill(rect);
160         rect = decodeRect3();
161         g.setPaint(color16);
162         g.fill(rect);
163         rect = decodeRect3();
164         g.setPaint(color16);
165         g.fill(rect);
166         rect = decodeRect3();
167         g.setPaint(color16);
168         g.fill(rect);
169         rect = decodeRect3();
170         g.setPaint(color16);
171         g.fill(rect);
172
173     }
174
175     private void paintBackgroundMouseOver(Graphics2D g) {
176         roundRect = decodeRoundRect1();
177         g.setPaint(color1);
178         g.fill(roundRect);
179         roundRect = decodeRoundRect2();
180         g.setPaint(decodeGradient5(roundRect));
181         g.fill(roundRect);
182         roundRect = decodeRoundRect3();
183         g.setPaint(decodeGradient6(roundRect));
184         g.fill(roundRect);
185         rect = decodeRect1();
186         g.setPaint(color23);
187         g.fill(rect);
188         rect = decodeRect2();
189         g.setPaint(color8);
190         g.fill(rect);
191         rect = decodeRect3();
192         g.setPaint(color16);
193         g.fill(rect);
194         rect = decodeRect3();
195         g.setPaint(color16);
196         g.fill(rect);
197         rect = decodeRect3();
198         g.setPaint(color16);
199         g.fill(rect);
200         rect = decodeRect3();
201         g.setPaint(color16);
202         g.fill(rect);
203         rect = decodeRect3();
204         g.setPaint(color16);
205         g.fill(rect);
206         rect = decodeRect3();
207         g.setPaint(color16);
208         g.fill(rect);
209         rect = decodeRect3();
210         g.setPaint(color16);
211         g.fill(rect);
212
213     }
214
215     private void paintBackgroundPressed(Graphics2D g) {
216         roundRect = decodeRoundRect1();
217         g.setPaint(color1);
218         g.fill(roundRect);
219         roundRect = decodeRoundRect2();
220         g.setPaint(decodeGradient7(roundRect));
221         g.fill(roundRect);
222         roundRect = decodeRoundRect3();
223         g.setPaint(decodeGradient8(roundRect));
224         g.fill(roundRect);
225         rect = decodeRect4();
226         g.setPaint(color30);
227         g.fill(rect);
228         rect = decodeRect2();
229         g.setPaint(color8);
230         g.fill(rect);
231         rect = decodeRect3();
232         g.setPaint(color16);
233         g.fill(rect);
234         rect = decodeRect3();
235         g.setPaint(color16);
236         g.fill(rect);
237         rect = decodeRect3();
238         g.setPaint(color16);
239         g.fill(rect);
240         rect = decodeRect3();
241         g.setPaint(color16);
242         g.fill(rect);
243         rect = decodeRect3();
244         g.setPaint(color16);
245         g.fill(rect);
246         rect = decodeRect3();
247         g.setPaint(color16);
248         g.fill(rect);
249         rect = decodeRect3();
250         g.setPaint(color16);
251         g.fill(rect);
252
253     }
254
255     private void paintBackgroundEnabledAndWindowNotFocused(Graphics2D g) {
256         roundRect = decodeRoundRect1();
257         g.setPaint(color1);
258         g.fill(roundRect);
259         roundRect = decodeRoundRect2();
260         g.setPaint(decodeGradient9(roundRect));
261         g.fill(roundRect);
262         roundRect = decodeRoundRect3();
263         g.setPaint(decodeGradient10(roundRect));
264         g.fill(roundRect);
265         rect = decodeRect1();
266         g.setPaint(color14);
267         g.fill(rect);
268         rect = decodeRect2();
269         g.setPaint(color37);
270         g.fill(rect);
271         rect = decodeRect3();
272         g.setPaint(color16);
273         g.fill(rect);
274         rect = decodeRect3();
275         g.setPaint(color16);
276         g.fill(rect);
277         rect = decodeRect3();
278         g.setPaint(color16);
279         g.fill(rect);
280         rect = decodeRect3();
281         g.setPaint(color16);
282         g.fill(rect);
283         rect = decodeRect3();
284         g.setPaint(color16);
285         g.fill(rect);
286         rect = decodeRect3();
287         g.setPaint(color16);
288         g.fill(rect);
289         rect = decodeRect3();
290         g.setPaint(color16);
291         g.fill(rect);
292
293     }
294
295     private void paintBackgroundMouseOverAndWindowNotFocused(Graphics2D g) {
296         roundRect = decodeRoundRect1();
297         g.setPaint(color1);
298         g.fill(roundRect);
299         roundRect = decodeRoundRect2();
300         g.setPaint(decodeGradient5(roundRect));
301         g.fill(roundRect);
302         roundRect = decodeRoundRect3();
303         g.setPaint(decodeGradient6(roundRect));
304         g.fill(roundRect);
305         rect = decodeRect1();
306         g.setPaint(color23);
307         g.fill(rect);
308         rect = decodeRect2();
309         g.setPaint(color8);
310         g.fill(rect);
311         rect = decodeRect3();
312         g.setPaint(color16);
313         g.fill(rect);
314         rect = decodeRect3();
315         g.setPaint(color16);
316         g.fill(rect);
317         rect = decodeRect3();
318         g.setPaint(color16);
319         g.fill(rect);
320         rect = decodeRect3();
321         g.setPaint(color16);
322         g.fill(rect);
323         rect = decodeRect3();
324         g.setPaint(color16);
325         g.fill(rect);
326         rect = decodeRect3();
327         g.setPaint(color16);
328         g.fill(rect);
329         rect = decodeRect3();
330         g.setPaint(color16);
331         g.fill(rect);
332
333     }
334
335     private void paintBackgroundPressedAndWindowNotFocused(Graphics2D g) {
336         roundRect = decodeRoundRect1();
337         g.setPaint(color1);
338         g.fill(roundRect);
339         roundRect = decodeRoundRect2();
340         g.setPaint(decodeGradient7(roundRect));
341         g.fill(roundRect);
342         roundRect = decodeRoundRect3();
343         g.setPaint(decodeGradient8(roundRect));
344         g.fill(roundRect);
345         rect = decodeRect4();
346         g.setPaint(color30);
347         g.fill(rect);
348         rect = decodeRect2();
349         g.setPaint(color8);
350         g.fill(rect);
351         rect = decodeRect3();
352         g.setPaint(color16);
353         g.fill(rect);
354         rect = decodeRect3();
355         g.setPaint(color16);
356         g.fill(rect);
357         rect = decodeRect3();
358         g.setPaint(color16);
359         g.fill(rect);
360         rect = decodeRect3();
361         g.setPaint(color16);
362         g.fill(rect);
363         rect = decodeRect3();
364         g.setPaint(color16);
365         g.fill(rect);
366         rect = decodeRect3();
367         g.setPaint(color16);
368         g.fill(rect);
369         rect = decodeRect3();
370         g.setPaint(color16);
371         g.fill(rect);
372
373     }
374
375
376
377     private RoundRectangle2D decodeRoundRect1() {
378         roundRect.setRoundRect(decodeX(1.0f), //x
379
decodeY(1.6111112f), //y
380
decodeX(2.0f) - decodeX(1.0f), //width
381
decodeY(2.0f) - decodeY(1.6111112f), //height
382
6.0f, 6.0f); //rounding
383
return roundRect;
384     }
385
386     private RoundRectangle2D decodeRoundRect2() {
387         roundRect.setRoundRect(decodeX(1.0f), //x
388
decodeY(1.0f), //y
389
decodeX(2.0f) - decodeX(1.0f), //width
390
decodeY(1.9444444f) - decodeY(1.0f), //height
391
8.6f, 8.6f); //rounding
392
return roundRect;
393     }
394
395     private RoundRectangle2D decodeRoundRect3() {
396         roundRect.setRoundRect(decodeX(1.0526316f), //x
397
decodeY(1.0555556f), //y
398
decodeX(1.9473684f) - decodeX(1.0526316f), //width
399
decodeY(1.8888888f) - decodeY(1.0555556f), //height
400
6.75f, 6.75f); //rounding
401
return roundRect;
402     }
403
404     private Rectangle2D decodeRect1() {
405             rect.setRect(decodeX(1.25f), //x
406
decodeY(1.6628788f), //y
407
decodeX(1.75f) - decodeX(1.25f), //width
408
decodeY(1.7487373f) - decodeY(1.6628788f)); //height
409
return rect;
410     }
411
412     private Rectangle2D decodeRect2() {
413             rect.setRect(decodeX(1.2870814f), //x
414
decodeY(1.6123737f), //y
415
decodeX(1.7165072f) - decodeX(1.2870814f), //width
416
decodeY(1.7222222f) - decodeY(1.6123737f)); //height
417
return rect;
418     }
419
420     private Rectangle2D decodeRect3() {
421             rect.setRect(decodeX(1.0f), //x
422
decodeY(1.0f), //y
423
decodeX(1.0f) - decodeX(1.0f), //width
424
decodeY(1.0f) - decodeY(1.0f)); //height
425
return rect;
426     }
427
428     private Rectangle2D decodeRect4() {
429             rect.setRect(decodeX(1.25f), //x
430
decodeY(1.6527778f), //y
431
decodeX(1.7511961f) - decodeX(1.25f), //width
432
decodeY(1.7828283f) - decodeY(1.6527778f)); //height
433
return rect;
434     }
435
436
437
438     private Paint decodeGradient1(Shape s) {
439         Rectangle2D bounds = s.getBounds2D();
440         float x = (float)bounds.getX();
441         float y = (float)bounds.getY();
442         float w = (float)bounds.getWidth();
443         float h = (float)bounds.getHeight();
444         return decodeGradient((0.24868421f * w) + x, (0.0014705883f * h) + y, (0.24868421f * w) + x, (1.0f * h) + y,
445                 new float[] { 0.0f,0.5f,1.0f },
446                 new Color[] { color2,
447                             decodeColor(color2,color3,0.5f),
448                             color3});
449     }
450
451     private Paint decodeGradient2(Shape s) {
452         Rectangle2D bounds = s.getBounds2D();
453         float x = (float)bounds.getX();
454         float y = (float)bounds.getY();
455         float w = (float)bounds.getWidth();
456         float h = (float)bounds.getHeight();
457         return decodeGradient((0.25f * w) + x, (0.0f * h) + y, (0.25441176f * w) + x, (1.0016667f * h) + y,
458                 new float[] { 0.0f,0.26988637f,0.53977275f,0.5951705f,0.6505682f,0.8252841f,1.0f },
459                 new Color[] { color4,
460                             decodeColor(color4,color3,0.5f),
461                             color3,
462                             decodeColor(color3,color5,0.5f),
463                             color5,
464                             decodeColor(color5,color6,0.5f),
465                             color6});
466     }
467
468     private Paint decodeGradient3(Shape s) {
469         Rectangle2D bounds = s.getBounds2D();
470         float x = (float)bounds.getX();
471         float y = (float)bounds.getY();
472         float w = (float)bounds.getWidth();
473         float h = (float)bounds.getHeight();
474         return decodeGradient((0.24868421f * w) + x, (0.0014705883f * h) + y, (0.24868421f * w) + x, (1.0f * h) + y,
475                 new float[] { 0.0f,0.5f,1.0f },
476                 new Color[] { color9,
477                             decodeColor(color9,color10,0.5f),
478                             color10});
479     }
480
481     private Paint decodeGradient4(Shape s) {
482         Rectangle2D bounds = s.getBounds2D();
483         float x = (float)bounds.getX();
484         float y = (float)bounds.getY();
485         float w = (float)bounds.getWidth();
486         float h = (float)bounds.getHeight();
487         return decodeGradient((0.25f * w) + x, (0.0f * h) + y, (0.25441176f * w) + x, (1.0016667f * h) + y,
488                 new float[] { 0.0f,0.26988637f,0.53977275f,0.5951705f,0.6505682f,0.8252841f,1.0f },
489                 new Color[] { color11,
490                             decodeColor(color11,color12,0.5f),
491                             color12,
492                             decodeColor(color12,color13,0.5f),
493                             color13,
494                             decodeColor(color13,color10,0.5f),
495                             color10});
496     }
497
498     private Paint decodeGradient5(Shape s) {
499         Rectangle2D bounds = s.getBounds2D();
500         float x = (float)bounds.getX();
501         float y = (float)bounds.getY();
502         float w = (float)bounds.getWidth();
503         float h = (float)bounds.getHeight();
504         return decodeGradient((0.24868421f * w) + x, (0.0014705883f * h) + y, (0.24868421f * w) + x, (1.0f * h) + y,
505                 new float[] { 0.0f,0.5f,1.0f },
506                 new Color[] { color17,
507                             decodeColor(color17,color18,0.5f),
508                             color18});
509     }
510
511     private Paint decodeGradient6(Shape s) {
512         Rectangle2D bounds = s.getBounds2D();
513         float x = (float)bounds.getX();
514         float y = (float)bounds.getY();
515         float w = (float)bounds.getWidth();
516         float h = (float)bounds.getHeight();
517         return decodeGradient((0.25f * w) + x, (0.0f * h) + y, (0.25441176f * w) + x, (1.0016667f * h) + y,
518                 new float[] { 0.0f,0.26988637f,0.53977275f,0.5951705f,0.6505682f,0.8252841f,1.0f },
519                 new Color[] { color19,
520                             decodeColor(color19,color20,0.5f),
521                             color20,
522                             decodeColor(color20,color21,0.5f),
523                             color21,
524                             decodeColor(color21,color22,0.5f),
525                             color22});
526     }
527
528     private Paint decodeGradient7(Shape s) {
529         Rectangle2D bounds = s.getBounds2D();
530         float x = (float)bounds.getX();
531         float y = (float)bounds.getY();
532         float w = (float)bounds.getWidth();
533         float h = (float)bounds.getHeight();
534         return decodeGradient((0.24868421f * w) + x, (0.0014705883f * h) + y, (0.24868421f * w) + x, (1.0f * h) + y,
535                 new float[] { 0.0f,0.5f,1.0f },
536                 new Color[] { color24,
537                             decodeColor(color24,color25,0.5f),
538                             color25});
539     }
540
541     private Paint decodeGradient8(Shape s) {
542         Rectangle2D bounds = s.getBounds2D();
543         float x = (float)bounds.getX();
544         float y = (float)bounds.getY();
545         float w = (float)bounds.getWidth();
546         float h = (float)bounds.getHeight();
547         return decodeGradient((0.25f * w) + x, (0.0f * h) + y, (0.25441176f * w) + x, (1.0016667f * h) + y,
548                 new float[] { 0.0f,0.26988637f,0.53977275f,0.5951705f,0.6505682f,0.8252841f,1.0f },
549                 new Color[] { color26,
550                             decodeColor(color26,color27,0.5f),
551                             color27,
552                             decodeColor(color27,color28,0.5f),
553                             color28,
554                             decodeColor(color28,color29,0.5f),
555                             color29});
556     }
557
558     private Paint decodeGradient9(Shape s) {
559         Rectangle2D bounds = s.getBounds2D();
560         float x = (float)bounds.getX();
561         float y = (float)bounds.getY();
562         float w = (float)bounds.getWidth();
563         float h = (float)bounds.getHeight();
564         return decodeGradient((0.24868421f * w) + x, (0.0014705883f * h) + y, (0.24868421f * w) + x, (1.0f * h) + y,
565                 new float[] { 0.0f,0.5f,1.0f },
566                 new Color[] { color31,
567                             decodeColor(color31,color32,0.5f),
568                             color32});
569     }
570
571     private Paint decodeGradient10(Shape s) {
572         Rectangle2D bounds = s.getBounds2D();
573         float x = (float)bounds.getX();
574         float y = (float)bounds.getY();
575         float w = (float)bounds.getWidth();
576         float h = (float)bounds.getHeight();
577         return decodeGradient((0.25f * w) + x, (0.0f * h) + y, (0.25441176f * w) + x, (1.0016667f * h) + y,
578                 new float[] { 0.0f,0.26988637f,0.53977275f,0.5951705f,0.6505682f,0.78336793f,0.9161677f },
579                 new Color[] { color33,
580                             decodeColor(color33,color34,0.5f),
581                             color34,
582                             decodeColor(color34,color35,0.5f),
583                             color35,
584                             decodeColor(color35,color36,0.5f),
585                             color36});
586     }
587
588
589 }
590
Popular Tags