00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef DX_IO_tiff_IO_PLUGIN_OST_HH
00021 #define DX_IO_tiff_IO_PLUGIN_OST_HH
00022
00023
00024
00025
00026
00027 #include <boost/logic/tribool.hpp>
00028
00029 #include "map_io_handler.hh"
00030
00031
00032
00033 struct tiff;
00034
00035 namespace ost { namespace io {
00036
00037 class DLLEXPORT_OST_IO TIF: public ImageFormatBase
00038 {
00039
00040 public:
00041
00042 TIF(boost::logic::tribool normalize_on_save = boost::logic::indeterminate, Format bit_depth = OST_DEFAULT_FORMAT, bool sign = false, bool phasecolor = false, int subimage = -1);
00043
00044 Format GetBitDepth() const;
00045 void SetBitDepth ( Format bitdepth);
00046
00047 bool GetSigned () const;
00048 void SetSigned (bool sign);
00049
00050 bool GetPhasecolor () const;
00051 void SetPhasecolor (bool phasecolor);
00052
00053 Format GetFormat () const;
00054 void SetFormat (Format bit_depth);
00055
00056 boost::logic::tribool GetNormalizeOnSave() const;
00057 void SetNormalizeOnSave(boost::logic::tribool normalize_on_save);
00058
00059 int GetSubimage() const;
00060 void SetSubimage(int subimage);
00061
00062 static String FORMAT_STRING;
00063
00064
00065 protected:
00066
00067 TIF(String format_string, boost::logic::tribool normalize_on_save = boost::logic::indeterminate, Format bit_depth = OST_DEFAULT_FORMAT, bool sign = false, bool phasecolor = false, int subimage = -1);
00068 void do_export(const img::MapHandle& image,tiff* tfile,const TIF& formattif) const;
00069
00070 private:
00071
00072 boost::logic::tribool normalize_on_save_;
00073 Format bit_depth_;
00074 bool signed_;
00075 bool phasecolor_;
00076 int subimage_;
00077
00078 };
00079
00080
00081 class DLLEXPORT_OST_IO MapIOTiffHandler: public MapIOHandler
00082 {
00083 public:
00087 virtual void Import(img::MapHandle& sh, const boost::filesystem::path& loc,
00088 const ImageFormatBase& formatstruct);
00089 virtual void Import(img::MapHandle& sh, std::istream& loc,
00090 const ImageFormatBase& formatstruct);
00091 virtual void Export(const img::MapHandle& sh,
00092 const boost::filesystem::path& loc,
00093 const ImageFormatBase& formatstruct) const;
00094 virtual void Export(const img::MapHandle& sh, std::ostream& loc,
00095 const ImageFormatBase& formatstruct) const;
00096 static bool MatchContent(unsigned char* header);
00097 static bool MatchType(const ImageFormatBase& type);
00098 static bool MatchSuffix(const String& loc);
00099 static String GetFormatName() { return String( "Tiff"); }
00100 static String GetFormatDescription() { return String("Tagged Image File Format"); }
00101
00102 protected:
00103
00104 tiff* open_subimage_file(const boost::filesystem::path& location,
00105 const TIF& formattif);
00106 tiff* open_subimage_stream(std::istream& location,const TIF& formattif);
00107 void load_image_data(tiff* tfile, img::ImageHandle& image,
00108 const TIF& formattif);
00109 virtual void do_export(const img::MapHandle& sh,tiff* tfile,
00110 TIF& formatstruct) const;
00111
00112 };
00113
00114 typedef MapIOHandlerFactory<MapIOTiffHandler> MapIOTiffHandlerFactory;
00115
00116 }}
00117
00118 #endif