Java 类java.awt.ImageCapabilities 实例源码
项目:OpenJSharp
文件:SunVolatileImage.java
protected VolatileSurfaceManager createSurfaceManager(Object context,
ImageCapabilities caps)
{
/**
* Platform-specific SurfaceManagerFactories will return a
* manager suited to acceleration on each platform. But if
* the user is asking for a VolatileImage from a BufferedImageGC,
* then we need to return the appropriate unaccelerated manager.
* Note: this could change in the future; if some platform would
* like to accelerate BIGC volatile images, then this special-casing
* of the BIGC graphicsConfig should live in platform-specific
* code instead.
* We do the same for a Printer Device, and if user requested an
* unaccelerated VolatileImage by passing the capabilities object.
*/
if (graphicsConfig instanceof BufferedImageGraphicsConfig ||
graphicsConfig instanceof sun.print.PrinterGraphicsConfig ||
(caps != null && !caps.isAccelerated()))
{
return new BufImgVolatileSurfaceManager(this, context);
}
SurfaceManagerFactory smf = SurfaceManagerFactory.getInstance();
return smf.createVolatileManager(this, context);
}
项目:jdk8u-jdk
文件:SunVolatileImage.java
protected VolatileSurfaceManager createSurfaceManager(Object context,
ImageCapabilities caps)
{
/**
* Platform-specific SurfaceManagerFactories will return a
* manager suited to acceleration on each platform. But if
* the user is asking for a VolatileImage from a BufferedImageGC,
* then we need to return the appropriate unaccelerated manager.
* Note: this could change in the future; if some platform would
* like to accelerate BIGC volatile images, then this special-casing
* of the BIGC graphicsConfig should live in platform-specific
* code instead.
* We do the same for a Printer Device, and if user requested an
* unaccelerated VolatileImage by passing the capabilities object.
*/
if (graphicsConfig instanceof BufferedImageGraphicsConfig ||
graphicsConfig instanceof sun.print.PrinterGraphicsConfig ||
(caps != null && !caps.isAccelerated()))
{
return new BufImgVolatileSurfaceManager(this, context);
}
SurfaceManagerFactory smf = SurfaceManagerFactory.getInstance();
return smf.createVolatileManager(this, context);
}
项目:openjdk-jdk10
文件:SunVolatileImage.java
protected VolatileSurfaceManager createSurfaceManager(Object context,
ImageCapabilities caps)
{
/**
* Platform-specific SurfaceManagerFactories will return a
* manager suited to acceleration on each platform. But if
* the user is asking for a VolatileImage from a BufferedImageGC,
* then we need to return the appropriate unaccelerated manager.
* Note: this could change in the future; if some platform would
* like to accelerate BIGC volatile images, then this special-casing
* of the BIGC graphicsConfig should live in platform-specific
* code instead.
* We do the same for a Printer Device, and if user requested an
* unaccelerated VolatileImage by passing the capabilities object.
*/
if (graphicsConfig instanceof BufferedImageGraphicsConfig ||
graphicsConfig instanceof sun.print.PrinterGraphicsConfig ||
(caps != null && !caps.isAccelerated()))
{
return new BufImgVolatileSurfaceManager(this, context);
}
SurfaceManagerFactory smf = SurfaceManagerFactory.getInstance();
return smf.createVolatileManager(this, context);
}
项目:openjdk9
文件:SunVolatileImage.java
protected VolatileSurfaceManager createSurfaceManager(Object context,
ImageCapabilities caps)
{
/**
* Platform-specific SurfaceManagerFactories will return a
* manager suited to acceleration on each platform. But if
* the user is asking for a VolatileImage from a BufferedImageGC,
* then we need to return the appropriate unaccelerated manager.
* Note: this could change in the future; if some platform would
* like to accelerate BIGC volatile images, then this special-casing
* of the BIGC graphicsConfig should live in platform-specific
* code instead.
* We do the same for a Printer Device, and if user requested an
* unaccelerated VolatileImage by passing the capabilities object.
*/
if (graphicsConfig instanceof BufferedImageGraphicsConfig ||
graphicsConfig instanceof sun.print.PrinterGraphicsConfig ||
(caps != null && !caps.isAccelerated()))
{
return new BufImgVolatileSurfaceManager(this, context);
}
SurfaceManagerFactory smf = SurfaceManagerFactory.getInstance();
return smf.createVolatileManager(this, context);
}
项目:jdk8u_jdk
文件:SunVolatileImage.java
protected VolatileSurfaceManager createSurfaceManager(Object context,
ImageCapabilities caps)
{
/**
* Platform-specific SurfaceManagerFactories will return a
* manager suited to acceleration on each platform. But if
* the user is asking for a VolatileImage from a BufferedImageGC,
* then we need to return the appropriate unaccelerated manager.
* Note: this could change in the future; if some platform would
* like to accelerate BIGC volatile images, then this special-casing
* of the BIGC graphicsConfig should live in platform-specific
* code instead.
* We do the same for a Printer Device, and if user requested an
* unaccelerated VolatileImage by passing the capabilities object.
*/
if (graphicsConfig instanceof BufferedImageGraphicsConfig ||
graphicsConfig instanceof sun.print.PrinterGraphicsConfig ||
(caps != null && !caps.isAccelerated()))
{
return new BufImgVolatileSurfaceManager(this, context);
}
SurfaceManagerFactory smf = SurfaceManagerFactory.getInstance();
return smf.createVolatileManager(this, context);
}
项目:lookaside_java-1.8.0-openjdk
文件:SunVolatileImage.java
protected VolatileSurfaceManager createSurfaceManager(Object context,
ImageCapabilities caps)
{
/**
* Platform-specific SurfaceManagerFactories will return a
* manager suited to acceleration on each platform. But if
* the user is asking for a VolatileImage from a BufferedImageGC,
* then we need to return the appropriate unaccelerated manager.
* Note: this could change in the future; if some platform would
* like to accelerate BIGC volatile images, then this special-casing
* of the BIGC graphicsConfig should live in platform-specific
* code instead.
* We do the same for a Printer Device, and if user requested an
* unaccelerated VolatileImage by passing the capabilities object.
*/
if (graphicsConfig instanceof BufferedImageGraphicsConfig ||
graphicsConfig instanceof sun.print.PrinterGraphicsConfig ||
(caps != null && !caps.isAccelerated()))
{
return new BufImgVolatileSurfaceManager(this, context);
}
SurfaceManagerFactory smf = SurfaceManagerFactory.getInstance();
return smf.createVolatileManager(this, context);
}
项目:infobip-open-jdk-8
文件:SunVolatileImage.java
protected VolatileSurfaceManager createSurfaceManager(Object context,
ImageCapabilities caps)
{
/**
* Platform-specific SurfaceManagerFactories will return a
* manager suited to acceleration on each platform. But if
* the user is asking for a VolatileImage from a BufferedImageGC,
* then we need to return the appropriate unaccelerated manager.
* Note: this could change in the future; if some platform would
* like to accelerate BIGC volatile images, then this special-casing
* of the BIGC graphicsConfig should live in platform-specific
* code instead.
* We do the same for a Printer Device, and if user requested an
* unaccelerated VolatileImage by passing the capabilities object.
*/
if (graphicsConfig instanceof BufferedImageGraphicsConfig ||
graphicsConfig instanceof sun.print.PrinterGraphicsConfig ||
(caps != null && !caps.isAccelerated()))
{
return new BufImgVolatileSurfaceManager(this, context);
}
SurfaceManagerFactory smf = SurfaceManagerFactory.getInstance();
return smf.createVolatileManager(this, context);
}
项目:jdk8u-dev-jdk
文件:SunVolatileImage.java
protected VolatileSurfaceManager createSurfaceManager(Object context,
ImageCapabilities caps)
{
/**
* Platform-specific SurfaceManagerFactories will return a
* manager suited to acceleration on each platform. But if
* the user is asking for a VolatileImage from a BufferedImageGC,
* then we need to return the appropriate unaccelerated manager.
* Note: this could change in the future; if some platform would
* like to accelerate BIGC volatile images, then this special-casing
* of the BIGC graphicsConfig should live in platform-specific
* code instead.
* We do the same for a Printer Device, and if user requested an
* unaccelerated VolatileImage by passing the capabilities object.
*/
if (graphicsConfig instanceof BufferedImageGraphicsConfig ||
graphicsConfig instanceof sun.print.PrinterGraphicsConfig ||
(caps != null && !caps.isAccelerated()))
{
return new BufImgVolatileSurfaceManager(this, context);
}
SurfaceManagerFactory smf = SurfaceManagerFactory.getInstance();
return smf.createVolatileManager(this, context);
}
项目:jdk7-jdk
文件:SunVolatileImage.java
protected VolatileSurfaceManager createSurfaceManager(Object context,
ImageCapabilities caps)
{
/**
* Platform-specific SurfaceManagerFactories will return a
* manager suited to acceleration on each platform. But if
* the user is asking for a VolatileImage from a BufferedImageGC,
* then we need to return the appropriate unaccelerated manager.
* Note: this could change in the future; if some platform would
* like to accelerate BIGC volatile images, then this special-casing
* of the BIGC graphicsConfig should live in platform-specific
* code instead.
* We do the same for a Printer Device, and if user requested an
* unaccelerated VolatileImage by passing the capabilities object.
*/
if (graphicsConfig instanceof BufferedImageGraphicsConfig ||
graphicsConfig instanceof sun.print.PrinterGraphicsConfig ||
(caps != null && !caps.isAccelerated()))
{
return new BufImgVolatileSurfaceManager(this, context);
}
SurfaceManagerFactory smf = SurfaceManagerFactory.getInstance();
return smf.createVolatileManager(this, context);
}
项目:openjdk-source-code-learn
文件:SunVolatileImage.java
protected VolatileSurfaceManager createSurfaceManager(Object context,
ImageCapabilities caps)
{
/**
* Platform-specific SurfaceManagerFactories will return a
* manager suited to acceleration on each platform. But if
* the user is asking for a VolatileImage from a BufferedImageGC,
* then we need to return the appropriate unaccelerated manager.
* Note: this could change in the future; if some platform would
* like to accelerate BIGC volatile images, then this special-casing
* of the BIGC graphicsConfig should live in platform-specific
* code instead.
* We do the same for a Printer Device, and if user requested an
* unaccelerated VolatileImage by passing the capabilities object.
*/
if (graphicsConfig instanceof BufferedImageGraphicsConfig ||
graphicsConfig instanceof sun.print.PrinterGraphicsConfig ||
(caps != null && !caps.isAccelerated()))
{
return new BufImgVolatileSurfaceManager(this, context);
}
SurfaceManagerFactory smf = SurfaceManagerFactory.getInstance();
return smf.createVolatileManager(this, context);
}
项目:RipplePower
文件:UIView.java
/**
* 创建初始的Graphics
*/
public void createScreen() {
int width = getWidth();
int height = getHeight();
try {
hardwareImage = createVolatileImage(width, height, new ImageCapabilities(true));
} catch (Exception e) {
hardwareImage = null;
int pixelSize = width * height;
int[] pixels = new int[pixelSize];
this.awtImage = GraphicsUtils.newAwtRGBImage(pixels, width, height, pixelSize);
}
if (hardwareImage == null) {
this.isSupportHardware = false;
this.gl = new LGraphics(awtImage);
} else {
this.isSupportHardware = true;
this.gl = new LGraphics(hardwareImage);
}
LSystem.screenRect = new RectBox(0, 0, width, height);
}
项目:OLD-OpenJDK8
文件:SunVolatileImage.java
protected VolatileSurfaceManager createSurfaceManager(Object context,
ImageCapabilities caps)
{
/**
* Platform-specific SurfaceManagerFactories will return a
* manager suited to acceleration on each platform. But if
* the user is asking for a VolatileImage from a BufferedImageGC,
* then we need to return the appropriate unaccelerated manager.
* Note: this could change in the future; if some platform would
* like to accelerate BIGC volatile images, then this special-casing
* of the BIGC graphicsConfig should live in platform-specific
* code instead.
* We do the same for a Printer Device, and if user requested an
* unaccelerated VolatileImage by passing the capabilities object.
*/
if (graphicsConfig instanceof BufferedImageGraphicsConfig ||
graphicsConfig instanceof sun.print.PrinterGraphicsConfig ||
(caps != null && !caps.isAccelerated()))
{
return new BufImgVolatileSurfaceManager(this, context);
}
SurfaceManagerFactory smf = SurfaceManagerFactory.getInstance();
return smf.createVolatileManager(this, context);
}
项目:openjdk-jdk7u-jdk
文件:SunVolatileImage.java
protected VolatileSurfaceManager createSurfaceManager(Object context,
ImageCapabilities caps)
{
/**
* Platform-specific SurfaceManagerFactories will return a
* manager suited to acceleration on each platform. But if
* the user is asking for a VolatileImage from a BufferedImageGC,
* then we need to return the appropriate unaccelerated manager.
* Note: this could change in the future; if some platform would
* like to accelerate BIGC volatile images, then this special-casing
* of the BIGC graphicsConfig should live in platform-specific
* code instead.
* We do the same for a Printer Device, and if user requested an
* unaccelerated VolatileImage by passing the capabilities object.
*/
if (graphicsConfig instanceof BufferedImageGraphicsConfig ||
graphicsConfig instanceof sun.print.PrinterGraphicsConfig ||
(caps != null && !caps.isAccelerated()))
{
return new BufImgVolatileSurfaceManager(this, context);
}
SurfaceManagerFactory smf = SurfaceManagerFactory.getInstance();
return smf.createVolatileManager(this, context);
}
项目:openjdk-icedtea7
文件:SunVolatileImage.java
protected VolatileSurfaceManager createSurfaceManager(Object context,
ImageCapabilities caps)
{
/**
* Platform-specific SurfaceManagerFactories will return a
* manager suited to acceleration on each platform. But if
* the user is asking for a VolatileImage from a BufferedImageGC,
* then we need to return the appropriate unaccelerated manager.
* Note: this could change in the future; if some platform would
* like to accelerate BIGC volatile images, then this special-casing
* of the BIGC graphicsConfig should live in platform-specific
* code instead.
* We do the same for a Printer Device, and if user requested an
* unaccelerated VolatileImage by passing the capabilities object.
*/
if (graphicsConfig instanceof BufferedImageGraphicsConfig ||
graphicsConfig instanceof sun.print.PrinterGraphicsConfig ||
(caps != null && !caps.isAccelerated()))
{
return new BufImgVolatileSurfaceManager(this, context);
}
SurfaceManagerFactory smf = SurfaceManagerFactory.getInstance();
return smf.createVolatileManager(this, context);
}
项目:basus
文件:FullScreenFrame.java
private void showGraphicsConfiguration(final GraphicsConfiguration gc) {
System.out.println(" pixel size: " + gc.getColorModel().getPixelSize());
System.out.println(" bounds: " + gc.getBounds().toString());
final GraphicsDevice gd = gc.getDevice();
System.out.println(" isFullScreenSupported: " + gd.isFullScreenSupported());
System.out.println(" isDisplayChangeSupported: " + gd.isDisplayChangeSupported());
System.out.println(" memory: " + gd.getAvailableAcceleratedMemory()
+ (gd.getAvailableAcceleratedMemory() < 0 ? " (unlimited)" : ""));
final DisplayMode dm = gd.getDisplayMode();
System.out.println(" disp size: " + dm.getWidth() + "x" + dm.getHeight());
System.out.println(" disp depth: " + dm.getBitDepth());
System.out.println(" disp refresh: " + dm.getRefreshRate());
final BufferCapabilities bc = gc.getBufferCapabilities();
System.out.println(" full screen required: " + bc.isFullScreenRequired());
System.out.println(" multi buffer available: " + bc.isMultiBufferAvailable());
System.out.println(" page flipping: " + bc.isPageFlipping());
final ImageCapabilities ic = gc.getImageCapabilities();
System.out.println(" is accel: " + ic.isAccelerated());
}
项目:haxademic
文件:JavaInfo.java
public static void printDisplayInfo() {
int g = 0;
for (GraphicsDevice gd : GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices()) {
out.println("graphics device #"+(++g)+": "+gd.getIDstring()+" type "+gd.getType());
out.println("\tavailable accelerated memory " + gd.getAvailableAcceleratedMemory());
int c = 0;
for (GraphicsConfiguration gc : gd.getConfigurations()) {
out.println("\tgraphics configuration #"+(++c)+":");
out.println("\t\twidth "+gc.getBounds().getWidth()+" height "+gc.getBounds().getHeight());
out.println("\t\tfull screen "+gc.getBufferCapabilities().isFullScreenRequired());
ImageCapabilities ic = gc.getImageCapabilities();
out.println("\t\tis accelerated "+ic.isAccelerated());
}
DisplayMode dm = gd.getDisplayMode();
out.println("\tdisplay mode bit width "+dm.getWidth()+" height "+dm.getHeight()+" bit depth "+dm.getBitDepth()+" refresh rate "+dm.getRefreshRate());
int m = 0;
for (DisplayMode d : gd.getDisplayModes())
out.println("\talt display mode #"+(++m)+" bit width "+d.getWidth()+" height "+d.getHeight()+" bit depth "+d.getBitDepth()+" refresh rate "+d.getRefreshRate());
}
}
项目:OpenJSharp
文件:ExtendedBufferCapabilities.java
/**
* Creates an ExtendedBufferCapabilities instance with front/back/flip caps
* from the passed caps, and VSYNC_DEFAULT v-sync mode.
*/
public ExtendedBufferCapabilities(ImageCapabilities front,
ImageCapabilities back, FlipContents flip)
{
super(front, back, flip);
this.vsync = VSyncType.VSYNC_DEFAULT;
}
项目:OpenJSharp
文件:ExtendedBufferCapabilities.java
/**
* Creates an ExtendedBufferCapabilities instance with front/back/flip caps
* from the passed image/flip caps, and the v-sync type.
*/
public ExtendedBufferCapabilities(ImageCapabilities front,
ImageCapabilities back, FlipContents flip,
VSyncType t)
{
super(front, back, flip);
this.vsync = t;
}
项目:OpenJSharp
文件:VolatileSurfaceManager.java
@Override
public ImageCapabilities getCapabilities(GraphicsConfiguration gc) {
if (isConfigValid(gc)) {
return isAccelerationEnabled() ?
new AcceleratedImageCapabilities() :
new ImageCapabilities(false);
}
return super.getCapabilities(gc);
}
项目:OpenJSharp
文件:SunVolatileImage.java
protected SunVolatileImage(Component comp,
GraphicsConfiguration graphicsConfig,
int width, int height, Object context,
int transparency, ImageCapabilities caps,
int accType)
{
this.comp = comp;
this.graphicsConfig = graphicsConfig;
this.width = width;
this.height = height;
this.forcedAccelSurfaceType = accType;
if (!(transparency == Transparency.OPAQUE ||
transparency == Transparency.BITMASK ||
transparency == Transparency.TRANSLUCENT))
{
throw new IllegalArgumentException("Unknown transparency type:" +
transparency);
}
this.transparency = transparency;
this.volSurfaceManager = createSurfaceManager(context, caps);
SurfaceManager.setManager(this, volSurfaceManager);
// post-construction initialization of the surface manager
volSurfaceManager.initialize();
// clear the background
volSurfaceManager.initContents();
}
项目:OpenJSharp
文件:SunVolatileImage.java
private SunVolatileImage(Component comp,
GraphicsConfiguration graphicsConfig,
int width, int height, Object context,
ImageCapabilities caps)
{
this(comp, graphicsConfig,
width, height, context, Transparency.OPAQUE, caps, UNDEFINED);
}
项目:OpenJSharp
文件:SunVolatileImage.java
public SunVolatileImage(GraphicsConfiguration graphicsConfig,
int width, int height, int transparency,
ImageCapabilities caps)
{
this(null, graphicsConfig, width, height, null, transparency,
caps, UNDEFINED);
}
项目:OpenJSharp
文件:XRVolatileSurfaceManager.java
/**
* Need to override the default behavior because Pixmaps-based
* images are accelerated but not volatile.
*/
@Override
public ImageCapabilities getCapabilities(GraphicsConfiguration gc) {
if (isConfigValid(gc) && isAccelerationEnabled()) {
return new ImageCapabilities(true);
}
return new ImageCapabilities(false);
}
项目:OpenJSharp
文件:X11VolatileSurfaceManager.java
/**
* Need to override the default behavior because Pixmaps-based
* images are accelerated but not volatile.
*/
@Override
public ImageCapabilities getCapabilities(GraphicsConfiguration gc) {
if (isConfigValid(gc) && isAccelerationEnabled()) {
// accelerated but not volatile
return new ImageCapabilities(true);
}
// neither accelerated nor volatile
return new ImageCapabilities(false);
}
项目:jdk8u-jdk
文件:ExtendedBufferCapabilities.java
/**
* Creates an ExtendedBufferCapabilities instance with front/back/flip caps
* from the passed caps, and VSYNC_DEFAULT v-sync mode.
*/
public ExtendedBufferCapabilities(ImageCapabilities front,
ImageCapabilities back, FlipContents flip)
{
super(front, back, flip);
this.vsync = VSyncType.VSYNC_DEFAULT;
}
项目:jdk8u-jdk
文件:ExtendedBufferCapabilities.java
/**
* Creates an ExtendedBufferCapabilities instance with front/back/flip caps
* from the passed image/flip caps, and the v-sync type.
*/
public ExtendedBufferCapabilities(ImageCapabilities front,
ImageCapabilities back, FlipContents flip,
VSyncType t)
{
super(front, back, flip);
this.vsync = t;
}
项目:jdk8u-jdk
文件:VolatileSurfaceManager.java
@Override
public ImageCapabilities getCapabilities(GraphicsConfiguration gc) {
if (isConfigValid(gc)) {
return isAccelerationEnabled() ?
new AcceleratedImageCapabilities() :
new ImageCapabilities(false);
}
return super.getCapabilities(gc);
}
项目:jdk8u-jdk
文件:SunVolatileImage.java
protected SunVolatileImage(Component comp,
GraphicsConfiguration graphicsConfig,
int width, int height, Object context,
int transparency, ImageCapabilities caps,
int accType)
{
this.comp = comp;
this.graphicsConfig = graphicsConfig;
if (width <= 0 || height <= 0) {
throw new IllegalArgumentException("Width (" + width + ")" +
" and height (" + height + ") cannot be <= 0");
}
this.width = width;
this.height = height;
this.forcedAccelSurfaceType = accType;
if (!(transparency == Transparency.OPAQUE ||
transparency == Transparency.BITMASK ||
transparency == Transparency.TRANSLUCENT))
{
throw new IllegalArgumentException("Unknown transparency type:" +
transparency);
}
this.transparency = transparency;
this.volSurfaceManager = createSurfaceManager(context, caps);
SurfaceManager.setManager(this, volSurfaceManager);
// post-construction initialization of the surface manager
volSurfaceManager.initialize();
// clear the background
volSurfaceManager.initContents();
}
项目:jdk8u-jdk
文件:SunVolatileImage.java
private SunVolatileImage(Component comp,
GraphicsConfiguration graphicsConfig,
int width, int height, Object context,
ImageCapabilities caps)
{
this(comp, graphicsConfig,
width, height, context, Transparency.OPAQUE, caps, UNDEFINED);
}
项目:jdk8u-jdk
文件:SunVolatileImage.java
public SunVolatileImage(GraphicsConfiguration graphicsConfig,
int width, int height, int transparency,
ImageCapabilities caps)
{
this(null, graphicsConfig, width, height, null, transparency,
caps, UNDEFINED);
}
项目:jdk8u-jdk
文件:XRVolatileSurfaceManager.java
/**
* Need to override the default behavior because Pixmaps-based
* images are accelerated but not volatile.
*/
@Override
public ImageCapabilities getCapabilities(GraphicsConfiguration gc) {
if (isConfigValid(gc) && isAccelerationEnabled()) {
return new ImageCapabilities(true);
}
return new ImageCapabilities(false);
}
项目:jdk8u-jdk
文件:X11VolatileSurfaceManager.java
/**
* Need to override the default behavior because Pixmaps-based
* images are accelerated but not volatile.
*/
@Override
public ImageCapabilities getCapabilities(GraphicsConfiguration gc) {
if (isConfigValid(gc) && isAccelerationEnabled()) {
// accelerated but not volatile
return new ImageCapabilities(true);
}
// neither accelerated nor volatile
return new ImageCapabilities(false);
}
项目:jdk8u-jdk
文件:BufferStrategyExceptionTest.java
public void render() {
ImageCapabilities imgBackBufCap = new ImageCapabilities(true);
ImageCapabilities imgFrontBufCap = new ImageCapabilities(true);
BufferCapabilities bufCap =
new BufferCapabilities(imgFrontBufCap,
imgBackBufCap, BufferCapabilities.FlipContents.COPIED);
try {
createBufferStrategy(2, bufCap);
} catch (AWTException ex) {
createBufferStrategy(2);
}
BufferStrategy bs = getBufferStrategy();
do {
Graphics g = bs.getDrawGraphics();
g.setColor(Color.green);
g.fillRect(0, 0, getWidth(), getHeight());
g.setColor(Color.red);
g.drawString("Rendering test", 20, 20);
g.drawImage(bi, 50, 50, null);
g.dispose();
bs.show();
} while (bs.contentsLost()||bs.contentsRestored());
}
项目:jdk8u-jdk
文件:CustomCompositeTest.java
private static void testVolatileImage(GraphicsConfiguration cfg,
boolean accelerated)
{
VolatileImage dst = null;
try {
dst = cfg.createCompatibleVolatileImage(640, 480,
new ImageCapabilities(accelerated));
} catch (AWTException e) {
System.out.println("Unable to create volatile image, skip the test.");
return;
}
renderToVolatileImage(dst);
}
项目:jdk8u-jdk
文件:VSyncedBufferStrategyTest.java
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);
}
项目:openjdk-jdk10
文件:ExtendedBufferCapabilities.java
/**
* Creates an ExtendedBufferCapabilities instance with front/back/flip caps
* from the passed caps, and VSYNC_DEFAULT v-sync mode.
*/
public ExtendedBufferCapabilities(ImageCapabilities front,
ImageCapabilities back, FlipContents flip)
{
super(front, back, flip);
this.vsync = VSyncType.VSYNC_DEFAULT;
}
项目:openjdk-jdk10
文件:ExtendedBufferCapabilities.java
/**
* Creates an ExtendedBufferCapabilities instance with front/back/flip caps
* from the passed image/flip caps, and the v-sync type.
*/
public ExtendedBufferCapabilities(ImageCapabilities front,
ImageCapabilities back, FlipContents flip,
VSyncType t)
{
super(front, back, flip);
this.vsync = t;
}
项目:openjdk-jdk10
文件:VolatileSurfaceManager.java
@Override
public ImageCapabilities getCapabilities(GraphicsConfiguration gc) {
if (isConfigValid(gc)) {
return isAccelerationEnabled() ?
new AcceleratedImageCapabilities() :
new ImageCapabilities(false);
}
return super.getCapabilities(gc);
}
项目:openjdk-jdk10
文件:SunVolatileImage.java
protected SunVolatileImage(Component comp,
GraphicsConfiguration graphicsConfig,
int width, int height, Object context,
int transparency, ImageCapabilities caps,
int accType)
{
this.comp = comp;
this.graphicsConfig = graphicsConfig;
if (width <= 0 || height <= 0) {
throw new IllegalArgumentException("Width (" + width + ")" +
" and height (" + height + ") cannot be <= 0");
}
this.width = width;
this.height = height;
this.forcedAccelSurfaceType = accType;
if (!(transparency == Transparency.OPAQUE ||
transparency == Transparency.BITMASK ||
transparency == Transparency.TRANSLUCENT))
{
throw new IllegalArgumentException("Unknown transparency type:" +
transparency);
}
this.transparency = transparency;
this.volSurfaceManager = createSurfaceManager(context, caps);
SurfaceManager.setManager(this, volSurfaceManager);
// post-construction initialization of the surface manager
volSurfaceManager.initialize();
// clear the background
volSurfaceManager.initContents();
}
项目:openjdk-jdk10
文件:SunVolatileImage.java
private SunVolatileImage(Component comp,
GraphicsConfiguration graphicsConfig,
int width, int height, Object context,
ImageCapabilities caps)
{
this(comp, graphicsConfig,
width, height, context, Transparency.OPAQUE, caps, UNDEFINED);
}