sun.awt.X11GraphicsConfig Java Examples

The following examples show how to use sun.awt.X11GraphicsConfig. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: X11VolatileSurfaceManager.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Create a pixmap-based SurfaceData object
 */
protected SurfaceData initAcceleratedSurface() {
    SurfaceData sData;

    try {
        X11GraphicsConfig gc = (X11GraphicsConfig)vImg.getGraphicsConfig();
        ColorModel cm = gc.getColorModel();
        long drawable = 0;
        if (context instanceof Long) {
            drawable = ((Long)context).longValue();
        }
        sData = X11SurfaceData.createData(gc,
                                          vImg.getWidth(),
                                          vImg.getHeight(),
                                          cm, vImg, drawable,
                                          Transparency.OPAQUE);
    } catch (NullPointerException ex) {
        sData = null;
    } catch (OutOfMemoryError er) {
        sData = null;
    }

    return sData;
}
 
Example #2
Source File: XEmbedClientHelper.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public void handleReparentNotify(XEvent xev) {
    XReparentEvent re = xev.get_xreparent();
    long newParent = re.get_parent();
    if (active) {
        // unregister accelerators, etc. for old parent
        embedded.notifyStopped();
        // check if newParent is a root window
        X11GraphicsConfig gc = (X11GraphicsConfig)embedded.getGraphicsConfiguration();
        X11GraphicsDevice gd = (X11GraphicsDevice)gc.getDevice();
        if ((newParent == XlibUtil.getRootWindow(gd.getScreen())) ||
            (newParent == XToolkit.getDefaultRootWindow()))
        {
            // reparenting to root means XEmbed termination
            active = false;
        } else {
            // continue XEmbed with a new parent
            server = newParent;
            embedded.notifyStarted();
        }
    }
}
 
Example #3
Source File: XEmbedClientHelper.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
public void handleReparentNotify(XEvent xev) {
    XReparentEvent re = xev.get_xreparent();
    long newParent = re.get_parent();
    if (active) {
        // unregister accelerators, etc. for old parent
        embedded.notifyStopped();
        // check if newParent is a root window
        X11GraphicsConfig gc = (X11GraphicsConfig)embedded.getGraphicsConfiguration();
        X11GraphicsDevice gd = (X11GraphicsDevice)gc.getDevice();
        if ((newParent == XlibUtil.getRootWindow(gd.getScreen())) ||
            (newParent == XToolkit.getDefaultRootWindow()))
        {
            // reparenting to root means XEmbed termination
            active = false;
        } else {
            // continue XEmbed with a new parent
            server = newParent;
            embedded.notifyStarted();
        }
    }
}
 
Example #4
Source File: XEmbedClientHelper.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public void handleReparentNotify(XEvent xev) {
    XReparentEvent re = xev.get_xreparent();
    long newParent = re.get_parent();
    if (active) {
        // unregister accelerators, etc. for old parent
        embedded.notifyStopped();
        // check if newParent is a root window
        X11GraphicsConfig gc = (X11GraphicsConfig)embedded.getGraphicsConfiguration();
        X11GraphicsDevice gd = (X11GraphicsDevice)gc.getDevice();
        if ((newParent == XlibUtil.getRootWindow(gd.getScreen())) ||
            (newParent == XToolkit.getDefaultRootWindow()))
        {
            // reparenting to root means XEmbed termination
            active = false;
        } else {
            // continue XEmbed with a new parent
            server = newParent;
            embedded.notifyStarted();
        }
    }
}
 
Example #5
Source File: X11VolatileSurfaceManager.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Create a pixmap-based SurfaceData object
 */
protected SurfaceData initAcceleratedSurface() {
    SurfaceData sData;

    try {
        X11GraphicsConfig gc = (X11GraphicsConfig)vImg.getGraphicsConfig();
        ColorModel cm = gc.getColorModel();
        long drawable = 0;
        if (context instanceof Long) {
            drawable = ((Long)context).longValue();
        }
        sData = X11SurfaceData.createData(gc,
                                          vImg.getWidth(),
                                          vImg.getHeight(),
                                          cm, vImg, drawable,
                                          Transparency.OPAQUE);
    } catch (NullPointerException ex) {
        sData = null;
    } catch (OutOfMemoryError er) {
        sData = null;
    }

    return sData;
}
 
