Source for java.awt.GraphicsConfiguration

   1: /* GraphicsConfiguration.java -- describes characteristics of graphics
   2:    Copyright (C) 2000, 2001, 2002 Free Software Foundation
   3: 
   4: This file is part of GNU Classpath.
   5: 
   6: GNU Classpath is free software; you can redistribute it and/or modify
   7: it under the terms of the GNU General Public License as published by
   8: the Free Software Foundation; either version 2, or (at your option)
   9: any later version.
  10: 
  11: GNU Classpath is distributed in the hope that it will be useful, but
  12: WITHOUT ANY WARRANTY; without even the implied warranty of
  13: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  14: General Public License for more details.
  15: 
  16: You should have received a copy of the GNU General Public License
  17: along with GNU Classpath; see the file COPYING.  If not, write to the
  18: Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  19: 02110-1301 USA.
  20: 
  21: Linking this library statically or dynamically with other modules is
  22: making a combined work based on this library.  Thus, the terms and
  23: conditions of the GNU General Public License cover the whole
  24: combination.
  25: 
  26: As a special exception, the copyright holders of this library give you
  27: permission to link this library with independent modules to produce an
  28: executable, regardless of the license terms of these independent
  29: modules, and to copy and distribute the resulting executable under
  30: terms of your choice, provided that you also meet, for each linked
  31: independent module, the terms and conditions of the license of that
  32: module.  An independent module is a module which is not derived from
  33: or based on this library.  If you modify this library, you may extend
  34: this exception to your version of the library, but you are not
  35: obligated to do so.  If you do not wish to do so, delete this
  36: exception statement from your version. */
  37: 
  38: 
  39: package java.awt;
  40: 
  41: import gnu.classpath.NotImplementedException;
  42: 
  43: import java.awt.geom.AffineTransform;
  44: import java.awt.image.BufferedImage;
  45: import java.awt.image.ColorModel;
  46: import java.awt.image.VolatileImage;
  47: 
  48: /**
  49:  * This class describes the configuration of various graphics devices, such
  50:  * as a monitor or printer. Different configurations may exist for the same
  51:  * device, according to the different native modes supported.
  52:  *
  53:  * <p>Virtual devices are supported (for example, in a multiple screen
  54:  * environment, a virtual device covers all screens simultaneously); the
  55:  * configuration will have a non-zero relative coordinate system in such
  56:  * a case.
  57:  *
  58:  * @author Eric Blake (ebb9@email.byu.edu)
  59:  * @see Window
  60:  * @see Frame
  61:  * @see GraphicsEnvironment
  62:  * @see GraphicsDevice
  63:  * @since 1.0
  64:  * @status updated to 1.4
  65:  */
  66: public abstract class GraphicsConfiguration
  67: {
  68:   /**
  69:    * The default constructor.
  70:    *
  71:    * @see GraphicsDevice#getConfigurations()
  72:    * @see GraphicsDevice#getDefaultConfiguration()
  73:    * @see GraphicsDevice#getBestConfiguration(GraphicsConfigTemplate)
  74:    * @see Graphics2D#getDeviceConfiguration()
  75:    */
  76:   protected GraphicsConfiguration ()
  77:   {
  78:   }
  79: 
  80:   /**
  81:    * Gets the associated device that this configuration describes.
  82:    *
  83:    * @return the device
  84:    */
  85:   public abstract GraphicsDevice getDevice();
  86: 
  87:   /**
  88:    * Returns a buffered image optimized to this device, so that blitting can
  89:    * be supported in the buffered image.
  90:    *
  91:    * @param w the width of the buffer
  92:    * @param h the height of the buffer
  93:    * @return the buffered image, or null if none is supported
  94:    */
  95:   public abstract BufferedImage createCompatibleImage(int w, int h);
  96: 
  97:   /**
  98:    * Returns a buffered volatile image optimized to this device, so that
  99:    * blitting can be supported in the buffered image. Because the buffer is
 100:    * volatile, it can be optimized by native graphics accelerators.
 101:    *
 102:    * @param w the width of the buffer
 103:    * @param h the height of the buffer
 104:    * @return the buffered image, or null if none is supported
 105:    * @see Component#createVolatileImage(int, int)
 106:    * @since 1.4
 107:    */
 108:   public abstract VolatileImage createCompatibleVolatileImage(int w, int h);
 109: 
 110:   /**
 111:    * Returns a buffered volatile image optimized to this device, and with the
 112:    * given capabilities, so that blitting can be supported in the buffered
 113:    * image. Because the buffer is volatile, it can be optimized by native
 114:    * graphics accelerators.
 115:    *
 116:    * @param w the width of the buffer
 117:    * @param h the height of the buffer
 118:    * @param caps the desired capabilities of the image buffer
 119:    * @return the buffered image, or null if none is supported
 120:    * @throws AWTException if the capabilities cannot be met
 121:    * @since 1.4
 122:    */
 123:   public VolatileImage createCompatibleVolatileImage(int w, int h,
 124:                                                      ImageCapabilities caps)
 125:     throws AWTException
 126:   {
 127:     throw new AWTException("not implemented");
 128:   }
 129: 
 130:   /**
 131:    * Returns a buffered volatile image optimized to this device, and
 132:    * with the given transparency. Because the buffer is volatile, it
 133:    * can be optimized by native graphics accelerators.
 134:    *
 135:    * @param width the width of the buffer
 136:    * @param height the height of the buffer
 137:    * @param transparency the transparency value for the buffer
 138:    * @return the buffered image, or null if none is supported
 139:    * @since 1.5
 140:    */
 141:   public abstract VolatileImage createCompatibleVolatileImage(int width,
 142:                                                               int height,
 143:                                                               int transparency);
 144: 
 145:   /**
 146:    * Returns a buffered image optimized to this device, and with the specified
 147:    * transparency, so that blitting can be supported in the buffered image.
 148:    *
 149:    * @param w the width of the buffer
 150:    * @param h the height of the buffer
 151:    * @param transparency the transparency of the buffer
 152:    * @return the buffered image, or null if none is supported
 153:    * @see Transparency#OPAQUE
 154:    * @see Transparency#BITMASK
 155:    * @see Transparency#TRANSLUCENT
 156:    */
 157:   public abstract BufferedImage createCompatibleImage(int w, int h,
 158:                                                       int transparency);
 159: 
 160:   /**
 161:    * Gets the color model of the corresponding device.
 162:    *
 163:    * @return the color model
 164:    */
 165:   public abstract ColorModel getColorModel();
 166: 
 167:   /**
 168:    * Gets a color model for the corresponding device which supports the desired
 169:    * transparency level.
 170:    *
 171:    * @param transparency the transparency of the model
 172:    * @return the color model, with transparency
 173:    * @see Transparency#OPAQUE
 174:    * @see Transparency#BITMASK
 175:    * @see Transparency#TRANSLUCENT
 176:    */
 177:   public abstract ColorModel getColorModel(int transparency);
 178: 
 179:   /**
 180:    * Returns a transform that maps user coordinates to device coordinates. The
 181:    * preferred mapping is about 72 user units to 1 inch (2.54 cm) of physical
 182:    * space. This is often the identity transform. The device coordinates have
 183:    * the origin at the upper left, with increasing x to the right, and
 184:    * increasing y to the bottom.
 185:    *
 186:    * @return the transformation from user space to device space
 187:    * @see #getNormalizingTransform()
 188:    */
 189:   public abstract AffineTransform getDefaultTransform();
 190: 
 191:   /**
 192:    * Returns a transform that maps user coordinates to device coordinates. The
 193:    * exact mapping is 72 user units to 1 inch (2.54 cm) of physical space.
 194:    * This is often the identity transform. The device coordinates have the
 195:    * origin at the upper left, with increasing x to the right, and increasing
 196:    * y to the bottom. Note that this is more accurate (and thus, sometimes more
 197:    * costly) than the default transform.
 198:    *
 199:    * @return the normalized transformation from user space to device space
 200:    * @see #getDefaultTransform()
 201:    */
 202:   public abstract AffineTransform getNormalizingTransform();
 203: 
 204:   /**
 205:    * Returns the bounds of the configuration, in device coordinates. If this
 206:    * is a virtual device (for example, encompassing several screens), the
 207:    * bounds may have a non-zero origin.
 208:    *
 209:    * @return the device bounds
 210:    * @since 1.3
 211:    */
 212:   public abstract Rectangle getBounds();
 213: 
 214:   /**
 215:    * Returns the buffering capabilities of this configuration.
 216:    *
 217:    * @return the buffer capabilities
 218:    * @since 1.4
 219:    */
 220:   public BufferCapabilities getBufferCapabilities()
 221:     throws NotImplementedException
 222:   {
 223:     throw new Error("not implemented");
 224:   }
 225: 
 226:   /**
 227:    * Returns the imaging capabilities of this configuration.
 228:    *
 229:    * @return the image capabilities
 230:    * @since 1.4
 231:    */
 232:   public ImageCapabilities getImageCapabilities()
 233:     throws NotImplementedException
 234:   {
 235:     throw new Error("not implemented");
 236:   }
 237: } // class GraphicsConfiguration