Statistics
| Revision:

svn-gvsig-desktop / trunk / libraries / libjni-mrsid / include / writers / JpegImageWriter.h @ 3539

History | View | Annotate | Download (2.59 KB)

1
/* $Id: JpegImageWriter.h 3539 2006-01-09 12:23:20Z nacho $ */
2
/* //////////////////////////////////////////////////////////////////////////
3
//                                                                         //
4
// This code is Copyright (c) 2004 LizardTech, Inc, 1008 Western Avenue,   //
5
// Suite 200, Seattle, WA 98104.  Unauthorized use or distribution         //
6
// prohibited.  Access to and use of this code is permitted only under     //
7
// license from LizardTech, Inc.  Portions of the code are protected by    //
8
// US and foreign patents and other filings. All Rights Reserved.          //
9
//                                                                         //
10
////////////////////////////////////////////////////////////////////////// */
11
/* PUBLIC */
12

    
13
#ifndef JPEGIMAGEWRITER_H
14
#define JPEGIMAGEWRITER_H
15

    
16
// lt_lib_mrsid_core
17
#include "lti_geoFileImageWriter.h"
18

    
19
// system
20
#include <stdio.h>
21

    
22
#if defined(LT_COMPILER_MS)
23
   #pragma warning(push,4)
24
#endif
25

    
26
struct jpeg_compress_struct;
27
struct jpeg_error_mgr;
28

    
29
LT_BEGIN_NAMESPACE(LizardTech)
30

    
31
class LTFileSpec;
32
class LTReusableBuffer;
33

    
34
/**
35
 * writes an image stage to a JPEG file
36
 *
37
 * This class writes an image stage to a JPEG file.
38
 */
39
class JpegImageWriter : public LTIGeoFileImageWriter
40
{
41
public:
42
   /**
43
    * constructor
44
    *
45
    * Creates a writer for JPEG images.
46
    *
47
    * @param  image      the image to write from
48
    * @param  quality    sets the JPEG "quality" encoding parameter;
49
    *                    this is a value between 0 and 100
50
    * @param  smoothing  sets the JPEG "smoothing" encoding parameter;
51
    *                    this is a value between 0 and 100
52
    */
53
   JpegImageWriter(LTIImageStage* image,
54
                   int quality = 0,          // 0-100
55
                   int smoothing = 0);       // 0-100
56
   virtual ~JpegImageWriter();
57
   LT_STATUS initialize();
58

    
59
   LT_STATUS writeBegin(const LTIScene& scene);
60
   LT_STATUS writeStrip(LTISceneBuffer& stripBuffer, const LTIScene& stripScene);
61
   LT_STATUS writeEnd();
62

    
63
private:
64
   typedef LTIGeoFileImageWriter Super;
65

    
66
   LT_STATUS checkImpedance() const;
67

    
68
   FILE* m_file;
69

    
70
   //struct that contains the JPEG compression parameters
71
   struct jpeg_compress_struct* m_jpegObject;
72

    
73
   //struct to handle error messages 
74
   struct jpeg_error_mgr* m_jpegErr;
75

    
76
   //two parameters for setting compression quality
77
   int m_quality;
78
   int m_smoothingFactor;
79

    
80
   LTReusableBuffer* m_stripBuffer;
81

    
82
   // nope
83
   JpegImageWriter();
84
   JpegImageWriter(JpegImageWriter&);
85
   JpegImageWriter& operator=(const JpegImageWriter&);
86
};
87

    
88

    
89
LT_END_NAMESPACE(LizardTech)
90

    
91
#if defined(LT_COMPILER_MS)
92
        #pragma warning(pop)
93
#endif
94

    
95
#endif // JPEGIMAGEWRITER_H