Example #6
Source File: X11VolatileSurfaceManager.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Create a pixmap-based SurfaceData object
 */
protected SurfaceData initAcceleratedSurface() {
    SurfaceData sData;

    try {
        X11GraphicsConfig gc = (X11GraphicsConfig)vImg.getGraphicsConfig();
        ColorModel cm = gc.getColorModel();
        long drawable = 0;
        if (context instanceof Long) {
            drawable = ((Long)context).longValue();
        }
        sData = X11SurfaceData.createData(gc,
                                          vImg.getWidth(),
                                          vImg.getHeight(),
                                          cm, vImg, drawable,
                                          Transparency.OPAQUE);
    } catch (NullPointerException ex) {
        sData = null;
    } catch (OutOfMemoryError er) {
        sData = null;
    }

    return sData;
}
 
Example #7
Source File: XEmbedClientHelper.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public void handleReparentNotify(XEvent xev) {
    XReparentEvent re = xev.get_xreparent();
    long newParent = re.get_parent();
    if (active) {
        // unregister accelerators, etc. for old parent
        embedded.notifyStopped();
        // check if newParent is a root window
        X11GraphicsConfig gc = (X11GraphicsConfig)embedded.getGraphicsConfiguration();
        X11GraphicsDevice gd = (X11GraphicsDevice)gc.getDevice();
        if ((newParent == XlibUtil.getRootWindow(gd.getScreen())) ||
            (newParent == XToolkit.getDefaultRootWindow()))
        {
            // reparenting to root means XEmbed termination
            active = false;
        } else {
            // continue XEmbed with a new parent
            server = newParent;
            embedded.notifyStarted();
        }
    }
}
 
Example #8
Source File: X11SurfaceData.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public X11PixmapSurfaceData(X11GraphicsConfig gc,
                            int width, int height,
                            Image image,
                            SurfaceType sType, ColorModel cm,
                            long drawable, int transparency)
{
    super(null, gc, sType, cm);
    this.width = width;
    this.height = height;
    offscreenImage = image;
    this.transparency = transparency;
    initSurface(depth, width, height, drawable);
    makePipes();
}
 
Example #9
Source File: X11SurfaceData.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public static X11GraphicsConfig getGC(X11ComponentPeer peer) {
    if (peer != null) {
        return (X11GraphicsConfig) peer.getGraphicsConfiguration();
    } else {
        GraphicsEnvironment env =
            GraphicsEnvironment.getLocalGraphicsEnvironment();
        GraphicsDevice gd = env.getDefaultScreenDevice();
        return (X11GraphicsConfig)gd.getDefaultConfiguration();
    }
}
 
Example #10
Source File: X11SurfaceData.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
public static X11GraphicsConfig getGC(X11ComponentPeer peer) {
    if (peer != null) {
        return (X11GraphicsConfig) peer.getGraphicsConfiguration();
    } else {
        GraphicsEnvironment env =
            GraphicsEnvironment.getLocalGraphicsEnvironment();
        GraphicsDevice gd = env.getDefaultScreenDevice();
        return (X11GraphicsConfig)gd.getDefaultConfiguration();
    }
}
 
Example #11
Source File: X11SurfaceData.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
protected X11SurfaceData(X11ComponentPeer peer,
                         X11GraphicsConfig gc,
                         SurfaceType sType,
                         ColorModel cm) {
    super(sType, cm);
    this.peer = peer;
    this.graphicsConfig = gc;
    this.solidloops = graphicsConfig.getSolidLoops(sType);
    this.depth = cm.getPixelSize();
    initOps(peer, graphicsConfig, depth);
    if (isAccelerationEnabled()) {
        setBlitProxyKey(gc.getProxyKey());
    }
}
 
