javax.imageio.plugins.tiff.BaselineTIFFTagSet#COMPRESSION_NONE源码实例Demo

下面列出了javax.imageio.plugins.tiff.BaselineTIFFTagSet#COMPRESSION_NONE 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: Bytecoder   文件: TIFFImageWriter.java
public boolean canReplacePixels(int imageIndex) throws IOException {
    if (getOutput() == null) {
        throw new IllegalStateException("getOutput() == null!");
    }

    TIFFIFD rootIFD = readIFD(imageIndex);
    TIFFField f = rootIFD.getTIFFField(BaselineTIFFTagSet.TAG_COMPRESSION);
    int compression = f.getAsInt(0);

    return compression == BaselineTIFFTagSet.COMPRESSION_NONE;
}
 
源代码2 项目: Bytecoder   文件: TIFFImageReader.java
private int getCompression() {
    TIFFField f
            = imageMetadata.getTIFFField(BaselineTIFFTagSet.TAG_COMPRESSION);
    if (f == null) {
        return BaselineTIFFTagSet.COMPRESSION_NONE;
    } else {
        return f.getAsInt(0);
    }
}
 
源代码3 项目: Bytecoder   文件: TIFFImageReader.java
public boolean isRandomAccessEasy(int imageIndex) throws IOException {
    if (currIndex != -1) {
        seekToImage(currIndex);
        return getCompression() == BaselineTIFFTagSet.COMPRESSION_NONE;
    } else {
        return false;
    }
}
 
源代码4 项目: openjdk-jdk9   文件: TIFFImageWriter.java
public boolean canReplacePixels(int imageIndex) throws IOException {
    if (getOutput() == null) {
        throw new IllegalStateException("getOutput() == null!");
    }

    TIFFIFD rootIFD = readIFD(imageIndex);
    TIFFField f = rootIFD.getTIFFField(BaselineTIFFTagSet.TAG_COMPRESSION);
    int compression = f.getAsInt(0);

    return compression == BaselineTIFFTagSet.COMPRESSION_NONE;
}
 
源代码5 项目: openjdk-jdk9   文件: TIFFImageReader.java
private int getCompression() {
    TIFFField f
            = imageMetadata.getTIFFField(BaselineTIFFTagSet.TAG_COMPRESSION);
    if (f == null) {
        return BaselineTIFFTagSet.COMPRESSION_NONE;
    } else {
        return f.getAsInt(0);
    }
}
 
源代码6 项目: openjdk-jdk9   文件: TIFFImageReader.java
public boolean isRandomAccessEasy(int imageIndex) throws IOException {
    if (currIndex != -1) {
        seekToImage(currIndex);
        return getCompression() == BaselineTIFFTagSet.COMPRESSION_NONE;
    } else {
        return false;
    }
}
 
源代码7 项目: Bytecoder   文件: TIFFImageWriter.java
public void prepareReplacePixels(int imageIndex,
                                 Rectangle region) throws IOException {
    synchronized(replacePixelsLock) {
        // Check state and parameters vis-a-vis ImageWriter specification.
        if (stream == null) {
            throw new IllegalStateException("Output not set!");
        }
        if (region == null) {
            throw new IllegalArgumentException("region == null!");
        }
        if (region.getWidth() < 1) {
            throw new IllegalArgumentException("region.getWidth() < 1!");
        }
        if (region.getHeight() < 1) {
            throw new IllegalArgumentException("region.getHeight() < 1!");
        }
        if (inReplacePixelsNest) {
            throw new IllegalStateException
                ("In nested call to prepareReplacePixels!");
        }

        // Read the IFD for the pixel replacement index.
        TIFFIFD replacePixelsIFD = readIFD(imageIndex);

        // Ensure that compression is "none".
        TIFFField f =
            replacePixelsIFD.getTIFFField(BaselineTIFFTagSet.TAG_COMPRESSION);
        int compression = f.getAsInt(0);
        if (compression != BaselineTIFFTagSet.COMPRESSION_NONE) {
            throw new UnsupportedOperationException
                ("canReplacePixels(imageIndex) == false!");
        }

        // Get the image dimensions.
        f =
            replacePixelsIFD.getTIFFField(BaselineTIFFTagSet.TAG_IMAGE_WIDTH);
        if(f == null) {
            throw new IIOException("Cannot read ImageWidth field.");
        }
        int w = f.getAsInt(0);

        f =
            replacePixelsIFD.getTIFFField(BaselineTIFFTagSet.TAG_IMAGE_LENGTH);
        if(f == null) {
            throw new IIOException("Cannot read ImageHeight field.");
        }
        int h = f.getAsInt(0);

        // Create image bounds.
        Rectangle bounds = new Rectangle(0, 0, w, h);

        // Intersect region with bounds.
        region = region.intersection(bounds);

        // Check for empty intersection.
        if(region.isEmpty()) {
            throw new IIOException("Region does not intersect image bounds");
        }

        // Save the region.
        replacePixelsRegion = region;

        // Get the tile offsets.
        f = replacePixelsIFD.getTIFFField(BaselineTIFFTagSet.TAG_TILE_OFFSETS);
        if(f == null) {
            f = replacePixelsIFD.getTIFFField(BaselineTIFFTagSet.TAG_STRIP_OFFSETS);
        }
        replacePixelsTileOffsets = f.getAsLongs();

        // Get the byte counts.
        f = replacePixelsIFD.getTIFFField(BaselineTIFFTagSet.TAG_TILE_BYTE_COUNTS);
        if(f == null) {
            f = replacePixelsIFD.getTIFFField(BaselineTIFFTagSet.TAG_STRIP_BYTE_COUNTS);
        }
        replacePixelsByteCounts = f.getAsLongs();

        replacePixelsOffsetsPosition =
            replacePixelsIFD.getStripOrTileOffsetsPosition();
        replacePixelsByteCountsPosition =
            replacePixelsIFD.getStripOrTileByteCountsPosition();

        // Get the image metadata.
        replacePixelsMetadata = new TIFFImageMetadata(replacePixelsIFD);

        // Save the image index.
        replacePixelsIndex = imageIndex;

        // Set the pixel replacement flag.
        inReplacePixelsNest = true;
    }
}
 
