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