Example #12
Source File: X11SurfaceData.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public X11PixmapSurfaceData(X11GraphicsConfig gc,
                            int width, int height,
                            Image image,
                            SurfaceType sType, ColorModel cm,
                            long drawable, int transparency)
{
    super(null, gc, sType, cm);
    this.width = width;
    this.height = height;
    offscreenImage = image;
    this.transparency = transparency;
    initSurface(depth, width, height, drawable);
    makePipes();
}
 
Example #13
Source File: X11SurfaceData.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
public X11PixmapSurfaceData(X11GraphicsConfig gc,
                            int width, int height,
                            Image image,
                            SurfaceType sType, ColorModel cm,
                            long drawable, int transparency)
{
    super(null, gc, sType, cm);
    this.width = width;
    this.height = height;
    offscreenImage = image;
    this.transparency = transparency;
    initSurface(depth, width, height, drawable);
    makePipes();
}
 
Example #14
Source File: X11SurfaceData.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public X11WindowSurfaceData(X11ComponentPeer peer,
                            X11GraphicsConfig gc,
                            SurfaceType sType) {
    super(peer, gc, sType, peer.getColorModel());
    if (isDrawableValid()) {
        makePipes();
    }
}
 
Example #15
Source File: X11SurfaceData.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
protected X11SurfaceData(X11ComponentPeer peer,
                         X11GraphicsConfig gc,
                         SurfaceType sType,
                         ColorModel cm) {
    super(sType, cm);
    this.peer = peer;
    this.graphicsConfig = gc;
    this.solidloops = graphicsConfig.getSolidLoops(sType);
    this.depth = cm.getPixelSize();
    initOps(peer, graphicsConfig, depth);
    if (isAccelerationEnabled()) {
        setBlitProxyKey(gc.getProxyKey());
    }
}
 
Example #16
Source File: X11SurfaceData.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public static X11GraphicsConfig getGC(X11ComponentPeer peer) {
    if (peer != null) {
        return (X11GraphicsConfig) peer.getGraphicsConfiguration();
    } else {
        GraphicsEnvironment env =
            GraphicsEnvironment.getLocalGraphicsEnvironment();
        GraphicsDevice gd = env.getDefaultScreenDevice();
        return (X11GraphicsConfig)gd.getDefaultConfiguration();
    }
}
 
Example #17
Source File: X11SurfaceData.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public X11WindowSurfaceData(X11ComponentPeer peer,
                            X11GraphicsConfig gc,
                            SurfaceType sType) {
    super(peer, gc, sType, peer.getColorModel());
    if (isDrawableValid()) {
        makePipes();
    }
}
 
Example #18
Source File: X11SurfaceData.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public static X11GraphicsConfig getGC(X11ComponentPeer peer) {
    if (peer != null) {
        return (X11GraphicsConfig) peer.getGraphicsConfiguration();
    } else {
        GraphicsEnvironment env =
            GraphicsEnvironment.getLocalGraphicsEnvironment();
        GraphicsDevice gd = env.getDefaultScreenDevice();
        return (X11GraphicsConfig)gd.getDefaultConfiguration();
    }
}
 
Example #19
Source File: X11SurfaceData.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public X11WindowSurfaceData(X11ComponentPeer peer,
                            X11GraphicsConfig gc,
                            SurfaceType sType) {
    super(peer, gc, sType, peer.getColorModel());
    if (isDrawableValid()) {
        makePipes();
    }
}
 
Example #20
Source File: X11SurfaceData.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public X11PixmapSurfaceData(X11GraphicsConfig gc,
                            int width, int height,
                            Image image,
                            SurfaceType sType, ColorModel cm,
                            long drawable, int transparency)
{
    super(null, gc, sType, cm);
    this.width = width;
    this.height = height;
    offscreenImage = image;
    this.transparency = transparency;
    initSurface(depth, width, height, drawable);
    makePipes();
}
 
Example #21
Source File: X11SurfaceData.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
protected X11SurfaceData(X11ComponentPeer peer,
                         X11GraphicsConfig gc,
                         SurfaceType sType,
                         ColorModel cm) {
    super(sType, cm);
    this.peer = peer;
    this.graphicsConfig = gc;
    this.solidloops = graphicsConfig.getSolidLoops(sType);
    this.depth = cm.getPixelSize();
    initOps(peer, graphicsConfig, depth);
    if (isAccelerationEnabled()) {
        setBlitProxyKey(gc.getProxyKey());
    }
}
 
