public abstract class IIOParam extends Object
ImageReadParam
和
ImageWriteParam
共享。
该类提供了指定源区域和目标区域的机制。当阅读时,源是流,在内存中的图像是目的地。写作时,这些都是颠倒的。在写作的情况下,目标区域可能只使用一个支持像素替换的作者。
抽取采样可以为读者和作者指定的,使用一个可移动的采样网格。
可以选择源带和目标带的子集。
Modifier and Type | Field and Description |
---|---|
protected IIOParamController |
controller
的
IIOParamController 将用于此
IIOParam 对象提供的设置时,
activateController 方法称为。
|
protected IIOParamController |
defaultController
默认
IIOParamController 将用于此
IIOParam 对象提供的设置时,
activateController 方法称为。
|
protected Point |
destinationOffset
在目标位置上的偏移量,左上角解码的像素应该放置在。
|
protected ImageTypeSpecifier |
destinationType
一个
ImageTypeSpecifier 用来生成目标图像阅读时,或设置输出颜色类型写作的时候。
|
protected int[] |
sourceBands
对
int s指示源带将使用一个数组,或
null 。
|
protected Rectangle |
sourceRegion
源区,在
null 如果没有设置。
|
protected int |
sourceXSubsampling
抽取抽样适用于水平方向。
|
protected int |
sourceYSubsampling
抽取抽样适用于垂直方向。
|
protected int |
subsamplingXOffset
水平偏移被应用于采样前采样网格。
|
protected int |
subsamplingYOffset
垂直偏移被应用到采样前采样网格。
|
Modifier | Constructor and Description |
---|---|
protected |
IIOParam()
保护的构造函数可以仅由子类调用。
|
Modifier and Type | Method and Description |
---|---|
boolean |
activateController()
激活安装
IIOParamController 这
IIOParam 对象并返回结果值。
|
IIOParamController |
getController()
返回当前安装的是什么
IIOParamController 。
|
IIOParamController |
getDefaultController()
返回默认
IIOParamController ,如果有一个,不管当前安装的控制器。
|
Point |
getDestinationOffset()
返回在要放置像素的目标图像中的偏移量。
|
ImageTypeSpecifier |
getDestinationType()
返回被读取返回的图像的类型,如果是由一个叫
setDestination(ImageTypeSpecifier) ,作为
ImageTypeSpecifier 。
|
int[] |
getSourceBands()
返回要使用的源带的集合。
|
Rectangle |
getSourceRegion()
返回要使用的源区域。
|
int |
getSourceXSubsampling()
返回每个像素的源列的数目。
|
int |
getSourceYSubsampling()
返回每个像素的行数。
|
int |
getSubsamplingXOffset()
返回子采样网格的水平偏移。
|
int |
getSubsamplingYOffset()
返回子采样网格的垂直偏移。
|
boolean |
hasController()
返回
true 如果有控制器安装此
IIOParam 对象。
|
void |
setController(IIOParamController controller)
集
IIOParamController 用来为这
IIOParam 对象提供的设置时,
activateController 方法被调用,覆盖任何默认的控制器。
|
void |
setDestinationOffset(Point destinationOffset)
指定在目标图像中的偏移量,在该图像中的未来解码像素将被放置,当阅读,或在一个区域将被写入时,写入。
|
void |
setDestinationType(ImageTypeSpecifier destinationType)
设置目标图像所需的图像类型,使用
ImageTypeSpecifier 。
|
void |
setSourceBands(int[] sourceBands)
设置要使用的源带的索引。
|
void |
setSourceRegion(Rectangle sourceRegion)
设置感兴趣的源区域。
|
void |
setSourceSubsampling(int sourceXSubsampling, int sourceYSubsampling, int subsamplingXOffset, int subsamplingYOffset)
指定一个抽取抽样对我/ O.申请
|
protected Rectangle sourceRegion
null
如果没有设置。
protected int sourceXSubsampling
1
。值不能为负或0。
protected int sourceYSubsampling
1
。值不能为负或0。
protected int subsamplingXOffset
protected int subsamplingYOffset
protected int[] sourceBands
int
s指示源带将被使用,或
null
。如果
null
,源带可设置为在评论中描述的
setSourceBands
方法。任何值都不应该被允许为负。
protected ImageTypeSpecifier destinationType
ImageTypeSpecifier
用来生成目标图像阅读时,或设置输出颜色类型写作的时候。如果不被设置的值将
null
。默认情况下,该值是
null
。
protected Point destinationOffset
protected IIOParamController defaultController
IIOParamController
将用于此
IIOParam
对象提供的设置时,
activateController
方法称为。此默认应设置由选择提供自己的默认控制器的子类,通常是一个图形用户界面,用于设置参数。
protected IIOParamController controller
IIOParamController
将用于此
IIOParam
对象提供的设置时,
activateController
方法称为。该值将覆盖任何默认的控制器,即使空。
public void setSourceRegion(Rectangle sourceRegion)
setSourceSubsampling
因素。如果已经建立,这个数字是零,一个
IllegalStateException
将抛出。
该方法指定的感兴趣的源区域将被修剪,以适应在源范围内,以及目标偏移量,宽度和高度,在实际的I / O.的时间
对于sourceRegion
值null
将删除任何地区的规范,使整个图像的应用。
sourceRegion
-
Rectangle
指定感兴趣的源区,或
null
。
IllegalArgumentException
-如果
sourceRegion
是非
null
和
sourceRegion.x
或
sourceRegion.y
是负的。
IllegalArgumentException
-如果
sourceRegion
是非
null
和
sourceRegion.width
或
sourceRegion.height
阴性或0。
IllegalStateException
如果取样是这样的,这个区域将有一个采样宽度或高度为零。
getSourceRegion()
,
setSourceSubsampling(int, int, int, int)
,
setDestinationOffset(java.awt.Point)
,
getDestinationOffset()
public Rectangle getSourceRegion()
setSourceRegion
最近称,将
null
如果没有区域集。
Rectangle
,或
null
。
setSourceRegion(java.awt.Rectangle)
public void setSourceSubsampling(int sourceXSubsampling, int sourceYSubsampling, int subsamplingXOffset, int subsamplingYOffset)
sourceXSubsampling
和
sourceYSubsampling
参数将指定采样周期(即,行数和列数提升每源像素后)。具体而言,一个1周期将使用每一行或一列;一个周期的2将使用每一个其他行或列。的
subsamplingXOffset
和
subsamplingYOffset
参数指定的区域的偏移量(或图像)的第一个采样像素的起源。调整的子网格的起源是用于避免焊缝在进行一个非常大的源图像到目标区域,将组装成一个完整的采样图像。大多数用户将只想简单地离开这些参数在0。
要使用像素和扫描线数计算如下。
在扫描线的二次采样的像素数是由
truncate[(width - subsamplingXOffset + sourceXSubsampling - 1) / sourceXSubsampling]
。
如果区域是这样这样的宽度为零,一个IllegalStateException
抛出。
要使用扫描线数可以计算同样。
设置采样网格开始比如果该地区被用来创建采样瓷砖大图像的源区的起源是有用的其他地方的能力,在瓷砖的宽度和高度是不是欠采样周期的倍数。如果采样网格不一致的瓦砖,将有在瓷砖的边界效应。通过调整采样网格的每瓦补偿偏移,这些文物是可以避免的。权衡的是,为了避免这些文物,瓷砖不都是相同的尺寸。网格偏移,在这种情况下使用了:
网格偏移= [期(地区胶印模期)]模期)
如果sourceXSubsampling
或sourceYSubsampling
是0或负数,将抛出一IllegalArgumentException
。
如果subsamplingXOffset
或subsamplingYOffset
阴性或大于或等于相应的时期,一个IllegalArgumentException
将抛出。
没有unsetSourceSubsampling
方法;简单的叫setSourceSubsampling(1, 1, 0, 0)
恢复默认值。
sourceXSubsampling
-列数提高像素之间。
sourceYSubsampling
-行数提高像素之间。
subsamplingXOffset
的水平偏移量,或在图像如果没有区域设置。
subsamplingYOffset
-区域内的第一次的水平偏移量,或在图像如果没有区域设置。
IllegalArgumentException
要是期负或0,或者网格偏移是消极的或大于同期。
IllegalStateException
-如果源区域是这样的采样输出将不包含像素。
public int getSourceXSubsampling()
如果setSourceSubsampling
未被调用,则返回1(这是正确的值)。
setSourceSubsampling(int, int, int, int)
,
getSourceYSubsampling()
public int getSourceYSubsampling()
如果setSourceSubsampling
未被调用,则返回1(这是正确的值)。
setSourceSubsampling(int, int, int, int)
,
getSourceXSubsampling()
public int getSubsamplingXOffset()
如果setSourceSubsampling
未被调用,则返回0(这是正确的值)。
setSourceSubsampling(int, int, int, int)
,
getSubsamplingYOffset()
public int getSubsamplingYOffset()
如果setSourceSubsampling
未被调用,则返回0(这是正确的值)。
setSourceSubsampling(int, int, int, int)
,
getSubsamplingXOffset()
public void setSourceBands(int[] sourceBands)
一个null
值表示所有源带将使用。
在阅读的时候,一个IllegalArgumentException
将被读者或作家,如果一个值大于最大可用的源带指数已被指定或者被用作不同的源和目的条带数条。的ImageReader.checkReadParamBandSettings
方法可用于自动化测试。
在语义上,一份由数组的数组的内容;随后这个电话改变对这IIOParam
无影响。
sourceBands
-整数带指标用于数组。
IllegalArgumentException
-如果
sourceBands
包含消极的或重复的值。
getSourceBands()
,
ImageReadParam.setDestinationBands(int[])
,
ImageReader.checkReadParamBandSettings(javax.imageio.ImageReadParam, int, int)
public int[] getSourceBands()
setSourceBands
最近的电话,或
null
如果没有电话
setSourceBands
。
在语义上,返回的数组复制到数组的内容;随后的这一呼吁改变对这IIOParam
无影响。
null
。
setSourceBands(int[])
public void setDestinationType(ImageTypeSpecifier destinationType)
ImageTypeSpecifier
。
阅读时,如果目的地的布局已经使用这种方法,每次调用一个ImageReader
read
方法将返回一个使用提供的类型说明符指定格式的新BufferedImage
。作为一个副作用,有目的地BufferedImage
由ImageReadParam.setDestination(BufferedImage)
将不再设置为目的地。换句话说,这个方法可以认为是调用setDestination((BufferedImage)null)
。
当写入时,目标类型可能用于确定图像的颜色类型。的SampleModel
信息将被忽略,并且可能null
。例如,一个4-banded图像表现为CMYK或RGBA数据。如果目的地类型设置,其ColorModel
将覆盖任何ColorModel
对图像本身。这是关键的时候setSourceBands
是由于图像的ColorModel
将整个图像而不是乐队写使用子集。
destinationType
-
ImageTypeSpecifier
用来确定目标的布局和颜色类型。
getDestinationType()
public ImageTypeSpecifier getDestinationType()
setDestination(ImageTypeSpecifier)
,作为
ImageTypeSpecifier
。如果没有设置,
null
返回。
ImageTypeSpecifier
描述目的类型,或
null
。
setDestinationType(javax.imageio.ImageTypeSpecifier)
public void setDestinationOffset(Point destinationOffset)
阅读时,该区域将在目的地BufferedImage
写会在这个起始位置的偏移量和有一个宽度和高度的兴趣源区确定,采样参数和目标范围。
正常写入此方法不受影响,只写用ImageWriter.replacePixels
。对于这样写,指定的偏移量在输出流图像中,其像素正在被修改。
没有unsetDestinationOffset
方法;简单的叫setDestinationOffset(new Point(0, 0))
恢复默认值。
destinationOffset
-目标偏移,作为一个
Point
。
null
destinationOffset
IllegalArgumentException
。
getDestinationOffset()
,
ImageWriter.replacePixels(java.awt.image.RenderedImage, javax.imageio.ImageWriteParam)
public Point getDestinationOffset()
如果setDestinationOffsets
未被调用,一个零x和y的值Point
返回(这是正确的值)。
Point
目标偏移。
setDestinationOffset(java.awt.Point)
public void setController(IIOParamController controller)
IIOParamController
用来为这
IIOParam
对象提供的设置时,
activateController
方法被调用,覆盖任何默认的控制器。如果参数是
null
,没有控制器将被使用,包括任何违约。恢复默认值,使用
setController(getDefaultController())
。
controller
-一个适当的
IIOParamController
,或
null
。
IIOParamController
,
getController()
,
getDefaultController()
,
hasController()
,
activateController()
public IIOParamController getController()
IIOParamController
。这可能有一个,是默认的
null
,或争论的最新电话
setController
。
IIOParamController
,或
null
。
IIOParamController
,
setController(javax.imageio.IIOParamController)
,
getDefaultController()
,
hasController()
,
activateController()
public IIOParamController getDefaultController()
IIOParamController
,如果有一个,不管当前安装的控制器。如果没有默认的控制器,返回
null
。
IIOParamController
,或
null
。
IIOParamController
,
setController(IIOParamController)
,
getController()
,
hasController()
,
activateController()
public boolean hasController()
true
如果有控制器安装此
IIOParam
对象。如果这样会不会回来
null
返回
true
getController
。
true
如果安装控制器。
IIOParamController
,
setController(IIOParamController)
,
getController()
,
getDefaultController()
,
activateController()
public boolean activateController()
IIOParamController
这
IIOParam
对象并返回结果值。当此方法返回
true
,这
IIOParam
对象的所有值将准备好下一个读或写操作。如果
false
返回,该对象没有设置将被打扰(即,用户取消操作)。
通常情况下,控制器将GUI提供一种特定的插件一类IIOParam
用户界面。控制器不需要GUI,但是。
true
如果控制器完成正常。
IllegalStateException
-如果没有控制器的当前安装的。
IIOParamController
,
setController(IIOParamController)
,
getController()
,
getDefaultController()
,
hasController()
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.