1 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 17 public final class SpinnerSpinnerNextButtonPainter extends AbstractRegionPainter { 18 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_MOUSEOVER_FOCUSED = 4; 26 static final int BACKGROUND_PRESSED_FOCUSED = 5; 27 static final int BACKGROUND_MOUSEOVER = 6; 28 static final int BACKGROUND_PRESSED = 7; 29 static final int FOREGROUND_DISABLED = 8; 30 static final int FOREGROUND_ENABLED = 9; 31 static final int FOREGROUND_FOCUSED = 10; 32 static final int FOREGROUND_MOUSEOVER_FOCUSED = 11; 33 static final int FOREGROUND_PRESSED_FOCUSED = 12; 34 static final int FOREGROUND_MOUSEOVER = 13; 35 static final int FOREGROUND_PRESSED = 14; 36 37 38 private int state; private PaintContext ctx; 40 41 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 private Color color1 = decodeColor("nimbusBase", 0.021348298f, -0.56289876f, 0.2588235f, 0); 51 private Color color2 = decodeColor("nimbusBase", 0.010237217f, -0.5607143f, 0.2352941f, 0); 52 private Color color3 = decodeColor("nimbusBase", 0.021348298f, -0.59223604f, 0.35294116f, 0); 53 private Color color4 = decodeColor("nimbusBase", 0.016586483f, -0.5723659f, 0.31764704f, 0); 54 private Color color5 = decodeColor("nimbusBase", 0.021348298f, -0.56182265f, 0.24705881f, 0); 55 private Color color6 = decodeColor("nimbusBase", 5.1498413E-4f, -0.34585923f, -0.007843137f, 0); 56 private Color color7 = decodeColor("nimbusBase", 5.1498413E-4f, -0.27207792f, -0.11764708f, 0); 57 private Color color8 = decodeColor("nimbusBase", 0.004681647f, -0.6197143f, 0.43137252f, 0); 58 private Color color9 = decodeColor("nimbusBase", -0.0012707114f, -0.5078604f, 0.3098039f, 0); 59 private Color color10 = decodeColor("nimbusBase", -0.0028941035f, -0.4800539f, 0.28235292f, 0); 60 private Color color11 = decodeColor("nimbusBase", 0.0023007393f, -0.3622768f, -0.04705882f, 0); 61 private Color color12 = decodeColor("nimbusFocus", 0.0f, 0.0f, 0.0f, 0); 62 private Color color13 = decodeColor("nimbusBase", 0.0013483167f, -0.1769987f, -0.12156865f, 0); 63 private Color color14 = decodeColor("nimbusBase", 0.0013483167f, 0.039961398f, -0.25882354f, 0); 64 private Color color15 = decodeColor("nimbusBase", 0.004681647f, -0.6198413f, 0.43921566f, 0); 65 private Color color16 = decodeColor("nimbusBase", -0.0012707114f, -0.51502466f, 0.3607843f, 0); 66 private Color color17 = decodeColor("nimbusBase", 0.0021564364f, -0.49097747f, 0.34509802f, 0); 67 private Color color18 = decodeColor("nimbusBase", 5.2034855E-5f, -0.38743842f, 0.019607842f, 0); 68 private Color color19 = decodeColor("nimbusBase", -0.57865167f, -0.6357143f, -0.54901963f, 0); 69 private Color color20 = decodeColor("nimbusBase", 0.08801502f, 0.3642857f, -0.454902f, 0); 70 private Color color21 = decodeColor("nimbusBase", -4.2033195E-4f, -0.38050595f, 0.20392156f, 0); 71 private Color color22 = decodeColor("nimbusBase", 2.9569864E-4f, -0.15470162f, 0.07058823f, 0); 72 private Color color23 = decodeColor("nimbusBase", -4.6235323E-4f, -0.09571427f, 0.039215684f, 0); 73 private Color color24 = decodeColor("nimbusBase", 0.018363237f, 0.18135887f, -0.227451f, 0); 74 private Color color25 = new Color(255, 200, 0, 255); 75 private Color color26 = decodeColor("nimbusBase", 0.021348298f, -0.58106947f, 0.16862744f, 0); 76 private Color color27 = decodeColor("nimbusBase", -0.57865167f, -0.6357143f, -0.043137252f, 0); 77 private Color color28 = decodeColor("nimbusBase", -0.57865167f, -0.6357143f, -0.24313727f, 0); 78 private Color color29 = decodeColor("nimbusBase", 0.0f, -0.6357143f, 0.45098037f, 0); 79 80 81 private Object [] componentColors; 83 84 public SpinnerSpinnerNextButtonPainter(PaintContext ctx, int state) { 85 super(); 86 this.state = state; 87 this.ctx = ctx; 88 } 89 90 @Override 91 protected void doPaint(Graphics2D g, JComponent c, int width, int height, Object [] extendedCacheKeys) { 92 componentColors = extendedCacheKeys; 94 switch(state) { 97 case BACKGROUND_DISABLED: paintBackgroundDisabled(g); break; 98 case BACKGROUND_ENABLED: paintBackgroundEnabled(g); break; 99 case BACKGROUND_FOCUSED: paintBackgroundFocused(g); break; 100 case BACKGROUND_MOUSEOVER_FOCUSED: paintBackgroundMouseOverAndFocused(g); break; 101 case BACKGROUND_PRESSED_FOCUSED: paintBackgroundPressedAndFocused(g); break; 102 case BACKGROUND_MOUSEOVER: paintBackgroundMouseOver(g); break; 103 case BACKGROUND_PRESSED: paintBackgroundPressed(g); break; 104 case FOREGROUND_DISABLED: paintForegroundDisabled(g); break; 105 case FOREGROUND_ENABLED: paintForegroundEnabled(g); break; 106 case FOREGROUND_FOCUSED: paintForegroundFocused(g); break; 107 case FOREGROUND_MOUSEOVER_FOCUSED: paintForegroundMouseOverAndFocused(g); break; 108 case FOREGROUND_PRESSED_FOCUSED: paintForegroundPressedAndFocused(g); break; 109 case FOREGROUND_MOUSEOVER: paintForegroundMouseOver(g); break; 110 case FOREGROUND_PRESSED: paintForegroundPressed(g); break; 111 112 } 113 } 114 115 116 117 @Override 118 protected final PaintContext getPaintContext() { 119 return ctx; 120 } 121 122 private void paintBackgroundDisabled(Graphics2D g) { 123 path = decodePath1(); 124 g.setPaint(decodeGradient1(path)); 125 g.fill(path); 126 path = decodePath2(); 127 g.setPaint(decodeGradient2(path)); 128 g.fill(path); 129 rect = decodeRect1(); 130 g.setPaint(color5); 131 g.fill(rect); 132 133 } 134 135 private void paintBackgroundEnabled(Graphics2D g) { 136 path = decodePath3(); 137 g.setPaint(decodeGradient3(path)); 138 g.fill(path); 139 path = decodePath4(); 140 g.setPaint(decodeGradient4(path)); 141 g.fill(path); 142 rect = decodeRect1(); 143 g.setPaint(color11); 144 g.fill(rect); 145 146 } 147 148 private void paintBackgroundFocused(Graphics2D g) { 149 path = decodePath5(); 150 g.setPaint(color12); 151 g.fill(path); 152 path = decodePath3(); 153 g.setPaint(decodeGradient3(path)); 154 g.fill(path); 155 path = decodePath4(); 156 g.setPaint(decodeGradient5(path)); 157 g.fill(path); 158 rect = decodeRect1(); 159 g.setPaint(color11); 160 g.fill(rect); 161 162 } 163 164 private void paintBackgroundMouseOverAndFocused(Graphics2D g) { 165 path = decodePath5(); 166 g.setPaint(color12); 167 g.fill(path); 168 path = decodePath3(); 169 g.setPaint(decodeGradient6(path)); 170 g.fill(path); 171 path = decodePath4(); 172 g.setPaint(decodeGradient7(path)); 173 g.fill(path); 174 rect = decodeRect1(); 175 g.setPaint(color18); 176 g.fill(rect); 177 178 } 179 180 private void paintBackgroundPressedAndFocused(Graphics2D g) { 181 path = decodePath5(); 182 g.setPaint(color12); 183 g.fill(path); 184 path = decodePath6(); 185 g.setPaint(decodeGradient8(path)); 186 g.fill(path); 187 path = decodePath4(); 188 g.setPaint(decodeGradient9(path)); 189 g.fill(path); 190 rect = decodeRect1(); 191 g.setPaint(color24); 192 g.fill(rect); 193 194 } 195 196 private void paintBackgroundMouseOver(Graphics2D g) { 197 path = decodePath3(); 198 g.setPaint(decodeGradient6(path)); 199 g.fill(path); 200 path = decodePath4(); 201 g.setPaint(decodeGradient10(path)); 202 g.fill(path); 203 rect = decodeRect1(); 204 g.setPaint(color18); 205 g.fill(rect); 206 207 } 208 209 private void paintBackgroundPressed(Graphics2D g) { 210 path = decodePath6(); 211 g.setPaint(decodeGradient8(path)); 212 g.fill(path); 213 path = decodePath4(); 214 g.setPaint(decodeGradient11(path)); 215 g.fill(path); 216 rect = decodeRect1(); 217 g.setPaint(color24); 218 g.fill(rect); 219 rect = decodeRect2(); 220 g.setPaint(color25); 221 g.fill(rect); 222 223 } 224 225 private void paintForegroundDisabled(Graphics2D g) { 226 path = decodePath7(); 227 g.setPaint(color26); 228 g.fill(path); 229 230 } 231 232 private void paintForegroundEnabled(Graphics2D g) { 233 path = decodePath7(); 234 g.setPaint(decodeGradient12(path)); 235 g.fill(path); 236 237 } 238 239 private void paintForegroundFocused(Graphics2D g) { 240 path = decodePath8(); 241 g.setPaint(decodeGradient12(path)); 242 g.fill(path); 243 244 } 245 246 private void paintForegroundMouseOverAndFocused(Graphics2D g) { 247 path = decodePath8(); 248 g.setPaint(decodeGradient12(path)); 249 g.fill(path); 250 251 } 252 253 private void paintForegroundPressedAndFocused(Graphics2D g) { 254 path = decodePath9(); 255 g.setPaint(color29); 256 g.fill(path); 257 258 } 259 260 private void paintForegroundMouseOver(Graphics2D g) { 261 path = decodePath7(); 262 g.setPaint(decodeGradient12(path)); 263 g.fill(path); 264 265 } 266 267 private void paintForegroundPressed(Graphics2D g) { 268 path = decodePath9(); 269 g.setPaint(color29); 270 g.fill(path); 271 272 } 273 274 275 276 private Path2D decodePath1() { 277 path.reset(); 278 path.moveTo(decodeX(0.0f), decodeY(3.0f)); 279 path.lineTo(decodeX(0.0f), decodeY(0.2857143f)); 280 path.curveTo(decodeAnchorX(0.0f, 0.0f), decodeAnchorY(0.2857142984867096f, 0.0f), decodeAnchorX(2.0f, -3.6363636363636402f), decodeAnchorY(0.2857142984867096f, 0.0f), decodeX(2.0f), decodeY(0.2857143f)); 281 path.curveTo(decodeAnchorX(2.0f, 3.6363636363636402f), decodeAnchorY(0.2857142984867096f, 0.0f), decodeAnchorX(2.7142858505249023f, -0.022727272727273373f), decodeAnchorY(1.0f, -3.749999999999999f), decodeX(2.7142859f), decodeY(1.0f)); 282 path.curveTo(decodeAnchorX(2.7142858505249023f, 0.022727272727273373f), decodeAnchorY(1.0f, 3.75f), decodeAnchorX(2.7142858505249023f, 0.0f), decodeAnchorY(3.0f, 0.0f), decodeX(2.7142859f), decodeY(3.0f)); 283 path.lineTo(decodeX(0.0f), decodeY(3.0f)); 284 path.closePath(); 285 return path; 286 } 287 288 private Path2D decodePath2() { 289 path.reset(); 290 path.moveTo(decodeX(1.0f), decodeY(2.0f)); 291 path.lineTo(decodeX(1.0f), decodeY(0.42857143f)); 292 path.curveTo(decodeAnchorX(1.0f, 0.0f), decodeAnchorY(0.4285714328289032f, 0.0f), decodeAnchorX(2.0f, -3.0f), decodeAnchorY(0.4285714328289032f, 0.0f), decodeX(2.0f), decodeY(0.42857143f)); 293 path.curveTo(decodeAnchorX(2.0f, 3.0f), decodeAnchorY(0.4285714328289032f, 0.0f), decodeAnchorX(2.5714285373687744f, 0.0f), decodeAnchorY(1.0f, -2.0f), decodeX(2.5714285f), decodeY(1.0f)); 294 path.curveTo(decodeAnchorX(2.5714285373687744f, 0.0f), decodeAnchorY(1.0f, 2.0f), decodeAnchorX(2.5714285373687744f, 0.0f), decodeAnchorY(2.0f, 0.0f), decodeX(2.5714285f), decodeY(2.0f)); 295 path.lineTo(decodeX(1.0f), decodeY(2.0f)); 296 path.closePath(); 297 return path; 298 } 299 300 private Rectangle2D decodeRect1() { 301 rect.setRect(decodeX(1.0f), decodeY(2.0f), decodeX(2.5714285f) - decodeX(1.0f), decodeY(3.0f) - decodeY(2.0f)); return rect; 306 } 307 308 private Path2D decodePath3() { 309 path.reset(); 310 path.moveTo(decodeX(0.0f), decodeY(3.0f)); 311 path.lineTo(decodeX(0.0f), decodeY(0.2857143f)); 312 path.lineTo(decodeX(2.0f), decodeY(0.2857143f)); 313 path.curveTo(decodeAnchorX(2.0f, 3.6363636363636402f), decodeAnchorY(0.2857142984867096f, 0.0f), decodeAnchorX(2.7142858505249023f, -0.022727272727273373f), decodeAnchorY(1.0f, -3.749999999999999f), decodeX(2.7142859f), decodeY(1.0f)); 314 path.lineTo(decodeX(2.7142859f), decodeY(3.0f)); 315 path.lineTo(decodeX(0.0f), decodeY(3.0f)); 316 path.closePath(); 317 return path; 318 } 319 320 private Path2D decodePath4() { 321 path.reset(); 322 path.moveTo(decodeX(1.0f), decodeY(2.0f)); 323 path.lineTo(decodeX(1.0f), decodeY(0.42857143f)); 324 path.lineTo(decodeX(2.0f), decodeY(0.42857143f)); 325 path.curveTo(decodeAnchorX(2.0f, 3.0f), decodeAnchorY(0.4285714328289032f, 0.0f), decodeAnchorX(2.5714285373687744f, 0.0f), decodeAnchorY(1.0f, -2.0f), decodeX(2.5714285f), decodeY(1.0f)); 326 path.lineTo(decodeX(2.5714285f), decodeY(2.0f)); 327 path.lineTo(decodeX(1.0f), decodeY(2.0f)); 328 path.closePath(); 329 return path; 330 } 331 332 private Path2D decodePath5() { 333 path.reset(); 334 path.moveTo(decodeX(0.0f), decodeY(3.0f)); 335 path.lineTo(decodeX(0.0f), decodeY(0.08571429f)); 336 path.lineTo(decodeX(2.142857f), decodeY(0.08571429f)); 337 path.curveTo(decodeAnchorX(2.142857074737549f, 3.3999999999999986f), decodeAnchorY(0.08571428805589676f, 0.0f), decodeAnchorX(2.914285659790039f, 0.0f), decodeAnchorY(1.0f, -3.4f), decodeX(2.9142857f), decodeY(1.0f)); 338 path.lineTo(decodeX(2.9142857f), decodeY(3.0f)); 339 path.lineTo(decodeX(0.0f), decodeY(3.0f)); 340 path.closePath(); 341 return path; 342 } 343 344 private Path2D decodePath6() { 345 path.reset(); 346 path.moveTo(decodeX(0.0f), decodeY(3.0f)); 347 path.lineTo(decodeX(0.0f), decodeY(0.2857143f)); 348 path.lineTo(decodeX(2.0f), decodeY(0.2857143f)); 349 path.curveTo(decodeAnchorX(2.0f, 3.4545454545454533f), decodeAnchorY(0.2857142984867096f, 0.0f), decodeAnchorX(2.7142858505249023f, -0.022727272727273373f), decodeAnchorY(1.0f, -3.4772727272727266f), decodeX(2.7142859f), decodeY(1.0f)); 350 path.lineTo(decodeX(2.7142859f), decodeY(3.0f)); 351 path.lineTo(decodeX(0.0f), decodeY(3.0f)); 352 path.closePath(); 353 return path; 354 } 355 356 private Rectangle2D decodeRect2() { 357 rect.setRect(decodeX(0.0f), decodeY(0.0f), decodeX(0.0f) - decodeX(0.0f), decodeY(0.0f) - decodeY(0.0f)); return rect; 362 } 363 364 private Path2D decodePath7() { 365 path.reset(); 366 path.moveTo(decodeX(1.0f), decodeY(2.0f)); 367 path.lineTo(decodeX(1.490909f), decodeY(1.0284091f)); 368 path.lineTo(decodeX(2.0f), decodeY(2.0f)); 369 path.lineTo(decodeX(1.0f), decodeY(2.0f)); 370 path.closePath(); 371 return path; 372 } 373 374 private Path2D decodePath8() { 375 path.reset(); 376 path.moveTo(decodeX(1.0f), decodeY(2.0f)); 377 path.lineTo(decodeX(1.490909f), decodeY(1.3522727f)); 378 path.lineTo(decodeX(2.0f), decodeY(2.0f)); 379 path.lineTo(decodeX(1.0f), decodeY(2.0f)); 380 path.closePath(); 381 return path; 382 } 383 384 private Path2D decodePath9() { 385 path.reset(); 386 path.moveTo(decodeX(1.0f), decodeY(2.0f)); 387 path.lineTo(decodeX(1.5045455f), decodeY(1.0795455f)); 388 path.lineTo(decodeX(2.0f), decodeY(2.0f)); 389 path.lineTo(decodeX(1.0f), decodeY(2.0f)); 390 path.closePath(); 391 return path; 392 } 393 394 395 396 private Paint decodeGradient1(Shape s) { 397 Rectangle2D bounds = s.getBounds2D(); 398 float x = (float)bounds.getX(); 399 float y = (float)bounds.getY(); 400 float w = (float)bounds.getWidth(); 401 float h = (float)bounds.getHeight(); 402 return decodeGradient((0.5f * w) + x, (0.0f * h) + y, (0.5f * w) + x, (1.0f * h) + y, 403 new float[] { 0.0f,0.5f,1.0f }, 404 new Color[] { color1, 405 decodeColor(color1,color2,0.5f), 406 color2}); 407 } 408 409 private Paint decodeGradient2(Shape s) { 410 Rectangle2D bounds = s.getBounds2D(); 411 float x = (float)bounds.getX(); 412 float y = (float)bounds.getY(); 413 float w = (float)bounds.getWidth(); 414 float h = (float)bounds.getHeight(); 415 return decodeGradient((0.5f * w) + x, (0.0f * h) + y, (0.5f * w) + x, (1.0f * h) + y, 416 new float[] { 0.0f,0.5f,1.0f }, 417 new Color[] { color3, 418 decodeColor(color3,color4,0.5f), 419 color4}); 420 } 421 422 private Paint decodeGradient3(Shape s) { 423 Rectangle2D bounds = s.getBounds2D(); 424 float x = (float)bounds.getX(); 425 float y = (float)bounds.getY(); 426 float w = (float)bounds.getWidth(); 427 float h = (float)bounds.getHeight(); 428 return decodeGradient((0.5f * w) + x, (0.0f * h) + y, (0.5f * w) + x, (1.0f * h) + y, 429 new float[] { 0.0f,0.5f,1.0f }, 430 new Color[] { color6, 431 decodeColor(color6,color7,0.5f), 432 color7}); 433 } 434 435 private Paint decodeGradient4(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.5f * w) + x, (0.0f * h) + y, (0.5f * w) + x, (1.0f * h) + y, 442 new float[] { 0.0f,0.36497328f,0.72994655f,0.8649733f,1.0f }, 443 new Color[] { color8, 444 decodeColor(color8,color9,0.5f), 445 color9, 446 decodeColor(color9,color10,0.5f), 447 color10}); 448 } 449 450 private Paint decodeGradient5(Shape s) { 451 Rectangle2D bounds = s.getBounds2D(); 452 float x = (float)bounds.getX(); 453 float y = (float)bounds.getY(); 454 float w = (float)bounds.getWidth(); 455 float h = (float)bounds.getHeight(); 456 return decodeGradient((0.5f * w) + x, (0.0f * h) + y, (0.5f * w) + x, (1.0f * h) + y, 457 new float[] { 0.0f,0.37566844f,0.7513369f,0.8756684f,1.0f }, 458 new Color[] { color8, 459 decodeColor(color8,color9,0.5f), 460 color9, 461 decodeColor(color9,color10,0.5f), 462 color10}); 463 } 464 465 private Paint decodeGradient6(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.5f * w) + x, (0.0f * h) + y, (0.5f * w) + x, (1.0f * h) + y, 472 new float[] { 0.0f,0.5f,1.0f }, 473 new Color[] { color13, 474 decodeColor(color13,color14,0.5f), 475 color14}); 476 } 477 478 private Paint decodeGradient7(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.5f * w) + x, (0.0f * h) + y, (0.5f * w) + x, (1.0f * h) + y, 485 new float[] { 0.0f,0.37967914f,0.7593583f,0.87967914f,1.0f }, 486 new Color[] { color15, 487 decodeColor(color15,color16,0.5f), 488 color16, 489 decodeColor(color16,color17,0.5f), 490 color17}); 491 } 492 493 private Paint decodeGradient8(Shape s) { 494 Rectangle2D bounds = s.getBounds2D(); 495 float x = (float)bounds.getX(); 496 float y = (float)bounds.getY(); 497 float w = (float)bounds.getWidth(); 498 float h = (float)bounds.getHeight(); 499 return decodeGradient((0.5f * w) + x, (0.0f * h) + y, (0.5f * w) + x, (1.0f * h) + y, 500 new float[] { 0.0f,0.5f,1.0f }, 501 new Color[] { color19, 502 decodeColor(color19,color20,0.5f), 503 color20}); 504 } 505 506 private Paint decodeGradient9(Shape s) { 507 Rectangle2D bounds = s.getBounds2D(); 508 float x = (float)bounds.getX(); 509 float y = (float)bounds.getY(); 510 float w = (float)bounds.getWidth(); 511 float h = (float)bounds.getHeight(); 512 return decodeGradient((0.5f * w) + x, (0.0f * h) + y, (0.5f * w) + x, (1.0f * h) + y, 513 new float[] { 0.0f,0.37165776f,0.7433155f,0.8716577f,1.0f }, 514 new Color[] { color21, 515 decodeColor(color21,color22,0.5f), 516 color22, 517 decodeColor(color22,color23,0.5f), 518 color23}); 519 } 520 521 private Paint decodeGradient10(Shape s) { 522 Rectangle2D bounds = s.getBounds2D(); 523 float x = (float)bounds.getX(); 524 float y = (float)bounds.getY(); 525 float w = (float)bounds.getWidth(); 526 float h = (float)bounds.getHeight(); 527 return decodeGradient((0.5f * w) + x, (0.0f * h) + y, (0.5f * w) + x, (1.0f * h) + y, 528 new float[] { 0.0f,0.3970588f,0.7941176f,0.89705884f,1.0f }, 529 new Color[] { color15, 530 decodeColor(color15,color16,0.5f), 531 color16, 532 decodeColor(color16,color17,0.5f), 533 color17}); 534 } 535 536 private Paint decodeGradient11(Shape s) { 537 Rectangle2D bounds = s.getBounds2D(); 538 float x = (float)bounds.getX(); 539 float y = (float)bounds.getY(); 540 float w = (float)bounds.getWidth(); 541 float h = (float)bounds.getHeight(); 542 return decodeGradient((0.5f * w) + x, (0.0f * h) + y, (0.5f * w) + x, (1.0f * h) + y, 543 new float[] { 0.0f,0.4318182f,0.8636364f,0.9318182f,1.0f }, 544 new Color[] { color21, 545 decodeColor(color21,color22,0.5f), 546 color22, 547 decodeColor(color22,color23,0.5f), 548 color23}); 549 } 550 551 private Paint decodeGradient12(Shape s) { 552 Rectangle2D bounds = s.getBounds2D(); 553 float x = (float)bounds.getX(); 554 float y = (float)bounds.getY(); 555 float w = (float)bounds.getWidth(); 556 float h = (float)bounds.getHeight(); 557 return decodeGradient((0.48636365f * w) + x, (0.0116959065f * h) + y, (0.4909091f * w) + x, (0.8888889f * h) + y, 558 new float[] { 0.0f,0.5f,1.0f }, 559 new Color[] { color27, 560 decodeColor(color27,color28,0.5f), 561 color28}); 562 } 563 564 565 } 566 | Popular Tags |