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

  1. /*
  2.  * @(#)AlphaCompositeContextCLEAR.java    1.4 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. /**
  20.  * This interface defines the encapsulated and optimized environment for
  21.  * a compositing operation.  CompositeContext objects maintain state for
  22.  * compositing operations.  In a multi-threaded environment, several
  23.  * contexts may exist simultaneously for a single Composite object.
  24.  * @see Composite
  25.  * @version 10 Feb 1997
  26.  */
  27.  
  28. class AlphaCompositeContextCLEAR implements CompositeContext {
  29.  
  30.     int xtrAlph;
  31.     ColorModel dstCM;
  32.     
  33.     protected AlphaCompositeContextCLEAR(ColorModel srcCM,
  34.                                          ColorModel dstCM,
  35.                                          float extraAlpha) {
  36.         this.dstCM = dstCM;
  37.     }
  38.     
  39.     /**
  40.      * Release resources allocated for context.
  41.      */
  42.     public void dispose() {
  43.     }
  44.  
  45.     /**
  46.      * This method composes the source tile with the destination tile
  47.      * and places the result in the destination tile.
  48.      * @param src The source tile for the compositing operation.
  49.      * @param dst The second source of the compositing operation and also
  50.      * where the result is placed.
  51.      */
  52.     public void compose(Tile src,
  53.             Tile dst) {
  54.         int color[] = new int[dstCM.getNumComponents()];
  55.  
  56.         for (int i = 0 ; i < dst.getHeight() ; i++) {
  57.             for (int j = 0 ; j < dst.getWidth() ; j++) {
  58.                 dst.putData(j, i, color);
  59.             }
  60.         }
  61.     }
  62.  
  63. }
  64.