类java.awt.ImageCapabilities源码实例Demo

下面列出了怎么用java.awt.ImageCapabilities的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: openjdk-jdk8u-backup   文件: 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);
}
 
源代码2 项目: 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);
}
 
/**
 * 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;
}
 
源代码4 项目: openjdk-8-source   文件: VolatileSurfaceManager.java
@Override
public ImageCapabilities getCapabilities(GraphicsConfiguration gc) {
    if (isConfigValid(gc)) {
        return isAccelerationEnabled() ?
            new AcceleratedImageCapabilities() :
            new ImageCapabilities(false);
    }
    return super.getCapabilities(gc);
}
 
源代码5 项目: dragonwell8_jdk   文件: VolatileSurfaceManager.java
@Override
public ImageCapabilities getCapabilities(GraphicsConfiguration gc) {
    if (isConfigValid(gc)) {
        return isAccelerationEnabled() ?
            new AcceleratedImageCapabilities() :
            new ImageCapabilities(false);
    }
    return super.getCapabilities(gc);
}
 
/**
 * 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;
}
 
源代码7 项目: 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);
}
 
源代码8 项目: openjdk-jdk9   文件: SunVolatileImage.java
public SunVolatileImage(GraphicsConfiguration graphicsConfig,
                        int width, int height, int transparency,
                        ImageCapabilities caps)
{
    this(null, graphicsConfig, width, height, null, transparency,
         caps, UNDEFINED);
}
 
/**
 * 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);
}
 
源代码10 项目: jdk8u-dev-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;
    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();
}
 
源代码11 项目: hottub   文件: 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);
}
 
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);
}
 
源代码13 项目: TencentKona-8   文件: 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;
}
 
源代码14 项目: openjdk-jdk8u-backup   文件: 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);
}
 
源代码15 项目: jdk8u-dev-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);
}
 
源代码16 项目: TencentKona-8   文件: 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();
}
 
源代码17 项目: TencentKona-8   文件: SunVolatileImage.java
public SunVolatileImage(GraphicsConfiguration graphicsConfig,
                        int width, int height, int transparency,
                        ImageCapabilities caps)
{
    this(null, graphicsConfig, width, height, null, transparency,
         caps, UNDEFINED);
}
 
源代码18 项目: jdk8u-dev-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);
}
 
源代码19 项目: jdk8u-dev-jdk   文件: SunVolatileImage.java
public SunVolatileImage(GraphicsConfiguration graphicsConfig,
                        int width, int height, int transparency,
                        ImageCapabilities caps)
{
    this(null, graphicsConfig, width, height, null, transparency,
         caps, UNDEFINED);
}
 
源代码20 项目: openjdk-8   文件: SunVolatileImage.java
public SunVolatileImage(GraphicsConfiguration graphicsConfig,
                        int width, int height, int transparency,
                        ImageCapabilities caps)
{
    this(null, graphicsConfig, width, height, null, transparency,
         caps, UNDEFINED);
}
 
源代码21 项目: 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);
}
 
源代码22 项目: TencentKona-8   文件: 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);
}
 
源代码23 项目: TencentKona-8   文件: 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);
}
 
源代码24 项目: 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);
}
 
源代码25 项目: 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;
}
 
源代码26 项目: jdk8u60   文件: SunVolatileImage.java
public SunVolatileImage(GraphicsConfiguration graphicsConfig,
                        int width, int height, int transparency,
                        ImageCapabilities caps)
{
    this(null, graphicsConfig, width, height, null, transparency,
         caps, UNDEFINED);
}
 
源代码27 项目: 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);
}
 
源代码28 项目: jdk8u60   文件: 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);
}
 
源代码29 项目: hottub   文件: 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);
}
 
源代码30 项目: 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);
}
 
 类所在包
 同包方法