API java : GraphicsConfiguration


java.awt
Class GraphicsConfiguration

java.lang.Object
  extended by java.awt.GraphicsConfiguration

public abstract class GraphicsConfiguration
extends Object

The GraphicsConfiguration class describes the characteristics of a graphics destination such as a printer or monitor. There can be many GraphicsConfiguration objects associated with a single graphics device, representing different drawing modes or capabilities. The corresponding native structure will vary from platform to platform. For example, on X11 windowing systems, each visual is a different GraphicsConfiguration. On Microsoft Windows, GraphicsConfigurations represent PixelFormats available in the current resolution and color depth.

In a virtual device multi-screen environment in which the desktop area could span multiple physical screen devices, the bounds of the GraphicsConfiguration objects are relative to the virtual coordinate system. When setting the location of a component, use getBounds to get the bounds of the desired GraphicsConfiguration and offset the location with the coordinates of the GraphicsConfiguration, as the following code sample illustrates:

  1. Frame f = new Frame(gc); // where gc is a GraphicsConfiguration
  2. Rectangle bounds = gc.getBounds();
  3. f.setLocation(10 + bounds.x, 10 + bounds.y);

To determine if your environment is a virtual device environment, call getBounds on all of the GraphicsConfiguration objects in your system. If any of the origins of the returned bounds is not (0, 0), your environment is a virtual device environment.

You can also use getBounds to determine the bounds of the virtual device. To do this, first call getBounds on all of the GraphicsConfiguration objects in your system. Then calculate the union of all of the bounds returned from the calls to getBounds. The union is the bounds of the virtual device. The following code sample calculates the bounds of the virtual device.

  1. Rectangle virtualBounds = new Rectangle();
  2. getLocalGraphicsEnvironment();
  3. ge.getScreenDevices();
  4. for (int j = 0; j < gs.length; j++) {
  5. GraphicsDevice gd = gs[j];
  6. gd.getConfigurations();
  7. for (int i=0; i < gc.length; i++) {
  8. virtualBounds =
  9. virtualBounds.union(gc[i].getBounds());
  10. }
  11. }

See Also:
Window, Frame, GraphicsEnvironment, GraphicsDevice

Constructor Summary
protected GraphicsConfiguration()
          This is an abstract class that cannot be instantiated directly.
 
Method Summary
abstract  BufferedImage createCompatibleImage(int width, int height)
          Returns a BufferedImage with a data layout and color model compatible with this GraphicsConfiguration.
abstract  BufferedImage createCompatibleImage(int width, int height, int transparency)
          Returns a BufferedImage that supports the specified transparency and has a data layout and color model compatible with this GraphicsConfiguration.
abstract  VolatileImage createCompatibleVolatileImage(int width, int height)
          Returns a VolatileImage with a data layout and color model compatible with this GraphicsConfiguration.
 VolatileImage createCompatibleVolatileImage(int width, int height, ImageCapabilities caps)
          Returns a VolatileImage with a data layout and color model compatible with this GraphicsConfiguration, using the specified image capabilities.
 VolatileImage createCompatibleVolatileImage(int width, int height, ImageCapabilities caps, int transparency)
          Returns a VolatileImage with a data layout and color model compatible with this GraphicsConfiguration, using the specified image capabilities and transparency value.
abstract  VolatileImage createCompatibleVolatileImage(int width, int height, int transparency)
          Returns a VolatileImage with a data layout and color model compatible with this GraphicsConfiguration.
abstract  Rectangle getBounds()
          Returns the bounds of the GraphicsConfiguration in the device coordinates.
 BufferCapabilities getBufferCapabilities()
          Returns the buffering capabilities of this GraphicsConfiguration.
abstract  ColorModel getColorModel()
          Returns the ColorModel associated with this GraphicsConfiguration.
abstract  ColorModel getColorModel(int transparency)
          Returns the ColorModel associated with this GraphicsConfiguration that supports the specified transparency.
abstract  AffineTransform getDefaultTransform()
          Returns the default AffineTransform for this GraphicsConfiguration.
