00001
00062 #ifndef INC_MI32_TIFFEXT_H
00063 #define INC_MI32_TIFFEXT_H
00064
00065 #ifndef INC_MI32_FILERAW_H
00066 #include <mi32/fileraw.h>
00067 #endif
00068
00069 #ifndef INC_MI32_GENERICRWMEM_H
00070 #include <mi32/genericrwmem.h>
00071 #endif
00072
00073 #ifndef INC_MI32_COLOR_H
00074 #include <mi32/color.h>
00075 #endif
00076
00077 #ifndef INC_MI32_CTRLPT_H
00078 #include <mi32/ctrlpt.h>
00079 #endif
00080
00081 #ifndef INC_MI32_MISTRING_H
00082 #include <mi32/mistring.h>
00083 #endif
00084
00085 #ifdef RVCSYSDLL
00086 #define CLASSLIBEXPORT MI_DLLCLASSEXPORT
00087 #else
00088 #define CLASSLIBEXPORT MI_DLLCLASSIMPORT
00089 #endif
00090
00091 #ifndef GENERATING_DOXYGEN_OUTPUT
00092 class TRANS2D_AFFINE;
00093 namespace SPATREF {
00094 class COORDREFSYS;
00095 }
00096 #endif
00097
00098
00099
00101 class CLASSLIBEXPORT TIFFEXT {
00102 public:
00103
00104 enum SUBTYPEFLAGS {
00105 SUBTYPEFLAG_None = 0x00,
00106 SUBTYPEFLAG_ReducedImage = 0x01,
00107 SUBTYPEFLAG_Page = 0x02,
00108 SUBTYPEFLAG_Mask = 0x04
00109 };
00110
00111 enum COMPRESSION {
00112 COMPRESSION_None = 1,
00113 COMPRESSION_CCITT_RLE = 2,
00114 COMPRESSION_CCITT_FAX3 = 3,
00115 COMPRESSION_CCITT_FAX4 = 4,
00116 COMPRESSION_L_Z_W = 5,
00117 COMPRESSION_OldJPEG = 6,
00118 COMPRESSION_JPEG_DCT = 7,
00119 COMPRESSION_NeXT = 32766,
00120 COMPRESSION_CCITT_RLEW = 32771,
00121 COMPRESSION_PackBits = 32773,
00122 COMPRESSION_ThunderScan = 32809
00123 };
00124
00125 enum PHOTOMETRIC {
00126 PHOTOMETRIC_MinIsWhite = 0,
00127 PHOTOMETRIC_MinIsBlack = 1,
00128 PHOTOMETRIC_RedGreenBlue = 2,
00129 PHOTOMETRIC_Palette = 3,
00130 PHOTOMETRIC_Mask = 4,
00131 PHOTOMETRIC_Separated = 5,
00132 PHOTOMETRIC_YCbCr = 6,
00133 PHOTOMETRIC_CIE_Lab = 8,
00134 PHOTOMETRIC_ITU_Lab = 10,
00135 PHOTOMETRIC_CMYK = 65530
00136 };
00137
00138 enum PLANARCONFIG {
00139 PLANARCONFIG_Contiguous = 1,
00140 PLANARCONFIG_Separate = 2
00141 };
00142
00143 enum RESOLUTIONUNIT {
00144 RESOLUTIONUNIT_Inch = 2,
00145 RESOLUTIONUNIT_Centimeter = 3
00146 };
00147
00148 enum SAMPLEFORMAT {
00149 SAMPLEFORMAT_Unsigned = 1,
00150 SAMPLEFORMAT_Signed = 2,
00151 SAMPLEFORMAT_Float = 3,
00152 SAMPLEFORMAT_Undefined = 4,
00153 SAMPLEFORMAT_ComplexInt = 5,
00154 SAMPLEFORMAT_ComplexFloat = 6
00155 };
00156
00157 #ifndef GENERATING_DOXYGEN_OUTPUT
00158 class IMAGEINFO;
00159 class IMAGEINFO_PRIV;
00160 #endif // GENERATING_DOXYGEN_OUTPUT
00161
00164 void AddRef (
00165 );
00166
00168 int GetDefaultImageIdx (
00169 ) const;
00170
00172 IMAGEINFO GetImageInfo (
00173 ) const;
00174
00176 int GetNumImages (
00177 ) const;
00178
00180 int GetOpenImageIdx (
00181 ) const;
00182
00185 int MakeImage (
00186 const IMAGEINFO& imageinfo
00187 );
00188
00191 ERRVALUE OpenImage (
00192 UINT16 ImageIdx
00193 );
00194
00197 int ReadContrastTable (
00198 SIMPLE_ARRAY<UINT8>& table
00199 );
00200
00203 int ReadGeoreference (
00204 SPATREF::COORDREFSYS& CoordRefSys,
00205 TRANS2D_AFFINE& TransAffine,
00206 SIMPLE_ARRAY<CTRLPOINT3>& CtrlPoints
00207 );
00208
00209
00210 ERRVALUE ReadMetadata (
00211 MISTRING& string
00212 );
00213
00216 int ReadPalette (
00217 COLOR_ARRAY& palette
00218 );
00219
00221 ERRVALUE ReadPixels (
00222 INT32 sample,
00223 INT32 line,
00224 INT32 column,
00225 INT32 numpixels,
00226 void *buffer,
00227 bool leavepacked = false
00228 );
00229
00232 bool Release (
00233 );
00234
00237 void SetWriteUserDefinedCRS (
00238 bool WriteUserDefinedCRS = true
00239 );
00240
00243 ERRVALUE WriteContrast (
00244 UINT16 MaxValue,
00245 UINT16 MinValue
00246 );
00247
00249 ERRVALUE WriteGeoreference (
00250 const SPATREF::COORDREFSYS& CoordRefSys,
00251 const TRANS2D_AFFINE& TransAffine,
00252 bool ForceNonRotated = false
00253 );
00254
00256 ERRVALUE WriteGeoreference (
00257 const SPATREF::COORDREFSYS& CoordRefSys,
00258 const CTRLPOINT3 *CtrlPoints,
00259 int NumCtrlPoints,
00260 bool ForceNonRotated = false
00261 );
00262
00264 ERRVALUE WriteGeoreference (
00265 const SPATREF::COORDREFSYS& CoordRefSys,
00266 const SIMPLE_ARRAY<CTRLPOINT3>& CtrlPoints,
00267 bool ForceNonRotated = false
00268 );
00269
00271 ERRVALUE WritePalette (
00272 const COLOR_ARRAY& palette
00273 );
00274
00276 ERRVALUE WritePixels (
00277 INT32 sample,
00278 INT32 line,
00279 INT32 column,
00280 INT32 numpixels,
00281 const void *buffer,
00282 bool prepacked = false
00283 );
00284
00285 protected:
00286
00287 enum OPENMODE {
00288 OPENMODE_Read = 0,
00289 OPENMODE_Write = 1
00290 };
00291
00293 TIFFEXT ();
00294
00296 virtual ~TIFFEXT ();
00297
00299 ERRVALUE CloseTIFF ();
00300
00302 ERRVALUE OpenTIFF (
00303 GENERICRW *pGenRW,
00304 const MIUNICODE *name,
00305 OPENMODE openmode,
00306 bool IsBigTiff = false
00307 );
00308
00309 private:
00310 #ifndef GENERATING_DOXYGEN_OUTPUT
00311 class PRIV;
00312 PRIV *m_pPriv;
00313
00314 TIFFEXT (const TIFFEXT&);
00315 TIFFEXT& operator= (const TIFFEXT&);
00316 friend class TIFFEXT::PRIV;
00317 #endif // GENERATING_DOXYGEN_OUTPUT
00318 };
00319
00320 #ifndef GENERATING_DOXYGEN_OUTPUT
00321 DEFINE_ENUM_OP_BITWISE(TIFFEXT::SUBTYPEFLAGS)
00322 #endif
00323
00324
00325
00326
00328 class CLASSLIBEXPORT TIFFEXT::IMAGEINFO {
00329 public:
00330
00332 IMAGEINFO (
00333 INT32 ImageLength,
00334 INT32 ImageWidth,
00335 UINT16 SamplesPerPixel,
00336 UINT16 BitsPerSample,
00337 SAMPLEFORMAT SampleFormat = SAMPLEFORMAT_Unsigned
00338 );
00339
00340 #ifndef GENERATING_DOXYGEN_OUTPUT
00341 IMAGEINFO (IMAGEINFO_PRIV*);
00342 #endif // GENERATING_DOXYGEN_OUTPUT
00343
00345 IMAGEINFO (
00346 const IMAGEINFO& rhs
00347 );
00348
00350 ~IMAGEINFO (
00351 );
00352
00354 IMAGEINFO& operator= (
00355 const IMAGEINFO& rhs
00356 );
00357
00361 UINT16 GetBitsPerSample (
00362 ) const;
00363
00365 COMPRESSION GetCompression (
00366 ) const;
00367
00369 MISTRING GetDescription (
00370 ) const;
00371
00373 INT32 GetImageLength (
00374 ) const;
00375
00377 INT32 GetImageWidth (
00378 ) const;
00379
00381 PHOTOMETRIC GetPhotometric (
00382 ) const;
00383
00386 PLANARCONFIG GetPlanarConfig (
00387 ) const;
00388
00392 SAMPLEFORMAT GetSampleFormat (
00393 ) const;
00394
00397 MISTRING GetSampleName (
00398 INT16 sample
00399 ) const;
00400
00402 UINT16 GetSamplesPerPixel (
00403 ) const;
00404
00406 INT32 GetSegmentLength (
00407 ) const;
00408
00410 INT32 GetSegmentWidth (
00411 ) const;
00412
00414 SUBTYPEFLAGS GetSubTypeFlags (
00415 ) const;
00416
00418 bool IsTiled (
00419 ) const;
00420
00422 void SetCompression (
00423 COMPRESSION compression
00424 );
00425
00427 void SetDescription (
00428 const MISTRING& desc
00429 );
00430
00432 void SetPhotometric (
00433 PHOTOMETRIC photometric
00434 );
00435
00437 void SetPlanarConfig (
00438 PLANARCONFIG PlanarConfig
00439 );
00440
00442 void SetResolution (
00443 double xres,
00444 double yres,
00445 RESOLUTIONUNIT resunit
00446 );
00447
00451 void SetSegmentSize (
00452 INT32 SegmentLength,
00453 INT32 SegmentWidth
00454 );
00455
00457 void SetSubTypeFlags (
00458 SUBTYPEFLAGS SubTypeFlags
00459 );
00460
00461 private:
00462 #ifndef GENERATING_DOXYGEN_OUTPUT
00463 IMAGEINFO_PRIV *m_pPriv;
00464 void GetExclusive();
00465 friend class TIFFEXT;
00466 #endif // GENERATING_DOXYGEN_OUTPUT
00467 };
00468
00469
00470
00471 class CLASSLIBEXPORT TIFFEXT_FILE : public TIFFEXT {
00472 public:
00473
00475 TIFFEXT_FILE ();
00476
00478 ~TIFFEXT_FILE ();
00479
00481 ERRVALUE Close ();
00482
00483 FILEPATH GetPath () const;
00484
00486 ERRVALUE Make (
00487 const FILEPATH& filepath,
00488 bool IsBigTiff = false
00489 );
00490
00492 ERRVALUE Open (
00493 const FILEPATH& filepath
00494 );
00495
00496 private:
00497 #ifndef GENERATING_DOXYGEN_OUTPUT
00498 FILE_RAW m_file;
00499 #endif // GENERATING_DOXYGEN_OUTPUT
00500 };
00501
00503 class CLASSLIBEXPORT TIFFEXT_MEM : public TIFFEXT {
00504 public:
00505
00507 TIFFEXT_MEM ();
00508
00510 ~TIFFEXT_MEM ();
00511
00513 ERRVALUE Close ();
00514
00516 const UINT8* GetBuffer (
00517 ) const;
00518
00521 INT64 GetBufferSize (
00522 ) const;
00523
00525 UINT8* Detach (
00526 );
00527
00531 ERRVALUE Make (
00532 UINT8*& buf,
00533 UINT32 bufsize
00534 );
00535
00537 ERRVALUE Open (
00538 UINT8*& buf,
00539 UINT32 bufsize
00540 );
00541
00542 private:
00543 #ifndef GENERATING_DOXYGEN_OUTPUT
00544 GENERICRW_MEMORY m_mem;
00545 #endif
00546 };
00547
00548
00549
00550 #undef CLASSLIBEXPORT
00551
00552 #endif // INC_MI32_TIFFEXT_H