Example #22
Source File: X11SurfaceData.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
public X11WindowSurfaceData(X11ComponentPeer peer,
                            X11GraphicsConfig gc,
                            SurfaceType sType) {
    super(peer, gc, sType, peer.getColorModel());
    if (isDrawableValid()) {
        makePipes();
    }
}
 
Example #23
Source File: X11SurfaceData.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
protected X11SurfaceData(X11ComponentPeer peer,
                         X11GraphicsConfig gc,
                         SurfaceType sType,
                         ColorModel cm) {
    super(sType, cm);
    this.peer = peer;
    this.graphicsConfig = gc;
    this.solidloops = graphicsConfig.getSolidLoops(sType);
    this.depth = cm.getPixelSize();
    initOps(peer, graphicsConfig, depth);
    if (isAccelerationEnabled()) {
        setBlitProxyKey(gc.getProxyKey());
    }
}
 
Example #24
Source File: XRobotPeer.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
XRobotPeer(GraphicsConfiguration gc) {
    this.xgc = (X11GraphicsConfig)gc;
    SunToolkit tk = (SunToolkit)Toolkit.getDefaultToolkit();
    setup(tk.getNumberOfButtons(),
            AWTAccessor.getInputEventAccessor().getButtonDownMasks());

    boolean isGtkSupported = false;
    if (tryGtk) {
        if (tk instanceof UNIXToolkit && ((UNIXToolkit) tk).loadGTK()) {
            isGtkSupported = true;
        }
    }

    useGtk = (tryGtk && isGtkSupported);
}
 
Example #25
Source File: X11SurfaceData.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public X11PixmapSurfaceData(X11GraphicsConfig gc,
                            int width, int height,
                            Image image,
                            SurfaceType sType, ColorModel cm,
                            long drawable, int transparency)
{
    super(null, gc, sType, cm);
    this.width = width;
    this.height = height;
    offscreenImage = image;
    this.transparency = transparency;
    initSurface(depth, width, height, drawable);
    makePipes();
}
 
Example #26
Source File: X11SurfaceData.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Method for instantiating a Pixmap SurfaceData (offscreen)
 */
public static X11PixmapSurfaceData createData(X11GraphicsConfig gc,
                                              int width, int height,
                                              ColorModel cm, Image image,
                                              long drawable,
                                              int transparency)
{
    return new X11PixmapSurfaceData(gc, width, height, image,
                                    getSurfaceType(gc, transparency, true),
                                    cm, drawable, transparency);
}
 
Example #27
Source File: X11SurfaceData.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public X11WindowSurfaceData(X11ComponentPeer peer,
                            X11GraphicsConfig gc,
                            SurfaceType sType) {
    super(peer, gc, sType, peer.getColorModel());
    if (isDrawableValid()) {
        makePipes();
    }
}
 
Example #28
Source File: X11SurfaceData.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
protected X11SurfaceData(X11ComponentPeer peer,
                         X11GraphicsConfig gc,
                         SurfaceType sType,
                         ColorModel cm) {
    super(sType, cm);
    this.peer = peer;
    this.graphicsConfig = gc;
    this.solidloops = graphicsConfig.getSolidLoops(sType);
    this.depth = cm.getPixelSize();
    initOps(peer, graphicsConfig, depth);
    if (isAccelerationEnabled()) {
        setBlitProxyKey(gc.getProxyKey());
    }
}
 
Example #29
Source File: X11SurfaceData.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public X11WindowSurfaceData(X11ComponentPeer peer,
                            X11GraphicsConfig gc,
                            SurfaceType sType) {
    super(peer, gc, sType, peer.getColorModel());
    if (isDrawableValid()) {
        makePipes();
    }
}
 
