图像与BufferedImage [英] Image vs. BufferedImage

查看:99
本文介绍了图像与BufferedImage的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每当处理Java中的图像加载和渲染时,我以前总是使用 BufferedImage 来存储和操作内存中的图像。

Whenever dealing with the loading and rendering of images in Java, I have previously always used BufferedImages to store and manipulate the images in memory.

但是,我最近遇到了一个少数 不同 网站使用图像类而不是 BufferedImage 这让我想知道 - 有什么区别?

However, I have recently come across a few different sites that use the Image class instead of BufferedImage and this got me wondering - what are the differences?

我知道 BufferedImage 已经一个更大/优化的工具集,但不惜任何代价?如果是这样,这个成本什么时候变得明显?在哪种情况下你会在 BufferedImage 上使用 Image ,反之亦然?

I'm aware that a BufferedImage has a larger/optimised toolset, but does come at any cost? If so, when does this cost become noticeable? In which situations would you use an Image over a BufferedImage, or vice-versa?

推荐答案

BufferedImage扩展图像 Image 只是一个基本的抽象类,你无法实例化它。在引擎盖下你肯定使用 BufferedImage 或其他实现。

BufferedImage extends Image. Image is just a base abstract class and you can't instantiate it. Under the hood you are using BufferedImage or another implementation for sure.

这篇关于图像与BufferedImage的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