1 /*M///////////////////////////////////////////////////////////////////////////////////////
\r
3 // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
\r
5 // By downloading, copying, installing or using the software you agree to this license.
\r
6 // If you do not agree to this license, do not download, install,
\r
7 // copy or use the software.
\r
10 // License Agreement
\r
11 // For Open Source Computer Vision Library
\r
13 // Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
\r
14 // Copyright (C) 2009, Willow Garage Inc., all rights reserved.
\r
15 // Third party copyrights are property of their respective owners.
\r
17 // Redistribution and use in source and binary forms, with or without modification,
\r
18 // are permitted provided that the following conditions are met:
\r
20 // * Redistribution's of source code must retain the above copyright notice,
\r
21 // this list of conditions and the following disclaimer.
\r
23 // * Redistribution's in binary form must reproduce the above copyright notice,
\r
24 // this list of conditions and the following disclaimer in the documentation
\r
25 // and/or other materials provided with the distribution.
\r
27 // * The name of the copyright holders may not be used to endorse or promote products
\r
28 // derived from this software without specific prior written permission.
\r
30 // This software is provided by the copyright holders and contributors "as is" and
\r
31 // any express or implied warranties, including, but not limited to, the implied
\r
32 // warranties of merchantability and fitness for a particular purpose are disclaimed.
\r
33 // In no event shall the Intel Corporation or contributors be liable for any direct,
\r
34 // indirect, incidental, special, exemplary, or consequential damages
\r
35 // (including, but not limited to, procurement of substitute goods or services;
\r
36 // loss of use, data, or profits; or business interruption) however caused
\r
37 // and on any theory of liability, whether in contract, strict liability,
\r
38 // or tort (including negligence or otherwise) arising in any way out of
\r
39 // the use of this software, even if advised of the possibility of such damage.
\r
43 #ifndef _GRFMT_TIFF_H_
\r
44 #define _GRFMT_TIFF_H_
\r
46 #include "grfmt_base.h"
\r
51 // native simple TIFF codec
\r
52 enum TiffCompression
\r
56 TIFF_PACKBITS = 32773
\r
61 TIFF_ORDER_II = 0x4949,
\r
62 TIFF_ORDER_MM = 0x4d4d
\r
68 TIFF_TAG_WIDTH = 256,
\r
69 TIFF_TAG_HEIGHT = 257,
\r
70 TIFF_TAG_BITS_PER_SAMPLE = 258,
\r
71 TIFF_TAG_COMPRESSION = 259,
\r
72 TIFF_TAG_PHOTOMETRIC = 262,
\r
73 TIFF_TAG_STRIP_OFFSETS = 273,
\r
74 TIFF_TAG_STRIP_COUNTS = 279,
\r
75 TIFF_TAG_SAMPLES_PER_PIXEL = 277,
\r
76 TIFF_TAG_ROWS_PER_STRIP = 278,
\r
77 TIFF_TAG_PLANAR_CONFIG = 284,
\r
78 TIFF_TAG_COLOR_MAP = 320
\r
85 TIFF_TYPE_SHORT = 3,
\r
92 // libtiff based TIFF codec
\r
94 class TiffDecoder : public BaseImageDecoder
\r
98 virtual ~TiffDecoder();
\r
101 bool readData( Mat& img );
\r
104 size_t signatureLength() const;
\r
105 bool checkSignature( const string& signature ) const;
\r
106 ImageDecoder newDecoder() const;
\r
115 class TiffEncoder : public BaseImageEncoder
\r
119 virtual ~TiffEncoder();
\r
121 bool write( const Mat& img, const vector<int>& params );
\r
122 ImageEncoder newEncoder() const;
\r
125 void writeTag( WLByteStream& strm, TiffTag tag,
\r
126 TiffFieldType fieldType,
\r
127 int count, int value );
\r
132 #endif/*_GRFMT_TIFF_H_*/
\r