当前位置: 首页>>代码示例>>Java>>正文


Java BufferedImage.setAccelerationPriority方法代码示例

本文整理汇总了Java中java.awt.image.BufferedImage.setAccelerationPriority方法的典型用法代码示例。如果您正苦于以下问题:Java BufferedImage.setAccelerationPriority方法的具体用法?Java BufferedImage.setAccelerationPriority怎么用?Java BufferedImage.setAccelerationPriority使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.awt.image.BufferedImage的用法示例。


在下文中一共展示了BufferedImage.setAccelerationPriority方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: makeImage

import java.awt.image.BufferedImage; //导入方法依赖的package包/类
public Image makeImage(TestEnvironment env, int w, int h) {
    BufferedImage img = new BufferedImage(w, h, type);
    if (unmanaged) {
        DataBuffer db = img.getRaster().getDataBuffer();
        if (db instanceof DataBufferInt) {
            ((DataBufferInt)db).getData();
        } else if (db instanceof DataBufferShort) {
            ((DataBufferShort)db).getData();
        } else if (db instanceof DataBufferByte) {
            ((DataBufferByte)db).getData();
        } else {
            try {
                img.setAccelerationPriority(0.0f);
            } catch (Throwable e) {}
        }
    }
    return img;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:19,代码来源:ImageTests.java

示例2: makeBufferedImage

import java.awt.image.BufferedImage; //导入方法依赖的package包/类
/**
 * Return a non-accelerated BufferedImage of the requested type with the
 * indicated subimage of the original image located at 0,0 in the new image.
 * If a bgColor is supplied, composite the original image over that color
 * with a SrcOver operation, otherwise make a SrcNoEa copy.
 * <p>
 * Returned BufferedImage is not accelerated for two reasons:
 * <ul>
 * <li> Types of the image and surface are predefined, because these types
 *      correspond to the TransformHelpers, which we know we have. And
 *      acceleration can change the type of the surface
 * <li> Image will be used only once and acceleration caching wouldn't help
 * </ul>
 */
BufferedImage makeBufferedImage(Image img, Color bgColor, int type,
                                int sx1, int sy1, int sx2, int sy2)
{
    final int width = sx2 - sx1;
    final int height = sy2 - sy1;
    final BufferedImage bimg = new BufferedImage(width, height, type);
    final SunGraphics2D g2d = (SunGraphics2D) bimg.createGraphics();
    g2d.setComposite(AlphaComposite.Src);
    bimg.setAccelerationPriority(0);
    if (bgColor != null) {
        g2d.setColor(bgColor);
        g2d.fillRect(0, 0, width, height);
        g2d.setComposite(AlphaComposite.SrcOver);
    }
    g2d.copyImage(img, 0, 0, sx1, sy1, width, height, null, null);
    g2d.dispose();
    return bimg;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:33,代码来源:DrawImage.java

示例3: makeUnmanagedBI

import java.awt.image.BufferedImage; //导入方法依赖的package包/类
private static BufferedImage makeUnmanagedBI(GraphicsConfiguration gc,
                                             int type) {
    BufferedImage img = gc.createCompatibleImage(SIZE, SIZE, type);
    Graphics2D g2d = img.createGraphics();
    g2d.setColor(RGB);
    g2d.fillRect(0, 0, SIZE, SIZE);
    g2d.dispose();
    final DataBuffer db = img.getRaster().getDataBuffer();
    if (db instanceof DataBufferInt) {
        ((DataBufferInt) db).getData();
    } else if (db instanceof DataBufferShort) {
        ((DataBufferShort) db).getData();
    } else if (db instanceof DataBufferByte) {
        ((DataBufferByte) db).getData();
    } else {
        try {
            img.setAccelerationPriority(0.0f);
        } catch (final Throwable ignored) {
        }
    }
    return img;
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:23,代码来源:IncorrectAlphaConversionBicubic.java

示例4: makeUnmanagedBI

import java.awt.image.BufferedImage; //导入方法依赖的package包/类
private static BufferedImage makeUnmanagedBI(final int type) {
    final BufferedImage img = new BufferedImage(SIZE, SIZE, type);
    final DataBuffer db = img.getRaster().getDataBuffer();
    if (db instanceof DataBufferInt) {
        ((DataBufferInt) db).getData();
    } else if (db instanceof DataBufferShort) {
        ((DataBufferShort) db).getData();
    } else if (db instanceof DataBufferByte) {
        ((DataBufferByte) db).getData();
    } else {
        try {
            img.setAccelerationPriority(0.0f);
        } catch (final Throwable ignored) {
        }
    }
    return img;
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:18,代码来源:UnmanagedDrawImagePerformance.java

示例5: getBufferedImage

import java.awt.image.BufferedImage; //导入方法依赖的package包/类
private static BufferedImage getBufferedImage(int sw) {
    final BufferedImage bi = new BufferedImage(sw, sw, BufferedImage.TYPE_INT_ARGB);
    Graphics2D g2d = bi.createGraphics();
    g2d.setColor(Color.RED);
    g2d.fillRect(0, 0, sw, sw);
    g2d.dispose();

    final DataBuffer db = bi.getRaster().getDataBuffer();
    if (db instanceof DataBufferInt) {
        ((DataBufferInt) db).getData();
    } else if (db instanceof DataBufferShort) {
        ((DataBufferShort) db).getData();
    } else if (db instanceof DataBufferByte) {
        ((DataBufferByte) db).getData();
    } else {
        try {
            bi.setAccelerationPriority(0.0f);
        } catch (final Throwable ignored) {
        }
    }
    return bi;
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:23,代码来源:IncorrectClipXorModeSW2Surface.java

示例6: makeUnmanagedBI

import java.awt.image.BufferedImage; //导入方法依赖的package包/类
private static BufferedImage makeUnmanagedBI() {
    final BufferedImage bi = new BufferedImage(500, 200, TYPE_INT_ARGB);
    final DataBuffer db = bi.getRaster().getDataBuffer();
    if (db instanceof DataBufferInt) {
        ((DataBufferInt) db).getData();
    } else if (db instanceof DataBufferShort) {
        ((DataBufferShort) db).getData();
    } else if (db instanceof DataBufferByte) {
        ((DataBufferByte) db).getData();
    } else {
        try {
            bi.setAccelerationPriority(0.0f);
        } catch (final Throwable ignored) {
        }
    }
    return bi;
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:18,代码来源:IncorrectUnmanagedImageRotatedClip.java

示例7: makeUnmanagedBI

import java.awt.image.BufferedImage; //导入方法依赖的package包/类
private static BufferedImage makeUnmanagedBI(final int type) {
    final BufferedImage bi = new BufferedImage(511, 255, type);
    final DataBuffer db = bi.getRaster().getDataBuffer();
    if (db instanceof DataBufferInt) {
        ((DataBufferInt) db).getData();
    } else if (db instanceof DataBufferShort) {
        ((DataBufferShort) db).getData();
    } else if (db instanceof DataBufferByte) {
        ((DataBufferByte) db).getData();
    } else {
        try {
            bi.setAccelerationPriority(0.0f);
        } catch (final Throwable ignored) {
        }
    }
    return bi;
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:18,代码来源:IncorrectUnmanagedImageSourceOffset.java

示例8: makeBufferedImage

import java.awt.image.BufferedImage; //导入方法依赖的package包/类
/**
 * Return a non-accelerated BufferedImage of the requested type with the
 * indicated subimage of the original image located at 0,0 in the new image.
 * If a bgColor is supplied, composite the original image over that color
 * with a SrcOver operation, otherwise make a SrcNoEa copy.
 * <p>
 * Returned BufferedImage is not accelerated for two reasons:
 * <ul>
 * <li> Types of the image and surface are predefined, because these types
 *      correspond to the TransformHelpers, which we know we have. And
 *      acceleration can change the type of the surface
 * <li> Image will be used only once and acceleration caching wouldn't help
 * </ul>
 */
private BufferedImage makeBufferedImage(Image img, Color bgColor, int type,
                                        int sx1, int sy1, int sx2, int sy2)
{
    final int width = sx2 - sx1;
    final int height = sy2 - sy1;
    final BufferedImage bimg = new BufferedImage(width, height, type);
    final SunGraphics2D g2d = (SunGraphics2D) bimg.createGraphics();
    g2d.setComposite(AlphaComposite.Src);
    bimg.setAccelerationPriority(0);
    if (bgColor != null) {
        g2d.setColor(bgColor);
        g2d.fillRect(0, 0, width, height);
        g2d.setComposite(AlphaComposite.SrcOver);
    }
    g2d.copyImage(img, 0, 0, sx1, sy1, width, height, null, null);
    g2d.dispose();
    return bimg;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:33,代码来源:DrawImage.java

示例9: createImage

import java.awt.image.BufferedImage; //导入方法依赖的package包/类
/**
 * Returns the BufferedImage that will be used as the representation of
 * the pixel data.  Subclasses can override this method to return
 * platform specific subclasses of BufferedImage that may or may not be
 * accelerated.
 *
 * It is subclass' responsibility to propagate acceleration priority
 * to the newly created image.
 */
protected BufferedImage createImage(ColorModel cm,
                                    WritableRaster raster,
                                    boolean isRasterPremultiplied,
                                    Hashtable properties)
{
    BufferedImage bi =
        new BufferedImage(cm, raster, isRasterPremultiplied, null);
    bi.setAccelerationPriority(image.getAccelerationPriority());
    return bi;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:20,代码来源:ImageRepresentation.java

示例10: getBufferedImage

import java.awt.image.BufferedImage; //导入方法依赖的package包/类
static Image getBufferedImage(GraphicsConfiguration gc,
                              int w, int h, int type, boolean acceleratable)
{
    BufferedImage image = new BufferedImage(w, h, type);
    if (!acceleratable) {
        image.setAccelerationPriority(0.0f);
    }
    initImage(gc, image);
    return image;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:11,代码来源:SourceClippingBlitTest.java

示例11: createImage

import java.awt.image.BufferedImage; //导入方法依赖的package包/类
/**
 * Returns the BufferedImage that will be used as the representation of
 * the pixel data.  Subclasses can override this method to return
 * platform specific subclasses of BufferedImage that may or may not be
 * accelerated.
 *
 * It is subclass' responsibility to propagate acceleration priority
 * to the newly created image.
 */
protected BufferedImage createImage(ColorModel cm,
                                    WritableRaster raster,
                                    boolean isRasterPremultiplied,
                                    Hashtable<?,?> properties)
{
    BufferedImage bi =
        new BufferedImage(cm, raster, isRasterPremultiplied, null);
    bi.setAccelerationPriority(image.getAccelerationPriority());
    return bi;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:20,代码来源:ImageRepresentation.java


注:本文中的java.awt.image.BufferedImage.setAccelerationPriority方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。