Update to 2.0.0 tree from current Fremantle build
[opencv] / src / highgui / grfmt_tiff.h
diff --git a/src/highgui/grfmt_tiff.h b/src/highgui/grfmt_tiff.h
new file mode 100644 (file)
index 0000000..e31fb46
--- /dev/null
@@ -0,0 +1,132 @@
+/*M///////////////////////////////////////////////////////////////////////////////////////\r
+//\r
+//  IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.\r
+//\r
+//  By downloading, copying, installing or using the software you agree to this license.\r
+//  If you do not agree to this license, do not download, install,\r
+//  copy or use the software.\r
+//\r
+//\r
+//                           License Agreement\r
+//                For Open Source Computer Vision Library\r
+//\r
+// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.\r
+// Copyright (C) 2009, Willow Garage Inc., all rights reserved.\r
+// Third party copyrights are property of their respective owners.\r
+//\r
+// Redistribution and use in source and binary forms, with or without modification,\r
+// are permitted provided that the following conditions are met:\r
+//\r
+//   * Redistribution's of source code must retain the above copyright notice,\r
+//     this list of conditions and the following disclaimer.\r
+//\r
+//   * Redistribution's in binary form must reproduce the above copyright notice,\r
+//     this list of conditions and the following disclaimer in the documentation\r
+//     and/or other materials provided with the distribution.\r
+//\r
+//   * The name of the copyright holders may not be used to endorse or promote products\r
+//     derived from this software without specific prior written permission.\r
+//\r
+// This software is provided by the copyright holders and contributors "as is" and\r
+// any express or implied warranties, including, but not limited to, the implied\r
+// warranties of merchantability and fitness for a particular purpose are disclaimed.\r
+// In no event shall the Intel Corporation or contributors be liable for any direct,\r
+// indirect, incidental, special, exemplary, or consequential damages\r
+// (including, but not limited to, procurement of substitute goods or services;\r
+// loss of use, data, or profits; or business interruption) however caused\r
+// and on any theory of liability, whether in contract, strict liability,\r
+// or tort (including negligence or otherwise) arising in any way out of\r
+// the use of this software, even if advised of the possibility of such damage.\r
+//\r
+//M*/\r
+\r
+#ifndef _GRFMT_TIFF_H_\r
+#define _GRFMT_TIFF_H_\r
+\r
+#include "grfmt_base.h"\r
+\r
+namespace cv\r
+{\r
+\r
+// native simple TIFF codec\r
+enum TiffCompression\r
+{\r
+    TIFF_UNCOMP = 1,\r
+    TIFF_HUFFMAN = 2,\r
+    TIFF_PACKBITS = 32773\r
+};\r
+\r
+enum TiffByteOrder\r
+{\r
+    TIFF_ORDER_II = 0x4949,\r
+    TIFF_ORDER_MM = 0x4d4d\r
+};\r
+\r
+\r
+enum  TiffTag\r
+{\r
+    TIFF_TAG_WIDTH  = 256,\r
+    TIFF_TAG_HEIGHT = 257,\r
+    TIFF_TAG_BITS_PER_SAMPLE = 258,\r
+    TIFF_TAG_COMPRESSION = 259,\r
+    TIFF_TAG_PHOTOMETRIC = 262,\r
+    TIFF_TAG_STRIP_OFFSETS = 273,\r
+    TIFF_TAG_STRIP_COUNTS = 279,\r
+    TIFF_TAG_SAMPLES_PER_PIXEL = 277,\r
+    TIFF_TAG_ROWS_PER_STRIP = 278,\r
+    TIFF_TAG_PLANAR_CONFIG = 284,\r
+    TIFF_TAG_COLOR_MAP = 320\r
+};\r
+\r
+\r
+enum TiffFieldType\r
+{\r
+    TIFF_TYPE_BYTE = 1,\r
+    TIFF_TYPE_SHORT = 3,\r
+    TIFF_TYPE_LONG = 4\r
+};\r
+\r
+\r
+#ifdef HAVE_TIFF\r
+\r
+// libtiff based TIFF codec\r
+\r
+class TiffDecoder : public BaseImageDecoder\r
+{\r
+public:\r
+    TiffDecoder();\r
+    virtual ~TiffDecoder();\r
+\r
+    bool  readHeader();\r
+    bool  readData( Mat& img );\r
+    void  close();\r
+\r
+    size_t signatureLength() const;\r
+    bool checkSignature( const string& signature ) const;\r
+    ImageDecoder newDecoder() const;\r
+\r
+protected:\r
+    void* m_tif;\r
+};\r
+\r
+#endif\r
+\r
+// ... and writer\r
+class TiffEncoder : public BaseImageEncoder\r
+{\r
+public:\r
+    TiffEncoder();\r
+    virtual ~TiffEncoder();\r
+\r
+    bool  write( const Mat& img, const vector<int>& params );\r
+    ImageEncoder newEncoder() const;\r
+\r
+protected:\r
+    void  writeTag( WLByteStream& strm, TiffTag tag,\r
+                    TiffFieldType fieldType,\r
+                    int count, int value );\r
+};\r
+\r
+}\r
+\r
+#endif/*_GRFMT_TIFF_H_*/\r