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

  1. /*
  2.  * @(#)GraphicsConfiguration.java    1.14 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.geom.AffineTransform;
  18. import java.awt.image.BufferedImage;
  19. import java.awt.image.ColorModel;
  20.  
  21. /**
  22.  * This class describes the characteristics of a physical graphics
  23.  * destination such as a printer or monitor.  There can be many
  24.  * GraphicsConfiguration objects associated with a single graphics device.
  25.  * For instance, on X11 windowing systems, each visual
  26.  * is a different GraphicsConfiguration.  On PCs and Macintoshes, the
  27.  * different screen resolution/color resolution combinations would
  28.  * be different GraphicsConfigurations.
  29.  * @see GraphicsEnvironment
  30.  * @see GraphicsDevice
  31.  */
  32. /*
  33.  * REMIND:  What to do about capabilities?
  34.  * The
  35.  * capabilities of the device can be determined by enumerating the possible
  36.  * capabilities and checking if the GraphicsConfiguration
  37.  * implements the interface for that capability.
  38.  *
  39.  * @version  10 Feb 1997
  40.  */
  41.  
  42.  
  43. public abstract class GraphicsConfiguration {
  44.     /**
  45.      * Return the graphics device associated with this configuration.
  46.      */
  47.     public abstract GraphicsDevice getDevice();
  48.  
  49.     /**
  50.      * Returns a BufferedImage with channel layout and color model
  51.      * compatible with this graphics configuration.  This method
  52.      * has nothing to do with memory-mapping
  53.      * a device.  This BufferedImage has
  54.      * a layout and color model
  55.      * that is closest to this native device configuration and thus
  56.      * can be optimally blitted to this device.
  57.      */
  58.     public abstract BufferedImage createCompatibleImage(int width, int height);
  59.  
  60.     /**
  61.      * Returns a BufferedImage that supports the specified transparency
  62.      * and has a channel layout and color model
  63.      * compatible with this graphics configuration.  This method
  64.      * has nothing to do with memory-mapping
  65.      * a device. This BufferedImage has a layout and
  66.      * color model that can be optimally blitted to a device
  67.      * with this configuration.  
  68.      * @see Transparency#OPAQUE
  69.      * @see Transparency#BITMASK
  70.      * @see Transparency#TRANSLUCENT
  71.      */
  72.     public abstract BufferedImage createCompatibleImage(int width, int height,
  73.                                                         int transparency);
  74.  
  75.     /**
  76.      * Returns the color model associated with this configuration.
  77.      */
  78.     public abstract ColorModel getColorModel();
  79.  
  80.     /**
  81.      * Returns the color model associated with this configuration that
  82.      * supports the specified transparency.
  83.      */
  84.     public abstract ColorModel getColorModel(int transparency);
  85.  
  86.     /**
  87.      * Returns the default Transform for this configuration.  This
  88.      * Transform is typically the Identity transform for most normal
  89.      * screens.  Device coordinates for screen and printer devices will
  90.      * have the origin in the upper left-hand corner of the target region of
  91.      * the device, with X coordinates
  92.      * increasing to the right and Y coordinates increasing downwards.
  93.      * For image buffers, this Transform will be the Identity transform.
  94.      */
  95.     public abstract AffineTransform getDefaultTransform();
  96.     
  97.     /**
  98.      *
  99.      * Returns a Transform that can be composed with the default Transform
  100.      * of a Graphics2D so that 72 units in user space will equal 1 inch
  101.      * in device space.  
  102.      * Given a Graphics2D, g, one can reset the transformation to create
  103.      * such a mapping by using the following pseudocode:
  104.      * <pre>
  105.      *      GraphicsConfiguration gc = g.getGraphicsConfiguration();
  106.      *
  107.      *      g.setTransform(gc.getDefaultTransform());
  108.      *      g.transform(gc.getNormalizingTransform());
  109.      * </pre>
  110.      * Note that sometimes this Transform will be identity (e.g. for 
  111.      * printers or metafile output) and that this Transform is only
  112.      * as accurate as the information supplied by the underlying system.
  113.      * For image buffers, this Transform will be the Identity transform,
  114.      * since there is no valid distance measurement.
  115.      */
  116.     public abstract AffineTransform getNormalizingTransform();
  117.  
  118. }
  119.  
  120.  
  121.