GradientPaint.java 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. /* GradientPaint.java --
  2. Copyright (C) 2002 Free Software Foundation, Inc.
  3. This file is part of GNU Classpath.
  4. GNU Classpath is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2, or (at your option)
  7. any later version.
  8. GNU Classpath is distributed in the hope that it will be useful, but
  9. WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with GNU Classpath; see the file COPYING. If not, write to the
  14. Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  15. 02111-1307 USA.
  16. Linking this library statically or dynamically with other modules is
  17. making a combined work based on this library. Thus, the terms and
  18. conditions of the GNU General Public License cover the whole
  19. combination.
  20. As a special exception, the copyright holders of this library give you
  21. permission to link this library with independent modules to produce an
  22. executable, regardless of the license terms of these independent
  23. modules, and to copy and distribute the resulting executable under
  24. terms of your choice, provided that you also meet, for each linked
  25. independent module, the terms and conditions of the license of that
  26. module. An independent module is a module which is not derived from
  27. or based on this library. If you modify this library, you may extend
  28. this exception to your version of the library, but you are not
  29. obligated to do so. If you do not wish to do so, delete this
  30. exception statement from your version. */
  31. package java.awt;
  32. import java.awt.geom.AffineTransform;
  33. import java.awt.geom.Point2D;
  34. import java.awt.geom.Rectangle2D;
  35. import java.awt.image.ColorModel;
  36. /**
  37. * STUB CLASS ONLY
  38. */
  39. public class GradientPaint implements Paint
  40. {
  41. private final float x1;
  42. private final float y1;
  43. private final Color c1;
  44. private final float x2;
  45. private final float y2;
  46. private final Color c2;
  47. private final boolean cyclic;
  48. public GradientPaint(float x1, float y1, Color c1,
  49. float x2, float y2, Color c2)
  50. {
  51. this(x1, y1, c1, x2, y2, c2, false);
  52. }
  53. public GradientPaint(Point2D p1, Color c1, Point2D p2, Color c2)
  54. {
  55. this((float) p1.getX(), (float) p1.getY(), c1,
  56. (float) p2.getX(), (float) p2.getY(), c2, false);
  57. }
  58. public GradientPaint(float x1, float y1, Color c1,
  59. float x2, float y2, Color c2, boolean cyclic)
  60. {
  61. if (c1 == null || c2 == null)
  62. throw new NullPointerException();
  63. this.x1 = x1;
  64. this.y1 = y1;
  65. this.c1 = c1;
  66. this.x2 = x2;
  67. this.y2 = y2;
  68. this.c2 = c2;
  69. this.cyclic = cyclic;
  70. }
  71. public GradientPaint(Point2D p1, Color c1, Point2D p2, Color c2,
  72. boolean cyclic)
  73. {
  74. this((float) p1.getX(), (float) p1.getY(), c1,
  75. (float) p2.getX(), (float) p2.getY(), c2, cyclic);
  76. }
  77. public Point2D getPoint1()
  78. {
  79. return new Point2D.Float(x1, y1);
  80. }
  81. public Color getColor1()
  82. {
  83. return c1;
  84. }
  85. public Point2D getPoint2()
  86. {
  87. return new Point2D.Float(x2, y2);
  88. }
  89. public Color getColor2()
  90. {
  91. return c2;
  92. }
  93. public boolean isCyclic()
  94. {
  95. return cyclic;
  96. }
  97. public PaintContext createContext(ColorModel cm, Rectangle deviceBounds,
  98. Rectangle2D userBounds,
  99. AffineTransform xform,
  100. RenderingHints hints)
  101. {
  102. throw new Error("not implemented");
  103. }
  104. public int getTransparency()
  105. {
  106. throw new Error("not implemented");
  107. }
  108. } // class GradientPaint