1. /*
  2. * @(#)Paint.java 1.21 01/11/29
  3. *
  4. * Copyright 2002 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package java.awt;
  8. import java.awt.image.ColorModel;
  9. import java.awt.geom.AffineTransform;
  10. import java.awt.geom.Point2D;
  11. import java.awt.geom.Rectangle2D;
  12. /**
  13. * This <code>Paint</code> interface defines how color patterns
  14. * can be generated for {@link Graphics2D} operations. A class
  15. * implementing the <code>Paint</code> interface is added to the
  16. * <code>Graphics2D</code> context in order to define the color
  17. * pattern used by the <code>draw</code> and <code>fill</code> methods.
  18. * <p>
  19. * Instances of classes implementing <code>Paint</code> must be
  20. * read-only because the <code>Graphics2D</code> does not clone
  21. * these objects when they are set as an attribute with the
  22. * <code>setPaint</code> method or when the <code>Graphics2D</code>
  23. * object is itself cloned.
  24. * @see PaintContext
  25. * @see Color
  26. * @see GradientPaint
  27. * @see TexturePaint
  28. * @see Graphics2D#setPaint
  29. * @version 10 Feb 1997
  30. */
  31. public interface Paint extends Transparency {
  32. /**
  33. * Creates and returns a {@link PaintContext} used to
  34. * generate the color pattern.
  35. * @param cm the {@link ColorModel} that receives the
  36. * <code>Paint</code> data. This is used only as a hint.
  37. * @param deviceBounds the device space bounding box
  38. * of the graphics primitive being rendered
  39. * @param userBounds the user space bounding box
  40. * of the graphics primitive being rendered
  41. * @param xform the {@link AffineTransform} from user
  42. * space into device space
  43. * @param hints the hint that the context object uses to
  44. * choose between rendering alternatives
  45. * @return the <code>PaintContext</code> for
  46. * generating color patterns
  47. * @see PaintContext
  48. */
  49. public PaintContext createContext(ColorModel cm,
  50. Rectangle deviceBounds,
  51. Rectangle2D userBounds,
  52. AffineTransform xform,
  53. RenderingHints hints);
  54. }