1 18 package org.apache.batik.ext.awt.image.codec.tiff; 19 20 import java.awt.image.RenderedImage ; 21 import java.io.IOException ; 22 23 import org.apache.batik.ext.awt.image.codec.ImageDecodeParam; 24 import org.apache.batik.ext.awt.image.codec.ImageDecoderImpl; 25 import org.apache.batik.ext.awt.image.codec.SeekableStream; 26 27 42 public class TIFFImageDecoder extends ImageDecoderImpl { 43 44 public static final int TIFF_IMAGE_WIDTH = 256; 46 public static final int TIFF_IMAGE_LENGTH = 257; 47 public static final int TIFF_BITS_PER_SAMPLE = 258; 48 public static final int TIFF_COMPRESSION = 259; 49 public static final int TIFF_PHOTOMETRIC_INTERPRETATION = 262; 50 public static final int TIFF_FILL_ORDER = 266; 51 public static final int TIFF_STRIP_OFFSETS = 273; 52 public static final int TIFF_SAMPLES_PER_PIXEL = 277; 53 public static final int TIFF_ROWS_PER_STRIP = 278; 54 public static final int TIFF_STRIP_BYTE_COUNTS = 279; 55 public static final int TIFF_X_RESOLUTION = 282; 56 public static final int TIFF_Y_RESOLUTION = 283; 57 public static final int TIFF_PLANAR_CONFIGURATION = 284; 58 public static final int TIFF_T4_OPTIONS = 292; 59 public static final int TIFF_T6_OPTIONS = 293; 60 public static final int TIFF_RESOLUTION_UNIT = 296; 61 public static final int TIFF_PREDICTOR = 317; 62 public static final int TIFF_COLORMAP = 320; 63 public static final int TIFF_TILE_WIDTH = 322; 64 public static final int TIFF_TILE_LENGTH = 323; 65 public static final int TIFF_TILE_OFFSETS = 324; 66 public static final int TIFF_TILE_BYTE_COUNTS = 325; 67 public static final int TIFF_EXTRA_SAMPLES = 338; 68 public static final int TIFF_SAMPLE_FORMAT = 339; 69 public static final int TIFF_S_MIN_SAMPLE_VALUE = 340; 70 public static final int TIFF_S_MAX_SAMPLE_VALUE = 341; 71 72 public TIFFImageDecoder(SeekableStream input, 73 ImageDecodeParam param) { 74 super(input, param); 75 } 76 77 public int getNumPages() throws IOException { 78 return TIFFDirectory.getNumDirectories(input); 79 } 80 81 public RenderedImage decodeAsRenderedImage(int page) throws IOException { 82 if ((page < 0) || (page >= getNumPages())) { 83 throw new IOException ("TIFFImageDecoder0"); 84 } 85 return new TIFFImage(input, (TIFFDecodeParam)param, page); 86 } 87 } 88 | Popular Tags |