34package com.jogamp.nativewindow.x11;
36import com.jogamp.common.util.Bitfield;
37import com.jogamp.nativewindow.CapabilitiesImmutable;
39import com.jogamp.nativewindow.MutableGraphicsConfiguration;
41import jogamp.nativewindow.x11.X11Capabilities;
42import jogamp.nativewindow.x11.X11Lib;
43import jogamp.nativewindow.x11.XRenderDirectFormat;
44import jogamp.nativewindow.x11.XRenderPictFormat;
45import jogamp.nativewindow.x11.XVisualInfo;
54 private XVisualInfo info;
59 final XRenderPictFormat xRenderPictFormat = XRenderPictFormat.create();
62 protected static XRenderDirectFormat
XVisual2XRenderMask(
final long dpy,
final long visual,
final XRenderPictFormat dest) {
63 if( !X11Lib.XRenderFindVisualFormat(dpy, visual, dest) ) {
66 return dest.getDirect();
72 final X11Capabilities res =
new X11Capabilities(info);
74 final XRenderDirectFormat xrmask = (
null != info ) ?
XVisual2XRenderMask( display, info.getVisual() ) :
null ;
75 final int alphaMask = (
null != xrmask ) ? xrmask.getAlphaMask() : 0;
77 res.setBackgroundOpaque(
false);
78 res.setTransparentRedValue(xrmask.getRedMask());
79 res.setTransparentGreenValue(xrmask.getGreenMask());
80 res.setTransparentBlueValue(xrmask.getBlueMask());
81 res.setTransparentAlphaValue(alphaMask);
83 res.setBackgroundOpaque(
true);
86 res.setRedBits (Bitfield.Util.bitCount((
int)info.getRed_mask()));
87 res.setGreenBits (Bitfield.Util.bitCount((
int)info.getGreen_mask()));
88 res.setBlueBits (Bitfield.Util.bitCount((
int)info.getBlue_mask()));
89 res.setAlphaBits (Bitfield.Util.bitCount(alphaMask));
96 final XVisualInfo info) {
97 super(screen, capsChosen, capsRequested);
103 return super.clone();
115 return (
null!=info)?(int)info.getVisualid():0;
120 return getClass().getSimpleName()+
"["+
getScreen()+
", visualID 0x" + Long.toHexString(
getXVisualID()) +
CapabilitiesImmutable capabilitiesRequested
final AbstractGraphicsScreen getScreen()
Return the screen this graphics configuration is valid for.
CapabilitiesImmutable capabilitiesChosen
final long getHandle()
Returns the native handle of the underlying native device, if such thing exist.
Encapsulates a graphics configuration, or OpenGL pixel format, on X11 platforms.
static XRenderDirectFormat XVisual2XRenderMask(final long dpy, final long visual, final XRenderPictFormat dest)
X11GraphicsConfiguration(final X11GraphicsScreen screen, final CapabilitiesImmutable capsChosen, final CapabilitiesImmutable capsRequested, final XVisualInfo info)
static X11Capabilities XVisualInfo2X11Capabilities(final X11GraphicsDevice device, final XVisualInfo info)
static XRenderDirectFormat XVisual2XRenderMask(final long dpy, final long visual)
final void setXVisualInfo(final XVisualInfo info)
final XVisualInfo getXVisualInfo()
Encapsulates a graphics device on X11 platforms.
Encapsulates a screen index on X11 platforms.
Specifies an immutable set of capabilities that a window's rendering context must support,...