Update to 2.0.0 tree from current Fremantle build
[opencv] / src / highgui / grfmt_sunras.h
1 /*M///////////////////////////////////////////////////////////////////////////////////////\r
2 //\r
3 //  IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.\r
4 //\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
8 //\r
9 //\r
10 //                           License Agreement\r
11 //                For Open Source Computer Vision Library\r
12 //\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
16 //\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
19 //\r
20 //   * Redistribution's of source code must retain the above copyright notice,\r
21 //     this list of conditions and the following disclaimer.\r
22 //\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
26 //\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
29 //\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
40 //\r
41 //M*/\r
42 \r
43 #ifndef _GRFMT_SUNRAS_H_\r
44 #define _GRFMT_SUNRAS_H_\r
45 \r
46 #include "grfmt_base.h"\r
47 \r
48 namespace cv\r
49 {\r
50 \r
51 enum SunRasType\r
52 {\r
53     RAS_OLD = 0,\r
54     RAS_STANDARD = 1,\r
55     RAS_BYTE_ENCODED = 2, /* RLE encoded */\r
56     RAS_FORMAT_RGB = 3    /* RGB instead of BGR */\r
57 };\r
58 \r
59 enum SunRasMapType\r
60 {\r
61     RMT_NONE = 0,       /* direct color encoding */\r
62     RMT_EQUAL_RGB = 1   /* paletted image */\r
63 };\r
64 \r
65 \r
66 // Sun Raster Reader\r
67 class SunRasterDecoder : public BaseImageDecoder\r
68 {\r
69 public:\r
70 \r
71     SunRasterDecoder();\r
72     virtual ~SunRasterDecoder();\r
73 \r
74     bool  readData( Mat& img );\r
75     bool  readHeader();\r
76     void  close();\r
77 \r
78     ImageDecoder newDecoder() const;\r
79 \r
80 protected:\r
81    \r
82     RMByteStream    m_strm;\r
83     PaletteEntry    m_palette[256];\r
84     int             m_bpp;\r
85     int             m_offset;\r
86     SunRasType      m_encoding;\r
87     SunRasMapType   m_maptype;\r
88     int             m_maplength;\r
89 };\r
90 \r
91 \r
92 class SunRasterEncoder : public BaseImageEncoder\r
93 {\r
94 public:\r
95     SunRasterEncoder();\r
96     virtual ~SunRasterEncoder();\r
97 \r
98     bool write( const Mat& img, const vector<int>& params );\r
99 \r
100     ImageEncoder newEncoder() const;\r
101 };\r
102 \r
103 }\r
104 \r
105 #endif/*_GRFMT_SUNRAS_H_*/\r