47 #ifndef VIGRA_CODEC_HXX
48 #define VIGRA_CODEC_HXX
54 #include "array_vector.hxx"
57 #include "sized_int.hxx"
77 static std::string result() {
return "undefined"; }
81 struct TypeAsString<
Int8>
83 static std::string result() {
return "INT8"; }
87 struct TypeAsString<
UInt8>
89 static std::string result() {
return "UINT8"; }
93 struct TypeAsString<
Int16>
95 static std::string result() {
return "INT16"; }
99 struct TypeAsString<
UInt16>
101 static std::string result() {
return "UINT16"; }
105 struct TypeAsString<
Int32>
107 static std::string result() {
return "INT32"; }
111 struct TypeAsString<
UInt32>
113 static std::string result() {
return "UINT32"; }
117 struct TypeAsString<float>
119 static std::string result() {
return "FLOAT"; }
123 struct TypeAsString<double>
125 static std::string result() {
return "DOUBLE"; }
132 std::string fileType;
133 std::vector<std::string> pixelTypes;
134 std::vector<std::string> compressionTypes;
135 std::vector<std::vector<char> > magicStrings;
136 std::vector<std::string> fileExtensions;
137 std::vector<int> bandNumbers;
145 virtual ~Decoder() {};
146 virtual void init(
const std::string & ) = 0;
149 virtual void init(
const std::string & fileName,
unsigned int)
154 virtual void close() = 0;
155 virtual void abort() = 0;
157 virtual std::string getFileType()
const = 0;
158 virtual std::string getPixelType()
const = 0;
160 virtual unsigned int getNumImages()
const
165 virtual void setImageIndex(
unsigned int)
169 virtual unsigned int getImageIndex()
const
174 virtual unsigned int getWidth()
const = 0;
175 virtual unsigned int getHeight()
const = 0;
176 virtual unsigned int getNumBands()
const = 0;
177 virtual unsigned int getNumExtraBands()
const
187 virtual float getXResolution()
const
191 virtual float getYResolution()
const
201 virtual unsigned int getOffset()
const = 0;
203 virtual const void * currentScanlineOfBand(
unsigned int )
const = 0;
204 virtual void nextScanline() = 0;
206 typedef ArrayVector<unsigned char> ICCProfile;
208 const ICCProfile & getICCProfile()
const
213 ICCProfile iccProfile_;
218 virtual ~Encoder() {};
219 virtual void init(
const std::string & ) = 0;
222 virtual void init(
const std::string & fileName,
const std::string & )
227 virtual void close() = 0;
228 virtual void abort() = 0;
230 virtual std::string getFileType()
const = 0;
231 virtual unsigned int getOffset()
const = 0;
233 virtual void setWidth(
unsigned int ) = 0;
234 virtual void setHeight(
unsigned int ) = 0;
235 virtual void setNumBands(
unsigned int ) = 0;
236 virtual void setCompressionType(
const std::string &,
int = -1 ) = 0;
237 virtual void setPixelType(
const std::string & ) = 0;
238 virtual void finalizeSettings() = 0;
246 virtual void setXResolution(
float )
249 virtual void setYResolution(
float )
253 typedef ArrayVector<unsigned char> ICCProfile;
255 virtual void setICCProfile(
const ICCProfile & )
259 virtual void * currentScanlineOfBand(
unsigned int ) = 0;
260 virtual void nextScanline() = 0;
262 struct TIFFCompressionException {};
269 virtual CodecDesc getCodecDesc()
const = 0;
270 virtual VIGRA_UNIQUE_PTR<Decoder> getDecoder()
const = 0;
271 virtual VIGRA_UNIQUE_PTR<Encoder> getEncoder()
const = 0;
272 virtual ~CodecFactory() {};
282 VIGRA_EXPORT VIGRA_UNIQUE_PTR<Decoder>
283 getDecoder(
const std::string &,
const std::string & =
"undefined",
unsigned int = 0 );
285 VIGRA_EXPORT VIGRA_UNIQUE_PTR<Encoder>
286 getEncoder(
const std::string &,
const std::string & =
"undefined",
const std::string & =
"w" );
288 VIGRA_EXPORT std::string
289 getEncoderType(
const std::string &,
const std::string & =
"undefined" );
293 VIGRA_EXPORT std::vector<std::string> queryCodecPixelTypes(
const std::string & );
295 VIGRA_EXPORT
bool negotiatePixelType( std::string
const & codecname,
296 std::string
const & srcPixeltype, std::string & destPixeltype);
298 VIGRA_EXPORT
bool isPixelTypeSupported(
const std::string &,
const std::string & );
300 VIGRA_EXPORT
bool isBandNumberSupported(
const std::string &,
int bands );
303 #endif // VIGRA_CODEC_HXX
detail::SelectIntegerType< 8, detail::UnsignedIntTypes >::type UInt8
8-bit unsigned int
Definition: sized_int.hxx:179
Two dimensional difference vector.
Definition: diff2d.hxx:185
detail::SelectIntegerType< 16, detail::UnsignedIntTypes >::type UInt16
16-bit unsigned int
Definition: sized_int.hxx:181
Two dimensional size object.
Definition: diff2d.hxx:482
detail::SelectIntegerType< 16, detail::SignedIntTypes >::type Int16
16-bit signed int
Definition: sized_int.hxx:173
detail::SelectIntegerType< 32, detail::SignedIntTypes >::type Int32
32-bit signed int
Definition: sized_int.hxx:175
detail::SelectIntegerType< 32, detail::UnsignedIntTypes >::type UInt32
32-bit unsigned int
Definition: sized_int.hxx:183
detail::SelectIntegerType< 8, detail::SignedIntTypes >::type Int8
8-bit signed int
Definition: sized_int.hxx:171