41package com.jogamp.nativewindow.awt;
43import com.jogamp.nativewindow.*;
45import java.awt.Component;
46import java.awt.GraphicsConfiguration;
47import java.awt.GraphicsDevice;
48import java.awt.image.ColorModel;
49import com.jogamp.nativewindow.AbstractGraphicsConfiguration;
51import jogamp.nativewindow.Debug;
57 private final GraphicsConfiguration config;
63 super(screen, capsChosen, capsRequested);
65 this.encapsulated=encapsulated;
69 final GraphicsConfiguration config) {
70 super(screen, capsChosen, capsRequested);
72 this.encapsulated=
null;
86 throw new IllegalArgumentException(
"Null AWT GraphicsConfiguration");
88 final GraphicsDevice awtGraphicsDevice = gc.getDevice();
89 if(
null==awtGraphicsDevice) {
97 if(
null==capsRequested) {
100 if(
null==capsChosen) {
115 super.setChosenCapabilities(capsChosen);
120 return super.clone();
130 return (
null!=encapsulated)?encapsulated:
this;
143 final ColorModel cm = gc.getColorModel();
147 final int cmBitsPerPixel = cm.getPixelSize();
148 int bitsPerPixel = 0;
149 final int[] bitesPerComponent = cm.getComponentSize();
150 if(bitesPerComponent.length>=3) {
151 capabilities.
setRedBits(bitesPerComponent[0]);
152 bitsPerPixel += bitesPerComponent[0];
154 bitsPerPixel += bitesPerComponent[1];
156 bitsPerPixel += bitesPerComponent[2];
158 if(bitesPerComponent.length>=4) {
160 bitsPerPixel += bitesPerComponent[3];
164 if(Debug.debugAll()) {
165 if(cmBitsPerPixel!=bitsPerPixel) {
166 System.err.println(
"AWT Colormodel bits per components/pixel mismatch: "+bitsPerPixel+
" != "+cmBitsPerPixel);
174 return getClass().getSimpleName()+
"[" +
getScreen() +
178 ",\n\tencapsulated "+encapsulated+
"]";
Specifies a set of capabilities that a window's rendering context must support, such as color depth p...
void setRedBits(final int redBits)
Sets the number of bits requested for the color buffer's red component.
void setGreenBits(final int greenBits)
Sets the number of bits requested for the color buffer's green component.
void setBlueBits(final int blueBits)
Sets the number of bits requested for the color buffer's blue component.
void setAlphaBits(final int alphaBits)
Sets the number of bits requested for the color buffer's alpha component.
CapabilitiesImmutable capabilitiesRequested
final AbstractGraphicsScreen getScreen()
Return the screen this graphics configuration is valid for.
CapabilitiesImmutable capabilitiesChosen
Provides the mechanism by which the graphics configuration for a window can be chosen before the wind...
final AbstractGraphicsConfiguration chooseGraphicsConfiguration(final CapabilitiesImmutable capsChosen, final CapabilitiesImmutable capsRequested, final CapabilitiesChooser chooser, final AbstractGraphicsScreen screen, final int nativeVisualID)
static GraphicsConfigurationFactory getFactory(final AbstractGraphicsDevice device, final CapabilitiesImmutable caps)
Returns the graphics configuration factory for use with the given device and capability.
A generic exception for OpenGL errors used throughout the binding as a substitute for RuntimeExceptio...
A wrapper for an AWT GraphicsConfiguration allowing it to be handled in a toolkit-independent manner.
AWTGraphicsConfiguration(final AWTGraphicsScreen screen, final CapabilitiesImmutable capsChosen, final CapabilitiesImmutable capsRequested, final GraphicsConfiguration config, final AbstractGraphicsConfiguration encapsulated)
GraphicsConfiguration getAWTGraphicsConfiguration()
Return the AWT GraphicsConfiguration.
static CapabilitiesImmutable setupCapabilitiesRGBABits(final CapabilitiesImmutable capabilitiesIn, final GraphicsConfiguration gc)
Sets up the Capabilities' RGBA size based on the given GraphicsConfiguration's ColorModel.
AbstractGraphicsConfiguration getNativeGraphicsConfiguration()
In case the implementation utilizes a delegation pattern to wrap abstract toolkits,...
void setChosenCapabilities(final CapabilitiesImmutable capsChosen)
Set the capabilities to a new value.
static AWTGraphicsConfiguration create(final GraphicsConfiguration gc, CapabilitiesImmutable capsChosen, CapabilitiesImmutable capsRequested)
Method constructs a new AWTGraphicsConfiguration primarily based on the given GraphicsConfiguration.
A wrapper for an AWT GraphicsDevice allowing it to be handled in a toolkit-independent manner.
A wrapper for an AWT GraphicsDevice (screen) allowing it to be handled in a toolkit-independent manne...
A marker interface describing a graphics configuration, visual, or pixel format in a toolkit-independ...
A interface describing a graphics device in a toolkit-independent manner.
static int DEFAULT_UNIT
Default unit id for the 1st device: 0.
Specifies an immutable set of capabilities that a window's rendering context must support,...
Visual ID holder interface.
static final int VID_UNDEFINED
getVisualID(VIDType) result indicating an undefined value, which could be cause by an unsupported que...