@Override public Object cloneMutable() { return clone(); }
/** * Sets whether the surface shall be opaque or translucent. * <p> * Platform implementations may need an alpha component in the surface (eg. Windows), * or expect pre-multiplied alpha values (eg. X11/XRender).<br> * To unify the experience, this method also invokes {@link #setAlphaBits(int) setAlphaBits(1)} * if {@link #getAlphaBits()} == 0.<br> * Please note that in case alpha is required on the platform the * clear color shall have an alpha lower than 1.0 to allow anything shining through. * </p> * <p> * Mind that translucency may cause a performance penalty * due to the composite work required by the window manager. * </p> */ public void setBackgroundOpaque(final boolean opaque) { backgroundOpaque = opaque; if(!opaque && getAlphaBits()==0) { setAlphaBits(1); } }
protected StringBuilder toString(StringBuilder sink, final boolean withOnOffScreen) { if(null == sink) { sink = new StringBuilder(); } sink.append("rgba ").append(redBits).append(ESEP).append(greenBits).append(ESEP).append(blueBits).append(ESEP).append(alphaBits); if(backgroundOpaque) { sink.append(", opaque"); } else { sink.append(", trans-rgba 0x").append(toHexString(transparentValueRed)).append(ESEP).append(toHexString(transparentValueGreen)).append(ESEP).append(toHexString(transparentValueBlue)).append(ESEP).append(toHexString(transparentValueAlpha)); } if(withOnOffScreen) { sink.append(CSEP); onoffScreenToString(sink); } return sink; }
final int[] bitesPerComponent = cm.getComponentSize(); if(bitesPerComponent.length>=3) { capabilities.setRedBits(bitesPerComponent[0]); bitsPerPixel += bitesPerComponent[0]; capabilities.setGreenBits(bitesPerComponent[1]); bitsPerPixel += bitesPerComponent[1]; capabilities.setBlueBits(bitesPerComponent[2]); bitsPerPixel += bitesPerComponent[2]; capabilities.setAlphaBits(bitesPerComponent[3]); bitsPerPixel += bitesPerComponent[3]; } else { capabilities.setAlphaBits(0);
if(capsRequested.isBackgroundOpaque() != chosenCaps.isBackgroundOpaque()) { chosenCaps.setBackgroundOpaque(capsRequested.isBackgroundOpaque()); chosenCaps.isBackgroundOpaque(), chosenCaps.getAlphaBits()); if (nativeWindowHandle == 0) { throw new NativeWindowException("Error creating egl window: "+cfg);
/** * Creates a wrapped {@link NativeWindow} with given native handles and {@link AbstractGraphicsScreen}. * <p> * The given {@link UpstreamWindowHookMutableSizePos} maybe used to reflect resizes and repositioning of the native window. * </p> * <p> * The {@link AbstractGraphicsScreen} may be created via {@link #createScreen(AbstractGraphicsDevice, int)}. * </p> * <p> * The {@link AbstractGraphicsScreen} may have an underlying open {@link AbstractGraphicsDevice} * or a simple <i>dummy</i> instance, see {@link #createDevice(String, boolean)}. * </p> */ public static NativeWindow createWrappedWindow(final AbstractGraphicsScreen aScreen, final long surfaceHandle, final long windowHandle, final UpstreamWindowHookMutableSizePos hook) { final CapabilitiesImmutable caps = new Capabilities(); final AbstractGraphicsConfiguration config = new DefaultGraphicsConfiguration(aScreen, caps, caps); return new WrappedWindow(config, surfaceHandle, hook, true, windowHandle); }
@Override public int hashCode() { // 31 * x == (x << 5) - x int hash = super.hashCode(); hash = ((hash << 5) - hash) + this.glProfile.hashCode() ; hash = ((hash << 5) - hash) + ( this.hardwareAccelerated ? 1 : 0 ); hash = ((hash << 5) - hash) + ( this.stereo ? 1 : 0 ); hash = ((hash << 5) - hash) + ( this.isFBO ? 1 : 0 ); hash = ((hash << 5) - hash) + ( this.isPBuffer ? 1 : 0 ); hash = ((hash << 5) - hash) + ( this.sampleBuffers ? 1 : 0 ); hash = ((hash << 5) - hash) + this.getNumSamples(); hash = ((hash << 5) - hash) + this.sampleExtension.hashCode(); hash = ((hash << 5) - hash) + this.depthBits; hash = ((hash << 5) - hash) + this.stencilBits; hash = ((hash << 5) - hash) + this.accumRedBits; hash = ((hash << 5) - hash) + this.accumGreenBits; hash = ((hash << 5) - hash) + this.accumBlueBits; hash = ((hash << 5) - hash) + this.accumAlphaBits; return hash; }
final int sc = super.compareTo(caps); // RGBA if(0 != sc) { return sc;
@Override public boolean equals(final Object obj) { if(this == obj) { return true; } if(!(obj instanceof GLCapabilitiesImmutable)) { return false; } final GLCapabilitiesImmutable other = (GLCapabilitiesImmutable)obj; boolean res = super.equals(obj) && other.getGLProfile()==glProfile && other.isPBuffer()==isPBuffer && other.isFBO()==isFBO && other.getDoubleBuffered() == doubleBuffered && other.getStereo()==stereo && other.getHardwareAccelerated()==hardwareAccelerated && other.getDepthBits()==depthBits && other.getStencilBits()==stencilBits && other.getAccumRedBits()==accumRedBits && other.getAccumGreenBits()==accumGreenBits && other.getAccumBlueBits()==accumBlueBits && other.getAccumAlphaBits()==accumAlphaBits && other.getSampleBuffers()==sampleBuffers; if(res && sampleBuffers) { res = other.getNumSamples()==getNumSamples() && other.getSampleExtension().equals(sampleExtension) ; } return res; }
/** * Copies all {@link GLCapabilitiesImmutable} values * from <code>source</code> into this instance. * @return this instance */ public GLCapabilities copyFrom(final GLCapabilitiesImmutable source) { super.copyFrom(source); glProfile = source.getGLProfile(); isPBuffer = source.isPBuffer(); isFBO = source.isFBO(); doubleBuffered = source.getDoubleBuffered(); stereo = source.getStereo(); hardwareAccelerated = source.getHardwareAccelerated(); depthBits = source.getDepthBits(); stencilBits = source.getStencilBits(); accumRedBits = source.getAccumRedBits(); accumGreenBits = source.getAccumGreenBits(); accumBlueBits = source.getAccumBlueBits(); accumAlphaBits = source.getAccumAlphaBits(); sampleBuffers = source.getSampleBuffers(); numSamples = source.getNumSamples(); sampleExtension = source.getSampleExtension(); return this; }
final CapabilitiesImmutable caps = new Capabilities(); final GraphicsConfigurationFactory factory = GraphicsConfigurationFactory.getFactory(screen.getDevice(), caps); final AbstractGraphicsConfiguration config = factory.chooseGraphicsConfiguration( caps, caps, null, screen, visualID );
@Override public Object clone() { try { return super.clone(); } catch (final RuntimeException e) { throw new GLException(e); } }
capsRequested = new Capabilities();
@Override public Object clone() { try { return super.clone(); } catch (final RuntimeException e) { throw new NativeWindowException(e); } }