java.awt.BufferCapabilities Java Examples
The following examples show how to use
java.awt.BufferCapabilities.
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: D3DSurfaceData.java From hottub with GNU General Public License v2.0 | 6 votes |
/** * Creates a SurfaceData object representing the back buffer of a * double-buffered on-screen Window. */ public static D3DSurfaceData createData(WComponentPeer peer, Image image) { D3DGraphicsConfig gc = getGC(peer); if (gc == null || !peer.isAccelCapable()) { return null; } BufferCapabilities caps = peer.getBackBufferCaps(); VSyncType vSyncType = VSYNC_DEFAULT; if (caps instanceof ExtendedBufferCapabilities) { vSyncType = ((ExtendedBufferCapabilities)caps).getVSync(); } Rectangle r = peer.getBounds(); BufferCapabilities.FlipContents flip = caps.getFlipContents(); int swapEffect; if (flip == FlipContents.COPIED) { swapEffect = SWAP_COPY; } else if (flip == FlipContents.PRIOR) { swapEffect = SWAP_FLIP; } else { // flip == FlipContents.UNDEFINED || .BACKGROUND swapEffect = SWAP_DISCARD; } return new D3DSurfaceData(peer, gc, r.width, r.height, image, peer.getColorModel(), peer.getBackBuffersNum(), swapEffect, vSyncType, FLIP_BACKBUFFER); }
Example #2
Source File: CGLGraphicsConfig.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
@Override public void assertOperationSupported(final int numBuffers, final BufferCapabilities caps) throws AWTException { // Assume this method is never called with numBuffers != 2, as 0 is // unsupported, and 1 corresponds to a SingleBufferStrategy which // doesn't depend on the peer. Screen is considered as a separate // "buffer". if (numBuffers != 2) { throw new AWTException("Only double buffering is supported"); } final BufferCapabilities configCaps = getBufferCapabilities(); if (!configCaps.isPageFlipping()) { throw new AWTException("Page flipping is not supported"); } if (caps.getFlipContents() == BufferCapabilities.FlipContents.PRIOR) { throw new AWTException("FlipContents.PRIOR is not supported"); } }
Example #3
Source File: CGLGraphicsConfig.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
@Override public void flip(final LWComponentPeer<?, ?> peer, final Image backBuffer, final int x1, final int y1, final int x2, final int y2, final BufferCapabilities.FlipContents flipAction) { final Graphics g = peer.getGraphics(); try { g.drawImage(backBuffer, x1, y1, x2, y2, x1, y1, x2, y2, null); } finally { g.dispose(); } if (flipAction == BufferCapabilities.FlipContents.BACKGROUND) { final Graphics2D bg = (Graphics2D) backBuffer.getGraphics(); try { bg.setBackground(peer.getBackground()); bg.clearRect(0, 0, backBuffer.getWidth(null), backBuffer.getHeight(null)); } finally { bg.dispose(); } } }
Example #4
Source File: CGLGraphicsConfig.java From hottub with GNU General Public License v2.0 | 6 votes |
@Override public void flip(final LWComponentPeer<?, ?> peer, final Image backBuffer, final int x1, final int y1, final int x2, final int y2, final BufferCapabilities.FlipContents flipAction) { final Graphics g = peer.getGraphics(); try { g.drawImage(backBuffer, x1, y1, x2, y2, x1, y1, x2, y2, null); } finally { g.dispose(); } if (flipAction == BufferCapabilities.FlipContents.BACKGROUND) { final Graphics2D bg = (Graphics2D) backBuffer.getGraphics(); try { bg.setBackground(peer.getBackground()); bg.clearRect(0, 0, backBuffer.getWidth(null), backBuffer.getHeight(null)); } finally { bg.dispose(); } } }
Example #5
Source File: GLXGraphicsConfig.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
/** * Attempts to create a GLX-based backbuffer for the given peer. If * the requested configuration is not natively supported, an AWTException * is thrown. Otherwise, if the backbuffer creation is successful, a * value of 1 is returned. */ @Override public long createBackBuffer(X11ComponentPeer peer, int numBuffers, BufferCapabilities caps) throws AWTException { if (numBuffers > 2) { throw new AWTException( "Only double or single buffering is supported"); } BufferCapabilities configCaps = getBufferCapabilities(); if (!configCaps.isPageFlipping()) { throw new AWTException("Page flipping is not supported"); } if (caps.getFlipContents() == BufferCapabilities.FlipContents.PRIOR) { throw new AWTException("FlipContents.PRIOR is not supported"); } // non-zero return value means backbuffer creation was successful // (checked in X11ComponentPeer.flip(), etc.) return 1; }
Example #6
Source File: D3DGraphicsConfig.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
/** * Checks that the requested configuration is natively supported; if not, * an AWTException is thrown. */ @Override public void assertOperationSupported(Component target, int numBuffers, BufferCapabilities caps) throws AWTException { if (numBuffers < 2 || numBuffers > 4) { throw new AWTException("Only 2-4 buffers supported"); } if (caps.getFlipContents() == BufferCapabilities.FlipContents.COPIED && numBuffers != 2) { throw new AWTException("FlipContents.COPIED is only" + "supported for 2 buffers"); } }
Example #7
Source File: CGLGraphicsConfig.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
@Override public void assertOperationSupported(final int numBuffers, final BufferCapabilities caps) throws AWTException { // Assume this method is never called with numBuffers != 2, as 0 is // unsupported, and 1 corresponds to a SingleBufferStrategy which // doesn't depend on the peer. Screen is considered as a separate // "buffer". if (numBuffers != 2) { throw new AWTException("Only double buffering is supported"); } final BufferCapabilities configCaps = getBufferCapabilities(); if (!configCaps.isPageFlipping()) { throw new AWTException("Page flipping is not supported"); } if (caps.getFlipContents() == BufferCapabilities.FlipContents.PRIOR) { throw new AWTException("FlipContents.PRIOR is not supported"); } }
Example #8
Source File: GLXGraphicsConfig.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
/** * Attempts to create a GLX-based backbuffer for the given peer. If * the requested configuration is not natively supported, an AWTException * is thrown. Otherwise, if the backbuffer creation is successful, a * value of 1 is returned. */ @Override public long createBackBuffer(X11ComponentPeer peer, int numBuffers, BufferCapabilities caps) throws AWTException { if (numBuffers > 2) { throw new AWTException( "Only double or single buffering is supported"); } BufferCapabilities configCaps = getBufferCapabilities(); if (!configCaps.isPageFlipping()) { throw new AWTException("Page flipping is not supported"); } if (caps.getFlipContents() == BufferCapabilities.FlipContents.PRIOR) { throw new AWTException("FlipContents.PRIOR is not supported"); } // non-zero return value means backbuffer creation was successful // (checked in X11ComponentPeer.flip(), etc.) return 1; }
Example #9
Source File: CGLGraphicsConfig.java From hottub with GNU General Public License v2.0 | 6 votes |
@Override public void assertOperationSupported(final int numBuffers, final BufferCapabilities caps) throws AWTException { // Assume this method is never called with numBuffers != 2, as 0 is // unsupported, and 1 corresponds to a SingleBufferStrategy which // doesn't depend on the peer. Screen is considered as a separate // "buffer". if (numBuffers != 2) { throw new AWTException("Only double buffering is supported"); } final BufferCapabilities configCaps = getBufferCapabilities(); if (!configCaps.isPageFlipping()) { throw new AWTException("Page flipping is not supported"); } if (caps.getFlipContents() == BufferCapabilities.FlipContents.PRIOR) { throw new AWTException("FlipContents.PRIOR is not supported"); } }
Example #10
Source File: CGLGraphicsConfig.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
@Override public void assertOperationSupported(final int numBuffers, final BufferCapabilities caps) throws AWTException { // Assume this method is never called with numBuffers != 2, as 0 is // unsupported, and 1 corresponds to a SingleBufferStrategy which // doesn't depend on the peer. Screen is considered as a separate // "buffer". if (numBuffers != 2) { throw new AWTException("Only double buffering is supported"); } final BufferCapabilities configCaps = getBufferCapabilities(); if (!configCaps.isPageFlipping()) { throw new AWTException("Page flipping is not supported"); } if (caps.getFlipContents() == BufferCapabilities.FlipContents.PRIOR) { throw new AWTException("FlipContents.PRIOR is not supported"); } }
Example #11
Source File: CGLGraphicsConfig.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
@Override public void flip(final LWComponentPeer<?, ?> peer, final Image backBuffer, final int x1, final int y1, final int x2, final int y2, final BufferCapabilities.FlipContents flipAction) { final Graphics g = peer.getGraphics(); try { g.drawImage(backBuffer, x1, y1, x2, y2, x1, y1, x2, y2, null); } finally { g.dispose(); } if (flipAction == BufferCapabilities.FlipContents.BACKGROUND) { final Graphics2D bg = (Graphics2D) backBuffer.getGraphics(); try { bg.setBackground(peer.getBackground()); bg.clearRect(0, 0, backBuffer.getWidth(null), backBuffer.getHeight(null)); } finally { bg.dispose(); } } }
Example #12
Source File: CGLGraphicsConfig.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
@Override public void flip(final LWComponentPeer<?, ?> peer, final Image backBuffer, final int x1, final int y1, final int x2, final int y2, final BufferCapabilities.FlipContents flipAction) { final Graphics g = peer.getGraphics(); try { g.drawImage(backBuffer, x1, y1, x2, y2, x1, y1, x2, y2, null); } finally { g.dispose(); } if (flipAction == BufferCapabilities.FlipContents.BACKGROUND) { final Graphics2D bg = (Graphics2D) backBuffer.getGraphics(); try { bg.setBackground(peer.getBackground()); bg.clearRect(0, 0, backBuffer.getWidth(null), backBuffer.getHeight(null)); } finally { bg.dispose(); } } }
Example #13
Source File: D3DGraphicsConfig.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
/** * Checks that the requested configuration is natively supported; if not, * an AWTException is thrown. */ @Override public void assertOperationSupported(Component target, int numBuffers, BufferCapabilities caps) throws AWTException { if (numBuffers < 2 || numBuffers > 4) { throw new AWTException("Only 2-4 buffers supported"); } if (caps.getFlipContents() == BufferCapabilities.FlipContents.COPIED && numBuffers != 2) { throw new AWTException("FlipContents.COPIED is only" + "supported for 2 buffers"); } }
Example #14
Source File: CGLGraphicsConfig.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
@Override public void assertOperationSupported(final int numBuffers, final BufferCapabilities caps) throws AWTException { // Assume this method is never called with numBuffers != 2, as 0 is // unsupported, and 1 corresponds to a SingleBufferStrategy which // doesn't depend on the peer. Screen is considered as a separate // "buffer". if (numBuffers != 2) { throw new AWTException("Only double buffering is supported"); } final BufferCapabilities configCaps = getBufferCapabilities(); if (!configCaps.isPageFlipping()) { throw new AWTException("Page flipping is not supported"); } if (caps.getFlipContents() == BufferCapabilities.FlipContents.PRIOR) { throw new AWTException("FlipContents.PRIOR is not supported"); } }
Example #15
Source File: X11GraphicsConfig.java From hottub with GNU General Public License v2.0 | 6 votes |
/** * Attempts to create an XDBE-based backbuffer for the given peer. If * the requested configuration is not natively supported, an AWTException * is thrown. Otherwise, if the backbuffer creation is successful, a * handle to the native backbuffer is returned. */ public long createBackBuffer(X11ComponentPeer peer, int numBuffers, BufferCapabilities caps) throws AWTException { if (!X11GraphicsDevice.isDBESupported()) { throw new AWTException("Page flipping is not supported"); } if (numBuffers > 2) { throw new AWTException( "Only double or single buffering is supported"); } BufferCapabilities configCaps = getBufferCapabilities(); if (!configCaps.isPageFlipping()) { throw new AWTException("Page flipping is not supported"); } long window = peer.getContentWindow(); int swapAction = getSwapAction(caps.getFlipContents()); return createBackBuffer(window, swapAction); }
Example #16
Source File: WGLGraphicsConfig.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
/** * Checks that the requested configuration is natively supported; if not, * an AWTException is thrown. */ @Override public void assertOperationSupported(Component target, int numBuffers, BufferCapabilities caps) throws AWTException { if (numBuffers > 2) { throw new AWTException( "Only double or single buffering is supported"); } BufferCapabilities configCaps = getBufferCapabilities(); if (!configCaps.isPageFlipping()) { throw new AWTException("Page flipping is not supported"); } if (caps.getFlipContents() == BufferCapabilities.FlipContents.PRIOR) { throw new AWTException("FlipContents.PRIOR is not supported"); } }
Example #17
Source File: CGLGraphicsConfig.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
@Override public void flip(final LWComponentPeer<?, ?> peer, final Image backBuffer, final int x1, final int y1, final int x2, final int y2, final BufferCapabilities.FlipContents flipAction) { final Graphics g = peer.getGraphics(); try { g.drawImage(backBuffer, x1, y1, x2, y2, x1, y1, x2, y2, null); } finally { g.dispose(); } if (flipAction == BufferCapabilities.FlipContents.BACKGROUND) { final Graphics2D bg = (Graphics2D) backBuffer.getGraphics(); try { bg.setBackground(peer.getBackground()); bg.clearRect(0, 0, backBuffer.getWidth(null), backBuffer.getHeight(null)); } finally { bg.dispose(); } } }
Example #18
Source File: D3DSurfaceData.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
/** * Creates a SurfaceData object representing the back buffer of a * double-buffered on-screen Window. */ public static D3DSurfaceData createData(WComponentPeer peer, Image image) { D3DGraphicsConfig gc = getGC(peer); if (gc == null || !peer.isAccelCapable()) { return null; } BufferCapabilities caps = peer.getBackBufferCaps(); VSyncType vSyncType = VSYNC_DEFAULT; if (caps instanceof ExtendedBufferCapabilities) { vSyncType = ((ExtendedBufferCapabilities)caps).getVSync(); } Rectangle r = peer.getBounds(); BufferCapabilities.FlipContents flip = caps.getFlipContents(); int swapEffect; if (flip == FlipContents.COPIED) { swapEffect = SWAP_COPY; } else if (flip == FlipContents.PRIOR) { swapEffect = SWAP_FLIP; } else { // flip == FlipContents.UNDEFINED || .BACKGROUND swapEffect = SWAP_DISCARD; } return new D3DSurfaceData(peer, gc, r.width, r.height, image, peer.getColorModel(), peer.getBackBuffersNum(), swapEffect, vSyncType, FLIP_BACKBUFFER); }
Example #19
Source File: X11GraphicsConfig.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
/** * Attempts to create an XDBE-based backbuffer for the given peer. If * the requested configuration is not natively supported, an AWTException * is thrown. Otherwise, if the backbuffer creation is successful, a * handle to the native backbuffer is returned. */ public long createBackBuffer(X11ComponentPeer peer, int numBuffers, BufferCapabilities caps) throws AWTException { if (!X11GraphicsDevice.isDBESupported()) { throw new AWTException("Page flipping is not supported"); } if (numBuffers > 2) { throw new AWTException( "Only double or single buffering is supported"); } BufferCapabilities configCaps = getBufferCapabilities(); if (!configCaps.isPageFlipping()) { throw new AWTException("Page flipping is not supported"); } long window = peer.getContentWindow(); int swapAction = getSwapAction(caps.getFlipContents()); return createBackBuffer(window, swapAction); }
Example #20
Source File: WGLGraphicsConfig.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
@Override public BufferCapabilities getBufferCapabilities() { if (bufferCaps == null) { boolean dblBuf = isCapPresent(CAPS_DOUBLEBUFFERED); bufferCaps = new WGLBufferCaps(dblBuf); } return bufferCaps; }
Example #21
Source File: ExtendedBufferCapabilities.java From hottub with GNU General Public License v2.0 | 5 votes |
/** * Creates an ExtendedBufferCapabilities object with front/back/flip caps * from the passed cap, and VSYNC_DEFAULT v-sync mode. */ public ExtendedBufferCapabilities(BufferCapabilities caps) { super(caps.getFrontBufferCapabilities(), caps.getBackBufferCapabilities(), caps.getFlipContents()); this.vsync = VSyncType.VSYNC_DEFAULT; }
Example #22
Source File: Win32GraphicsConfig.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * Checks that the requested configuration is natively supported; if not, * an AWTException is thrown. */ public void assertOperationSupported(Component target, int numBuffers, BufferCapabilities caps) throws AWTException { // the default pipeline doesn't support flip buffer strategy throw new AWTException( "The operation requested is not supported"); }
Example #23
Source File: D3DGraphicsConfig.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
@Override public BufferCapabilities getBufferCapabilities() { if (bufferCaps == null) { bufferCaps = new D3DBufferCaps(); } return bufferCaps; }
Example #24
Source File: GLXGraphicsConfig.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@Override public BufferCapabilities getBufferCapabilities() { if (bufferCaps == null) { bufferCaps = new GLXBufferCaps(isDoubleBuffered()); } return bufferCaps; }
Example #25
Source File: VSyncedBufferStrategyTest.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
private void createBS(boolean requestVSync) { if (bs != null && requestVSync == currentBSVSynced) { return; } BufferCapabilities bc = defaultBC; if (requestVSync) { bc = new sun.java2d.pipe.hw.ExtendedBufferCapabilities( new ImageCapabilities(true), new ImageCapabilities(true), FlipContents.COPIED, sun.java2d.pipe.hw.ExtendedBufferCapabilities.VSyncType.VSYNC_ON); } try { createBufferStrategy(2, bc); } catch (AWTException e) { System.err.println("Warning: cap is not supported: "+bc); e.printStackTrace(); createBufferStrategy(2); } currentBSVSynced = requestVSync; bs = getBufferStrategy(); String s = getParent() instanceof Frame ? ((Frame)getParent()).getTitle() : "parent"; System.out.println("Created BS for \"" + s + "\" frame, bs="+bs); }
Example #26
Source File: D3DGraphicsConfig.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
@Override public BufferCapabilities getBufferCapabilities() { if (bufferCaps == null) { bufferCaps = new D3DBufferCaps(); } return bufferCaps; }
Example #27
Source File: GLXGraphicsConfig.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
@Override public BufferCapabilities getBufferCapabilities() { if (bufferCaps == null) { bufferCaps = new GLXBufferCaps(isDoubleBuffered()); } return bufferCaps; }
Example #28
Source File: ExtendedBufferCapabilities.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
/** * Creates an ExtendedBufferCapabilities object with front/back/flip caps * from the passed cap, and VSYNC_DEFAULT v-sync mode. */ public ExtendedBufferCapabilities(BufferCapabilities caps) { super(caps.getFrontBufferCapabilities(), caps.getBackBufferCapabilities(), caps.getFlipContents()); this.vsync = VSyncType.VSYNC_DEFAULT; }
Example #29
Source File: VSyncedBufferStrategyTest.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
private void createBS(boolean requestVSync) { if (bs != null && requestVSync == currentBSVSynced) { return; } BufferCapabilities bc = defaultBC; if (requestVSync) { bc = new sun.java2d.pipe.hw.ExtendedBufferCapabilities( new ImageCapabilities(true), new ImageCapabilities(true), FlipContents.COPIED, sun.java2d.pipe.hw.ExtendedBufferCapabilities.VSyncType.VSYNC_ON); } try { createBufferStrategy(2, bc); } catch (AWTException e) { System.err.println("Warning: cap is not supported: "+bc); e.printStackTrace(); createBufferStrategy(2); } currentBSVSynced = requestVSync; bs = getBufferStrategy(); String s = getParent() instanceof Frame ? ((Frame)getParent()).getTitle() : "parent"; System.out.println("Created BS for \"" + s + "\" frame, bs="+bs); }
Example #30
Source File: XComponentPeer.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public void flip(int x1, int y1, int x2, int y2, BufferCapabilities.FlipContents flipAction) { if (buffersLog.isLoggable(PlatformLogger.Level.FINE)) { buffersLog.fine("flip(" + flipAction + ")"); } if (backBuffer == 0) { throw new IllegalStateException("Buffers have not been created"); } graphicsConfig.flip(this, target, xBackBuffer, x1, y1, x2, y2, flipAction); }