Example #30
Source File: X11SurfaceData.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
public static SurfaceType getSurfaceType(X11GraphicsConfig gc,
                                         int transparency,
                                         boolean pixmapSurface)
{
    boolean transparent = (transparency == Transparency.BITMASK);
    SurfaceType sType;
    ColorModel cm = gc.getColorModel();
    switch (cm.getPixelSize()) {
    case 24:
        if (gc.getBitsPerPixel() == 24) {
            if (cm instanceof DirectColorModel) {
                // 4517321: We will always use ThreeByteBgr for 24 bpp
                // surfaces, regardless of the pixel masks reported by
                // X11.  Despite ambiguity in the X11 spec in how 24 bpp
                // surfaces are treated, it appears that the best
                // SurfaceType for these configurations (including
                // some Matrox Millenium and ATI Radeon boards) is
                // ThreeByteBgr.
                sType = transparent ? X11SurfaceData.ThreeByteBgrX11_BM : X11SurfaceData.ThreeByteBgrX11;
            } else {
                throw new sun.java2d.InvalidPipeException("Unsupported bit " +
                                                          "depth/cm combo: " +
                                                          cm.getPixelSize()  +
                                                          ", " + cm);
            }
            break;
        }
        // Fall through for 32 bit case
    case 32:
        if (cm instanceof DirectColorModel) {
            if (((SunToolkit)java.awt.Toolkit.getDefaultToolkit()
                 ).isTranslucencyCapable(gc) && !pixmapSurface)
            {
                sType = X11SurfaceData.IntArgbPreX11;
            } else {
                if (((DirectColorModel)cm).getRedMask() == 0xff0000) {
                    sType = transparent ? X11SurfaceData.IntRgbX11_BM :
                                          X11SurfaceData.IntRgbX11;
                } else {
                    sType = transparent ? X11SurfaceData.IntBgrX11_BM :
                                          X11SurfaceData.IntBgrX11;
                }
            }
        } else if (cm instanceof ComponentColorModel) {
               sType = X11SurfaceData.FourByteAbgrPreX11;
        } else {

            throw new sun.java2d.InvalidPipeException("Unsupported bit " +
                                                      "depth/cm combo: " +
                                                      cm.getPixelSize()  +
                                                      ", " + cm);
        }
        break;
    case 15:
        sType = transparent ? X11SurfaceData.UShort555RgbX11_BM : X11SurfaceData.UShort555RgbX11;
        break;
    case 16:
        if ((cm instanceof DirectColorModel) &&
            (((DirectColorModel)cm).getGreenMask() == 0x3e0))
        {
            // fix for 4352984: Riva128 on Linux
            sType = transparent ? X11SurfaceData.UShort555RgbX11_BM : X11SurfaceData.UShort555RgbX11;
        } else {
            sType = transparent ? X11SurfaceData.UShort565RgbX11_BM : X11SurfaceData.UShort565RgbX11;
        }
        break;
    case  12:
        if (cm instanceof IndexColorModel) {
            sType = transparent ?
                X11SurfaceData.UShortIndexedX11_BM :
                X11SurfaceData.UShortIndexedX11;
        } else {
            throw new sun.java2d.InvalidPipeException("Unsupported bit " +
                                                      "depth: " +
                                                      cm.getPixelSize() +
                                                      " cm="+cm);
        }
        break;
    case 8:
        if (cm.getColorSpace().getType() == ColorSpace.TYPE_GRAY &&
            cm instanceof ComponentColorModel) {
            sType = transparent ? X11SurfaceData.ByteGrayX11_BM : X11SurfaceData.ByteGrayX11;
        } else if (cm instanceof IndexColorModel &&
                   isOpaqueGray((IndexColorModel)cm)) {
            sType = transparent ? X11SurfaceData.Index8GrayX11_BM : X11SurfaceData.Index8GrayX11;
        } else {
            sType = transparent ? X11SurfaceData.ByteIndexedX11_BM : X11SurfaceData.ByteIndexedOpaqueX11;
        }
        break;
    default:
        throw new sun.java2d.InvalidPipeException("Unsupported bit " +
                                                  "depth: " +
                                                  cm.getPixelSize());
    }
    return sType;
}