当前位置: 首页>>代码示例>>Java>>正文


Java ImageUtil类代码示例

本文整理汇总了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;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:12,代码来源:WBMPMetadata.java

示例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!");
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:61,代码来源:TIFFImageReader.java


注:本文中的com.sun.imageio.plugins.common.ImageUtil类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。