You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by se...@apache.org on 2010/09/10 18:33:42 UTC
svn commit: r995859 [24/30] - in
/commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan: ./ color/
common/ common/byteSources/ common/mylzw/ formats/bmp/
formats/bmp/pixelparsers/ formats/bmp/writers/ formats/gif/ formats/ico/
formats/jpeg/ f...
Modified: commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/formats/tiff/constants/TiffTagConstants.java
URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/formats/tiff/constants/TiffTagConstants.java?rev=995859&r1=995858&r2=995859&view=diff
==============================================================================
--- commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/formats/tiff/constants/TiffTagConstants.java (original)
+++ commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/formats/tiff/constants/TiffTagConstants.java Fri Sep 10 16:33:35 2010
@@ -17,333 +17,333 @@
package org.apache.sanselan.formats.tiff.constants;
public interface TiffTagConstants
- extends
- TiffDirectoryConstants,
- TiffFieldTypeConstants
+ extends
+ TiffDirectoryConstants,
+ TiffFieldTypeConstants
{
- public static final TagInfo TIFF_TAG_NEW_SUBFILE_TYPE = new TagInfo(
- "New Subfile Type", 0xFE, FIELD_TYPE_DESCRIPTION_LONG, 1,
- TIFF_DIRECTORY_ROOT);
-
- public static final TagInfo TIFF_TAG_SUBFILE_TYPE = new TagInfo(
- "Subfile Type", 0xFF, FIELD_TYPE_DESCRIPTION_SHORT, 1,
- TIFF_DIRECTORY_ROOT);
-
- public static final TagInfo TIFF_TAG_IMAGE_WIDTH = new TagInfo(
- "Image Width", 0x100, FIELD_TYPE_DESCRIPTION_SHORT_OR_LONG, 1,
- TIFF_DIRECTORY_ROOT);
-
- public static final TagInfo TIFF_TAG_IMAGE_LENGTH = new TagInfo(
- "Image Length", 0x101, FIELD_TYPE_DESCRIPTION_SHORT_OR_LONG, 1,
- TIFF_DIRECTORY_ROOT);
-
- public static final TagInfo TIFF_TAG_BITS_PER_SAMPLE = new TagInfo(
- "Bits Per Sample", 0x102, FIELD_TYPE_DESCRIPTION_SHORT, -1,
- TIFF_DIRECTORY_ROOT);
-
- public static final TagInfo TIFF_TAG_COMPRESSION = new TagInfo(
- "Compression", 0x103, FIELD_TYPE_DESCRIPTION_SHORT, 1,
- TIFF_DIRECTORY_ROOT);
-
- public static final TagInfo TIFF_TAG_PHOTOMETRIC_INTERPRETATION = new TagInfo(
- "Photometric Interpretation", 0x106, FIELD_TYPE_DESCRIPTION_SHORT,
- 1, TIFF_DIRECTORY_ROOT);
-
- public static final TagInfo TIFF_TAG_THRESHHOLDING = new TagInfo(
- "Threshholding", 0x107, FIELD_TYPE_DESCRIPTION_SHORT, 1,
- TIFF_DIRECTORY_ROOT);
-
- public static final TagInfo TIFF_TAG_CELL_WIDTH = new TagInfo("Cell Width",
- 0x108, FIELD_TYPE_DESCRIPTION_SHORT, 1, TIFF_DIRECTORY_ROOT);
-
- public static final TagInfo TIFF_TAG_CELL_LENGTH = new TagInfo(
- "Cell Length", 0x109, FIELD_TYPE_DESCRIPTION_SHORT, 1,
- TIFF_DIRECTORY_ROOT);
-
- public static final TagInfo TIFF_TAG_FILL_ORDER = new TagInfo("Fill Order",
- 0x10A, FIELD_TYPE_DESCRIPTION_SHORT, 1, TIFF_DIRECTORY_ROOT);
-
- public static final TagInfo TIFF_TAG_DOCUMENT_NAME = new TagInfo(
- "Document Name", 0x10D, FIELD_TYPE_DESCRIPTION_ASCII, -1,
- TIFF_DIRECTORY_ROOT);
-
- public static final TagInfo TIFF_TAG_IMAGE_DESCRIPTION = new TagInfo(
- "Image Description", 0x10E, FIELD_TYPE_DESCRIPTION_ASCII, -1,
- TIFF_DIRECTORY_ROOT);
-
- public static final TagInfo TIFF_TAG_MAKE = new TagInfo("Make", 0x10F,
- FIELD_TYPE_DESCRIPTION_ASCII, -1, TIFF_DIRECTORY_ROOT);
-
- public static final TagInfo TIFF_TAG_MODEL = new TagInfo("Model", 0x110,
- FIELD_TYPE_DESCRIPTION_ASCII, -1, TIFF_DIRECTORY_ROOT);
-
- public static final TagInfo TIFF_TAG_STRIP_OFFSETS = new TagInfo.Offset(
- "Strip Offsets", 0x111, FIELD_TYPE_DESCRIPTION_SHORT_OR_LONG, -1,
- TIFF_DIRECTORY_ROOT);
-
- public static final TagInfo TIFF_TAG_ORIENTATION = new TagInfo(
- "Orientation", 0x112, FIELD_TYPE_DESCRIPTION_SHORT, 1,
- TIFF_DIRECTORY_ROOT);
-
- public static final TagInfo TIFF_TAG_SAMPLES_PER_PIXEL = new TagInfo(
- "Samples Per Pixel", 0x115, FIELD_TYPE_DESCRIPTION_SHORT, 1,
- TIFF_DIRECTORY_ROOT);
-
- public static final TagInfo TIFF_TAG_ROWS_PER_STRIP = new TagInfo(
- "Rows Per Strip", 0x116, FIELD_TYPE_DESCRIPTION_SHORT_OR_LONG, 1,
- TIFF_DIRECTORY_ROOT);
-
- public static final TagInfo TIFF_TAG_STRIP_BYTE_COUNTS = new TagInfo(
- "Strip Byte Counts", 0x117, FIELD_TYPE_DESCRIPTION_LONG_OR_SHORT,
- -1, TIFF_DIRECTORY_ROOT);
-
- public static final TagInfo TIFF_TAG_MIN_SAMPLE_VALUE = new TagInfo(
- "Min Sample Value", 0x118, FIELD_TYPE_DESCRIPTION_SHORT, -1,
- TIFF_DIRECTORY_ROOT);
-
- public static final TagInfo TIFF_TAG_MAX_SAMPLE_VALUE = new TagInfo(
- "Max Sample Value", 0x119, FIELD_TYPE_DESCRIPTION_SHORT, -1,
- TIFF_DIRECTORY_ROOT);
-
- public static final TagInfo TIFF_TAG_XRESOLUTION = new TagInfo(
- "XResolution", 0x11A, FIELD_TYPE_DESCRIPTION_RATIONAL, 1,
- TIFF_DIRECTORY_ROOT);
-
- public static final TagInfo TIFF_TAG_YRESOLUTION = new TagInfo(
- "YResolution", 0x11B, FIELD_TYPE_DESCRIPTION_RATIONAL, 1,
- TIFF_DIRECTORY_ROOT);
-
- public static final TagInfo TIFF_TAG_PLANAR_CONFIGURATION = new TagInfo(
- "Planar Configuration", 0x11C, FIELD_TYPE_DESCRIPTION_SHORT, 1,
- TIFF_DIRECTORY_ROOT);
-
- public static final TagInfo TIFF_TAG_PAGE_NAME = new TagInfo("Page Name",
- 0x11D, FIELD_TYPE_DESCRIPTION_ASCII, -1, TIFF_DIRECTORY_ROOT);
-
- public static final TagInfo TIFF_TAG_XPOSITION = new TagInfo("XPosition",
- 0x11E, FIELD_TYPE_DESCRIPTION_RATIONAL, -1, TIFF_DIRECTORY_ROOT);
-
- public static final TagInfo TIFF_TAG_YPOSITION = new TagInfo("YPosition",
- 0x11F, FIELD_TYPE_DESCRIPTION_RATIONAL, -1, TIFF_DIRECTORY_ROOT);
-
- public static final TagInfo TIFF_TAG_FREE_OFFSETS = new TagInfo(
- "Free Offsets", 0x120, FIELD_TYPE_DESCRIPTION_LONG, -1,
- TIFF_DIRECTORY_ROOT);
-
- public static final TagInfo TIFF_TAG_FREE_BYTE_COUNTS = new TagInfo(
- "Free Byte Counts", 0x121, FIELD_TYPE_DESCRIPTION_LONG, -1,
- TIFF_DIRECTORY_ROOT);
-
- public static final TagInfo TIFF_TAG_GRAY_RESPONSE_UNIT = new TagInfo(
- "Gray Response Unit", 0x122, FIELD_TYPE_DESCRIPTION_SHORT, 1,
- TIFF_DIRECTORY_ROOT);
-
- public static final TagInfo TIFF_TAG_GRAY_RESPONSE_CURVE = new TagInfo(
- "Gray Response Curve", 0x123, FIELD_TYPE_DESCRIPTION_SHORT, -1,
- TIFF_DIRECTORY_ROOT);
-
- public static final TagInfo TIFF_TAG_T4_OPTIONS = new TagInfo("T4 Options",
- 0x124, FIELD_TYPE_DESCRIPTION_LONG, 1, TIFF_DIRECTORY_ROOT);
-
- public static final TagInfo TIFF_TAG_T6_OPTIONS = new TagInfo("T6 Options",
- 0x125, FIELD_TYPE_DESCRIPTION_LONG, 1, TIFF_DIRECTORY_ROOT);
-
- public static final TagInfo TIFF_TAG_RESOLUTION_UNIT = new TagInfo(
- "Resolution Unit", 0x128, FIELD_TYPE_DESCRIPTION_SHORT, 1,
- TIFF_DIRECTORY_ROOT);
-
- public static final TagInfo TIFF_TAG_PAGE_NUMBER = new TagInfo(
- "Page Number", 0x129, FIELD_TYPE_DESCRIPTION_SHORT, 2,
- TIFF_DIRECTORY_ROOT);
-
- public static final TagInfo TIFF_TAG_TRANSFER_FUNCTION = new TagInfo(
- "Transfer Function", 0x12D, FIELD_TYPE_DESCRIPTION_SHORT, -1,
- TIFF_DIRECTORY_ROOT);
-
- public static final TagInfo TIFF_TAG_SOFTWARE = new TagInfo("Software",
- 0x131, FIELD_TYPE_DESCRIPTION_ASCII, -1, TIFF_DIRECTORY_ROOT);
-
- public static final TagInfo TIFF_TAG_DATE_TIME = new TagInfo("Date Time",
- 0x132, FIELD_TYPE_DESCRIPTION_ASCII, 20, TIFF_DIRECTORY_ROOT);
-
- public static final TagInfo TIFF_TAG_ARTIST = new TagInfo("Artist", 0x13B,
- FIELD_TYPE_DESCRIPTION_ASCII, -1, TIFF_DIRECTORY_ROOT);
-
- public static final TagInfo TIFF_TAG_HOST_COMPUTER = new TagInfo(
- "Host Computer", 0x13C, FIELD_TYPE_DESCRIPTION_ASCII, -1,
- TIFF_DIRECTORY_ROOT);
-
- public static final TagInfo TIFF_TAG_PREDICTOR = new TagInfo("Predictor",
- 0x13D, FIELD_TYPE_DESCRIPTION_SHORT, 1, TIFF_DIRECTORY_ROOT);
-
- public static final TagInfo TIFF_TAG_WHITE_POINT = new TagInfo(
- "White Point", 0x13E, FIELD_TYPE_DESCRIPTION_RATIONAL, 2,
- TIFF_DIRECTORY_ROOT);
-
- public static final TagInfo TIFF_TAG_PRIMARY_CHROMATICITIES = new TagInfo(
- "Primary Chromaticities", 0x13F, FIELD_TYPE_DESCRIPTION_RATIONAL,
- 6, TIFF_DIRECTORY_ROOT);
-
- public static final TagInfo TIFF_TAG_COLOR_MAP = new TagInfo("Color Map",
- 0x140, FIELD_TYPE_DESCRIPTION_SHORT, -1, TIFF_DIRECTORY_ROOT);
-
- public static final TagInfo TIFF_TAG_HALFTONE_HINTS = new TagInfo(
- "Halftone Hints", 0x141, FIELD_TYPE_DESCRIPTION_SHORT, 2,
- TIFF_DIRECTORY_ROOT);
-
- public static final TagInfo TIFF_TAG_TILE_WIDTH = new TagInfo("Tile Width",
- 0x142, FIELD_TYPE_DESCRIPTION_SHORT_OR_LONG, 1, TIFF_DIRECTORY_ROOT);
-
- public static final TagInfo TIFF_TAG_TILE_LENGTH = new TagInfo(
- "Tile Length", 0x143, FIELD_TYPE_DESCRIPTION_SHORT_OR_LONG, 1,
- TIFF_DIRECTORY_ROOT);
-
- public static final TagInfo TIFF_TAG_TILE_OFFSETS = new TagInfo.Offset(
- "Tile Offsets", 0x144, FIELD_TYPE_DESCRIPTION_LONG, -1,
- TIFF_DIRECTORY_ROOT);
-
- public static final TagInfo TIFF_TAG_TILE_BYTE_COUNTS = new TagInfo(
- "Tile Byte Counts", 0x145, FIELD_TYPE_DESCRIPTION_SHORT_OR_LONG,
- -1, TIFF_DIRECTORY_ROOT);
-
- public static final TagInfo TIFF_TAG_INK_SET = new TagInfo("Ink Set",
- 0x14C, FIELD_TYPE_DESCRIPTION_SHORT, 1, TIFF_DIRECTORY_ROOT);
-
- public static final TagInfo TIFF_TAG_INK_NAMES = new TagInfo("Ink Names",
- 0x14D, FIELD_TYPE_DESCRIPTION_ASCII, -1, TIFF_DIRECTORY_ROOT);
-
- public static final TagInfo TIFF_TAG_NUMBER_OF_INKS = new TagInfo(
- "Number Of Inks", 0x14E, FIELD_TYPE_DESCRIPTION_SHORT, 1,
- TIFF_DIRECTORY_ROOT);
-
- public static final TagInfo TIFF_TAG_DOT_RANGE = new TagInfo("Dot Range",
- 0x150, FIELD_TYPE_DESCRIPTION_BYTE_OR_SHORT, -1,
- TIFF_DIRECTORY_ROOT);
-
- public static final TagInfo TIFF_TAG_TARGET_PRINTER = new TagInfo(
- "Target Printer", 0x151, FIELD_TYPE_DESCRIPTION_ASCII, -1,
- TIFF_DIRECTORY_ROOT);
-
- public static final TagInfo TIFF_TAG_EXTRA_SAMPLES = new TagInfo(
- "Extra Samples", 0x152, FIELD_TYPE_DESCRIPTION_BYTE, -1,
- TIFF_DIRECTORY_ROOT);
-
- public static final TagInfo TIFF_TAG_SAMPLE_FORMAT = new TagInfo(
- "Sample Format", 0x153, FIELD_TYPE_DESCRIPTION_SHORT, -1,
- TIFF_DIRECTORY_ROOT);
-
- public static final TagInfo TIFF_TAG_SMIN_SAMPLE_VALUE = new TagInfo(
- "SMin Sample Value", 0x154, FIELD_TYPE_DESCRIPTION_ANY, -1,
- TIFF_DIRECTORY_ROOT);
-
- public static final TagInfo TIFF_TAG_SMAX_SAMPLE_VALUE = new TagInfo(
- "SMax Sample Value", 0x155, FIELD_TYPE_DESCRIPTION_ANY, -1,
- TIFF_DIRECTORY_ROOT);
-
- public static final TagInfo TIFF_TAG_TRANSFER_RANGE = new TagInfo(
- "Transfer Range", 0x156, FIELD_TYPE_DESCRIPTION_SHORT, 6,
- TIFF_DIRECTORY_ROOT);
-
- public static final TagInfo TIFF_TAG_JPEG_PROC = new TagInfo("JPEGProc",
- 0x200, FIELD_TYPE_DESCRIPTION_SHORT, 1, TIFF_DIRECTORY_ROOT);
-
- public static final TagInfo TIFF_TAG_JPEG_INTERCHANGE_FORMAT = new TagInfo.Offset(
- "JPEGInterchange Format", 0x201, FIELD_TYPE_DESCRIPTION_LONG, 1,
- TIFF_DIRECTORY_ROOT);
-
- public static final TagInfo TIFF_TAG_JPEG_INTERCHANGE_FORMAT_LENGTH = new TagInfo(
- "JPEGInterchange Format Length", 0x202,
- FIELD_TYPE_DESCRIPTION_LONG, 1, TIFF_DIRECTORY_ROOT);
-
- public static final TagInfo TIFF_TAG_JPEG_RESTART_INTERVAL = new TagInfo(
- "JPEGRestart Interval", 0x203, FIELD_TYPE_DESCRIPTION_SHORT, 1,
- TIFF_DIRECTORY_ROOT);
-
- public static final TagInfo TIFF_TAG_JPEG_LOSSLESS_PREDICTORS = new TagInfo(
- "JPEGLossless Predictors", 0x205, FIELD_TYPE_DESCRIPTION_SHORT, -1,
- TIFF_DIRECTORY_ROOT);
-
- public static final TagInfo TIFF_TAG_JPEG_POINT_TRANSFORMS = new TagInfo(
- "JPEGPoint Transforms", 0x206, FIELD_TYPE_DESCRIPTION_SHORT, -1,
- TIFF_DIRECTORY_ROOT);
-
- public static final TagInfo TIFF_TAG_JPEG_QTABLES = new TagInfo(
- "JPEGQTables", 0x207, FIELD_TYPE_DESCRIPTION_LONG, -1,
- TIFF_DIRECTORY_ROOT);
-
- public static final TagInfo TIFF_TAG_JPEG_DCTABLES = new TagInfo(
- "JPEGDCTables", 0x208, FIELD_TYPE_DESCRIPTION_LONG, -1,
- TIFF_DIRECTORY_ROOT);
-
- public static final TagInfo TIFF_TAG_JPEG_ACTABLES = new TagInfo(
- "JPEGACTables", 0x209, FIELD_TYPE_DESCRIPTION_LONG, -1,
- TIFF_DIRECTORY_ROOT);
-
- public static final TagInfo TIFF_TAG_YCBCR_COEFFICIENTS = new TagInfo(
- "YCbCr Coefficients", 0x211, FIELD_TYPE_DESCRIPTION_RATIONAL, 3,
- TIFF_DIRECTORY_ROOT);
-
- public static final TagInfo TIFF_TAG_YCBCR_SUB_SAMPLING = new TagInfo(
- "YCbCr Sub Sampling", 0x212, FIELD_TYPE_DESCRIPTION_SHORT, 2,
- TIFF_DIRECTORY_ROOT);
-
- public static final TagInfo TIFF_TAG_YCBCR_POSITIONING = new TagInfo(
- "YCbCr Positioning", 0x213, FIELD_TYPE_DESCRIPTION_SHORT, 1,
- TIFF_DIRECTORY_ROOT);
-
- public static final TagInfo TIFF_TAG_REFERENCE_BLACK_WHITE = new TagInfo(
- "Reference Black White", 0x214, FIELD_TYPE_DESCRIPTION_LONG, -1,
- TIFF_DIRECTORY_ROOT);
-
- public static final TagInfo TIFF_TAG_COPYRIGHT = new TagInfo("Copyright",
- 0x8298, FIELD_TYPE_DESCRIPTION_ASCII, -1, TIFF_DIRECTORY_ROOT);
-
- public static final TagInfo TIFF_TAG_XMP = new TagInfo("XMP",
- 0x2BC, FIELD_TYPE_DESCRIPTION_BYTE, -1, TIFF_DIRECTORY_ROOT);
-
- // TODO:
- // public static final TagInfo2 TIFF_TAG_UNKNOWN = null;
- public static final TagInfo TIFF_TAG_UNKNOWN = new TagInfo.Unknown(
- "Unknown Tag", -1, FIELD_TYPE_DESCRIPTION_UNKNOWN,
- TagInfo.LENGTH_UNKNOWN, EXIF_DIRECTORY_UNKNOWN);
-
- public static final TagInfo ALL_TIFF_TAGS[] = {
- TIFF_TAG_NEW_SUBFILE_TYPE, TIFF_TAG_SUBFILE_TYPE,
- TIFF_TAG_IMAGE_WIDTH, TIFF_TAG_IMAGE_LENGTH,
- TIFF_TAG_BITS_PER_SAMPLE, TIFF_TAG_COMPRESSION,
- TIFF_TAG_PHOTOMETRIC_INTERPRETATION, TIFF_TAG_THRESHHOLDING,
- TIFF_TAG_CELL_WIDTH, TIFF_TAG_CELL_LENGTH, TIFF_TAG_FILL_ORDER,
- TIFF_TAG_DOCUMENT_NAME, TIFF_TAG_IMAGE_DESCRIPTION, TIFF_TAG_MAKE,
- TIFF_TAG_MODEL, TIFF_TAG_STRIP_OFFSETS, TIFF_TAG_ORIENTATION,
- TIFF_TAG_SAMPLES_PER_PIXEL, TIFF_TAG_ROWS_PER_STRIP,
- TIFF_TAG_STRIP_BYTE_COUNTS, TIFF_TAG_MIN_SAMPLE_VALUE,
- TIFF_TAG_MAX_SAMPLE_VALUE, TIFF_TAG_XRESOLUTION,
- TIFF_TAG_YRESOLUTION, TIFF_TAG_PLANAR_CONFIGURATION,
- TIFF_TAG_PAGE_NAME, TIFF_TAG_XPOSITION, TIFF_TAG_YPOSITION,
- TIFF_TAG_FREE_OFFSETS, TIFF_TAG_FREE_BYTE_COUNTS,
- TIFF_TAG_GRAY_RESPONSE_UNIT, TIFF_TAG_GRAY_RESPONSE_CURVE,
- TIFF_TAG_T4_OPTIONS, TIFF_TAG_T6_OPTIONS, TIFF_TAG_RESOLUTION_UNIT,
- TIFF_TAG_PAGE_NUMBER, TIFF_TAG_TRANSFER_FUNCTION,
- TIFF_TAG_SOFTWARE, TIFF_TAG_DATE_TIME, TIFF_TAG_ARTIST,
- TIFF_TAG_HOST_COMPUTER, TIFF_TAG_PREDICTOR, TIFF_TAG_WHITE_POINT,
- TIFF_TAG_PRIMARY_CHROMATICITIES, TIFF_TAG_COLOR_MAP,
- TIFF_TAG_HALFTONE_HINTS, TIFF_TAG_TILE_WIDTH, TIFF_TAG_TILE_LENGTH,
- TIFF_TAG_TILE_OFFSETS, TIFF_TAG_TILE_BYTE_COUNTS, TIFF_TAG_INK_SET,
- TIFF_TAG_INK_NAMES, TIFF_TAG_NUMBER_OF_INKS, TIFF_TAG_DOT_RANGE,
- TIFF_TAG_TARGET_PRINTER, TIFF_TAG_EXTRA_SAMPLES,
- TIFF_TAG_SAMPLE_FORMAT, TIFF_TAG_SMIN_SAMPLE_VALUE,
- TIFF_TAG_SMAX_SAMPLE_VALUE, TIFF_TAG_TRANSFER_RANGE,
- TIFF_TAG_JPEG_PROC, TIFF_TAG_JPEG_INTERCHANGE_FORMAT,
- TIFF_TAG_JPEG_INTERCHANGE_FORMAT_LENGTH,
- TIFF_TAG_JPEG_RESTART_INTERVAL, TIFF_TAG_JPEG_LOSSLESS_PREDICTORS,
- TIFF_TAG_JPEG_POINT_TRANSFORMS, TIFF_TAG_JPEG_QTABLES,
- TIFF_TAG_JPEG_DCTABLES, TIFF_TAG_JPEG_ACTABLES,
- TIFF_TAG_YCBCR_COEFFICIENTS, TIFF_TAG_YCBCR_SUB_SAMPLING,
- TIFF_TAG_YCBCR_POSITIONING, TIFF_TAG_REFERENCE_BLACK_WHITE,
- TIFF_TAG_COPYRIGHT,
- //
- TIFF_TAG_XMP,
- };
+ public static final TagInfo TIFF_TAG_NEW_SUBFILE_TYPE = new TagInfo(
+ "New Subfile Type", 0xFE, FIELD_TYPE_DESCRIPTION_LONG, 1,
+ TIFF_DIRECTORY_ROOT);
+
+ public static final TagInfo TIFF_TAG_SUBFILE_TYPE = new TagInfo(
+ "Subfile Type", 0xFF, FIELD_TYPE_DESCRIPTION_SHORT, 1,
+ TIFF_DIRECTORY_ROOT);
+
+ public static final TagInfo TIFF_TAG_IMAGE_WIDTH = new TagInfo(
+ "Image Width", 0x100, FIELD_TYPE_DESCRIPTION_SHORT_OR_LONG, 1,
+ TIFF_DIRECTORY_ROOT);
+
+ public static final TagInfo TIFF_TAG_IMAGE_LENGTH = new TagInfo(
+ "Image Length", 0x101, FIELD_TYPE_DESCRIPTION_SHORT_OR_LONG, 1,
+ TIFF_DIRECTORY_ROOT);
+
+ public static final TagInfo TIFF_TAG_BITS_PER_SAMPLE = new TagInfo(
+ "Bits Per Sample", 0x102, FIELD_TYPE_DESCRIPTION_SHORT, -1,
+ TIFF_DIRECTORY_ROOT);
+
+ public static final TagInfo TIFF_TAG_COMPRESSION = new TagInfo(
+ "Compression", 0x103, FIELD_TYPE_DESCRIPTION_SHORT, 1,
+ TIFF_DIRECTORY_ROOT);
+
+ public static final TagInfo TIFF_TAG_PHOTOMETRIC_INTERPRETATION = new TagInfo(
+ "Photometric Interpretation", 0x106, FIELD_TYPE_DESCRIPTION_SHORT,
+ 1, TIFF_DIRECTORY_ROOT);
+
+ public static final TagInfo TIFF_TAG_THRESHHOLDING = new TagInfo(
+ "Threshholding", 0x107, FIELD_TYPE_DESCRIPTION_SHORT, 1,
+ TIFF_DIRECTORY_ROOT);
+
+ public static final TagInfo TIFF_TAG_CELL_WIDTH = new TagInfo("Cell Width",
+ 0x108, FIELD_TYPE_DESCRIPTION_SHORT, 1, TIFF_DIRECTORY_ROOT);
+
+ public static final TagInfo TIFF_TAG_CELL_LENGTH = new TagInfo(
+ "Cell Length", 0x109, FIELD_TYPE_DESCRIPTION_SHORT, 1,
+ TIFF_DIRECTORY_ROOT);
+
+ public static final TagInfo TIFF_TAG_FILL_ORDER = new TagInfo("Fill Order",
+ 0x10A, FIELD_TYPE_DESCRIPTION_SHORT, 1, TIFF_DIRECTORY_ROOT);
+
+ public static final TagInfo TIFF_TAG_DOCUMENT_NAME = new TagInfo(
+ "Document Name", 0x10D, FIELD_TYPE_DESCRIPTION_ASCII, -1,
+ TIFF_DIRECTORY_ROOT);
+
+ public static final TagInfo TIFF_TAG_IMAGE_DESCRIPTION = new TagInfo(
+ "Image Description", 0x10E, FIELD_TYPE_DESCRIPTION_ASCII, -1,
+ TIFF_DIRECTORY_ROOT);
+
+ public static final TagInfo TIFF_TAG_MAKE = new TagInfo("Make", 0x10F,
+ FIELD_TYPE_DESCRIPTION_ASCII, -1, TIFF_DIRECTORY_ROOT);
+
+ public static final TagInfo TIFF_TAG_MODEL = new TagInfo("Model", 0x110,
+ FIELD_TYPE_DESCRIPTION_ASCII, -1, TIFF_DIRECTORY_ROOT);
+
+ public static final TagInfo TIFF_TAG_STRIP_OFFSETS = new TagInfo.Offset(
+ "Strip Offsets", 0x111, FIELD_TYPE_DESCRIPTION_SHORT_OR_LONG, -1,
+ TIFF_DIRECTORY_ROOT);
+
+ public static final TagInfo TIFF_TAG_ORIENTATION = new TagInfo(
+ "Orientation", 0x112, FIELD_TYPE_DESCRIPTION_SHORT, 1,
+ TIFF_DIRECTORY_ROOT);
+
+ public static final TagInfo TIFF_TAG_SAMPLES_PER_PIXEL = new TagInfo(
+ "Samples Per Pixel", 0x115, FIELD_TYPE_DESCRIPTION_SHORT, 1,
+ TIFF_DIRECTORY_ROOT);
+
+ public static final TagInfo TIFF_TAG_ROWS_PER_STRIP = new TagInfo(
+ "Rows Per Strip", 0x116, FIELD_TYPE_DESCRIPTION_SHORT_OR_LONG, 1,
+ TIFF_DIRECTORY_ROOT);
+
+ public static final TagInfo TIFF_TAG_STRIP_BYTE_COUNTS = new TagInfo(
+ "Strip Byte Counts", 0x117, FIELD_TYPE_DESCRIPTION_LONG_OR_SHORT,
+ -1, TIFF_DIRECTORY_ROOT);
+
+ public static final TagInfo TIFF_TAG_MIN_SAMPLE_VALUE = new TagInfo(
+ "Min Sample Value", 0x118, FIELD_TYPE_DESCRIPTION_SHORT, -1,
+ TIFF_DIRECTORY_ROOT);
+
+ public static final TagInfo TIFF_TAG_MAX_SAMPLE_VALUE = new TagInfo(
+ "Max Sample Value", 0x119, FIELD_TYPE_DESCRIPTION_SHORT, -1,
+ TIFF_DIRECTORY_ROOT);
+
+ public static final TagInfo TIFF_TAG_XRESOLUTION = new TagInfo(
+ "XResolution", 0x11A, FIELD_TYPE_DESCRIPTION_RATIONAL, 1,
+ TIFF_DIRECTORY_ROOT);
+
+ public static final TagInfo TIFF_TAG_YRESOLUTION = new TagInfo(
+ "YResolution", 0x11B, FIELD_TYPE_DESCRIPTION_RATIONAL, 1,
+ TIFF_DIRECTORY_ROOT);
+
+ public static final TagInfo TIFF_TAG_PLANAR_CONFIGURATION = new TagInfo(
+ "Planar Configuration", 0x11C, FIELD_TYPE_DESCRIPTION_SHORT, 1,
+ TIFF_DIRECTORY_ROOT);
+
+ public static final TagInfo TIFF_TAG_PAGE_NAME = new TagInfo("Page Name",
+ 0x11D, FIELD_TYPE_DESCRIPTION_ASCII, -1, TIFF_DIRECTORY_ROOT);
+
+ public static final TagInfo TIFF_TAG_XPOSITION = new TagInfo("XPosition",
+ 0x11E, FIELD_TYPE_DESCRIPTION_RATIONAL, -1, TIFF_DIRECTORY_ROOT);
+
+ public static final TagInfo TIFF_TAG_YPOSITION = new TagInfo("YPosition",
+ 0x11F, FIELD_TYPE_DESCRIPTION_RATIONAL, -1, TIFF_DIRECTORY_ROOT);
+
+ public static final TagInfo TIFF_TAG_FREE_OFFSETS = new TagInfo(
+ "Free Offsets", 0x120, FIELD_TYPE_DESCRIPTION_LONG, -1,
+ TIFF_DIRECTORY_ROOT);
+
+ public static final TagInfo TIFF_TAG_FREE_BYTE_COUNTS = new TagInfo(
+ "Free Byte Counts", 0x121, FIELD_TYPE_DESCRIPTION_LONG, -1,
+ TIFF_DIRECTORY_ROOT);
+
+ public static final TagInfo TIFF_TAG_GRAY_RESPONSE_UNIT = new TagInfo(
+ "Gray Response Unit", 0x122, FIELD_TYPE_DESCRIPTION_SHORT, 1,
+ TIFF_DIRECTORY_ROOT);
+
+ public static final TagInfo TIFF_TAG_GRAY_RESPONSE_CURVE = new TagInfo(
+ "Gray Response Curve", 0x123, FIELD_TYPE_DESCRIPTION_SHORT, -1,
+ TIFF_DIRECTORY_ROOT);
+
+ public static final TagInfo TIFF_TAG_T4_OPTIONS = new TagInfo("T4 Options",
+ 0x124, FIELD_TYPE_DESCRIPTION_LONG, 1, TIFF_DIRECTORY_ROOT);
+
+ public static final TagInfo TIFF_TAG_T6_OPTIONS = new TagInfo("T6 Options",
+ 0x125, FIELD_TYPE_DESCRIPTION_LONG, 1, TIFF_DIRECTORY_ROOT);
+
+ public static final TagInfo TIFF_TAG_RESOLUTION_UNIT = new TagInfo(
+ "Resolution Unit", 0x128, FIELD_TYPE_DESCRIPTION_SHORT, 1,
+ TIFF_DIRECTORY_ROOT);
+
+ public static final TagInfo TIFF_TAG_PAGE_NUMBER = new TagInfo(
+ "Page Number", 0x129, FIELD_TYPE_DESCRIPTION_SHORT, 2,
+ TIFF_DIRECTORY_ROOT);
+
+ public static final TagInfo TIFF_TAG_TRANSFER_FUNCTION = new TagInfo(
+ "Transfer Function", 0x12D, FIELD_TYPE_DESCRIPTION_SHORT, -1,
+ TIFF_DIRECTORY_ROOT);
+
+ public static final TagInfo TIFF_TAG_SOFTWARE = new TagInfo("Software",
+ 0x131, FIELD_TYPE_DESCRIPTION_ASCII, -1, TIFF_DIRECTORY_ROOT);
+
+ public static final TagInfo TIFF_TAG_DATE_TIME = new TagInfo("Date Time",
+ 0x132, FIELD_TYPE_DESCRIPTION_ASCII, 20, TIFF_DIRECTORY_ROOT);
+
+ public static final TagInfo TIFF_TAG_ARTIST = new TagInfo("Artist", 0x13B,
+ FIELD_TYPE_DESCRIPTION_ASCII, -1, TIFF_DIRECTORY_ROOT);
+
+ public static final TagInfo TIFF_TAG_HOST_COMPUTER = new TagInfo(
+ "Host Computer", 0x13C, FIELD_TYPE_DESCRIPTION_ASCII, -1,
+ TIFF_DIRECTORY_ROOT);
+
+ public static final TagInfo TIFF_TAG_PREDICTOR = new TagInfo("Predictor",
+ 0x13D, FIELD_TYPE_DESCRIPTION_SHORT, 1, TIFF_DIRECTORY_ROOT);
+
+ public static final TagInfo TIFF_TAG_WHITE_POINT = new TagInfo(
+ "White Point", 0x13E, FIELD_TYPE_DESCRIPTION_RATIONAL, 2,
+ TIFF_DIRECTORY_ROOT);
+
+ public static final TagInfo TIFF_TAG_PRIMARY_CHROMATICITIES = new TagInfo(
+ "Primary Chromaticities", 0x13F, FIELD_TYPE_DESCRIPTION_RATIONAL,
+ 6, TIFF_DIRECTORY_ROOT);
+
+ public static final TagInfo TIFF_TAG_COLOR_MAP = new TagInfo("Color Map",
+ 0x140, FIELD_TYPE_DESCRIPTION_SHORT, -1, TIFF_DIRECTORY_ROOT);
+
+ public static final TagInfo TIFF_TAG_HALFTONE_HINTS = new TagInfo(
+ "Halftone Hints", 0x141, FIELD_TYPE_DESCRIPTION_SHORT, 2,
+ TIFF_DIRECTORY_ROOT);
+
+ public static final TagInfo TIFF_TAG_TILE_WIDTH = new TagInfo("Tile Width",
+ 0x142, FIELD_TYPE_DESCRIPTION_SHORT_OR_LONG, 1, TIFF_DIRECTORY_ROOT);
+
+ public static final TagInfo TIFF_TAG_TILE_LENGTH = new TagInfo(
+ "Tile Length", 0x143, FIELD_TYPE_DESCRIPTION_SHORT_OR_LONG, 1,
+ TIFF_DIRECTORY_ROOT);
+
+ public static final TagInfo TIFF_TAG_TILE_OFFSETS = new TagInfo.Offset(
+ "Tile Offsets", 0x144, FIELD_TYPE_DESCRIPTION_LONG, -1,
+ TIFF_DIRECTORY_ROOT);
+
+ public static final TagInfo TIFF_TAG_TILE_BYTE_COUNTS = new TagInfo(
+ "Tile Byte Counts", 0x145, FIELD_TYPE_DESCRIPTION_SHORT_OR_LONG,
+ -1, TIFF_DIRECTORY_ROOT);
+
+ public static final TagInfo TIFF_TAG_INK_SET = new TagInfo("Ink Set",
+ 0x14C, FIELD_TYPE_DESCRIPTION_SHORT, 1, TIFF_DIRECTORY_ROOT);
+
+ public static final TagInfo TIFF_TAG_INK_NAMES = new TagInfo("Ink Names",
+ 0x14D, FIELD_TYPE_DESCRIPTION_ASCII, -1, TIFF_DIRECTORY_ROOT);
+
+ public static final TagInfo TIFF_TAG_NUMBER_OF_INKS = new TagInfo(
+ "Number Of Inks", 0x14E, FIELD_TYPE_DESCRIPTION_SHORT, 1,
+ TIFF_DIRECTORY_ROOT);
+
+ public static final TagInfo TIFF_TAG_DOT_RANGE = new TagInfo("Dot Range",
+ 0x150, FIELD_TYPE_DESCRIPTION_BYTE_OR_SHORT, -1,
+ TIFF_DIRECTORY_ROOT);
+
+ public static final TagInfo TIFF_TAG_TARGET_PRINTER = new TagInfo(
+ "Target Printer", 0x151, FIELD_TYPE_DESCRIPTION_ASCII, -1,
+ TIFF_DIRECTORY_ROOT);
+
+ public static final TagInfo TIFF_TAG_EXTRA_SAMPLES = new TagInfo(
+ "Extra Samples", 0x152, FIELD_TYPE_DESCRIPTION_BYTE, -1,
+ TIFF_DIRECTORY_ROOT);
+
+ public static final TagInfo TIFF_TAG_SAMPLE_FORMAT = new TagInfo(
+ "Sample Format", 0x153, FIELD_TYPE_DESCRIPTION_SHORT, -1,
+ TIFF_DIRECTORY_ROOT);
+
+ public static final TagInfo TIFF_TAG_SMIN_SAMPLE_VALUE = new TagInfo(
+ "SMin Sample Value", 0x154, FIELD_TYPE_DESCRIPTION_ANY, -1,
+ TIFF_DIRECTORY_ROOT);
+
+ public static final TagInfo TIFF_TAG_SMAX_SAMPLE_VALUE = new TagInfo(
+ "SMax Sample Value", 0x155, FIELD_TYPE_DESCRIPTION_ANY, -1,
+ TIFF_DIRECTORY_ROOT);
+
+ public static final TagInfo TIFF_TAG_TRANSFER_RANGE = new TagInfo(
+ "Transfer Range", 0x156, FIELD_TYPE_DESCRIPTION_SHORT, 6,
+ TIFF_DIRECTORY_ROOT);
+
+ public static final TagInfo TIFF_TAG_JPEG_PROC = new TagInfo("JPEGProc",
+ 0x200, FIELD_TYPE_DESCRIPTION_SHORT, 1, TIFF_DIRECTORY_ROOT);
+
+ public static final TagInfo TIFF_TAG_JPEG_INTERCHANGE_FORMAT = new TagInfo.Offset(
+ "JPEGInterchange Format", 0x201, FIELD_TYPE_DESCRIPTION_LONG, 1,
+ TIFF_DIRECTORY_ROOT);
+
+ public static final TagInfo TIFF_TAG_JPEG_INTERCHANGE_FORMAT_LENGTH = new TagInfo(
+ "JPEGInterchange Format Length", 0x202,
+ FIELD_TYPE_DESCRIPTION_LONG, 1, TIFF_DIRECTORY_ROOT);
+
+ public static final TagInfo TIFF_TAG_JPEG_RESTART_INTERVAL = new TagInfo(
+ "JPEGRestart Interval", 0x203, FIELD_TYPE_DESCRIPTION_SHORT, 1,
+ TIFF_DIRECTORY_ROOT);
+
+ public static final TagInfo TIFF_TAG_JPEG_LOSSLESS_PREDICTORS = new TagInfo(
+ "JPEGLossless Predictors", 0x205, FIELD_TYPE_DESCRIPTION_SHORT, -1,
+ TIFF_DIRECTORY_ROOT);
+
+ public static final TagInfo TIFF_TAG_JPEG_POINT_TRANSFORMS = new TagInfo(
+ "JPEGPoint Transforms", 0x206, FIELD_TYPE_DESCRIPTION_SHORT, -1,
+ TIFF_DIRECTORY_ROOT);
+
+ public static final TagInfo TIFF_TAG_JPEG_QTABLES = new TagInfo(
+ "JPEGQTables", 0x207, FIELD_TYPE_DESCRIPTION_LONG, -1,
+ TIFF_DIRECTORY_ROOT);
+
+ public static final TagInfo TIFF_TAG_JPEG_DCTABLES = new TagInfo(
+ "JPEGDCTables", 0x208, FIELD_TYPE_DESCRIPTION_LONG, -1,
+ TIFF_DIRECTORY_ROOT);
+
+ public static final TagInfo TIFF_TAG_JPEG_ACTABLES = new TagInfo(
+ "JPEGACTables", 0x209, FIELD_TYPE_DESCRIPTION_LONG, -1,
+ TIFF_DIRECTORY_ROOT);
+
+ public static final TagInfo TIFF_TAG_YCBCR_COEFFICIENTS = new TagInfo(
+ "YCbCr Coefficients", 0x211, FIELD_TYPE_DESCRIPTION_RATIONAL, 3,
+ TIFF_DIRECTORY_ROOT);
+
+ public static final TagInfo TIFF_TAG_YCBCR_SUB_SAMPLING = new TagInfo(
+ "YCbCr Sub Sampling", 0x212, FIELD_TYPE_DESCRIPTION_SHORT, 2,
+ TIFF_DIRECTORY_ROOT);
+
+ public static final TagInfo TIFF_TAG_YCBCR_POSITIONING = new TagInfo(
+ "YCbCr Positioning", 0x213, FIELD_TYPE_DESCRIPTION_SHORT, 1,
+ TIFF_DIRECTORY_ROOT);
+
+ public static final TagInfo TIFF_TAG_REFERENCE_BLACK_WHITE = new TagInfo(
+ "Reference Black White", 0x214, FIELD_TYPE_DESCRIPTION_LONG, -1,
+ TIFF_DIRECTORY_ROOT);
+
+ public static final TagInfo TIFF_TAG_COPYRIGHT = new TagInfo("Copyright",
+ 0x8298, FIELD_TYPE_DESCRIPTION_ASCII, -1, TIFF_DIRECTORY_ROOT);
+
+ public static final TagInfo TIFF_TAG_XMP = new TagInfo("XMP",
+ 0x2BC, FIELD_TYPE_DESCRIPTION_BYTE, -1, TIFF_DIRECTORY_ROOT);
+
+ // TODO:
+ // public static final TagInfo2 TIFF_TAG_UNKNOWN = null;
+ public static final TagInfo TIFF_TAG_UNKNOWN = new TagInfo.Unknown(
+ "Unknown Tag", -1, FIELD_TYPE_DESCRIPTION_UNKNOWN,
+ TagInfo.LENGTH_UNKNOWN, EXIF_DIRECTORY_UNKNOWN);
+
+ public static final TagInfo ALL_TIFF_TAGS[] = {
+ TIFF_TAG_NEW_SUBFILE_TYPE, TIFF_TAG_SUBFILE_TYPE,
+ TIFF_TAG_IMAGE_WIDTH, TIFF_TAG_IMAGE_LENGTH,
+ TIFF_TAG_BITS_PER_SAMPLE, TIFF_TAG_COMPRESSION,
+ TIFF_TAG_PHOTOMETRIC_INTERPRETATION, TIFF_TAG_THRESHHOLDING,
+ TIFF_TAG_CELL_WIDTH, TIFF_TAG_CELL_LENGTH, TIFF_TAG_FILL_ORDER,
+ TIFF_TAG_DOCUMENT_NAME, TIFF_TAG_IMAGE_DESCRIPTION, TIFF_TAG_MAKE,
+ TIFF_TAG_MODEL, TIFF_TAG_STRIP_OFFSETS, TIFF_TAG_ORIENTATION,
+ TIFF_TAG_SAMPLES_PER_PIXEL, TIFF_TAG_ROWS_PER_STRIP,
+ TIFF_TAG_STRIP_BYTE_COUNTS, TIFF_TAG_MIN_SAMPLE_VALUE,
+ TIFF_TAG_MAX_SAMPLE_VALUE, TIFF_TAG_XRESOLUTION,
+ TIFF_TAG_YRESOLUTION, TIFF_TAG_PLANAR_CONFIGURATION,
+ TIFF_TAG_PAGE_NAME, TIFF_TAG_XPOSITION, TIFF_TAG_YPOSITION,
+ TIFF_TAG_FREE_OFFSETS, TIFF_TAG_FREE_BYTE_COUNTS,
+ TIFF_TAG_GRAY_RESPONSE_UNIT, TIFF_TAG_GRAY_RESPONSE_CURVE,
+ TIFF_TAG_T4_OPTIONS, TIFF_TAG_T6_OPTIONS, TIFF_TAG_RESOLUTION_UNIT,
+ TIFF_TAG_PAGE_NUMBER, TIFF_TAG_TRANSFER_FUNCTION,
+ TIFF_TAG_SOFTWARE, TIFF_TAG_DATE_TIME, TIFF_TAG_ARTIST,
+ TIFF_TAG_HOST_COMPUTER, TIFF_TAG_PREDICTOR, TIFF_TAG_WHITE_POINT,
+ TIFF_TAG_PRIMARY_CHROMATICITIES, TIFF_TAG_COLOR_MAP,
+ TIFF_TAG_HALFTONE_HINTS, TIFF_TAG_TILE_WIDTH, TIFF_TAG_TILE_LENGTH,
+ TIFF_TAG_TILE_OFFSETS, TIFF_TAG_TILE_BYTE_COUNTS, TIFF_TAG_INK_SET,
+ TIFF_TAG_INK_NAMES, TIFF_TAG_NUMBER_OF_INKS, TIFF_TAG_DOT_RANGE,
+ TIFF_TAG_TARGET_PRINTER, TIFF_TAG_EXTRA_SAMPLES,
+ TIFF_TAG_SAMPLE_FORMAT, TIFF_TAG_SMIN_SAMPLE_VALUE,
+ TIFF_TAG_SMAX_SAMPLE_VALUE, TIFF_TAG_TRANSFER_RANGE,
+ TIFF_TAG_JPEG_PROC, TIFF_TAG_JPEG_INTERCHANGE_FORMAT,
+ TIFF_TAG_JPEG_INTERCHANGE_FORMAT_LENGTH,
+ TIFF_TAG_JPEG_RESTART_INTERVAL, TIFF_TAG_JPEG_LOSSLESS_PREDICTORS,
+ TIFF_TAG_JPEG_POINT_TRANSFORMS, TIFF_TAG_JPEG_QTABLES,
+ TIFF_TAG_JPEG_DCTABLES, TIFF_TAG_JPEG_ACTABLES,
+ TIFF_TAG_YCBCR_COEFFICIENTS, TIFF_TAG_YCBCR_SUB_SAMPLING,
+ TIFF_TAG_YCBCR_POSITIONING, TIFF_TAG_REFERENCE_BLACK_WHITE,
+ TIFF_TAG_COPYRIGHT,
+ //
+ TIFF_TAG_XMP,
+ };
}
\ No newline at end of file
Modified: commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/formats/tiff/datareaders/DataReader.java
URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/formats/tiff/datareaders/DataReader.java?rev=995859&r1=995858&r2=995859&view=diff
==============================================================================
--- commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/formats/tiff/datareaders/DataReader.java (original)
+++ commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/formats/tiff/datareaders/DataReader.java Fri Sep 10 16:33:35 2010
@@ -31,110 +31,110 @@ import org.apache.sanselan.formats.tiff.
public abstract class DataReader implements TiffConstants, BinaryConstants
{
- protected final PhotometricInterpreter photometricInterpreter;
- protected final int bitsPerSample[];
- protected final int last[];
-
- protected final int predictor;
- protected final int samplesPerPixel;
-
- public DataReader(PhotometricInterpreter photometricInterpreter,
- int bitsPerSample[], int predictor, int samplesPerPixel)
- {
- this.photometricInterpreter = photometricInterpreter;
- this.bitsPerSample = bitsPerSample;
- this.samplesPerPixel = samplesPerPixel;
- this.predictor = predictor;
- last = new int[samplesPerPixel];
- }
-
- // public abstract void readImageData(BufferedImage bi, ByteSource byteSource)
- public abstract void readImageData(BufferedImage bi)
- throws ImageReadException, IOException;
-
- protected int[] getSamplesAsBytes(BitInputStream bis)
- throws ImageReadException, IOException
- {
- int result[] = new int[bitsPerSample.length];
- for (int i = 0; i < bitsPerSample.length; i++)
- {
- int bits = bitsPerSample[i];
- int sample = bis.readBits(bits);
- if (bits < 8)
- {
- int sign = sample & 1;
- sample = sample << (8 - bits); // scale to byte.
- if (sign > 0)
- sample = sample | ((1 << (8 - bits)) - 1); // extend to byte
- }
- else if (bits > 8)
- {
- sample = sample >> (bits - 8); // extend to byte.
- }
- result[i] = sample;
- }
-
- return result;
- }
-
- protected int[] applyPredictor(int samples[], int x)
- {
- if (predictor == 2) // Horizontal differencing.
- {
- for (int i = 0; i < samples.length; i++)
- {
- if (x > 0)
- {
- samples[i] = 0xff & (samples[i] + last[i]);
- }
- last[i] = samples[i];
- }
- }
-
- return samples;
- }
-
- private int count = 0;
-
- protected byte[] decompress(byte compressed[], int compression,
- int expected_size) throws ImageReadException, IOException
- {
- switch (compression)
- {
- case 1 : // None;
- return compressed;
- case 2 : // CCITT Group 3 1-Dimensional Modified Huffman run-length encoding.
- throw new ImageReadException("Tiff: unknown compression: "
- + compression);
- case TIFF_COMPRESSION_LZW : // LZW
- {
- InputStream is = new ByteArrayInputStream(compressed);
-
- int LZWMinimumCodeSize = 8;
-
- MyLZWDecompressor myLzwDecompressor = new MyLZWDecompressor(
- LZWMinimumCodeSize, BYTE_ORDER_NETWORK);
-
- myLzwDecompressor.setTiffLZWMode();
-
- byte[] result = myLzwDecompressor.decompress(is, expected_size);
-
- return result;
- }
-
- case TIFF_COMPRESSION_PACKBITS : // Packbits
- {
- byte unpacked[] = new PackBits().decompress(compressed,
- expected_size);
- count++;
-
- return unpacked;
- }
-
- default :
- throw new ImageReadException("Tiff: unknown compression: "
- + compression);
- }
- }
+ protected final PhotometricInterpreter photometricInterpreter;
+ protected final int bitsPerSample[];
+ protected final int last[];
+
+ protected final int predictor;
+ protected final int samplesPerPixel;
+
+ public DataReader(PhotometricInterpreter photometricInterpreter,
+ int bitsPerSample[], int predictor, int samplesPerPixel)
+ {
+ this.photometricInterpreter = photometricInterpreter;
+ this.bitsPerSample = bitsPerSample;
+ this.samplesPerPixel = samplesPerPixel;
+ this.predictor = predictor;
+ last = new int[samplesPerPixel];
+ }
+
+ // public abstract void readImageData(BufferedImage bi, ByteSource byteSource)
+ public abstract void readImageData(BufferedImage bi)
+ throws ImageReadException, IOException;
+
+ protected int[] getSamplesAsBytes(BitInputStream bis)
+ throws ImageReadException, IOException
+ {
+ int result[] = new int[bitsPerSample.length];
+ for (int i = 0; i < bitsPerSample.length; i++)
+ {
+ int bits = bitsPerSample[i];
+ int sample = bis.readBits(bits);
+ if (bits < 8)
+ {
+ int sign = sample & 1;
+ sample = sample << (8 - bits); // scale to byte.
+ if (sign > 0)
+ sample = sample | ((1 << (8 - bits)) - 1); // extend to byte
+ }
+ else if (bits > 8)
+ {
+ sample = sample >> (bits - 8); // extend to byte.
+ }
+ result[i] = sample;
+ }
+
+ return result;
+ }
+
+ protected int[] applyPredictor(int samples[], int x)
+ {
+ if (predictor == 2) // Horizontal differencing.
+ {
+ for (int i = 0; i < samples.length; i++)
+ {
+ if (x > 0)
+ {
+ samples[i] = 0xff & (samples[i] + last[i]);
+ }
+ last[i] = samples[i];
+ }
+ }
+
+ return samples;
+ }
+
+ private int count = 0;
+
+ protected byte[] decompress(byte compressed[], int compression,
+ int expected_size) throws ImageReadException, IOException
+ {
+ switch (compression)
+ {
+ case 1 : // None;
+ return compressed;
+ case 2 : // CCITT Group 3 1-Dimensional Modified Huffman run-length encoding.
+ throw new ImageReadException("Tiff: unknown compression: "
+ + compression);
+ case TIFF_COMPRESSION_LZW : // LZW
+ {
+ InputStream is = new ByteArrayInputStream(compressed);
+
+ int LZWMinimumCodeSize = 8;
+
+ MyLZWDecompressor myLzwDecompressor = new MyLZWDecompressor(
+ LZWMinimumCodeSize, BYTE_ORDER_NETWORK);
+
+ myLzwDecompressor.setTiffLZWMode();
+
+ byte[] result = myLzwDecompressor.decompress(is, expected_size);
+
+ return result;
+ }
+
+ case TIFF_COMPRESSION_PACKBITS : // Packbits
+ {
+ byte unpacked[] = new PackBits().decompress(compressed,
+ expected_size);
+ count++;
+
+ return unpacked;
+ }
+
+ default :
+ throw new ImageReadException("Tiff: unknown compression: "
+ + compression);
+ }
+ }
}
\ No newline at end of file
Modified: commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/formats/tiff/datareaders/DataReaderStrips.java
URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/formats/tiff/datareaders/DataReaderStrips.java?rev=995859&r1=995858&r2=995859&view=diff
==============================================================================
--- commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/formats/tiff/datareaders/DataReaderStrips.java (original)
+++ commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/formats/tiff/datareaders/DataReaderStrips.java Fri Sep 10 16:33:35 2010
@@ -28,77 +28,77 @@ import org.apache.sanselan.formats.tiff.
public final class DataReaderStrips extends DataReader
{
- private final int bitsPerPixel;
- private final int width, height;
- private final int compression;
- private final int rowsPerStrip;
-
- private final TiffImageData.Strips imageData;
-
- public DataReaderStrips(PhotometricInterpreter photometricInterpreter,
- int bitsPerPixel, int bitsPerSample[], int predictor,
- int samplesPerPixel, int width, int height, int compression,
- int rowsPerStrip, TiffImageData.Strips imageData)
- {
- super(photometricInterpreter, bitsPerSample, predictor, samplesPerPixel);
-
- this.bitsPerPixel = bitsPerPixel;
- this.width = width;
- this.height = height;
- this.compression = compression;
- this.rowsPerStrip = rowsPerStrip;
- this.imageData = imageData;
- }
-
- private void interpretStrip(BufferedImage bi, byte bytes[],
- int pixels_per_strip) throws ImageReadException, IOException
- {
- ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
- BitInputStream bis = new BitInputStream(bais);
-
- for (int i = 0; i < pixels_per_strip; i++)
- {
- int samples[] = getSamplesAsBytes(bis);
-
- if ((x < width) && (y < height))
- {
- samples = applyPredictor(samples, x);
-
- photometricInterpreter.interpretPixel(bi, samples, x, y);
- }
-
- x++;
- if (x >= width)
- {
- x = 0;
- y++;
- bis.flushCache();
- if (y >= height)
- break;
- }
- }
- }
-
- private int x = 0, y = 0;
-
- public void readImageData(BufferedImage bi) throws ImageReadException,
- IOException
- {
- for (int strip = 0; strip < imageData.strips.length; strip++)
- {
- int rowsRemaining = height - (strip * rowsPerStrip);
- int rowsInThisStrip = Math.min(rowsRemaining, rowsPerStrip);
- int pixelsPerStrip = rowsInThisStrip * width;
- int bytesPerStrip = ((pixelsPerStrip * bitsPerPixel) + 7) / 8;
-
- byte compressed[] = imageData.strips[strip].data;
+ private final int bitsPerPixel;
+ private final int width, height;
+ private final int compression;
+ private final int rowsPerStrip;
+
+ private final TiffImageData.Strips imageData;
+
+ public DataReaderStrips(PhotometricInterpreter photometricInterpreter,
+ int bitsPerPixel, int bitsPerSample[], int predictor,
+ int samplesPerPixel, int width, int height, int compression,
+ int rowsPerStrip, TiffImageData.Strips imageData)
+ {
+ super(photometricInterpreter, bitsPerSample, predictor, samplesPerPixel);
+
+ this.bitsPerPixel = bitsPerPixel;
+ this.width = width;
+ this.height = height;
+ this.compression = compression;
+ this.rowsPerStrip = rowsPerStrip;
+ this.imageData = imageData;
+ }
+
+ private void interpretStrip(BufferedImage bi, byte bytes[],
+ int pixels_per_strip) throws ImageReadException, IOException
+ {
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
+ BitInputStream bis = new BitInputStream(bais);
+
+ for (int i = 0; i < pixels_per_strip; i++)
+ {
+ int samples[] = getSamplesAsBytes(bis);
+
+ if ((x < width) && (y < height))
+ {
+ samples = applyPredictor(samples, x);
+
+ photometricInterpreter.interpretPixel(bi, samples, x, y);
+ }
+
+ x++;
+ if (x >= width)
+ {
+ x = 0;
+ y++;
+ bis.flushCache();
+ if (y >= height)
+ break;
+ }
+ }
+ }
+
+ private int x = 0, y = 0;
+
+ public void readImageData(BufferedImage bi) throws ImageReadException,
+ IOException
+ {
+ for (int strip = 0; strip < imageData.strips.length; strip++)
+ {
+ int rowsRemaining = height - (strip * rowsPerStrip);
+ int rowsInThisStrip = Math.min(rowsRemaining, rowsPerStrip);
+ int pixelsPerStrip = rowsInThisStrip * width;
+ int bytesPerStrip = ((pixelsPerStrip * bitsPerPixel) + 7) / 8;
+
+ byte compressed[] = imageData.strips[strip].data;
- byte decompressed[] = decompress(compressed, compression,
- bytesPerStrip);
+ byte decompressed[] = decompress(compressed, compression,
+ bytesPerStrip);
- interpretStrip(bi, decompressed, pixelsPerStrip);
+ interpretStrip(bi, decompressed, pixelsPerStrip);
- }
- }
+ }
+ }
}
\ No newline at end of file
Modified: commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/formats/tiff/datareaders/DataReaderTiled.java
URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/formats/tiff/datareaders/DataReaderTiled.java?rev=995859&r1=995858&r2=995859&view=diff
==============================================================================
--- commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/formats/tiff/datareaders/DataReaderTiled.java (original)
+++ commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/formats/tiff/datareaders/DataReaderTiled.java Fri Sep 10 16:33:35 2010
@@ -28,99 +28,99 @@ import org.apache.sanselan.formats.tiff.
public final class DataReaderTiled extends DataReader
{
- private final int tileWidth;
- private final int tileLength;
+ private final int tileWidth;
+ private final int tileLength;
- private final int bitsPerPixel;
+ private final int bitsPerPixel;
- private final int width, height;
+ private final int width, height;
- private final int compression;
+ private final int compression;
- private final TiffImageData.Tiles imageData;
+ private final TiffImageData.Tiles imageData;
- public DataReaderTiled(PhotometricInterpreter photometricInterpreter,
- int tileWidth, int tileLength, int bitsPerPixel,
- int bitsPerSample[], int predictor, int samplesPerPixel, int width,
- int height, int compression, TiffImageData.Tiles imageData)
- {
- super(photometricInterpreter, bitsPerSample, predictor, samplesPerPixel);
+ public DataReaderTiled(PhotometricInterpreter photometricInterpreter,
+ int tileWidth, int tileLength, int bitsPerPixel,
+ int bitsPerSample[], int predictor, int samplesPerPixel, int width,
+ int height, int compression, TiffImageData.Tiles imageData)
+ {
+ super(photometricInterpreter, bitsPerSample, predictor, samplesPerPixel);
- this.tileWidth = tileWidth;
- this.tileLength = tileLength;
+ this.tileWidth = tileWidth;
+ this.tileLength = tileLength;
- this.bitsPerPixel = bitsPerPixel;
- this.width = width;
- this.height = height;
- this.compression = compression;
+ this.bitsPerPixel = bitsPerPixel;
+ this.width = width;
+ this.height = height;
+ this.compression = compression;
- this.imageData = imageData;
- }
+ this.imageData = imageData;
+ }
- private void interpretTile(BufferedImage bi, byte bytes[], int startX,
- int startY) throws ImageReadException, IOException
- {
- ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
- BitInputStream bis = new BitInputStream(bais);
+ private void interpretTile(BufferedImage bi, byte bytes[], int startX,
+ int startY) throws ImageReadException, IOException
+ {
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
+ BitInputStream bis = new BitInputStream(bais);
- int pixelsPerTile = tileWidth * tileLength;
+ int pixelsPerTile = tileWidth * tileLength;
- int tileX = 0, tileY = 0;
+ int tileX = 0, tileY = 0;
- for (int i = 0; i < pixelsPerTile; i++)
- {
+ for (int i = 0; i < pixelsPerTile; i++)
+ {
- int x = tileX + startX;
- int y = tileY + startY;
+ int x = tileX + startX;
+ int y = tileY + startY;
- int samples[] = getSamplesAsBytes(bis);
+ int samples[] = getSamplesAsBytes(bis);
- if ((x < width) && (y < height))
- {
- samples = applyPredictor(samples, x);
- photometricInterpreter.interpretPixel(bi, samples, x, y);
- }
+ if ((x < width) && (y < height))
+ {
+ samples = applyPredictor(samples, x);
+ photometricInterpreter.interpretPixel(bi, samples, x, y);
+ }
- tileX++;
+ tileX++;
- if (tileX >= tileWidth)
- {
- tileX = 0;
- tileY++;
- bis.flushCache();
- if (tileY >= tileLength)
- break;
- }
+ if (tileX >= tileWidth)
+ {
+ tileX = 0;
+ tileY++;
+ bis.flushCache();
+ if (tileY >= tileLength)
+ break;
+ }
- }
- }
+ }
+ }
- public void readImageData(BufferedImage bi) throws ImageReadException,
- IOException
- {
- int bitsPerRow = tileWidth * bitsPerPixel;
- int bytesPerRow = (bitsPerRow + 7) / 8;
- int bytesPerTile = bytesPerRow * tileLength;
- int x = 0, y = 0;
+ public void readImageData(BufferedImage bi) throws ImageReadException,
+ IOException
+ {
+ int bitsPerRow = tileWidth * bitsPerPixel;
+ int bytesPerRow = (bitsPerRow + 7) / 8;
+ int bytesPerTile = bytesPerRow * tileLength;
+ int x = 0, y = 0;
- for (int tile = 0; tile < imageData.tiles.length; tile++)
- {
- byte compressed[] = imageData.tiles[tile].data;
+ for (int tile = 0; tile < imageData.tiles.length; tile++)
+ {
+ byte compressed[] = imageData.tiles[tile].data;
- byte decompressed[] = decompress(compressed, compression,
- bytesPerTile);
+ byte decompressed[] = decompress(compressed, compression,
+ bytesPerTile);
- interpretTile(bi, decompressed, x, y);
+ interpretTile(bi, decompressed, x, y);
- x += tileWidth;
- if (x >= width)
- {
- x = 0;
- y += tileLength;
- if (y >= height)
- break;
- }
+ x += tileWidth;
+ if (x >= width)
+ {
+ x = 0;
+ y += tileLength;
+ if (y >= height)
+ break;
+ }
- }
- }
+ }
+ }
}
Modified: commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/formats/tiff/fieldtypes/FieldType.java
URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/formats/tiff/fieldtypes/FieldType.java?rev=995859&r1=995858&r2=995859&view=diff
==============================================================================
--- commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/formats/tiff/fieldtypes/FieldType.java (original)
+++ commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/formats/tiff/fieldtypes/FieldType.java Fri Sep 10 16:33:35 2010
@@ -23,91 +23,91 @@ import org.apache.sanselan.formats.tiff.
import org.apache.sanselan.formats.tiff.constants.TiffConstants;
public abstract class FieldType extends BinaryFileFunctions implements
- TiffConstants
+ TiffConstants
{
- public final int type, length;
- public final String name;
+ public final int type, length;
+ public final String name;
- public FieldType(int type, int length, String name)
- {
- this.type = type;
- this.length = length;
- this.name = name;
- }
-
- public boolean isLocalValue(TiffField entry)
- {
- return ((length > 0) && ((length * entry.length) <= TIFF_ENTRY_MAX_VALUE_LENGTH));
- }
-
- public int getBytesLength(TiffField entry) throws ImageReadException
- {
- if (length < 1)
- throw new ImageReadException("Unknown field type");
-
- return length * entry.length;
- }
-
- // public static final byte[] STUB_LOCAL_VALUE = new
- // byte[TIFF_ENTRY_MAX_VALUE_LENGTH];
-
- public static final byte[] getStubLocalValue()
- {
- return new byte[TIFF_ENTRY_MAX_VALUE_LENGTH];
- }
-
- public final byte[] getStubValue(int count)
- {
- return new byte[count * length];
- }
-
- public String getDisplayValue(TiffField entry) throws ImageReadException
- {
- Object o = getSimpleValue(entry);
- if (o == null)
- return "NULL";
- return o.toString();
- }
-
- public final byte[] getRawBytes(TiffField entry)
- {
- if (isLocalValue(entry))
- {
- int rawLength = length * entry.length;
- byte result[] = new byte[rawLength];
- System.arraycopy(entry.valueOffsetBytes, 0, result, 0, rawLength);
- return result;
-// return readBytearray(name, entry.valueOffsetBytes, 0, length
-// * entry.length);
- // return getBytearrayHead(name + " (" + entry.tagInfo.name + ")",
- // entry.valueOffsetBytes, length * entry.length);
- }
-
- return entry.oversizeValue;
- }
-
- public abstract Object getSimpleValue(TiffField entry)
- throws ImageReadException;
-
- // public final Object getSimpleValue(TiffField entry)
- // {
- // Object array[] = getValueArray(entry);
- // if (null == array)
- // return null;
- // if (array.length == 1)
- // return array[0];
- // return array;
- // }
- //
- // public abstract Object[] getValueArray(TiffField entry);
-
- public String toString()
- {
- return "[" + getClass().getName() + ". type: " + type + ", name: "
- + name + ", length: " + length + "]";
- }
+ public FieldType(int type, int length, String name)
+ {
+ this.type = type;
+ this.length = length;
+ this.name = name;
+ }
+
+ public boolean isLocalValue(TiffField entry)
+ {
+ return ((length > 0) && ((length * entry.length) <= TIFF_ENTRY_MAX_VALUE_LENGTH));
+ }
+
+ public int getBytesLength(TiffField entry) throws ImageReadException
+ {
+ if (length < 1)
+ throw new ImageReadException("Unknown field type");
+
+ return length * entry.length;
+ }
+
+ // public static final byte[] STUB_LOCAL_VALUE = new
+ // byte[TIFF_ENTRY_MAX_VALUE_LENGTH];
+
+ public static final byte[] getStubLocalValue()
+ {
+ return new byte[TIFF_ENTRY_MAX_VALUE_LENGTH];
+ }
+
+ public final byte[] getStubValue(int count)
+ {
+ return new byte[count * length];
+ }
+
+ public String getDisplayValue(TiffField entry) throws ImageReadException
+ {
+ Object o = getSimpleValue(entry);
+ if (o == null)
+ return "NULL";
+ return o.toString();
+ }
+
+ public final byte[] getRawBytes(TiffField entry)
+ {
+ if (isLocalValue(entry))
+ {
+ int rawLength = length * entry.length;
+ byte result[] = new byte[rawLength];
+ System.arraycopy(entry.valueOffsetBytes, 0, result, 0, rawLength);
+ return result;
+// return readBytearray(name, entry.valueOffsetBytes, 0, length
+// * entry.length);
+ // return getBytearrayHead(name + " (" + entry.tagInfo.name + ")",
+ // entry.valueOffsetBytes, length * entry.length);
+ }
+
+ return entry.oversizeValue;
+ }
+
+ public abstract Object getSimpleValue(TiffField entry)
+ throws ImageReadException;
+
+ // public final Object getSimpleValue(TiffField entry)
+ // {
+ // Object array[] = getValueArray(entry);
+ // if (null == array)
+ // return null;
+ // if (array.length == 1)
+ // return array[0];
+ // return array;
+ // }
+ //
+ // public abstract Object[] getValueArray(TiffField entry);
+
+ public String toString()
+ {
+ return "[" + getClass().getName() + ". type: " + type + ", name: "
+ + name + ", length: " + length + "]";
+ }
- public abstract byte[] writeData(Object o, int byteOrder)
- throws ImageWriteException;
+ public abstract byte[] writeData(Object o, int byteOrder)
+ throws ImageWriteException;
}
\ No newline at end of file
Modified: commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/formats/tiff/fieldtypes/FieldTypeASCII.java
URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/formats/tiff/fieldtypes/FieldTypeASCII.java?rev=995859&r1=995858&r2=995859&view=diff
==============================================================================
--- commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/formats/tiff/fieldtypes/FieldTypeASCII.java (original)
+++ commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/formats/tiff/fieldtypes/FieldTypeASCII.java Fri Sep 10 16:33:35 2010
@@ -21,35 +21,35 @@ import org.apache.sanselan.formats.tiff.
public class FieldTypeASCII extends FieldType
{
- public FieldTypeASCII(int type, String name)
- {
- super(type, 1, name);
- }
+ public FieldTypeASCII(int type, String name)
+ {
+ super(type, 1, name);
+ }
- public Object getSimpleValue(TiffField entry) {
- // According to EXIF specification "2 = ASCII An 8-bit byte containing one 7-bit ASCII code. The final byte is terminated with NULL."
- byte bytes[] = getRawBytes(entry);
- // Ignore last (should be NULL) byte.
- return new String(bytes, 0, bytes.length-1);
- }
+ public Object getSimpleValue(TiffField entry) {
+ // According to EXIF specification "2 = ASCII An 8-bit byte containing one 7-bit ASCII code. The final byte is terminated with NULL."
+ byte bytes[] = getRawBytes(entry);
+ // Ignore last (should be NULL) byte.
+ return new String(bytes, 0, bytes.length-1);
+ }
- public byte[] writeData(Object o, int byteOrder) throws ImageWriteException
- {
- if (o instanceof byte[]) {
- byte bytes[] = (byte[]) o;
- byte result[] = new byte[bytes.length + 1];
- System.arraycopy(bytes, 0, result, 0, bytes.length);
- result[result.length - 1] = 0;
- return result;
- } else if (o instanceof String) {
- byte bytes[] = ((String) o).getBytes();
- byte result[] = new byte[bytes.length + 1];
- System.arraycopy(bytes, 0, result, 0, bytes.length);
- result[result.length - 1] = 0;
- return result;
- }
- else
- throw new ImageWriteException("Unknown data type: " + o);
- }
+ public byte[] writeData(Object o, int byteOrder) throws ImageWriteException
+ {
+ if (o instanceof byte[]) {
+ byte bytes[] = (byte[]) o;
+ byte result[] = new byte[bytes.length + 1];
+ System.arraycopy(bytes, 0, result, 0, bytes.length);
+ result[result.length - 1] = 0;
+ return result;
+ } else if (o instanceof String) {
+ byte bytes[] = ((String) o).getBytes();
+ byte result[] = new byte[bytes.length + 1];
+ System.arraycopy(bytes, 0, result, 0, bytes.length);
+ result[result.length - 1] = 0;
+ return result;
+ }
+ else
+ throw new ImageWriteException("Unknown data type: " + o);
+ }
}
\ No newline at end of file
Modified: commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/formats/tiff/fieldtypes/FieldTypeByte.java
URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/formats/tiff/fieldtypes/FieldTypeByte.java?rev=995859&r1=995858&r2=995859&view=diff
==============================================================================
--- commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/formats/tiff/fieldtypes/FieldTypeByte.java (original)
+++ commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/formats/tiff/fieldtypes/FieldTypeByte.java Fri Sep 10 16:33:35 2010
@@ -22,30 +22,30 @@ import org.apache.sanselan.util.Debug;
public class FieldTypeByte extends FieldType
{
- public FieldTypeByte(int type, String name)
- {
- super(type, 1, name);
- }
+ public FieldTypeByte(int type, String name)
+ {
+ super(type, 1, name);
+ }
- public Object getSimpleValue(TiffField entry)
- {
- if (entry.length == 1)
- return new Byte(entry.valueOffsetBytes[0]);
+ public Object getSimpleValue(TiffField entry)
+ {
+ if (entry.length == 1)
+ return new Byte(entry.valueOffsetBytes[0]);
- return getRawBytes(entry);
- }
+ return getRawBytes(entry);
+ }
- public byte[] writeData(Object o, int byteOrder) throws ImageWriteException
- {
- if (o instanceof Byte)
- return new byte[]{
- ((Byte) o).byteValue(),
- };
- else if (o instanceof byte[])
- return (byte[]) o;
- else
- throw new ImageWriteException("Invalid data: " + o + " ("
- + Debug.getType(o) + ")");
- }
+ public byte[] writeData(Object o, int byteOrder) throws ImageWriteException
+ {
+ if (o instanceof Byte)
+ return new byte[]{
+ ((Byte) o).byteValue(),
+ };
+ else if (o instanceof byte[])
+ return (byte[]) o;
+ else
+ throw new ImageWriteException("Invalid data: " + o + " ("
+ + Debug.getType(o) + ")");
+ }
}
\ No newline at end of file
Modified: commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/formats/tiff/fieldtypes/FieldTypeDouble.java
URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/formats/tiff/fieldtypes/FieldTypeDouble.java?rev=995859&r1=995858&r2=995859&view=diff
==============================================================================
--- commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/formats/tiff/fieldtypes/FieldTypeDouble.java (original)
+++ commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/formats/tiff/fieldtypes/FieldTypeDouble.java Fri Sep 10 16:33:35 2010
@@ -22,37 +22,37 @@ import org.apache.sanselan.util.Debug;
public class FieldTypeDouble extends FieldType
{
- public FieldTypeDouble()
- {
- super(12, 8, "Double");
- }
+ public FieldTypeDouble()
+ {
+ super(12, 8, "Double");
+ }
- public Object getSimpleValue(TiffField entry)
- {
- return "?";
- }
+ public Object getSimpleValue(TiffField entry)
+ {
+ return "?";
+ }
- public byte[] writeData(Object o, int byteOrder) throws ImageWriteException
- {
- if (o instanceof Double)
- return convertDoubleToByteArray(((Double) o).doubleValue(),
- byteOrder);
- else if (o instanceof double[])
- {
- double numbers[] = (double[]) o;
- return convertDoubleArrayToByteArray(numbers, byteOrder);
- }
- else if (o instanceof Double[])
- {
- Double numbers[] = (Double[]) o;
- double values[] = new double[numbers.length];
- for (int i = 0; i < values.length; i++)
- values[i] = numbers[i].doubleValue();
- return convertDoubleArrayToByteArray(values, byteOrder);
- }
- else
- throw new ImageWriteException("Invalid data: " + o + " ("
- + Debug.getType(o) + ")");
- }
+ public byte[] writeData(Object o, int byteOrder) throws ImageWriteException
+ {
+ if (o instanceof Double)
+ return convertDoubleToByteArray(((Double) o).doubleValue(),
+ byteOrder);
+ else if (o instanceof double[])
+ {
+ double numbers[] = (double[]) o;
+ return convertDoubleArrayToByteArray(numbers, byteOrder);
+ }
+ else if (o instanceof Double[])
+ {
+ Double numbers[] = (Double[]) o;
+ double values[] = new double[numbers.length];
+ for (int i = 0; i < values.length; i++)
+ values[i] = numbers[i].doubleValue();
+ return convertDoubleArrayToByteArray(values, byteOrder);
+ }
+ else
+ throw new ImageWriteException("Invalid data: " + o + " ("
+ + Debug.getType(o) + ")");
+ }
}
\ No newline at end of file
Modified: commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/formats/tiff/fieldtypes/FieldTypeFloat.java
URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/formats/tiff/fieldtypes/FieldTypeFloat.java?rev=995859&r1=995858&r2=995859&view=diff
==============================================================================
--- commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/formats/tiff/fieldtypes/FieldTypeFloat.java (original)
+++ commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/formats/tiff/fieldtypes/FieldTypeFloat.java Fri Sep 10 16:33:35 2010
@@ -22,44 +22,44 @@ import org.apache.sanselan.util.Debug;
public class FieldTypeFloat extends FieldType
{
- public FieldTypeFloat()
- {
- super(11, 4, "Float");
- }
-
- // = new FieldType(11, 4, "Float")
-
- public Object getSimpleValue(TiffField entry)
- {
- if (entry.length == 1)
- return new Float(convertByteArrayToFloat(name + " ("
- + entry.tagInfo.name + ")", entry.valueOffsetBytes,
- entry.byteOrder));
-
- return convertByteArrayToFloatArray(name + " (" + entry.tagInfo.name
- + ")", getRawBytes(entry), 0, entry.length, entry.byteOrder);
- }
-
- public byte[] writeData(Object o, int byteOrder) throws ImageWriteException
- {
- if (o instanceof Float)
- return convertFloatToByteArray(((Float) o).floatValue(), byteOrder);
- else if (o instanceof float[])
- {
- float numbers[] = (float[]) o;
- return convertFloatArrayToByteArray(numbers, byteOrder);
- }
- else if (o instanceof Float[])
- {
- Float numbers[] = (Float[]) o;
- float values[] = new float[numbers.length];
- for (int i = 0; i < values.length; i++)
- values[i] = numbers[i].floatValue();
- return convertFloatArrayToByteArray(values, byteOrder);
- }
- else
- throw new ImageWriteException("Invalid data: " + o + " ("
- + Debug.getType(o) + ")");
- }
+ public FieldTypeFloat()
+ {
+ super(11, 4, "Float");
+ }
+
+ // = new FieldType(11, 4, "Float")
+
+ public Object getSimpleValue(TiffField entry)
+ {
+ if (entry.length == 1)
+ return new Float(convertByteArrayToFloat(name + " ("
+ + entry.tagInfo.name + ")", entry.valueOffsetBytes,
+ entry.byteOrder));
+
+ return convertByteArrayToFloatArray(name + " (" + entry.tagInfo.name
+ + ")", getRawBytes(entry), 0, entry.length, entry.byteOrder);
+ }
+
+ public byte[] writeData(Object o, int byteOrder) throws ImageWriteException
+ {
+ if (o instanceof Float)
+ return convertFloatToByteArray(((Float) o).floatValue(), byteOrder);
+ else if (o instanceof float[])
+ {
+ float numbers[] = (float[]) o;
+ return convertFloatArrayToByteArray(numbers, byteOrder);
+ }
+ else if (o instanceof Float[])
+ {
+ Float numbers[] = (Float[]) o;
+ float values[] = new float[numbers.length];
+ for (int i = 0; i < values.length; i++)
+ values[i] = numbers[i].floatValue();
+ return convertFloatArrayToByteArray(values, byteOrder);
+ }
+ else
+ throw new ImageWriteException("Invalid data: " + o + " ("
+ + Debug.getType(o) + ")");
+ }
}
\ No newline at end of file
Modified: commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/formats/tiff/fieldtypes/FieldTypeLong.java
URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/formats/tiff/fieldtypes/FieldTypeLong.java?rev=995859&r1=995858&r2=995859&view=diff
==============================================================================
--- commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/formats/tiff/fieldtypes/FieldTypeLong.java (original)
+++ commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/formats/tiff/fieldtypes/FieldTypeLong.java Fri Sep 10 16:33:35 2010
@@ -22,44 +22,44 @@ import org.apache.sanselan.util.Debug;
public class FieldTypeLong extends FieldType
{
- public FieldTypeLong(int type, String name)
- {
- super(type, 4, name);
- }
+ public FieldTypeLong(int type, String name)
+ {
+ super(type, 4, name);
+ }
- public Object getSimpleValue(TiffField entry)
- {
- if (entry.length == 1)
- return new Integer(convertByteArrayToInt(name + " ("
- + entry.tagInfo.name + ")", entry.valueOffsetBytes,
- entry.byteOrder));
+ public Object getSimpleValue(TiffField entry)
+ {
+ if (entry.length == 1)
+ return new Integer(convertByteArrayToInt(name + " ("
+ + entry.tagInfo.name + ")", entry.valueOffsetBytes,
+ entry.byteOrder));
- return convertByteArrayToIntArray(name + " (" + entry.tagInfo.name
- + ")", getRawBytes(entry), 0, entry.length, entry.byteOrder);
- }
+ return convertByteArrayToIntArray(name + " (" + entry.tagInfo.name
+ + ")", getRawBytes(entry), 0, entry.length, entry.byteOrder);
+ }
- public byte[] writeData(Object o, int byteOrder) throws ImageWriteException
- {
- if (o instanceof Integer)
- return convertIntArrayToByteArray(new int[]{
- ((Integer) o).intValue(),
- }, byteOrder);
- else if (o instanceof int[])
- {
- int numbers[] = (int[]) o;
- return convertIntArrayToByteArray(numbers, byteOrder);
- }
- else if (o instanceof Integer[])
- {
- Integer numbers[] = (Integer[]) o;
- int values[] = new int[numbers.length];
- for (int i = 0; i < values.length; i++)
- values[i] = numbers[i].intValue();
- return convertIntArrayToByteArray(values, byteOrder);
- }
- else
- throw new ImageWriteException("Invalid data: " + o + " ("
- + Debug.getType(o) + ")");
- }
+ public byte[] writeData(Object o, int byteOrder) throws ImageWriteException
+ {
+ if (o instanceof Integer)
+ return convertIntArrayToByteArray(new int[]{
+ ((Integer) o).intValue(),
+ }, byteOrder);
+ else if (o instanceof int[])
+ {
+ int numbers[] = (int[]) o;
+ return convertIntArrayToByteArray(numbers, byteOrder);
+ }
+ else if (o instanceof Integer[])
+ {
+ Integer numbers[] = (Integer[]) o;
+ int values[] = new int[numbers.length];
+ for (int i = 0; i < values.length; i++)
+ values[i] = numbers[i].intValue();
+ return convertIntArrayToByteArray(values, byteOrder);
+ }
+ else
+ throw new ImageWriteException("Invalid data: " + o + " ("
+ + Debug.getType(o) + ")");
+ }
}
\ No newline at end of file
Modified: commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/formats/tiff/fieldtypes/FieldTypeRational.java
URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/formats/tiff/fieldtypes/FieldTypeRational.java?rev=995859&r1=995858&r2=995859&view=diff
==============================================================================
--- commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/formats/tiff/fieldtypes/FieldTypeRational.java (original)
+++ commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/formats/tiff/fieldtypes/FieldTypeRational.java Fri Sep 10 16:33:35 2010
@@ -24,80 +24,80 @@ import org.apache.sanselan.util.Debug;
public class FieldTypeRational extends FieldType
{
- public FieldTypeRational(int type, String name)
- {
- super(type, 8, name);
- }
-
- public Object getSimpleValue(TiffField entry)
- {
- if (entry.length == 1)
- return convertByteArrayToRational(name + " (" + entry.tagInfo.name
- + ")", entry.oversizeValue, entry.byteOrder);
-
- return convertByteArrayToRationalArray(name + " (" + entry.tagInfo.name
- + ")", getRawBytes(entry), 0, entry.length, entry.byteOrder);
- }
-
- public byte[] writeData(Object o, int byteOrder) throws ImageWriteException
- {
- if (o instanceof RationalNumber)
- return convertRationalToByteArray((RationalNumber) o, byteOrder);
- else if (o instanceof RationalNumber[])
- {
- return convertRationalArrayToByteArray((RationalNumber[]) o,
- byteOrder);
- }
- else if (o instanceof Number)
- {
- Number number = (Number) o;
- RationalNumber rationalNumber = RationalNumberUtilities
- .getRationalNumber(number.doubleValue());
- return convertRationalToByteArray(rationalNumber, byteOrder);
- }
- else if (o instanceof Number[])
- {
- Number numbers[] = (Number[]) o;
- RationalNumber rationalNumbers[] = new RationalNumber[numbers.length];
- for (int i = 0; i < numbers.length; i++)
- {
- Number number = numbers[i];
- rationalNumbers[i] = RationalNumberUtilities
- .getRationalNumber(number.doubleValue());
- }
- return convertRationalArrayToByteArray(rationalNumbers, byteOrder);
- }
- else if (o instanceof double[])
- {
- double numbers[] = (double[]) o;
- RationalNumber rationalNumbers[] = new RationalNumber[numbers.length];
- for (int i = 0; i < numbers.length; i++)
- {
- double number = numbers[i];
- rationalNumbers[i] = RationalNumberUtilities
- .getRationalNumber(number);
- }
- return convertRationalArrayToByteArray(rationalNumbers, byteOrder);
- }
- else
- throw new ImageWriteException("Invalid data: " + o + " ("
- + Debug.getType(o) + ")");
- }
-
- public byte[] writeData(int numerator, int denominator, int byteOrder)
- throws ImageWriteException
- {
- return writeData(new int[]{
- numerator
- }, new int[]{
- denominator
- }, byteOrder);
- }
-
- public byte[] writeData(int numerators[], int denominators[], int byteOrder)
- throws ImageWriteException
- {
- return convertIntArrayToRationalArray(numerators, denominators,
- byteOrder);
- }
+ public FieldTypeRational(int type, String name)
+ {
+ super(type, 8, name);
+ }
+
+ public Object getSimpleValue(TiffField entry)
+ {
+ if (entry.length == 1)
+ return convertByteArrayToRational(name + " (" + entry.tagInfo.name
+ + ")", entry.oversizeValue, entry.byteOrder);
+
+ return convertByteArrayToRationalArray(name + " (" + entry.tagInfo.name
+ + ")", getRawBytes(entry), 0, entry.length, entry.byteOrder);
+ }
+
+ public byte[] writeData(Object o, int byteOrder) throws ImageWriteException
+ {
+ if (o instanceof RationalNumber)
+ return convertRationalToByteArray((RationalNumber) o, byteOrder);
+ else if (o instanceof RationalNumber[])
+ {
+ return convertRationalArrayToByteArray((RationalNumber[]) o,
+ byteOrder);
+ }
+ else if (o instanceof Number)
+ {
+ Number number = (Number) o;
+ RationalNumber rationalNumber = RationalNumberUtilities
+ .getRationalNumber(number.doubleValue());
+ return convertRationalToByteArray(rationalNumber, byteOrder);
+ }
+ else if (o instanceof Number[])
+ {
+ Number numbers[] = (Number[]) o;
+ RationalNumber rationalNumbers[] = new RationalNumber[numbers.length];
+ for (int i = 0; i < numbers.length; i++)
+ {
+ Number number = numbers[i];
+ rationalNumbers[i] = RationalNumberUtilities
+ .getRationalNumber(number.doubleValue());
+ }
+ return convertRationalArrayToByteArray(rationalNumbers, byteOrder);
+ }
+ else if (o instanceof double[])
+ {
+ double numbers[] = (double[]) o;
+ RationalNumber rationalNumbers[] = new RationalNumber[numbers.length];
+ for (int i = 0; i < numbers.length; i++)
+ {
+ double number = numbers[i];
+ rationalNumbers[i] = RationalNumberUtilities
+ .getRationalNumber(number);
+ }
+ return convertRationalArrayToByteArray(rationalNumbers, byteOrder);
+ }
+ else
+ throw new ImageWriteException("Invalid data: " + o + " ("
+ + Debug.getType(o) + ")");
+ }
+
+ public byte[] writeData(int numerator, int denominator, int byteOrder)
+ throws ImageWriteException
+ {
+ return writeData(new int[]{
+ numerator
+ }, new int[]{
+ denominator
+ }, byteOrder);
+ }
+
+ public byte[] writeData(int numerators[], int denominators[], int byteOrder)
+ throws ImageWriteException
+ {
+ return convertIntArrayToRationalArray(numerators, denominators,
+ byteOrder);
+ }
}
\ No newline at end of file
Modified: commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/formats/tiff/fieldtypes/FieldTypeShort.java
URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/formats/tiff/fieldtypes/FieldTypeShort.java?rev=995859&r1=995858&r2=995859&view=diff
==============================================================================
--- commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/formats/tiff/fieldtypes/FieldTypeShort.java (original)
+++ commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/formats/tiff/fieldtypes/FieldTypeShort.java Fri Sep 10 16:33:35 2010
@@ -23,58 +23,58 @@ import org.apache.sanselan.util.Debug;
public class FieldTypeShort extends FieldType
{
- public FieldTypeShort(int type, String name)
- {
- super(type, 2, name);
- }
-
- // public Object[] getValueArray(TiffField entry)
- // {
- // if(isLocalValue(entry))
- // return convertByteArrayToShortArray(name + " (" + entry.tagInfo.name
- // + ")", entry.valueOffsetBytes, 0, entry.length, entry.byteOrder);
- //
- //// return new Integer(convertByteArrayToShort(name + " ("
- //// + entry.tagInfo.name + ")", entry.valueOffsetBytes,
- //// entry.byteOrder));
- //
- // return convertByteArrayToShortArray(name + " (" + entry.tagInfo.name
- // + ")", getRawBytes(entry), 0, entry.length, entry.byteOrder);
- // }
-
- public Object getSimpleValue(TiffField entry) throws ImageReadException
- {
- if (entry.length == 1)
- return new Integer(convertByteArrayToShort(name + " ("
- + entry.tagInfo.name + ")", entry.valueOffsetBytes,
- entry.byteOrder));
-
- return convertByteArrayToShortArray(name + " (" + entry.tagInfo.name
- + ")", getRawBytes(entry), 0, entry.length, entry.byteOrder);
- }
-
- public byte[] writeData(Object o, int byteOrder) throws ImageWriteException
- {
- if (o instanceof Integer)
- return convertShortArrayToByteArray(new int[]{
- ((Integer) o).intValue(),
- }, byteOrder);
- else if (o instanceof int[])
- {
- int numbers[] = (int[]) o;
- return convertShortArrayToByteArray(numbers, byteOrder);
- }
- else if (o instanceof Integer[])
- {
- Integer numbers[] = (Integer[]) o;
- int values[] = new int[numbers.length];
- for (int i = 0; i < values.length; i++)
- values[i] = numbers[i].intValue();
- return convertShortArrayToByteArray(values, byteOrder);
- }
- else
- throw new ImageWriteException("Invalid data: " + o + " ("
- + Debug.getType(o) + ")");
- }
+ public FieldTypeShort(int type, String name)
+ {
+ super(type, 2, name);
+ }
+
+ // public Object[] getValueArray(TiffField entry)
+ // {
+ // if(isLocalValue(entry))
+ // return convertByteArrayToShortArray(name + " (" + entry.tagInfo.name
+ // + ")", entry.valueOffsetBytes, 0, entry.length, entry.byteOrder);
+ //
+ //// return new Integer(convertByteArrayToShort(name + " ("
+ //// + entry.tagInfo.name + ")", entry.valueOffsetBytes,
+ //// entry.byteOrder));
+ //
+ // return convertByteArrayToShortArray(name + " (" + entry.tagInfo.name
+ // + ")", getRawBytes(entry), 0, entry.length, entry.byteOrder);
+ // }
+
+ public Object getSimpleValue(TiffField entry) throws ImageReadException
+ {
+ if (entry.length == 1)
+ return new Integer(convertByteArrayToShort(name + " ("
+ + entry.tagInfo.name + ")", entry.valueOffsetBytes,
+ entry.byteOrder));
+
+ return convertByteArrayToShortArray(name + " (" + entry.tagInfo.name
+ + ")", getRawBytes(entry), 0, entry.length, entry.byteOrder);
+ }
+
+ public byte[] writeData(Object o, int byteOrder) throws ImageWriteException
+ {
+ if (o instanceof Integer)
+ return convertShortArrayToByteArray(new int[]{
+ ((Integer) o).intValue(),
+ }, byteOrder);
+ else if (o instanceof int[])
+ {
+ int numbers[] = (int[]) o;
+ return convertShortArrayToByteArray(numbers, byteOrder);
+ }
+ else if (o instanceof Integer[])
+ {
+ Integer numbers[] = (Integer[]) o;
+ int values[] = new int[numbers.length];
+ for (int i = 0; i < values.length; i++)
+ values[i] = numbers[i].intValue();
+ return convertShortArrayToByteArray(values, byteOrder);
+ }
+ else
+ throw new ImageWriteException("Invalid data: " + o + " ("
+ + Debug.getType(o) + ")");
+ }
}
\ No newline at end of file
Modified: commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/formats/tiff/fieldtypes/FieldTypeUnknown.java
URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/formats/tiff/fieldtypes/FieldTypeUnknown.java?rev=995859&r1=995858&r2=995859&view=diff
==============================================================================
--- commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/formats/tiff/fieldtypes/FieldTypeUnknown.java (original)
+++ commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/formats/tiff/fieldtypes/FieldTypeUnknown.java Fri Sep 10 16:33:35 2010
@@ -22,37 +22,37 @@ import org.apache.sanselan.util.Debug;
public class FieldTypeUnknown extends FieldType
{
- public FieldTypeUnknown()
- {
- super(-1, 1, "Unknown");
- }
-
- public Object getSimpleValue(TiffField entry)
- {
- // Debug.debug("unknown field type. entry", entry.tagInfo.name);
- // Debug.debug("unknown field type. entry.type", entry.type);
- // Debug.debug("unknown field type. entry.length", entry.length);
- // Debug.debug("unknown field type. entry.oversizeValue", entry.oversizeValue);
- // Debug.debug("unknown field type. entry.isLocalValue()", entry.isLocalValue());
- // Debug.debug("unknown field type. entry.oversizeValue", entry.oversizeValue);
-
- if (entry.length == 1)
- return new Byte(entry.valueOffsetBytes[0]);
-
- return getRawBytes(entry);
- }
-
- public byte[] writeData(Object o, int byteOrder) throws ImageWriteException
- {
- if (o instanceof Byte)
- return new byte[]{
- ((Byte) o).byteValue(),
- };
- else if (o instanceof byte[])
- return (byte[]) o;
- else
- throw new ImageWriteException("Invalid data: " + o + " ("
- + Debug.getType(o) + ")");
- }
+ public FieldTypeUnknown()
+ {
+ super(-1, 1, "Unknown");
+ }
+
+ public Object getSimpleValue(TiffField entry)
+ {
+ // Debug.debug("unknown field type. entry", entry.tagInfo.name);
+ // Debug.debug("unknown field type. entry.type", entry.type);
+ // Debug.debug("unknown field type. entry.length", entry.length);
+ // Debug.debug("unknown field type. entry.oversizeValue", entry.oversizeValue);
+ // Debug.debug("unknown field type. entry.isLocalValue()", entry.isLocalValue());
+ // Debug.debug("unknown field type. entry.oversizeValue", entry.oversizeValue);
+
+ if (entry.length == 1)
+ return new Byte(entry.valueOffsetBytes[0]);
+
+ return getRawBytes(entry);
+ }
+
+ public byte[] writeData(Object o, int byteOrder) throws ImageWriteException
+ {
+ if (o instanceof Byte)
+ return new byte[]{
+ ((Byte) o).byteValue(),
+ };
+ else if (o instanceof byte[])
+ return (byte[]) o;
+ else
+ throw new ImageWriteException("Invalid data: " + o + " ("
+ + Debug.getType(o) + ")");
+ }
}
\ No newline at end of file
Modified: commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/formats/tiff/photometricinterpreters/PhotometricInterpreter.java
URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/formats/tiff/photometricinterpreters/PhotometricInterpreter.java?rev=995859&r1=995858&r2=995859&view=diff
==============================================================================
--- commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/formats/tiff/photometricinterpreters/PhotometricInterpreter.java (original)
+++ commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/formats/tiff/photometricinterpreters/PhotometricInterpreter.java Fri Sep 10 16:33:35 2010
@@ -23,28 +23,28 @@ import org.apache.sanselan.ImageReadExce
public abstract class PhotometricInterpreter
{
- protected final int samplesPerPixel;
- protected final int bitsPerSample[];
- protected final int predictor;
- protected final int width;
- protected final int height;
-
- public PhotometricInterpreter(int fSamplesPerPixel, int fBitsPerSample[],
- int Predictor, int width, int height)
- {
- this.samplesPerPixel = fSamplesPerPixel;
- this.bitsPerSample = fBitsPerSample;
- this.predictor = Predictor;
- this.width = width;
- this.height = height;
- }
+ protected final int samplesPerPixel;
+ protected final int bitsPerSample[];
+ protected final int predictor;
+ protected final int width;
+ protected final int height;
+
+ public PhotometricInterpreter(int fSamplesPerPixel, int fBitsPerSample[],
+ int Predictor, int width, int height)
+ {
+ this.samplesPerPixel = fSamplesPerPixel;
+ this.bitsPerSample = fBitsPerSample;
+ this.predictor = Predictor;
+ this.width = width;
+ this.height = height;
+ }
- public abstract void interpretPixel(BufferedImage bi, int samples[], int x,
- int y) throws ImageReadException, IOException;
+ public abstract void interpretPixel(BufferedImage bi, int samples[], int x,
+ int y) throws ImageReadException, IOException;
- public void dumpstats() throws ImageReadException, IOException
- {
+ public void dumpstats() throws ImageReadException, IOException
+ {
- }
+ }
}
\ No newline at end of file
Modified: commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/formats/tiff/photometricinterpreters/PhotometricInterpreterBiLevel.java
URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/formats/tiff/photometricinterpreters/PhotometricInterpreterBiLevel.java?rev=995859&r1=995858&r2=995859&view=diff
==============================================================================
--- commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/formats/tiff/photometricinterpreters/PhotometricInterpreterBiLevel.java (original)
+++ commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/formats/tiff/photometricinterpreters/PhotometricInterpreterBiLevel.java Fri Sep 10 16:33:35 2010
@@ -23,35 +23,35 @@ import org.apache.sanselan.ImageReadExce
public class PhotometricInterpreterBiLevel extends PhotometricInterpreter
{
- private final boolean invert;
+ private final boolean invert;
- // private final int bitsPerPixel;
+ // private final int bitsPerPixel;
- public PhotometricInterpreterBiLevel(int fBitsPerPixel,
- int fSamplesPerPixel, int fBitsPerSample[], int Predictor,
- int width, int height, boolean invert)
- {
- super(fSamplesPerPixel, fBitsPerSample, Predictor, width, height);
+ public PhotometricInterpreterBiLevel(int fBitsPerPixel,
+ int fSamplesPerPixel, int fBitsPerSample[], int Predictor,
+ int width, int height, boolean invert)
+ {
+ super(fSamplesPerPixel, fBitsPerSample, Predictor, width, height);
- this.invert = invert;
- // this.bitsPerPixel = fBitsPerPixel;
- }
+ this.invert = invert;
+ // this.bitsPerPixel = fBitsPerPixel;
+ }
- public void interpretPixel(BufferedImage bi, int samples[], int x, int y)
- throws ImageReadException, IOException
- {
- int sample = samples[0];
+ public void interpretPixel(BufferedImage bi, int samples[], int x, int y)
+ throws ImageReadException, IOException
+ {
+ int sample = samples[0];
- if (invert)
- sample = 255 - sample;
+ if (invert)
+ sample = 255 - sample;
- int red = sample;
- int green = sample;
- int blue = sample;
+ int red = sample;
+ int green = sample;
+ int blue = sample;
- int alpha = 0xff;
- int rgb = (alpha << 24) | (red << 16) | (green << 8) | (blue << 0);
+ int alpha = 0xff;
+ int rgb = (alpha << 24) | (red << 16) | (green << 8) | (blue << 0);
- bi.setRGB(x, y, rgb);
- }
+ bi.setRGB(x, y, rgb);
+ }
}
\ No newline at end of file
Modified: commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/formats/tiff/photometricinterpreters/PhotometricInterpreterCIELAB.java
URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/formats/tiff/photometricinterpreters/PhotometricInterpreterCIELAB.java?rev=995859&r1=995858&r2=995859&view=diff
==============================================================================
--- commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/formats/tiff/photometricinterpreters/PhotometricInterpreterCIELAB.java (original)
+++ commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/formats/tiff/photometricinterpreters/PhotometricInterpreterCIELAB.java Fri Sep 10 16:33:35 2010
@@ -24,25 +24,25 @@ import org.apache.sanselan.color.ColorCo
public class PhotometricInterpreterCIELAB extends PhotometricInterpreter
{
- public PhotometricInterpreterCIELAB(int fSamplesPerPixel,
- int fBitsPerSample[], int Predictor, int width, int height)
- {
- super(fSamplesPerPixel, fBitsPerSample, Predictor, width, height);
- }
+ public PhotometricInterpreterCIELAB(int fSamplesPerPixel,
+ int fBitsPerSample[], int Predictor, int width, int height)
+ {
+ super(fSamplesPerPixel, fBitsPerSample, Predictor, width, height);
+ }
- public void dumpstats() throws ImageReadException, IOException
- {
- }
+ public void dumpstats() throws ImageReadException, IOException
+ {
+ }
- public void interpretPixel(BufferedImage bi, int samples[], int x, int y)
- throws ImageReadException, IOException
- {
- int cieL = samples[0];
- int cieA = (byte) samples[1];
- int cieB = (byte) samples[2];
+ public void interpretPixel(BufferedImage bi, int samples[], int x, int y)
+ throws ImageReadException, IOException
+ {
+ int cieL = samples[0];
+ int cieA = (byte) samples[1];
+ int cieB = (byte) samples[2];
- int rgb = ColorConversions.convertCIELabtoARGBTest(cieL, cieA, cieB);
- bi.setRGB(x, y, rgb);
- }
+ int rgb = ColorConversions.convertCIELabtoARGBTest(cieL, cieA, cieB);
+ bi.setRGB(x, y, rgb);
+ }
}
\ No newline at end of file