41package com.jogamp.nativewindow;
48 protected final static String
na_str =
"----" ;
50 private int redBits = 8;
51 private int greenBits = 8;
52 private int blueBits = 8;
53 private int alphaBits = 0;
56 private boolean backgroundOpaque =
true;
57 private int transparentValueRed = 0;
58 private int transparentValueGreen = 0;
59 private int transparentValueBlue = 0;
60 private int transparentValueAlpha = 0;
63 private boolean onscreen =
true;
66 private boolean isBitmap =
false;
82 }
catch (
final CloneNotSupportedException e) {
110 int hash = 31 + this.redBits;
111 hash = ((hash << 5) - hash) + ( this.onscreen ? 1 : 0 );
112 hash = ((hash << 5) - hash) + ( this.isBitmap ? 1 : 0 );
113 hash = ((hash << 5) - hash) + this.greenBits;
114 hash = ((hash << 5) - hash) + this.blueBits;
115 hash = ((hash << 5) - hash) + this.alphaBits;
116 hash = ((hash << 5) - hash) + ( this.backgroundOpaque ? 1 : 0 );
117 hash = ((hash << 5) - hash) + this.transparentValueRed;
118 hash = ((hash << 5) - hash) + this.transparentValueGreen;
119 hash = ((hash << 5) - hash) + this.transparentValueBlue;
120 hash = ((hash << 5) - hash) + this.transparentValueAlpha;
132 private static boolean checkSameValueIfBothSupp(
final VIDType type,
final VisualIDHolder a,
final VisualIDHolder b) {
133 final boolean has_a = a.isVisualIDSupported(type);
134 if( has_a && has_a == b.isVisualIDSupported(type) ) {
135 return a.getVisualID(type) == b.getVisualID(type);
141 public boolean equals(
final Object obj) {
142 if(
this == obj) {
return true; }
168 if(res && !backgroundOpaque) {
190 final int rgba = redBits * greenBits * blueBits * ( alphaBits + 1 );
196 }
else if(rgba < xrgba) {
234 this.redBits = redBits;
246 this.greenBits = greenBits;
258 this.blueBits = blueBits;
279 this.alphaBits = alphaBits;
298 backgroundOpaque = opaque;
306 return backgroundOpaque;
322 this.onscreen=onscreen;
395 public StringBuilder
toString(
final StringBuilder sink) {
403 final StringBuilder msg =
new StringBuilder();
407 return msg.toString();
413 sink =
new StringBuilder();
416 sink.append(
"on-scr");
418 sink.append(
"offscr[");
421 sink.append(
"bitmap");
422 }
else if(onscreen) {
425 sink.append(
"auto-cfg");
433 protected static final String
ESEP =
"/";
435 protected static final String
CSEP =
", ";
437 protected StringBuilder
toString(StringBuilder sink,
final boolean withOnOffScreen) {
439 sink =
new StringBuilder();
441 sink.append(
"rgba ").append(redBits).append(
ESEP).append(greenBits).append(
ESEP).append(blueBits).append(
ESEP).append(alphaBits);
442 if(backgroundOpaque) {
443 sink.append(
", opaque");
447 if(withOnOffScreen) {
454 protected final String
toHexString(
final int val) {
return Integer.toHexString(val); }
Specifies a set of capabilities that a window's rendering context must support, such as color depth p...
final int getTransparentAlphaValue()
Gets the transparent alpha value for the frame buffer configuration.
int compareTo(final CapabilitiesImmutable caps)
Comparing RGBA values only.
final String toHexString(final int val)
static final String CSEP
Component separator.
final int getAlphaBits()
Returns the number of bits for the color buffer's alpha component.
final int getGreenBits()
Returns the number of bits for the color buffer's green component.
void setTransparentBlueValue(final int transValueBlue)
Sets the transparent blue value for the frame buffer configuration, ranging from 0 to the maximum fra...
StringBuilder onoffScreenToString(StringBuilder sink)
Return a textual representation of this object's on/off screen state.
boolean equals(final Object obj)
Equality over the immutable attributes of both objects.
void setRedBits(final int redBits)
Sets the number of bits requested for the color buffer's red component.
final boolean isBackgroundOpaque()
Returns whether an opaque or translucent surface is requested, supported or chosen.
final int getTransparentGreenValue()
Gets the transparent green value for the frame buffer configuration.
int getVisualID(final VIDType type)
Returns the native visual ID of the given type if supported, or VID_UNDEFINED if not supported.
final boolean isOnscreen()
Returns whether an on- or offscreen surface is requested, available or chosen.
void setBitmap(final boolean enable)
Requesting offscreen bitmap mode.
void setGreenBits(final int greenBits)
Sets the number of bits requested for the color buffer's green component.
boolean isBitmap()
Returns whether bitmap offscreen mode is requested, available or chosen.
static final String ESEP
Element separator.
final int getBlueBits()
Returns the number of bits for the color buffer's blue component.
int hashCode()
Hash code over the immutable attributes.
void setTransparentGreenValue(final int transValueGreen)
Sets the transparent green value for the frame buffer configuration, ranging from 0 to the maximum fr...
void setBackgroundOpaque(final boolean opaque)
Sets whether the surface shall be opaque or translucent.
void setBlueBits(final int blueBits)
Sets the number of bits requested for the color buffer's blue component.
final int getRedBits()
Returns the number of bits for the color buffer's red component.
final int getTransparentRedValue()
Gets the transparent red value for the frame buffer configuration.
String toString()
Returns a textual representation of this Capabilities object.
void setTransparentAlphaValue(final int transValueAlpha)
Sets the transparent alpha value for the frame buffer configuration, ranging from 0 to the maximum fr...
void setAlphaBits(final int alphaBits)
Sets the number of bits requested for the color buffer's alpha component.
static final String na_str
StringBuilder toString(StringBuilder sink, final boolean withOnOffScreen)
void setOnscreen(final boolean onscreen)
Sets whether the surface shall be on- or offscreen.
Capabilities()
Creates a Capabilities object.
boolean isVisualIDSupported(final VIDType type)
Returns true if the given VIDType is supported, otherwise false.
Capabilities copyFrom(final CapabilitiesImmutable other)
Copies all Capabilities values from source into this instance.
final int getTransparentBlueValue()
Gets the transparent blue value for the frame buffer configuration.
void setTransparentRedValue(final int transValueRed)
Sets the transparent red value for the frame buffer configuration, ranging from 0 to the maximum fram...
StringBuilder toString(final StringBuilder sink)
Return a textual representation of this object.
A generic exception for OpenGL errors used throughout the binding as a substitute for RuntimeExceptio...
Specifies an immutable set of capabilities that a window's rendering context must support,...
int getAlphaBits()
Returns the number of bits for the color buffer's alpha component.
int getBlueBits()
Returns the number of bits for the color buffer's blue component.
int getTransparentAlphaValue()
Gets the transparent alpha value for the frame buffer configuration.
boolean isBitmap()
Returns whether bitmap offscreen mode is requested, available or chosen.
int getRedBits()
Returns the number of bits for the color buffer's red component.
int getGreenBits()
Returns the number of bits for the color buffer's green component.
boolean isOnscreen()
Returns whether an on- or offscreen surface is requested, available or chosen.
int getTransparentGreenValue()
Gets the transparent green value for the frame buffer configuration.
int getTransparentRedValue()
Gets the transparent red value for the frame buffer configuration.
boolean isBackgroundOpaque()
Returns whether an opaque or translucent surface is requested, supported or chosen.
int getTransparentBlueValue()
Gets the transparent blue value for the frame buffer configuration.
Visual ID holder interface.
static final int VID_UNDEFINED
getVisualID(VIDType) result indicating an undefined value, which could be cause by an unsupported que...
int getVisualID(VIDType type)
Returns the native visual ID of the given type if supported, or VID_UNDEFINED if not supported.
boolean isVisualIDSupported(VIDType type)
Returns true if the given VIDType is supported, otherwise false.