aboutsummaryrefslogtreecommitdiffstats
path: root/src/nativewindow
diff options
context:
space:
mode:
Diffstat (limited to 'src/nativewindow')
-rw-r--r--src/nativewindow/classes/com/jogamp/nativewindow/impl/x11/X11GraphicsConfigurationFactory.java4
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsConfiguration.java10
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/Capabilities.java6
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/CapabilitiesImmutable.java81
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsConfiguration.java21
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/awt/AWTGraphicsConfiguration.java9
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/x11/X11GraphicsConfiguration.java2
7 files changed, 109 insertions, 24 deletions
diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/impl/x11/X11GraphicsConfigurationFactory.java b/src/nativewindow/classes/com/jogamp/nativewindow/impl/x11/X11GraphicsConfigurationFactory.java
index 87324a57c..ff07fab44 100644
--- a/src/nativewindow/classes/com/jogamp/nativewindow/impl/x11/X11GraphicsConfigurationFactory.java
+++ b/src/nativewindow/classes/com/jogamp/nativewindow/impl/x11/X11GraphicsConfigurationFactory.java
@@ -65,14 +65,14 @@ public class X11GraphicsConfigurationFactory extends GraphicsConfigurationFactor
return XVisualInfo.create(xvis[0]);
}
- public static XVisualInfo getXVisualInfo(AbstractGraphicsScreen screen, Capabilities capabilities)
+ public static XVisualInfo getXVisualInfo(AbstractGraphicsScreen screen, CapabilitiesImmutable capabilities)
{
XVisualInfo xv = getXVisualInfoImpl(screen, capabilities, 4 /* TrueColor */);
if(null!=xv) return xv;
return getXVisualInfoImpl(screen, capabilities, 5 /* DirectColor */);
}
- private static XVisualInfo getXVisualInfoImpl(AbstractGraphicsScreen screen, Capabilities capabilities, int c_class)
+ private static XVisualInfo getXVisualInfoImpl(AbstractGraphicsScreen screen, CapabilitiesImmutable capabilities, int c_class)
{
XVisualInfo ret = null;
int[] num = { -1 };
diff --git a/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsConfiguration.java b/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsConfiguration.java
index e53f75251..784343c5a 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsConfiguration.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsConfiguration.java
@@ -52,9 +52,10 @@ public interface AbstractGraphicsConfiguration extends Cloneable {
* Return the capabilities reflecting this graphics configuration,
* which may differ from the capabilites used to choose this configuration.
*
- * @return A copy of the Capabilities to avoid mutation by the user.
+ * @return An immutable instance of the Capabilities to avoid mutation by
+ * the user.
*/
- public Capabilities getChosenCapabilities();
+ public CapabilitiesImmutable getChosenCapabilities();
/**
* Return the capabilities used to choose this graphics configuration.
@@ -62,9 +63,10 @@ public interface AbstractGraphicsConfiguration extends Cloneable {
* These may be used to reconfigure the NativeWindow in case
* the device changes in a multi screen environment.
*
- * @return A copy of the Capabilities to avoid mutation by the user.
+ * @return An immutable instance of the Capabilities to avoid mutation by
+ * the user.
*/
- public Capabilities getRequestedCapabilities();
+ public CapabilitiesImmutable getRequestedCapabilities();
/**
* In case this instance already reflects a native configuration,
diff --git a/src/nativewindow/classes/javax/media/nativewindow/Capabilities.java b/src/nativewindow/classes/javax/media/nativewindow/Capabilities.java
index 6c875ab40..ff6e077ee 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/Capabilities.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/Capabilities.java
@@ -44,7 +44,7 @@ package javax.media.nativewindow;
contains the minimal number of routines which allow configuration
on all supported window systems. */
-public class Capabilities implements Cloneable {
+public class Capabilities implements CapabilitiesImmutable, Cloneable {
private int redBits = 8;
private int greenBits = 8;
private int blueBits = 8;
@@ -65,6 +65,10 @@ public class Capabilities implements Cloneable {
*/
public Capabilities() {}
+ public Capabilities cloneCapabilites() {
+ return (Capabilities) clone();
+ }
+
public Object clone() {
try {
return super.clone();
diff --git a/src/nativewindow/classes/javax/media/nativewindow/CapabilitiesImmutable.java b/src/nativewindow/classes/javax/media/nativewindow/CapabilitiesImmutable.java
new file mode 100644
index 000000000..9369221cb
--- /dev/null
+++ b/src/nativewindow/classes/javax/media/nativewindow/CapabilitiesImmutable.java
@@ -0,0 +1,81 @@
+package javax.media.nativewindow;
+
+/**
+ * Specifies an immutable set of capabilities that a window's rendering context
+ * must support, such as color depth per channel.
+ *
+ * @see javax.media.nativewindow.Capabilities
+ */
+public interface CapabilitiesImmutable extends Cloneable {
+
+ /**
+ * Returns the number of bits requested for the color buffer's red
+ * component. On some systems only the color depth, which is the sum of the
+ * red, green, and blue bits, is considered.
+ */
+ int getRedBits();
+
+ /**
+ * Returns the number of bits requested for the color buffer's green
+ * component. On some systems only the color depth, which is the sum of the
+ * red, green, and blue bits, is considered.
+ */
+ int getGreenBits();
+
+ /**
+ * Returns the number of bits requested for the color buffer's blue
+ * component. On some systems only the color depth, which is the sum of the
+ * red, green, and blue bits, is considered.
+ */
+ int getBlueBits();
+
+ /**
+ * Returns the number of bits requested for the color buffer's alpha
+ * component. On some systems only the color depth, which is the sum of the
+ * red, green, and blue bits, is considered.
+ */
+ int getAlphaBits();
+
+ /**
+ * Indicates whether the background of this OpenGL context should be
+ * considered opaque. Defaults to true.
+ */
+ boolean isBackgroundOpaque();
+
+ /**
+ * Indicates whether the drawable surface is onscreen. Defaults to true.
+ */
+ boolean isOnscreen();
+
+ /**
+ * Gets the transparent red value for the frame buffer configuration. This
+ * value is undefined if; equals true.
+ */
+ int getTransparentRedValue();
+
+ /**
+ * Gets the transparent green value for the frame buffer configuration. This
+ * value is undefined if; equals true.
+ */
+ int getTransparentGreenValue();
+
+ /**
+ * Gets the transparent blue value for the frame buffer configuration. This
+ * value is undefined if; equals true.
+ */
+ int getTransparentBlueValue();
+
+ /**
+ * Gets the transparent alpha value for the frame buffer configuration. This
+ * value is undefined if; equals true.
+ */
+ int getTransparentAlphaValue();
+
+ /**
+ * Get a mutable clone of this instance.
+ *
+ * @see java.lang.Object#clone()
+ */
+ Capabilities cloneCapabilites();
+
+}
diff --git a/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsConfiguration.java b/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsConfiguration.java
index 42350e6c1..3d06388c2 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsConfiguration.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsConfiguration.java
@@ -34,16 +34,16 @@ package javax.media.nativewindow;
public class DefaultGraphicsConfiguration implements Cloneable, AbstractGraphicsConfiguration {
private AbstractGraphicsScreen screen;
- protected Capabilities capabilitiesChosen;
- protected Capabilities capabilitiesRequested;
+ protected CapabilitiesImmutable capabilitiesChosen;
+ protected CapabilitiesImmutable capabilitiesRequested;
public DefaultGraphicsConfiguration(AbstractGraphicsScreen screen,
- Capabilities capsChosen, Capabilities capsRequested) {
+ CapabilitiesImmutable capsChosen, CapabilitiesImmutable capsRequested) {
this.screen = screen;
// Create "immutable" copies of capabilities.
- this.capabilitiesChosen = (Capabilities) capsChosen.clone();
- this.capabilitiesRequested = (Capabilities) capsRequested.clone();
+ this.capabilitiesChosen = capsChosen.cloneCapabilites();
+ this.capabilitiesRequested = capsRequested.cloneCapabilites();
}
public Object clone() {
@@ -58,13 +58,11 @@ public class DefaultGraphicsConfiguration implements Cloneable, AbstractGraphics
return screen;
}
- // TODO: Return immutable instance.
- public Capabilities getChosenCapabilities() {
+ public CapabilitiesImmutable getChosenCapabilities() {
return capabilitiesChosen;
}
- // TODO: Return immutable instance.
- public Capabilities getRequestedCapabilities() {
+ public CapabilitiesImmutable getRequestedCapabilities() {
return capabilitiesRequested;
}
@@ -82,8 +80,9 @@ public class DefaultGraphicsConfiguration implements Cloneable, AbstractGraphics
*
* @see javax.media.nativewindow.GraphicsConfigurationFactory#chooseGraphicsConfiguration(Capabilities, CapabilitiesChooser, AbstractGraphicsScreen)
*/
- protected void setChosenCapabilities(Capabilities capsChosen) {
- capabilitiesChosen = (Capabilities) capsChosen.clone();
+ protected void setChosenCapabilities(CapabilitiesImmutable capsChosen) {
+ // Create "immutable" copy of capabilities.
+ capabilitiesChosen = (CapabilitiesImmutable) capsChosen.cloneCapabilites();
}
/**
diff --git a/src/nativewindow/classes/javax/media/nativewindow/awt/AWTGraphicsConfiguration.java b/src/nativewindow/classes/javax/media/nativewindow/awt/AWTGraphicsConfiguration.java
index 6aafc8549..bce9b248d 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/awt/AWTGraphicsConfiguration.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/awt/AWTGraphicsConfiguration.java
@@ -56,14 +56,14 @@ public class AWTGraphicsConfiguration extends DefaultGraphicsConfiguration imple
AbstractGraphicsConfiguration encapsulated;
public AWTGraphicsConfiguration(AWTGraphicsScreen screen,
- Capabilities capsChosen, Capabilities capsRequested,
+ CapabilitiesImmutable capsChosen, CapabilitiesImmutable capsRequested,
GraphicsConfiguration config, AbstractGraphicsConfiguration encapsulated) {
super(screen, capsChosen, capsRequested);
this.config = config;
this.encapsulated=encapsulated;
}
- public AWTGraphicsConfiguration(AWTGraphicsScreen screen, Capabilities capsChosen, Capabilities capsRequested, GraphicsConfiguration config) {
+ public AWTGraphicsConfiguration(AWTGraphicsScreen screen, CapabilitiesImmutable capsChosen, CapabilitiesImmutable capsRequested, GraphicsConfiguration config) {
super(screen, capsChosen, capsRequested);
this.config = config;
this.encapsulated=null;
@@ -74,7 +74,7 @@ public class AWTGraphicsConfiguration extends DefaultGraphicsConfiguration imple
* with the graphics capabilties of the AWT Component to produce the chosen Capabilties.
* Otherwise the <code>capsChosen</code> is used.
*/
- public static AWTGraphicsConfiguration create(Component awtComp, Capabilities capsChosen, Capabilities capsRequested)
+ public static AWTGraphicsConfiguration create(Component awtComp, CapabilitiesImmutable capsChosen, CapabilitiesImmutable capsRequested)
{
AWTGraphicsScreen awtScreen = null;
AWTGraphicsDevice awtDevice = null;
@@ -96,9 +96,8 @@ public class AWTGraphicsConfiguration extends DefaultGraphicsConfiguration imple
}
if(null==capsChosen) {
- capsChosen = (Capabilities) capsRequested.clone() ;
GraphicsConfiguration gc = awtGraphicsDevice.getDefaultConfiguration();
- setupCapabilitiesRGBABits(capsChosen, gc);
+ capsChosen = setupCapabilitiesRGBABits(capsRequested.cloneCapabilites(), gc);
}
return new AWTGraphicsConfiguration(awtScreen, capsChosen, capsRequested, awtGfxConfig);
}
diff --git a/src/nativewindow/classes/javax/media/nativewindow/x11/X11GraphicsConfiguration.java b/src/nativewindow/classes/javax/media/nativewindow/x11/X11GraphicsConfiguration.java
index 5659dcdcc..07171e141 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/x11/X11GraphicsConfiguration.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/x11/X11GraphicsConfiguration.java
@@ -45,7 +45,7 @@ public class X11GraphicsConfiguration extends DefaultGraphicsConfiguration imple
private XVisualInfo info;
public X11GraphicsConfiguration(X11GraphicsScreen screen,
- Capabilities capsChosen, Capabilities capsRequested,
+ CapabilitiesImmutable capsChosen, CapabilitiesImmutable capsRequested,
XVisualInfo info) {
super(screen, capsChosen, capsRequested);
this.info = info;