home *** CD-ROM | disk | FTP | other *** search
/ Apple Developer Connection Student Program / ADC Tools Sampler CD Disk 3 1999.iso / Metrowerks CodeWarrior / Java Support / Java_Source / Java2 / src / java / awt / Composite.java < prev    next >
Encoding:
Java Source  |  1999-05-28  |  3.4 KB  |  77 lines  |  [TEXT/CWIE]

  1. /*
  2.  * @(#)Composite.java    1.18 98/10/19
  3.  *
  4.  * Copyright 1997, 1998 by Sun Microsystems, Inc.,
  5.  * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
  6.  * All rights reserved.
  7.  *
  8.  * This software is the confidential and proprietary information
  9.  * of Sun Microsystems, Inc. ("Confidential Information").  You
  10.  * shall not disclose such Confidential Information and shall use
  11.  * it only in accordance with the terms of the license agreement
  12.  * you entered into with Sun.
  13.  */
  14.  
  15. package java.awt;
  16.  
  17. import java.awt.image.ColorModel;
  18.  
  19. /**
  20.  * The <code>Composite</code> interface, along with 
  21.  * {@link CompositeContext}, defines the methods to compose a draw
  22.  * primitive with the underlying graphics area.
  23.  * After the <code>Composite</code> is set in the 
  24.  * {@link Graphics2D} context, it combines a shape, text, or an image
  25.  * being rendered with the colors that have already been rendered
  26.  * according to pre-defined rules. The classes
  27.  * implementing this interface provide the rules and a method to create
  28.  * the context for a particular operation.
  29.  * <code>CompositeContext</code> is an environment used by the 
  30.  * compositing operation, which is created by the <code>Graphics2D</code>
  31.  * prior to the start of the operation.  <code>CompositeContext</code>
  32.  * contains private information and resources needed for a compositing 
  33.  * operation.  When the <code>CompositeContext</code> is no longer needed,
  34.  * the <code>Graphics2D</code> object disposes of it in order to reclaim 
  35.  * resources allocated for the operation.
  36.  * <p>
  37.  * Instances of classes implementing <code>Composite</code> must be 
  38.  * immutable because the <code>Graphics2D</code> does not clone
  39.  * these objects when they are set as an attribute with the 
  40.  * <code>setComposite</code> method or when the <code>Graphics2D</code>
  41.  * object is cloned.  This is to avoid undefined rendering behavior of 
  42.  * <code>Graphics2D</code>, resulting from the modification of 
  43.  * the <code>Composite</code> object after it has been set in the 
  44.  * <code>Graphics2D</code> context.
  45.  * <p>
  46.  * Since this interface must expose the contents of pixels on the
  47.  * target device or image to potentially arbitrary code, the use of
  48.  * custom objects which implement this interface when rendering directly
  49.  * to a screen device is governed by the <code>readDisplayPixels</code>
  50.  * {@link AWTPermission}.  The permission check will occur when such
  51.  * a custom object is passed to the <code>setComposite</code> method
  52.  * of a <code>Graphics2D</code> retrieved from a {@link Component}.
  53.  * @see AlphaComposite
  54.  * @see CompositeContext
  55.  * @see Graphics2D#setComposite
  56.  * @version 10 Feb 1997
  57.  */
  58. public interface Composite {
  59.  
  60.     /**
  61.      * Creates a context containing state that is used to perform
  62.      * the compositing operation.  In a multi-threaded environment,
  63.      * several contexts can exist simultaneously for a single
  64.      * <code>Composite</code> object.
  65.      * @param srcColorModel  the {@link ColorModel} of the source
  66.      * @param dstColorModel  the <code>ColorModel</code> of the destination
  67.      * @param hints the hint that the context object uses to choose between
  68.      * rendering alternatives
  69.      * @return the <code>CompositeContext</code> object used to perform the
  70.      * compositing operation.
  71.      */
  72.     public CompositeContext createContext(ColorModel srcColorModel,
  73.                       ColorModel dstColorModel,
  74.                                           RenderingHints hints);
  75.  
  76. }
  77.