GraphicsConfiguration.java 7.6 KB

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