本文整理汇总了Java中com.sun.imageio.plugins.common.ImageUtil类的典型用法代码示例。如果您正苦于以下问题:Java ImageUtil类的具体用法?Java ImageUtil怎么用?Java ImageUtil使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ImageUtil类属于com.sun.imageio.plugins.common包,在下文中一共展示了ImageUtil类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addChildNode
import com.sun.imageio.plugins.common.ImageUtil; //导入依赖的package包/类
private IIOMetadataNode addChildNode(IIOMetadataNode root,
String name,
Object object) {
IIOMetadataNode child = new IIOMetadataNode(name);
if (object != null) {
child.setUserObject(object);
child.setNodeValue(ImageUtil.convertObjectToString(object));
}
root.appendChild(child);
return child;
}
示例2: prepareRead
import com.sun.imageio.plugins.common.ImageUtil; //导入依赖的package包/类
private void prepareRead(int imageIndex, ImageReadParam param)
throws IOException {
if (stream == null) {
throw new IllegalStateException("Input not set!");
}
// A null ImageReadParam means we use the default
if (param == null) {
param = getDefaultReadParam();
}
this.imageReadParam = param;
seekToImage(imageIndex);
this.tileOrStripWidth = getTileOrStripWidth();
this.tileOrStripHeight = getTileOrStripHeight();
this.planarConfiguration = getPlanarConfiguration();
this.sourceBands = param.getSourceBands();
if (sourceBands == null) {
sourceBands = new int[numBands];
for (int i = 0; i < numBands; i++) {
sourceBands[i] = i;
}
}
// Initialize the destination image
Iterator<ImageTypeSpecifier> imageTypes = getImageTypes(imageIndex);
ImageTypeSpecifier theImageType
= ImageUtil.getDestinationType(param, imageTypes);
int destNumBands = theImageType.getSampleModel().getNumBands();
this.destinationBands = param.getDestinationBands();
if (destinationBands == null) {
destinationBands = new int[destNumBands];
for (int i = 0; i < destNumBands; i++) {
destinationBands[i] = i;
}
}
if (sourceBands.length != destinationBands.length) {
throw new IllegalArgumentException(
"sourceBands.length != destinationBands.length");
}
for (int i = 0; i < sourceBands.length; i++) {
int sb = sourceBands[i];
if (sb < 0 || sb >= numBands) {
throw new IllegalArgumentException(
"Source band out of range!");
}
int db = destinationBands[i];
if (db < 0 || db >= destNumBands) {
throw new IllegalArgumentException(
"Destination band out of range!");
}
}
}