MrSID Decode SDK for Raster Reference Manual  9.5.1.4427
PNGImageWriter.h
Go to the documentation of this file.
00001 /* $Id$ */
00002 /* //////////////////////////////////////////////////////////////////////////
00003 //                                                                         //
00004 // This code is Copyright (c) 2005 LizardTech, Inc, 1008 Western Avenue,   //
00005 // Suite 200, Seattle, WA 98104.  Unauthorized use or distribution         //
00006 // prohibited.  Access to and use of this code is permitted only under     //
00007 // license from LizardTech, Inc.  Portions of the code are protected by    //
00008 // US and foreign patents and other filings. All Rights Reserved.          //
00009 //                                                                         //
00011 /* PUBLIC */
00012 
00013 #ifndef PNGIMAGEWRITER_H
00014 #define PNGIMAGEWRITER_H
00015 
00016 // lt_lib_mrsid_core
00017 #include "lti_geoFileImageWriter.h"
00018 
00019 #if defined(LT_COMPILER_MS)
00020    #pragma warning(push,4)
00021 #endif
00022 
00023 struct png_struct_def;
00024 struct png_info_struct;
00025 struct png_color_struct;
00026 
00027 LT_BEGIN_NAMESPACE(LizardTech)
00028 
00029 class LTFileSpec;
00030 
00036 class PNGImageWriter : public LTIGeoFileImageWriter
00037 {
00038    LT_DISALLOW_COPY_CONSTRUCTOR(PNGImageWriter);
00039 public:
00040    PNGImageWriter(void);
00041    ~PNGImageWriter(void);
00042 
00043    LT_STATUS initialize(LTIImageStage *imageStage);
00044 
00045 
00056    void setCompressionLevel( lt_int16 level );
00057 
00066    enum ScanlineFilter {
00067       NoFilters = 0x00,
00068       FilterNone  = 0x08,
00069       FilterSub   = 0x10,
00070       FilterUp    = 0x20,
00071       FilterAvg   = 0x40,
00072       FilterPaeth = 0x80,
00073       FilterAll   = 0xf8,
00074    };
00075    void setScanlineFilter(ScanlineFilter filters);
00076 
00083    LT_STATUS setWriteTransparencyColor(bool write);
00084 
00089    LT_STATUS setAddAlphaBand(bool addAlpha);
00090 
00101    LT_STATUS setPaletteSize(lt_uint32 size);
00102 
00107    LT_STATUS write(const LTIScene &scene);
00109 
00114    LT_STATUS writeBegin(const LTIScene& scene);
00115    LT_STATUS writeStrip(LTISceneBuffer& stripBuffer, const LTIScene& stripScene);
00116    LT_STATUS writeEnd();
00118 
00119 private:
00120    LT_STATUS checkImpedance() const;
00121 
00122    struct png_struct_def *m_png;
00123    struct png_info_struct *m_info;
00124    struct png_color_struct *m_pct;
00125    lt_int32 m_pctsize;
00126 
00127    bool m_writeTransparencyColor;
00128    bool m_addAlphaBand;
00129    lt_uint32 m_paletteSize;
00130    lt_int16 m_compressionLevel;
00131    ScanlineFilter m_scanlineFilters;
00132 
00133    char *m_errorMessage;
00134 };
00135 
00136 
00137 LT_END_NAMESPACE(LizardTech)
00138 
00139 #if defined(LT_COMPILER_MS)
00140    #pragma warning(pop)
00141 #endif
00142 
00143 #endif // PNGIMAGEWRITER_H