本文整理汇总了Java中sun.java2d.pipe.hw.AccelSurface类的典型用法代码示例。如果您正苦于以下问题:Java AccelSurface类的具体用法?Java AccelSurface怎么用?Java AccelSurface使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AccelSurface类属于sun.java2d.pipe.hw包,在下文中一共展示了AccelSurface类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createCompatibleVolatileImage
import sun.java2d.pipe.hw.AccelSurface; //导入依赖的package包/类
/**
* {@inheritDoc}
*
* @see sun.java2d.pipe.hw.AccelGraphicsConfig#createCompatibleVolatileImage
*/
@Override
public VolatileImage
createCompatibleVolatileImage(int width, int height,
int transparency, int type)
{
if ((type != FBOBJECT && type != TEXTURE)
|| transparency == Transparency.BITMASK
|| type == FBOBJECT && !isCapPresent(CAPS_EXT_FBOBJECT)) {
return null;
}
SunVolatileImage vi = new AccelTypedVolatileImage(this, width, height,
transparency, type);
Surface sd = vi.getDestSurface();
if (!(sd instanceof AccelSurface) ||
((AccelSurface)sd).getType() != type)
{
vi.flush();
vi = null;
}
return vi;
}
示例2: createCompatibleVolatileImage
import sun.java2d.pipe.hw.AccelSurface; //导入依赖的package包/类
@Override
public VolatileImage createCompatibleVolatileImage(int width, int height,
int transparency,
int type) {
if ((type != FBOBJECT && type != TEXTURE)
|| transparency == Transparency.BITMASK
|| type == FBOBJECT && !isCapPresent(CAPS_EXT_FBOBJECT)) {
return null;
}
SunVolatileImage vi = new AccelTypedVolatileImage(this, width, height,
transparency, type);
Surface sd = vi.getDestSurface();
if (!(sd instanceof AccelSurface) ||
((AccelSurface)sd).getType() != type)
{
vi.flush();
vi = null;
}
return vi;
}
示例3: setSurfaces
import sun.java2d.pipe.hw.AccelSurface; //导入依赖的package包/类
private void setSurfaces(AccelSurface srcData,
AccelSurface dstData)
{
// assert rq.lock.isHeldByCurrentThread();
rq.ensureCapacityAndAlignment(20, 4);
buf.putInt(SET_SURFACES);
buf.putLong(srcData.getNativeOps());
buf.putLong(dstData.getNativeOps());
}
示例4: createCompatibleVolatileImage
import sun.java2d.pipe.hw.AccelSurface; //导入依赖的package包/类
@Override
public VolatileImage createCompatibleVolatileImage(int width, int height,
int transparency,
int type) {
if (type == FLIP_BACKBUFFER || type == WINDOW || type == UNDEFINED ||
transparency == Transparency.BITMASK)
{
return null;
}
if (type == FBOBJECT) {
if (!isCapPresent(CAPS_EXT_FBOBJECT)) {
return null;
}
} else if (type == PBUFFER) {
boolean isOpaque = transparency == Transparency.OPAQUE;
if (!isOpaque && !isCapPresent(CAPS_STORED_ALPHA)) {
return null;
}
}
SunVolatileImage vi = new AccelTypedVolatileImage(this, width, height,
transparency, type);
Surface sd = vi.getDestSurface();
if (!(sd instanceof AccelSurface) ||
((AccelSurface)sd).getType() != type)
{
vi.flush();
vi = null;
}
return vi;
}
示例5: createCompatibleVolatileImage
import sun.java2d.pipe.hw.AccelSurface; //导入依赖的package包/类
/**
* {@inheritDoc}
*
* @see sun.java2d.pipe.hw.AccelGraphicsConfig#createCompatibleVolatileImage
*/
@Override
public VolatileImage
createCompatibleVolatileImage(int width, int height,
int transparency, int type)
{
if (type == FLIP_BACKBUFFER || type == WINDOW || type == UNDEFINED ||
transparency == Transparency.BITMASK)
{
return null;
}
boolean isOpaque = transparency == Transparency.OPAQUE;
if (type == RT_TEXTURE) {
int cap = isOpaque ? CAPS_RT_TEXTURE_OPAQUE : CAPS_RT_TEXTURE_ALPHA;
if (!device.isCapPresent(cap)) {
return null;
}
} else if (type == RT_PLAIN) {
if (!isOpaque && !device.isCapPresent(CAPS_RT_PLAIN_ALPHA)) {
return null;
}
}
SunVolatileImage vi = new AccelTypedVolatileImage(this, width, height,
transparency, type);
Surface sd = vi.getDestSurface();
if (!(sd instanceof AccelSurface) ||
((AccelSurface)sd).getType() != type)
{
vi.flush();
vi = null;
}
return vi;
}
示例6: createCompatibleVolatileImage
import sun.java2d.pipe.hw.AccelSurface; //导入依赖的package包/类
/**
* {@inheritDoc}
*
* @see sun.java2d.pipe.hw.AccelGraphicsConfig#createCompatibleVolatileImage
*/
@Override
public VolatileImage
createCompatibleVolatileImage(int width, int height,
int transparency, int type)
{
if (type == FLIP_BACKBUFFER || type == WINDOW || type == UNDEFINED ||
transparency == Transparency.BITMASK)
{
return null;
}
if (type == FBOBJECT) {
if (!isCapPresent(CAPS_EXT_FBOBJECT)) {
return null;
}
} else if (type == PBUFFER) {
boolean isOpaque = transparency == Transparency.OPAQUE;
if (!isOpaque && !isCapPresent(CAPS_STORED_ALPHA)) {
return null;
}
}
SunVolatileImage vi = new AccelTypedVolatileImage(this, width, height,
transparency, type);
Surface sd = vi.getDestSurface();
if (!(sd instanceof AccelSurface) ||
((AccelSurface)sd).getType() != type)
{
vi.flush();
vi = null;
}
return vi;
}
示例7: update
import sun.java2d.pipe.hw.AccelSurface; //导入依赖的package包/类
@Override
protected boolean update(Image bb) {
if (bb instanceof DestSurfaceProvider) {
Surface s = ((DestSurfaceProvider)bb).getDestSurface();
if (s instanceof AccelSurface) {
final int w = bb.getWidth(null);
final int h = bb.getHeight(null);
final boolean arr[] = { false };
final AccelSurface as = (AccelSurface)s;
RenderQueue rq = as.getContext().getRenderQueue();
rq.lock();
try {
BufferedContext.validateContext(as);
rq.flushAndInvokeNow(new Runnable() {
@Override
public void run() {
long psdops = as.getNativeOps();
arr[0] = updateWindowAccel(psdops, w, h);
}
});
} catch (InvalidPipeException e) {
// ignore, false will be returned
} finally {
rq.unlock();
}
return arr[0];
}
}
return super.update(bb);
}
示例8: testInvalidType
import sun.java2d.pipe.hw.AccelSurface; //导入依赖的package包/类
private static void testInvalidType(AccelSurface surface, int type) {
long ret = surface.getNativeResource(type);
System.out.printf(" getNativeResource(%d)=0x%x\n", type, ret);
if (ret != 0l) {
System.err.printf(
"FAILED: surface.getNativeResource(%d) returned" +
" 0x%s. It should have have returned 0L\n",
type, ret);
failed = true;
}
}
示例9: printSurface
import sun.java2d.pipe.hw.AccelSurface; //导入依赖的package包/类
private static void printSurface(Surface s) {
if (s instanceof AccelSurface) {
final AccelSurface surface = (AccelSurface) s;
System.out.println(" Accel Surface: ");
System.out.println(" type=" + surface.getType());
System.out.println(" bounds=" + surface.getBounds());
System.out.println(" nativeBounds=" + surface.getNativeBounds());
System.out.println(" isSurfaceLost=" + surface.isSurfaceLost());
System.out.println(" isValid=" + surface.isValid());
RenderQueue rq = surface.getContext().getRenderQueue();
rq.lock();
try {
rq.flushAndInvokeNow(new Runnable() {
public void run() {
System.out.printf(" getNativeResource(TEXTURE)=0x%x\n",
surface.getNativeResource(TEXTURE));
System.out.printf(" getNativeResource(RT_TEXTURE)=0x%x\n",
surface.getNativeResource(RT_TEXTURE));
System.out.printf(" getNativeResource(RT_PLAIN)=0x%x\n",
surface.getNativeResource(RT_PLAIN));
System.out.printf(
" getNativeResource(FLIP_BACKBUFFER)=0x%x\n",
surface.getNativeResource(FLIP_BACKBUFFER));
testD3DDeviceResourceField(surface);
testInvalidType(surface, -1);
testInvalidType(surface, -150);
testInvalidType(surface, 300);
testInvalidType(surface, Integer.MAX_VALUE);
testInvalidType(surface, Integer.MIN_VALUE);
}
});
} finally {
rq.unlock();
}
} else {
System.out.println("null accelerated surface");
}
}
示例10: testGC
import sun.java2d.pipe.hw.AccelSurface; //导入依赖的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);
}
示例11: update
import sun.java2d.pipe.hw.AccelSurface; //导入依赖的package包/类
@Override
protected boolean update(Image bb) {
if (bb instanceof DestSurfaceProvider) {
Surface s = ((DestSurfaceProvider)bb).getDestSurface();
if (s instanceof AccelSurface) {
final boolean arr[] = { false };
final AccelSurface as = (AccelSurface)s;
final int w = as.getBounds().width;
final int h = as.getBounds().height;
RenderQueue rq = as.getContext().getRenderQueue();
rq.lock();
try {
BufferedContext.validateContext(as);
rq.flushAndInvokeNow(new Runnable() {
@Override
public void run() {
long psdops = as.getNativeOps();
arr[0] = updateWindowAccel(psdops, w, h);
}
});
} catch (InvalidPipeException e) {
// ignore, false will be returned
} finally {
rq.unlock();
}
return arr[0];
}
}
return super.update(bb);
}