abstract  GraphicsDevice getDevice()
          Returns the GraphicsDevice associated with this GraphicsConfiguration.
 ImageCapabilities getImageCapabilities()
          Returns the image capabilities of this GraphicsConfiguration.
abstract  AffineTransform getNormalizingTransform()
          Returns a AffineTransform that can be concatenated with the default AffineTransform of a GraphicsConfiguration so that 72 units in user space equals 1 inch in device space.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GraphicsConfiguration

protected GraphicsConfiguration()
This is an abstract class that cannot be instantiated directly. Instances must be obtained from a suitable factory or query method.

See Also:
GraphicsDevice.getConfigurations(), GraphicsDevice.getDefaultConfiguration(), GraphicsDevice.getBestConfiguration(java.awt.GraphicsConfigTemplate), Graphics2D.getDeviceConfiguration()
Method Detail

getDevice

public abstract GraphicsDevice getDevice()
Returns the GraphicsDevice associated with this GraphicsConfiguration.

Returns:
a GraphicsDevice object that is associated with this GraphicsConfiguration.

createCompatibleImage

public abstract BufferedImage createCompatibleImage(int width,
                                                    int height)
Returns a BufferedImage with a data layout and color model compatible with this GraphicsConfiguration. This method has nothing to do with memory-mapping a device. The returned BufferedImage has a layout and color model that is closest to this native device configuration and can therefore be optimally blitted to this device.

Parameters:
width - the width of the returned BufferedImage
height - the height of the returned BufferedImage
Returns:
a BufferedImage whose data layout and color model is compatible with this GraphicsConfiguration.

createCompatibleVolatileImage

public abstract VolatileImage createCompatibleVolatileImage(int width,
                                                            int height)
Returns a VolatileImage with a data layout and color model compatible with this GraphicsConfiguration. The returned VolatileImage may have data that is stored optimally for the underlying graphics device and may therefore benefit from platform-specific rendering acceleration.

Parameters:
width - the width of the returned VolatileImage
height - the height of the returned VolatileImage
Returns:
a VolatileImage whose data layout and color model is compatible with this GraphicsConfiguration.
See Also:
Component.createVolatileImage(int, int)

createCompatibleVolatileImage

public abstract VolatileImage createCompatibleVolatileImage(int width,
                                                            int height,
                                                            int transparency)
Returns a VolatileImage with a data layout and color model compatible with this GraphicsConfiguration. The returned VolatileImage may have data that is stored optimally for the underlying graphics device and may therefore benefit from platform-specific rendering acceleration.

Parameters:
width - the width of the returned VolatileImage
height - the height of the returned VolatileImage
transparency - the specified transparency mode
Returns:
a VolatileImage whose data layout and color model is compatible with this GraphicsConfiguration.
Throws:
IllegalArgumentException - if the transparency is not a valid value
Since:
1.5
See Also:
Transparency.OPAQUE, Transparency.BITMASK, Transparency.TRANSLUCENT, Component.createVolatileImage(int, int)

createCompatibleVolatileImage

public VolatileImage createCompatibleVolatileImage(int width,
                                                   int height,
                                                   ImageCapabilities caps)
                                            throws AWTException
Returns a VolatileImage with a data layout and color model compatible with this GraphicsConfiguration, using the specified image capabilities. The returned VolatileImage has a layout and color model that is closest to this native device configuration and can therefore be optimally blitted to this device.

Parameters:
width - the width of the returned VolatileImage
height - the height of the returned VolatileImage
caps - the image capabilities
Returns:
a VolatileImage whose data layout and color model is compatible with this GraphicsConfiguration.
Throws:
AWTException - if the supplied image capabilities could not be met by this graphics configuration
Since:
1.4

createCompatibleVolatileImage

public VolatileImage createCompatibleVolatileImage(int width,
                                                   int height,
                                                   ImageCapabilities caps,
                                                   int transparency)
                                            throws AWTException
