本文整理汇总了Java中sun.java2d.pipe.hw.AccelGraphicsConfig类的典型用法代码示例。如果您正苦于以下问题:Java AccelGraphicsConfig类的具体用法?Java AccelGraphicsConfig怎么用?Java AccelGraphicsConfig使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AccelGraphicsConfig类属于sun.java2d.pipe.hw包,在下文中一共展示了AccelGraphicsConfig类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createInstance
import sun.java2d.pipe.hw.AccelGraphicsConfig; //导入依赖的package包/类
/**
* Creates an instance of the painter for particular peer.
*/
public static TranslucentWindowPainter createInstance(WWindowPeer peer) {
GraphicsConfiguration gc = peer.getGraphicsConfiguration();
if (!forceSW && gc instanceof AccelGraphicsConfig) {
String gcName = gc.getClass().getSimpleName();
AccelGraphicsConfig agc = (AccelGraphicsConfig)gc;
// this is a heuristic to check that we have a pcix board
// (those have higher transfer rate from gpu to cpu)
if ((agc.getContextCapabilities().getCaps() & CAPS_PS30) != 0 ||
forceOpt)
{
// we check for name to avoid loading classes unnecessarily if
// a pipeline isn't enabled
if (gcName.startsWith("D3D")) {
return new VIOptD3DWindowPainter(peer);
} else if (forceOpt && gcName.startsWith("WGL")) {
// on some boards (namely, ATI, even on pcix bus) ogl is
// very slow reading pixels back so for now it is disabled
// unless forced
return new VIOptWGLWindowPainter(peer);
}
}
}
return new BIWindowPainter(peer);
}
示例2: getBackBuffer
import sun.java2d.pipe.hw.AccelGraphicsConfig; //导入依赖的package包/类
@Override
protected Image getBackBuffer(boolean clear) {
int w = window.getWidth();
int h = window.getHeight();
GraphicsConfiguration gc = peer.getGraphicsConfiguration();
if (viBB == null || viBB.getWidth() != w || viBB.getHeight() != h ||
viBB.validate(gc) == IMAGE_INCOMPATIBLE)
{
flush();
if (gc instanceof AccelGraphicsConfig) {
AccelGraphicsConfig agc = ((AccelGraphicsConfig)gc);
viBB = agc.createCompatibleVolatileImage(w, h,
TRANSLUCENT,
RT_PLAIN);
}
if (viBB == null) {
viBB = gc.createCompatibleVolatileImage(w, h, TRANSLUCENT);
}
viBB.validate(gc);
}
return clear ? clearImage(viBB) : viBB;
}
示例3: testContext
import sun.java2d.pipe.hw.AccelGraphicsConfig; //导入依赖的package包/类
private static void testContext(final AccelGraphicsConfig agc) {
BufferedContext c = agc.getContext();
final AccelDeviceEventListener l = new AccelDeviceEventListener() {
public void onDeviceDispose() {
System.out.println("onDeviceDispose invoked");
agc.removeDeviceEventListener(this);
}
public void onDeviceReset() {
System.out.println("onDeviceReset invoked");
}
};
agc.addDeviceEventListener(l);
RenderQueue rq = c.getRenderQueue();
rq.lock();
try {
c.saveState();
rq.flushNow();
c.restoreState();
rq.flushNow();
System.out.println("Passed: Save/Restore");
} finally {
rq.unlock();
}
}
示例4: printAGC
import sun.java2d.pipe.hw.AccelGraphicsConfig; //导入依赖的package包/类
private static void printAGC(AccelGraphicsConfig agc) {
System.out.println("Accelerated Graphics Config: " + agc);
System.out.println("Capabilities:");
System.out.printf("AGC caps: 0x%x\n",
agc.getContextCapabilities().getCaps());
System.out.println(agc.getContextCapabilities());
}
示例5: testGC
import sun.java2d.pipe.hw.AccelGraphicsConfig; //导入依赖的package包/类
private static void testGC(GraphicsConfiguration gc) {
if (!(gc instanceof AccelGraphicsConfig)) {
System.out.println("Test passed: no hw accelerated configs found.");
return;
}
System.out.println("AccelGraphicsConfig exists, testing.");
AccelGraphicsConfig agc = (AccelGraphicsConfig) gc;
printAGC(agc);
testContext(agc);
VolatileImage vi = gc.createCompatibleVolatileImage(10, 10);
vi.validate(gc);
if (vi instanceof DestSurfaceProvider) {
System.out.println("Passed: VI is DestSurfaceProvider");
Surface s = ((DestSurfaceProvider) vi).getDestSurface();
if (s instanceof AccelSurface) {
System.out.println("Passed: Obtained Accel Surface");
printSurface((AccelSurface) s);
}
Graphics g = vi.getGraphics();
if (g instanceof DestSurfaceProvider) {
System.out.println("Passed: VI graphics is " +
"DestSurfaceProvider");
printSurface(((DestSurfaceProvider) g).getDestSurface());
}
} else {
System.out.println("VI is not DestSurfaceProvider");
}
testVICreation(agc, CAPS_RT_TEXTURE_ALPHA, TRANSLUCENT, RT_TEXTURE);
testVICreation(agc, CAPS_RT_TEXTURE_OPAQUE, OPAQUE, RT_TEXTURE);
testVICreation(agc, CAPS_RT_PLAIN_ALPHA, TRANSLUCENT, RT_PLAIN);
testVICreation(agc, agc.getContextCapabilities().getCaps(), OPAQUE,
TEXTURE);
testForNPEDuringCreation(agc);
}