1. /*
  2. * @(#)PaintContext.java 1.25 03/12/19
  3. *
  4. * Copyright 2004 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.color.ColorSpace;
  9. import java.awt.image.Raster;
  10. import java.awt.image.ColorModel;
  11. /**
  12. * The <code>PaintContext</code> interface defines the encapsulated
  13. * and optimized environment to generate color patterns in device
  14. * space for fill or stroke operations on a
  15. * {@link Graphics2D}. The <code>PaintContext</code> provides
  16. * the necessary colors for <code>Graphics2D</code> operations in the
  17. * form of a {@link Raster} associated with a {@link ColorModel}.
  18. * The <code>PaintContext</code> maintains state for a particular paint
  19. * operation. In a multi-threaded environment, several
  20. * contexts can exist simultaneously for a single {@link Paint} object.
  21. * @see Paint
  22. * @version 10 Feb 1997
  23. */
  24. public interface PaintContext {
  25. /**
  26. * Releases the resources allocated for the operation.
  27. */
  28. public void dispose();
  29. /**
  30. * Returns the <code>ColorModel</code> of the output. Note that
  31. * this <code>ColorModel</code> might be different from the hint
  32. * specified in the
  33. * {@link Paint#createContext(ColorModel, Rectangle, Rectangle2D,
  34. AffineTransform, RenderingHints) createContext} method of
  35. * <code>Paint</code>. Not all <code>PaintContext</code> objects are
  36. * capable of generating color patterns in an arbitrary
  37. * <code>ColorModel</code>.
  38. * @return the <code>ColorModel</code> of the output.
  39. */
  40. ColorModel getColorModel();
  41. /**
  42. * Returns a <code>Raster</code> containing the colors generated for
  43. * the graphics operation.
  44. * @param x the x coordinate of the area in device space
  45. * for which colors are generated.
  46. * @param y the y coordinate of the area in device space
  47. * for which colors are generated.
  48. * @param w the width of the area in device space
  49. * @param h the height of the area in device space
  50. * @return a <code>Raster</code> representing the specified
  51. * rectangular area and containing the colors generated for
  52. * the graphics operation.
  53. */
  54. Raster getRaster(int x,
  55. int y,
  56. int w,
  57. int h);
  58. }