Returns a VolatileImage with a data layout and color model compatible with this GraphicsConfiguration, using the specified image capabilities and transparency value. The returned VolatileImage has a layout and color model that is closest to this native device configuration and can therefore be optimally blitted to this device.

Parameters:
width - the width of the returned VolatileImage
height - the height of the returned VolatileImage
caps - the image capabilities
transparency - the specified transparency mode
Returns:
a VolatileImage whose data layout and color model is compatible with this GraphicsConfiguration.
Throws:
IllegalArgumentException - if the transparency is not a valid value
AWTException - if the supplied image capabilities could not be met by this graphics configuration
Since:
1.5
See Also:
Transparency.OPAQUE, Transparency.BITMASK, Transparency.TRANSLUCENT, Component.createVolatileImage(int, int)

createCompatibleImage

public abstract BufferedImage createCompatibleImage(int width,
                                                    int height,
                                                    int transparency)
Returns a BufferedImage that supports the specified transparency and has a data layout and color model compatible with this GraphicsConfiguration. This method has nothing to do with memory-mapping a device. The returned BufferedImage has a layout and color model that can be optimally blitted to a device with this GraphicsConfiguration.

Parameters:
width - the width of the returned BufferedImage
height - the height of the returned BufferedImage
transparency - the specified transparency mode
Returns:
a BufferedImage whose data layout and color model is compatible with this GraphicsConfiguration and also supports the specified transparency.
Throws:
IllegalArgumentException - if the transparency is not a valid value
See Also:
Transparency.OPAQUE, Transparency.BITMASK, Transparency.TRANSLUCENT

getColorModel

public abstract ColorModel getColorModel()
Returns the ColorModel associated with this GraphicsConfiguration.

Returns:
a ColorModel object that is associated with this GraphicsConfiguration.

getColorModel

public abstract ColorModel getColorModel(int transparency)
Returns the ColorModel associated with this GraphicsConfiguration that supports the specified transparency.

Parameters:
transparency - the specified transparency mode
Returns:
a ColorModel object that is associated with this GraphicsConfiguration and supports the specified transparency or null if the transparency is not a valid value.
See Also:
Transparency.OPAQUE, Transparency.BITMASK, Transparency.TRANSLUCENT

getDefaultTransform

public abstract AffineTransform getDefaultTransform()
Returns the default AffineTransform for this GraphicsConfiguration. This AffineTransform is typically the Identity transform for most normal screens. The default AffineTransform maps coordinates onto the device such that 72 user space coordinate units measure approximately 1 inch in device space. The normalizing transform can be used to make this mapping more exact. Coordinates in the coordinate space defined by the default AffineTransform for screen and printer devices have the origin in the upper left-hand corner of the target region of the device, with X coordinates increasing to the right and Y coordinates increasing downwards. For image buffers not associated with a device, such as those not created by createCompatibleImage, this AffineTransform is the Identity transform.

Returns:
the default AffineTransform for this GraphicsConfiguration.

getNormalizingTransform

public abstract AffineTransform getNormalizingTransform()
Returns a AffineTransform that can be concatenated with the default AffineTransform of a GraphicsConfiguration so that 72 units in user space equals 1 inch in device space.

For a particular Graphics2D, g, one can reset the transformation to create such a mapping by using the following pseudocode:

  1. GraphicsConfiguration gc = g.getGraphicsConfiguration();
  2.  
  3. g.setTransform(gc.getDefaultTransform());
  4. g.transform(gc.getNormalizingTransform());
Note that sometimes this AffineTransform is identity, such as for printers or metafile output, and that this AffineTransform is only as accurate as the information supplied by the underlying system. For image buffers not associated with a device, such as those not created by createCompatibleImage, this AffineTransform is the Identity transform since there is no valid distance measurement.

Returns:
an AffineTransform to concatenate to the default AffineTransform so that 72 units in user space is mapped to 1 inch in device space.

getBounds

public abstract Rectangle getBounds()
Returns the bounds of the GraphicsConfiguration in the device coordinates. In a multi-screen environment with a virtual device, the bounds can have negative X or Y origins.