源代码8 项目: Bytecoder   文件: TIFFLSBCompressor.java
public TIFFLSBCompressor() {
    super("", BaselineTIFFTagSet.COMPRESSION_NONE, true);
}
 
源代码9 项目: Bytecoder   文件: TIFFNullCompressor.java
public TIFFNullCompressor() {
    super("", BaselineTIFFTagSet.COMPRESSION_NONE, true);
}
 
源代码10 项目: openjdk-jdk9   文件: TIFFImageWriter.java
public void prepareReplacePixels(int imageIndex,
                                 Rectangle region) throws IOException {
    synchronized(replacePixelsLock) {
        // Check state and parameters vis-a-vis ImageWriter specification.
        if (stream == null) {
            throw new IllegalStateException("Output not set!");
        }
        if (region == null) {
            throw new IllegalArgumentException("region == null!");
        }
        if (region.getWidth() < 1) {
            throw new IllegalArgumentException("region.getWidth() < 1!");
        }
        if (region.getHeight() < 1) {
            throw new IllegalArgumentException("region.getHeight() < 1!");
        }
        if (inReplacePixelsNest) {
            throw new IllegalStateException
                ("In nested call to prepareReplacePixels!");
        }

        // Read the IFD for the pixel replacement index.
        TIFFIFD replacePixelsIFD = readIFD(imageIndex);

        // Ensure that compression is "none".
        TIFFField f =
            replacePixelsIFD.getTIFFField(BaselineTIFFTagSet.TAG_COMPRESSION);
        int compression = f.getAsInt(0);
        if (compression != BaselineTIFFTagSet.COMPRESSION_NONE) {
            throw new UnsupportedOperationException
                ("canReplacePixels(imageIndex) == false!");
        }

        // Get the image dimensions.
        f =
            replacePixelsIFD.getTIFFField(BaselineTIFFTagSet.TAG_IMAGE_WIDTH);
        if(f == null) {
            throw new IIOException("Cannot read ImageWidth field.");
        }
        int w = f.getAsInt(0);

        f =
            replacePixelsIFD.getTIFFField(BaselineTIFFTagSet.TAG_IMAGE_LENGTH);
        if(f == null) {
            throw new IIOException("Cannot read ImageHeight field.");
        }
        int h = f.getAsInt(0);

        // Create image bounds.
        Rectangle bounds = new Rectangle(0, 0, w, h);

        // Intersect region with bounds.
        region = region.intersection(bounds);

        // Check for empty intersection.
        if(region.isEmpty()) {
            throw new IIOException("Region does not intersect image bounds");
        }

        // Save the region.
        replacePixelsRegion = region;

        // Get the tile offsets.
        f = replacePixelsIFD.getTIFFField(BaselineTIFFTagSet.TAG_TILE_OFFSETS);
        if(f == null) {
            f = replacePixelsIFD.getTIFFField(BaselineTIFFTagSet.TAG_STRIP_OFFSETS);
        }
        replacePixelsTileOffsets = f.getAsLongs();

        // Get the byte counts.
        f = replacePixelsIFD.getTIFFField(BaselineTIFFTagSet.TAG_TILE_BYTE_COUNTS);
        if(f == null) {
            f = replacePixelsIFD.getTIFFField(BaselineTIFFTagSet.TAG_STRIP_BYTE_COUNTS);
        }
        replacePixelsByteCounts = f.getAsLongs();

        replacePixelsOffsetsPosition =
            replacePixelsIFD.getStripOrTileOffsetsPosition();
        replacePixelsByteCountsPosition =
            replacePixelsIFD.getStripOrTileByteCountsPosition();

        // Get the image metadata.
        replacePixelsMetadata = new TIFFImageMetadata(replacePixelsIFD);

        // Save the image index.
        replacePixelsIndex = imageIndex;

        // Set the pixel replacement flag.
        inReplacePixelsNest = true;
    }
}
 
源代码11 项目: openjdk-jdk9   文件: TIFFLSBCompressor.java
public TIFFLSBCompressor() {
    super("", BaselineTIFFTagSet.COMPRESSION_NONE, true);
}
 
源代码12 项目: openjdk-jdk9   文件: TIFFNullCompressor.java
public TIFFNullCompressor() {
    super("", BaselineTIFFTagSet.COMPRESSION_NONE, true);
}