aboutsummaryrefslogtreecommitdiffstats
path: root/src/nativewindow/classes/javax/media
diff options
context:
space:
mode:
Diffstat (limited to 'src/nativewindow/classes/javax/media')
-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.java25
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/awt/AWTGraphicsConfiguration.java9
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/x11/X11GraphicsConfiguration.java2
6 files changed, 111 insertions, 22 deletions
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 47f02c7cc..3d06388c2 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsConfiguration.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsConfiguration.java
@@ -34,14 +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;
- this.capabilitiesChosen = capsChosen;
- this.capabilitiesRequested = capsRequested;
+
+ // Create "immutable" copies of capabilities.
+ this.capabilitiesChosen = capsChosen.cloneCapabilites();
+ this.capabilitiesRequested = capsRequested.cloneCapabilites();
}
public Object clone() {
@@ -56,12 +58,12 @@ public class DefaultGraphicsConfiguration implements Cloneable, AbstractGraphics
return screen;
}
- public Capabilities getChosenCapabilities() {
- return (null!=capabilitiesChosen)?(Capabilities)capabilitiesChosen.clone():null;
+ public CapabilitiesImmutable getChosenCapabilities() {
+ return capabilitiesChosen;
}
- public Capabilities getRequestedCapabilities() {
- return (null!=capabilitiesRequested)?(Capabilities)capabilitiesRequested.clone():null;
+ public CapabilitiesImmutable getRequestedCapabilities() {
+ return capabilitiesRequested;
}
public AbstractGraphicsConfiguration getNativeGraphicsConfiguration() {
@@ -78,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;