Returns:
the bounds of the area covered by this GraphicsConfiguration.
Since:
1.3

getBufferCapabilities

public BufferCapabilities getBufferCapabilities()
Returns the buffering capabilities of this GraphicsConfiguration.

Returns:
the buffering capabilities of this graphics configuration object
Since:
1.4

getImageCapabilities

public ImageCapabilities getImageCapabilities()
Returns the image capabilities of this GraphicsConfiguration.

Returns:
the image capabilities of this graphics configuration object
Since:
1.4

Ces informations proviennent du site de http://java.sun.com

Remarques

Contenu

Le contenu de cette page provient du site de Sun, et est généré depuis un cache sur l'infobrol après certains traitements automatisés. La présentation peut donc différer du document original, mais le contenu aussi. Vous pouvez utiliser ce bouton pour afficher la page originale du site de Sun :

Quels sont les motivations de cette démarche?

Maintenir les pages en cache sur différents sites peut offrir plus de disponibilité.

Chaque page est indexée dans la base de donnée, ce qui permet de retrouver facilement les informations, au moyen des sommaires, du moteur de recherche interne, etc.

Des facilités sont mises en place pour que les membres de l'infobrol puissent effectuer des traductions en français des différents documents. Ceci devrait permettre aux débutants en programmation Java de consulter les API en français s'ils maîtrisent moins bien la langue de Shakespeare. Dans le cas où une traduction a été soumise, elle est disponible au moyen d'un lien en bas de page. Si la traduction a été validée, la page s'affiche par défaut en français, et un lien en bas de page permet d'atteindre la version en anglais.

Le code sur l'infobrol est automatiquement coloré selon la syntaxe, et les différents mots clés sont transformés en liens pour accéder rapidement aux informations.

Vous avez la possibilité de partager vos expériences en proposant vos propres extraits de code en utilisant le bouton "ajouter un commentaire" en bas de page. Si vous visitez simplement l'infobrol, vous avez déjà accès à cette fonction, mais si vous étes membre du brol, vous pouvez en plus utiliser des boutons supplémentaires de mise en forme, dont la coloration automatique de vos extraits de codes.

Réseaux sociaux

Vous pouvez modifier vos préférences dans votre profil pour ne plus afficher les interactions avec les réseaux sociaux sur ces pages.

 

Nuage de mots clés

6 mots clés dont 0 définis manuellement (plus d'information...).

Avertissement

Cette page ne possède pas encore de mots clés manuels, ceci est donc un exemple automatique (les niveaux de pertinence sont fictifs, mais les liens sont valables). Pour tester le nuage avec une page qui contient des mots définis manuellement, vous pouvez cliquer ici.

Vous pouvez modifier vos préférences dans votre profil pour ne plus afficher le nuage de mots clés.

 

Astuce pour imprimer les couleurs des cellules de tableaux : http://www.gaudry.be/ast-rf-450.html
Aucun commentaire pour cette page

© Ce document issu de l′infobrol est enregistré sous le certificat Cyber PrInterDeposit Digital Numbertection. Enregistrement IDDN n° 5329-1865
Document créé le 30/08/06 23:37, dernière modification le Vendredi 17 Juin 2011, 12:12
Source du document imprimé : http://www.gaudry.be/java-api-rf-java/awt/GraphicsConfiguration.html Document affiché 1 fois ce mois de Juin.
St.Gaudry©07.01.02
Outils (masquer)
||
Recherche (afficher)
Recherche :

Utilisateur (masquer)
Navigation (masquer)
Apparence (afficher)
Stats (afficher)
15832 documents
452 astuces.
549 niouzes.
3099 definitions.
447 membres.
8115 messages.

Document genere en :
1,00 seconde

Mises à jour :
Mises à jour du site
Citation (masquer)
Le bonheur n’est pas un gros diamant, c’est une mosaïque de petites pierres harmonieusement rangées.

Alphonse Karr
 
l'infobrol
Nous sommes le Vendredi 01 Juin 2012, 11:49, toutes les heures sont au format GMT+1.00 Heure, heure d'été (+1)