Slow Java2D Drawing on Integrated Graphics

杀马特。学长 韩版系。学妹 提交于 2019-12-02 07:48:28

This is an example of converting an image to a compatiable image...not an answer in of itself

This is some of the library code that I use...

public static BufferedImage createCompatibleImage(BufferedImage image) {
    BufferedImage target = createCompatibleImage(image, image.getWidth(), image.getHeight());
    Graphics2D g2d = target.createGraphics();
    g2d.drawImage(image, 0, 0, null);
    g2d.dispose();
    return target;
}

public static BufferedImage createCompatibleImage(BufferedImage image,
        int width, int height) {
    return getGraphicsConfiguration().createCompatibleImage(width, height, image.getTransparency());
}

public static GraphicsConfiguration getGraphicsConfiguration() {
    return GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration();
}

I would do something like...

I = createCompatibleImage(ImageIO.read(new File(currentFolder+imgPath)));
imgMap.put(imgIdentifier, I);
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!