jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFImageWriteParam.java
changeset 34416 68c0d866db5d
child 36448 a07e108d5722
equal deleted inserted replaced
34415:098d54b4051d 34416:68c0d866db5d
       
     1 /*
       
     2  * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
       
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       
     4  *
       
     5  * This code is free software; you can redistribute it and/or modify it
       
     6  * under the terms of the GNU General Public License version 2 only, as
       
     7  * published by the Free Software Foundation.  Oracle designates this
       
     8  * particular file as subject to the "Classpath" exception as provided
       
     9  * by Oracle in the LICENSE file that accompanied this code.
       
    10  *
       
    11  * This code is distributed in the hope that it will be useful, but WITHOUT
       
    12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
       
    13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
       
    14  * version 2 for more details (a copy is included in the LICENSE file that
       
    15  * accompanied this code).
       
    16  *
       
    17  * You should have received a copy of the GNU General Public License version
       
    18  * 2 along with this work; if not, write to the Free Software Foundation,
       
    19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
       
    20  *
       
    21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
       
    22  * or visit www.oracle.com if you need additional information or have any
       
    23  * questions.
       
    24  */
       
    25 package com.sun.imageio.plugins.tiff;
       
    26 
       
    27 import java.util.Locale;
       
    28 import javax.imageio.ImageWriteParam;
       
    29 
       
    30 /**
       
    31  * A subclass of {@link ImageWriteParam ImageWriteParam}
       
    32  * allowing control over the TIFF writing process. The set of innately
       
    33  * supported compression types is listed in the following table:
       
    34  *
       
    35  * <table border=1>
       
    36  * <caption><b>Supported Compression Types</b></caption>
       
    37  * <tr><th>Compression Type</th> <th>Description</th> <th>Reference</th></tr>
       
    38  * <tr>
       
    39  * <td>CCITT RLE</td>
       
    40  * <td>Modified Huffman compression</td>
       
    41  * <td>TIFF 6.0 Specification, Section 10</td>
       
    42  * </tr>
       
    43  * <tr>
       
    44  * <td>CCITT T.4</td>
       
    45  * <td>CCITT T.4 bilevel encoding/Group 3 facsimile compression</td>
       
    46  * <td>TIFF 6.0 Specification, Section 11</td>
       
    47  * </tr>
       
    48  * <tr>
       
    49  * <td>CCITT T.6</td>
       
    50  * <td>CCITT T.6 bilevel encoding/Group 4 facsimile compression</td>
       
    51  * <td>TIFF 6.0 Specification, Section 11</td></tr>
       
    52  * <tr>
       
    53  * <td>LZW</td>
       
    54  * <td>LZW compression</td>
       
    55  * <td>TIFF 6.0 Specification, Section 13</td></tr>
       
    56  * <tr>
       
    57  * <td>JPEG</td>
       
    58  * <td>"New" JPEG-in-TIFF compression</td>
       
    59  * <td><a href="ftp://ftp.sgi.com/graphics/tiff/TTN2.draft.txt">TIFF
       
    60  * Technical Note #2</a></td>
       
    61  * </tr>
       
    62  * <tr>
       
    63  * <td>ZLib</td>
       
    64  * <td>"Deflate/Inflate" compression (see note following this table)</td>
       
    65  * <td><a href="http://partners.adobe.com/asn/developer/pdfs/tn/TIFFphotoshop.pdf">
       
    66  * Adobe Photoshop&#174; TIFF Technical Notes</a> (PDF)</td>
       
    67  * </tr>
       
    68  * <tr>
       
    69  * <td>PackBits</td>
       
    70  * <td>Byte-oriented, run length compression</td>
       
    71  * <td>TIFF 6.0 Specification, Section 9</td>
       
    72  * </tr>
       
    73  * <tr>
       
    74  * <td>Deflate</td>
       
    75  * <td>"Zip-in-TIFF" compression (see note following this table)</td>
       
    76  * <td><a href="http://www.isi.edu/in-notes/rfc1950.txt">
       
    77  * ZLIB Compressed Data Format Specification</a>,
       
    78  * <a href="http://www.isi.edu/in-notes/rfc1951.txt">
       
    79  * DEFLATE Compressed Data Format Specification</a></td>
       
    80  * </tr>
       
    81  * <tr>
       
    82  * <td>Exif JPEG</td>
       
    83  * <td>Exif-specific JPEG compression (see note following this table)</td>
       
    84  * <td><a href="http://www.exif.org/Exif2-2.PDF">Exif 2.2 Specification</a>
       
    85  * (PDF), section 4.5.5, "Basic Structure of Thumbnail Data"</td>
       
    86  * </table>
       
    87  *
       
    88  * <p>
       
    89  * Old-style JPEG compression as described in section 22 of the TIFF 6.0
       
    90  * Specification is <i>not</i> supported.
       
    91  * </p>
       
    92  *
       
    93  * <p> The CCITT compression types are applicable to bilevel (1-bit)
       
    94  * images only.  The JPEG compression type is applicable to byte
       
    95  * grayscale (1-band) and RGB (3-band) images only.</p>
       
    96  *
       
    97  * <p>
       
    98  * ZLib and Deflate compression are identical except for the value of the
       
    99  * TIFF Compression field: for ZLib the Compression field has value 8
       
   100  * whereas for Deflate it has value 32946 (0x80b2). In both cases each
       
   101  * image segment (strip or tile) is written as a single complete zlib data
       
   102  * stream.
       
   103  * </p>
       
   104  *
       
   105  * <p>
       
   106  * "Exif JPEG" is a compression type used when writing the contents of an
       
   107  * APP1 Exif marker segment for inclusion in a JPEG native image metadata
       
   108  * tree. The contents appended to the output when this compression type is
       
   109  * used are a function of whether an empty or non-empty image is written.
       
   110  * If the image is empty, then a TIFF IFD adhering to the specification of
       
   111  * a compressed Exif primary IFD is appended. If the image is non-empty,
       
   112  * then a complete IFD and image adhering to the specification of a
       
   113  * compressed Exif thumbnail IFD and image are appended. Note that the
       
   114  * data of the empty image may <i>not</i> later be appended using the pixel
       
   115  * replacement capability of the TIFF writer.
       
   116  * </p>
       
   117  *
       
   118  * <p> If ZLib/Deflate or JPEG compression is used, the compression quality
       
   119  * may be set. For ZLib/Deflate the supplied floating point quality value is
       
   120  * rescaled to the range <tt>[1,&nbsp;9]</tt> and truncated to an integer
       
   121  * to derive the Deflate compression level. For JPEG the floating point
       
   122  * quality value is passed directly to the JPEG writer plug-in which
       
   123  * interprets it in the usual way.</p>
       
   124  *
       
   125  * <p> The <code>canWriteTiles</code> and
       
   126  * <code>canWriteCompressed</code> methods will return
       
   127  * <code>true</code>; the <code>canOffsetTiles</code> and
       
   128  * <code>canWriteProgressive</code> methods will return
       
   129  * <code>false</code>.</p>
       
   130  *
       
   131  * <p> If tiles are being written, then each of their dimensions will be
       
   132  * rounded to the nearest multiple of 16 per the TIFF specification. If
       
   133  * JPEG-in-TIFF compression is being used, and tiles are being written
       
   134  * each tile dimension will be rounded to the nearest multiple of 8 times
       
   135  * the JPEG minimum coded unit (MCU) in that dimension. If JPEG-in-TIFF
       
   136  * compression is being used and strips are being written, the number of
       
   137  * rows per strip is rounded to a multiple of 8 times the maximum MCU over
       
   138  * both dimensions.</p>
       
   139  */
       
   140 public class TIFFImageWriteParam extends ImageWriteParam {
       
   141 
       
   142     /**
       
   143      * Constructs a <code>TIFFImageWriteParam</code> instance
       
   144      * for a given <code>Locale</code>.
       
   145      *
       
   146      * @param locale the <code>Locale</code> for which messages
       
   147      * should be localized.
       
   148      */
       
   149     public TIFFImageWriteParam(Locale locale) {
       
   150         super(locale);
       
   151         this.canWriteCompressed = true;
       
   152         this.canWriteTiles = true;
       
   153         this.compressionTypes = TIFFImageWriter.TIFFCompressionTypes;
       
   154     };
       
   155 }