home *** CD-ROM | disk | FTP | other *** search
/ Java 1.2 How-To / JavaHowTo.iso / 3rdParty / jbuilder / unsupported / JDK1.2beta3 / SOURCE / SRC.ZIP / java / awt / Composite.java < prev    next >
Encoding:
Java Source  |  1998-03-20  |  2.5 KB  |  66 lines

  1. /*
  2.  * @(#)Composite.java    1.12 98/03/18
  3.  *
  4.  * Copyright 1997 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.  * This interface, together with CompositeContext, defines the methods
  20.  * to compose a draw primitive with the
  21.  * underlying graphics area.
  22.  * The Composite is set in the Graphics2D and thereafter,
  23.  * whenever a shape, text, or an image is drawn, the Composite will
  24.  * combine the source with the colors that have already been drawn,
  25.  * according to pre-defined rules. The classes implementing this
  26.  * interface will provide the rules and a method to create the context for
  27.  * a particular operation.
  28.  * CompositeContext is an environment used by the compositing
  29.  * operation that a Graphics2D object must create prior to the start of the
  30.  * operation.
  31.  * CompositeContext contains various private information and resources
  32.  * needed for a compositing operation. When the CompositeContext
  33.  * is no longer needed it will be disposed by the Graphics2D object to reclaim
  34.  * resources allocated for the operation.
  35.  * <p>
  36.  * Instances of classes implementing Composite must be immutable
  37.  * (i.e. read-only) because the Graphics2D does not clone
  38.  * these objects when they are set as an attribute with the setComposite
  39.  * method or when the Graphics2D object is itself cloned.
  40.  * This is to avoid undefined behavior of Graphics2D rendering
  41.  * which would result if the Composite object were modified after
  42.  * being set in the Graphics2D state.
  43.  * @see AlphaComposite
  44.  * @see CompositeContext
  45.  * @see Graphics2D#setComposite
  46.  * @version 10 Feb 1997
  47.  */
  48.  
  49. public interface Composite {
  50.  
  51.     /**
  52.      * Create a context for the compositing operation.
  53.      * The context contains state that is used to perform
  54.      * the compositing operation.  In a multi-threaded environment
  55.      * several contexts may exist simultaneously for a single
  56.      * Composite object.
  57.      * @param srcColorModel  The ColorModel of the source.
  58.      * @param dstColorModel  The ColorModel of the destination.
  59.      * @return The CompositeContext object to perform the
  60.      * compositing operation.
  61.      */
  62.     public CompositeContext createContext(ColorModel srcColorModel,
  63.                       ColorModel dstColorModel);
  64.  
  65. }
  66.