本文整理汇总了Java中java.awt.BufferCapabilities.FlipContents方法的典型用法代码示例。如果您正苦于以下问题:Java BufferCapabilities.FlipContents方法的具体用法?Java BufferCapabilities.FlipContents怎么用?Java BufferCapabilities.FlipContents使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.BufferCapabilities
的用法示例。
在下文中一共展示了BufferCapabilities.FlipContents方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: flip
import java.awt.BufferCapabilities; //导入方法依赖的package包/类
@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();
}
}
}
示例2: createData
import java.awt.BufferCapabilities; //导入方法依赖的package包/类
/**
* 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);
}
示例3: flip
import java.awt.BufferCapabilities; //导入方法依赖的package包/类
public void flip (BufferCapabilities.FlipContents contents)
{
getGraphics().drawImage(backBuffer,
awtComponent.getWidth(),
awtComponent.getHeight(),
null);
// create new back buffer and clear it to the background color.
if (contents == BufferCapabilities.FlipContents.BACKGROUND)
{
backBuffer = createVolatileImage(awtComponent.getWidth(),
awtComponent.getHeight());
backBuffer.getGraphics().clearRect(0, 0,
awtComponent.getWidth(),
awtComponent.getHeight());
}
// FIXME: support BufferCapabilities.FlipContents.PRIOR
}
示例4: flip
import java.awt.BufferCapabilities; //导入方法依赖的package包/类
/**
* Performs the native XDBE flip operation for the given target Component.
*/
public void flip(X11ComponentPeer peer,
Component target, VolatileImage xBackBuffer,
int x1, int y1, int x2, int y2,
BufferCapabilities.FlipContents flipAction)
{
long window = peer.getContentWindow();
int swapAction = getSwapAction(flipAction);
swapBuffers(window, swapAction);
}
示例5: getSwapAction
import java.awt.BufferCapabilities; //导入方法依赖的package包/类
/**
* Maps the given FlipContents constant to the associated XDBE swap
* action constant.
*/
private static int getSwapAction(
BufferCapabilities.FlipContents flipAction) {
if (flipAction == BufferCapabilities.FlipContents.BACKGROUND) {
return 0x01;
} else if (flipAction == BufferCapabilities.FlipContents.PRIOR) {
return 0x02;
} else if (flipAction == BufferCapabilities.FlipContents.COPIED) {
return 0x03;
} else {
return 0x00; // UNDEFINED
}
}
示例6: flip
import java.awt.BufferCapabilities; //导入方法依赖的package包/类
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);
}
示例7: flip
import java.awt.BufferCapabilities; //导入方法依赖的package包/类
public void flip(int x1, int y1, int x2, int y2,
BufferCapabilities.FlipContents flipAction)
{
throw new IllegalStateException(
"Page-flipping is not allowed on a lightweight component");
}
示例8: flip
import java.awt.BufferCapabilities; //导入方法依赖的package包/类
public void flip(BufferCapabilities.FlipContents contents)
{
// Nothing to do here for lightweights.
}
示例9: flip
import java.awt.BufferCapabilities; //导入方法依赖的package包/类
public void flip(BufferCapabilities.FlipContents contents)
{
}
示例10: flip
import java.awt.BufferCapabilities; //导入方法依赖的package包/类
/**
* Performs the native flip operation for the given target Component. Our
* flip is implemented through normal drawImage() to the graphic object,
* because of our components uses a graphic object of the container(in this
* case we also apply necessary constrains)
*/
void flip(LWComponentPeer<?, ?> peer, Image backBuffer, int x1, int y1,
int x2, int y2, BufferCapabilities.FlipContents flipAction);
示例11: flip
import java.awt.BufferCapabilities; //导入方法依赖的package包/类
/**
* Perform a page flip, leaving the contents of the back buffer in
* the specified state.
*
* @param contents the state in which to leave the back buffer
*
* @since 1.2
*/
void flip(BufferCapabilities.FlipContents contents);
示例12: flip
import java.awt.BufferCapabilities; //导入方法依赖的package包/类
void flip(int x1, int y1, int x2, int y2, BufferCapabilities.FlipContents flipAction);