JPEGImageWriterSpi.java 文件源码

java
阅读 26 收藏 0 点赞 0 评论 0

项目:openjdk-jdk10 作者:
public boolean canEncodeImage(ImageTypeSpecifier type) {
    SampleModel sampleModel = type.getSampleModel();

    // Find the maximum bit depth across all channels
    int[] sampleSize = sampleModel.getSampleSize();
    int bitDepth = sampleSize[0];
    for (int i = 1; i < sampleSize.length; i++) {
        if (sampleSize[i] > bitDepth) {
            bitDepth = sampleSize[i];
        }
    }

    // 4450894: Ensure bitDepth is between 1 and 8
    if (bitDepth < 1 || bitDepth > 8) {
        return false;
    }

    return true;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号