public abstract class Image extends Object
Image
是所有类的父类的图形图像表示。必须以特定于平台的方式获得图像。
Modifier and Type | Field and Description |
---|---|
protected float |
accelerationPriority
优先用于加速这个图像。
|
static int |
SCALE_AREA_AVERAGING
使用面积平均图像缩放算法。
|
static int |
SCALE_DEFAULT
使用默认图像缩放算法。
|
static int |
SCALE_FAST
选择一个图像缩放算法,给出了更高的优先级缩放速度比缩放图像的平滑。
|
static int |
SCALE_REPLICATE
使用图像缩放算法体现在
ReplicateScaleFilter 类。
|
static int |
SCALE_SMOOTH
选择一种比缩放速度更高的图像平滑度的图像缩放算法。
|
static Object |
UndefinedProperty
的
UndefinedProperty 对象应返回时的属性不是一个特定的形象定义是牵强的。
|
Constructor and Description |
---|
Image() |
Modifier and Type | Method and Description |
---|---|
void |
flush()
把所有的可重构资源被这个图像对象使用。
|
float |
getAccelerationPriority()
返回加速优先级提示的当前值。
|
ImageCapabilities |
getCapabilities(GraphicsConfiguration gc)
返回一个imagecapabilities对象可以查询到该图像的能力在指定的graphicsconfiguration。
|
abstract Graphics |
getGraphics()
创建一个用于绘制离屏幕图像的图形上下文。
|
abstract int |
getHeight(ImageObserver observer)
确定图像的高度。
|
abstract Object |
getProperty(String name, ImageObserver observer)
获取此图像的属性的名称。
|
Image |
getScaledInstance(int width, int height, int hints)
创建此图像的缩放版本。
|
abstract ImageProducer |
getSource()
获取产生图像的像素的对象。
|
abstract int |
getWidth(ImageObserver observer)
确定图像的宽度。
|
void |
setAccelerationPriority(float priority)
为这个图像设置一个提示,关于加速是多么重要的一个。
|
protected float accelerationPriority
setAccelerationPriority(float)
特定图像的方法。
public static final Object UndefinedProperty
UndefinedProperty
对象应返回时的属性不是一个特定的形象定义是牵强的。
public static final int SCALE_DEFAULT
public static final int SCALE_FAST
public static final int SCALE_SMOOTH
public static final int SCALE_REPLICATE
ReplicateScaleFilter
类。的
Image
对象免费替换一个不同的过滤器,执行相同的算法还集成了更有效的工具提供的成像基础。
ReplicateScaleFilter
,
Constant Field Values
public static final int SCALE_AREA_AVERAGING
AreaAveragingScaleFilter
,
Constant Field Values
public abstract int getWidth(ImageObserver observer)
-1
和指定的
ImageObserver
对象通知。
observer
物体等的图像被加载。
-1
如果宽度不知道。
getHeight(java.awt.image.ImageObserver)
,
ImageObserver
public abstract int getHeight(ImageObserver observer)
-1
和指定的
ImageObserver
对象通知。
observer
物体等的图像被加载。
-1
如果高度不知道。
getWidth(java.awt.image.ImageObserver)
,
ImageObserver
public abstract ImageProducer getSource()
ImageProducer
public abstract Graphics getGraphics()
UnsupportedOperationException
如果为非银幕形象。
Graphics
,
Component.createImage(int, int)
public abstract Object getProperty(String name, ImageObserver observer)
单个属性名称由各种图像格式定义。如果一个属性不为特定图像的定义,这个方法返回UndefinedProperty
对象。
如果这个图像的性质尚不清楚,此方法返回null
,和ImageObserver
对象通知。
属性名称"comment"
应该用来存储可选的注释可以被提交到应用程序作为一个形象的描述,其来源,或它的作者。
name
-属性名称。
observer
对象等待这个图像被加载。
NullPointerException
-如果属性名是空的。
ImageObserver
,
UndefinedProperty
public Image getScaledInstance(int width, int height, int hints)
Image
对象还将在指定的
width
和
height
默认渲染图像。新
Image
对象可以是异步即使原始图像已经加载完全加载。
如果width
或height
是负数则值替换保持原始图像的尺寸长宽比。如果width
和height
是负面的,那么使用原始图像的尺寸。
width
的宽度来缩放图像。
height
的高度来缩放图像。
hints
-标志来表明使用图像重采样算法的类型。
IllegalArgumentException
-如果
width
或
height
是零。
SCALE_DEFAULT
,
SCALE_FAST
,
SCALE_SMOOTH
,
SCALE_REPLICATE
,
SCALE_AREA_AVERAGING
public void flush()
该方法如何影响特定类型的图像对象的例子:
validate
方法恢复。ImageProducer
产生卸所有本地资源发布。这些对象可以被重新从原始源需要在渲染时,当他们首先创造了。public ImageCapabilities getCapabilities(GraphicsConfiguration gc)
gc
-
GraphicsConfiguration
对象。此参数的值无效将导致违约
GraphicsConfiguration
获取图像的能力。
ImageCapabilities
对象包含此
Image
能力在指定的graphicsconfiguration。
VolatileImage.getCapabilities()
public void setAccelerationPriority(float priority)
priority
- 0和1之间的值,值越高,表明加速度更重要。值为0意味着这个图像不应该被加速。其他的值是用来简单地确定相对于其他图像的加速优先级。
IllegalArgumentException
-如果
priority
小于零或大于1。
public float getAccelerationPriority()
setAccelerationPriority
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.