001: package org.libtiff.jai.codec;
002:
003: /*
004: * XTIFF: eXtensible TIFF libraries for JAI.
005: *
006: * The contents of this file are subject to the JAVA ADVANCED IMAGING
007: * SAMPLE INPUT-OUTPUT CODECS AND WIDGET HANDLING SOURCE CODE License
008: * Version 1.0 (the "License"); You may not use this file except in
009: * compliance with the License. You may obtain a copy of the License at
010: * http://www.sun.com/software/imaging/JAI/index.html
011: *
012: * Software distributed under the License is distributed on an "AS IS"
013: * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
014: * the License for the specific language governing rights and limitations
015: * under the License.
016: *
017: * The Original Code is JAVA ADVANCED IMAGING SAMPLE INPUT-OUTPUT CODECS
018: * AND WIDGET HANDLING SOURCE CODE.
019: * The Initial Developer of the Original Code is: Sun Microsystems, Inc..
020: * Portions created by: Niles Ritter
021: * are Copyright (C): Niles Ritter, GeoTIFF.org, 1999,2000.
022: * All Rights Reserved.
023: * Contributor(s): Niles Ritter
024: */
025:
026: /**
027: * An extension of <code>TIFFEncodeParam</code> for encoding images in
028: * the TIFF format using the XTIFF machinery. The encode object creates
029: * an empty XTIFFDirectory, which the user may may access and add
030: * whatever XTIFFFields they need for annotation, compression, etc.
031: * It shouldn't be necessary to extend this class further, as all
032: * parameters will be passed through the XTIFFDirectory.
033: */
034:
035: import com.sun.media.jai.codec.TIFFEncodeParam;
036:
037: public class XTIFFEncodeParam extends TIFFEncodeParam {
038:
039: /* inherited: compression, tiled */
040: private int _compression;
041: private boolean _isTiled;
042:
043: /** For XTIFF everything is stored in the directory */
044: private XTIFFDirectory directory;
045:
046: /**
047: * Promotes an XTIFFEncodeParam object from simpler one
048: */
049: public XTIFFEncodeParam(TIFFEncodeParam param) {
050: initialize();
051: if (param == null)
052: return;
053: setCompression(param.getCompression());
054: setWriteTiled(param.getWriteTiled());
055: }
056:
057: /**
058: * Constructs an XTIFFEncodeParam object with default values for parameters.
059: */
060: public XTIFFEncodeParam() {
061: initialize();
062: }
063:
064: /**
065: * Initializes an XTIFFEncodeParam with default values for parameters.
066: */
067: public void initialize() {
068: directory = XTIFFDirectory.create();
069: setCompression(COMPRESSION_NONE);
070: setWriteTiled(false);
071: }
072:
073: public XTIFFDirectory getDirectory() {
074: return directory;
075: }
076:
077: /**
078: * Specifies the type of compression to be used. The compression type
079: * specified will be honored only if it is compatible with the image
080: * being written out.
081: *
082: * @param compression The compression type.
083: */
084: public void setCompression(int compression) {
085: directory.setCompression(compression);
086: _compression = compression;
087: }
088:
089: /**
090: * Specifies the type of compression to be used. The compression type
091: * specified will be honored only if it is compatible with the image
092: * being written out.
093: *
094: */
095: public int getCompression() {
096: return _compression;
097: }
098:
099: /**
100: * If set, the data is in tiled format, instead of
101: * in strips.
102: */
103: public boolean getWriteTiled() {
104: return _isTiled;
105: }
106:
107: /**
108: * If set, the data will be written out in tiled format, instead of
109: * in strips.
110: *
111: * @param writeTiled Specifies whether the image data should be
112: * wriiten out in tiled format.
113: */
114: public void setWriteTiled(boolean writeTiled) {
115: directory.setIsTiled(writeTiled);
116: _isTiled = writeTiled;
117: }
118: }
|