GNU Classpath (0.18) | ||
Frames | No Frames |
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 java.awt.geom.AffineTransform; 42: import java.awt.image.BufferedImage; 43: import java.awt.image.ColorModel; 44: import java.awt.image.VolatileImage; 45: 46: /** 47: * This class describes the configuration of various graphics devices, such 48: * as a monitor or printer. Different configurations may exist for the same 49: * device, according to the different native modes supported. 50: * 51: * <p>Virtual devices are supported (for example, in a multiple screen 52: * environment, a virtual device covers all screens simultaneously); the 53: * configuration will have a non-zero relative coordinate system in such 54: * a case. 55: * 56: * @author Eric Blake (ebb9@email.byu.edu) 57: * @see Window 58: * @see Frame 59: * @see GraphicsEnvironment 60: * @see GraphicsDevice 61: * @since 1.0 62: * @status updated to 1.4 63: */ 64: public abstract class GraphicsConfiguration 65: { 66: /** 67: * The default constructor. 68: * 69: * @see GraphicsDevice#getConfigurations() 70: * @see GraphicsDevice#getDefaultConfiguration() 71: * @see GraphicsDevice#getBestConfiguration(GraphicsConfigTemplate) 72: * @see Graphics2D#getDeviceConfiguration() 73: */ 74: protected GraphicsConfiguration () 75: { 76: } 77: 78: /** 79: * Gets the associated device that this configuration describes. 80: * 81: * @return the device 82: */ 83: public abstract GraphicsDevice getDevice(); 84: 85: /** 86: * Returns a buffered image optimized to this device, so that blitting can 87: * be supported in the buffered image. 88: * 89: * @param w the width of the buffer 90: * @param h the height of the buffer 91: * @return the buffered image, or null if none is supported 92: */ 93: public abstract BufferedImage createCompatibleImage(int w, int h); 94: 95: /** 96: * Returns a buffered volatile image optimized to this device, so that 97: * blitting can be supported in the buffered image. Because the buffer is 98: * volatile, it can be optimized by native graphics accelerators. 99: * 100: * @param w the width of the buffer 101: * @param h the height of the buffer 102: * @return the buffered image, or null if none is supported 103: * @see Component#createVolatileImage(int, int) 104: * @since 1.4 105: */ 106: public abstract VolatileImage createCompatibleVolatileImage(int w, int h); 107: 108: /** 109: * Returns a buffered volatile image optimized to this device, and with the 110: * given capabilities, so that blitting can be supported in the buffered 111: * image. Because the buffer is volatile, it can be optimized by native 112: * graphics accelerators. 113: * 114: * @param w the width of the buffer 115: * @param h the height of the buffer 116: * @param caps the desired capabilities of the image buffer 117: * @return the buffered image, or null if none is supported 118: * @throws AWTException if the capabilities cannot be met 119: * @since 1.4 120: */ 121: public VolatileImage createCompatibleVolatileImage(int w, int h, 122: ImageCapabilities caps) 123: throws AWTException 124: { 125: throw new AWTException("not implemented"); 126: } 127: 128: /** 129: * Returns a buffered volatile image optimized to this device, and 130: * with the given transparency. Because the buffer is volatile, it 131: * can be optimized by native graphics accelerators. 132: * 133: * @param w the width of the buffer 134: * @param h the height of the buffer 135: * @param transparency the transparency value for the buffer 136: * @return the buffered image, or null if none is supported 137: * @throws AWTException if the capabilities cannot be met 138: * @since 1.5 139: */ 140: public abstract VolatileImage createCompatibleVolatileImage(int width, 141: int height, 142: int transparency); 143: 144: /** 145: * Returns a buffered image optimized to this device, and with the specified 146: * transparency, so that blitting can be supported in the buffered image. 147: * 148: * @param w the width of the buffer 149: * @param h the height of the buffer 150: * @param transparency the transparency of the buffer 151: * @return the buffered image, or null if none is supported 152: * @see Transparency#OPAQUE 153: * @see Transparency#BITMASK 154: * @see Transparency#TRANSLUCENT 155: */ 156: public abstract BufferedImage createCompatibleImage(int w, int h, 157: int transparency); 158: 159: /** 160: * Gets the color model of the corresponding device. 161: * 162: * @return the color model 163: */ 164: public abstract ColorModel getColorModel(); 165: 166: /** 167: * Gets a color model for the corresponding device which supports the desired 168: * transparency level. 169: * 170: * @param transparency the transparency of the model 171: * @return the color model, with transparency 172: * @see Transparency#OPAQUE 173: * @see Transparency#BITMASK 174: * @see Transparency#TRANSLUCENT 175: */ 176: public abstract ColorModel getColorModel(int transparency); 177: 178: /** 179: * Returns a transform that maps user coordinates to device coordinates. The 180: * preferred mapping is about 72 user units to 1 inch (2.54 cm) of physical 181: * space. This is often the identity transform. The device coordinates have 182: * the origin at the upper left, with increasing x to the right, and 183: * increasing y to the bottom. 184: * 185: * @return the transformation from user space to device space 186: * @see #getNormalizingTransform() 187: */ 188: public abstract AffineTransform getDefaultTransform(); 189: 190: /** 191: * Returns a transform that maps user coordinates to device coordinates. The 192: * exact mapping is 72 user units to 1 inch (2.54 cm) of physical space. 193: * This is often the identity transform. The device coordinates have the 194: * origin at the upper left, with increasing x to the right, and increasing 195: * y to the bottom. Note that this is more accurate (and thus, sometimes more 196: * costly) than the default transform. 197: * 198: * @return the normalized transformation from user space to device space 199: * @see #getDefaultTransform() 200: */ 201: public abstract AffineTransform getNormalizingTransform(); 202: 203: /** 204: * Returns the bounds of the configuration, in device coordinates. If this 205: * is a virtual device (for example, encompassing several screens), the 206: * bounds may have a non-zero origin. 207: * 208: * @return the device bounds 209: * @since 1.3 210: */ 211: public abstract Rectangle getBounds(); 212: 213: /** 214: * Returns the buffering capabilities of this configuration. 215: * 216: * @return the buffer capabilities 217: * @since 1.4 218: */ 219: public BufferCapabilities getBufferCapabilities() 220: { 221: throw new Error("not implemented"); 222: } 223: 224: /** 225: * Returns the imaging capabilities of this configuration. 226: * 227: * @return the image capabilities 228: * @since 1.4 229: */ 230: public ImageCapabilities getImageCapabilities() 231: { 232: throw new Error("not implemented"); 233: } 234: } // class GraphicsConfiguration
GNU Classpath (0.18) |