]> Creatis software - clitk.git/blob - utilities/CxImage/ximatif.h
cosmetic
[clitk.git] / utilities / CxImage / ximatif.h
1 /*
2  * File:        ximatif.h
3  * Purpose:     TIFF Image Class Loader and Writer
4  */
5 /* ==========================================================
6  * CxImageTIF (c) 07/Aug/2001 Davide Pizzolato - www.xdp.it
7  * For conditions of distribution and use, see copyright notice in ximage.h
8  *
9  * Special thanks to Troels Knakkergaard for new features, enhancements and bugfixes
10  *
11  * Special thanks to Abe <God(dot)bless(at)marihuana(dot)com> for MultiPageTIFF code.
12  *
13  * LibTIFF is:
14  * Copyright (c) 1988-1997 Sam Leffler
15  * Copyright (c) 1991-1997 Silicon Graphics, Inc.
16  * ==========================================================
17  */
18
19 #if !defined(__ximatif_h)
20 #define __ximatif_h
21
22 #include "ximage.h"
23
24 #if CXIMAGE_SUPPORT_TIF
25
26 #include "../tiff/tiffio.h"
27
28 class DLL_EXP CxImageTIF: public CxImage
29 {
30 public:
31         CxImageTIF(): CxImage(CXIMAGE_FORMAT_TIF) {m_tif2=NULL; m_multipage=false; m_pages=0;}
32         ~CxImageTIF();
33
34         TIFF* TIFFOpenEx(CxFile * hFile);
35         void  TIFFCloseEx(TIFF* tif);
36
37 //      bool Load(const TCHAR * imageFileName){ return CxImage::Load(imageFileName,CXIMAGE_FORMAT_TIF);}
38 //      bool Save(const TCHAR * imageFileName){ return CxImage::Save(imageFileName,CXIMAGE_FORMAT_TIF);}
39         bool Decode(CxFile * hFile);
40         bool Decode(FILE *hFile) { CxIOFile file(hFile); return Decode(&file); }
41
42 #if CXIMAGE_SUPPORT_ENCODE
43         bool Encode(CxFile * hFile, bool bAppend=false);
44         bool Encode(CxFile * hFile, CxImage ** pImages, int pagecount);
45         bool Encode(FILE *hFile, bool bAppend=false) { CxIOFile file(hFile); return Encode(&file,bAppend); }
46         bool Encode(FILE *hFile, CxImage ** pImages, int pagecount)
47                                 { CxIOFile file(hFile); return Encode(&file, pImages, pagecount); }
48 #endif // CXIMAGE_SUPPORT_ENCODE
49
50 protected:
51         void TileToStrip(uint8* out, uint8* in, uint32 rows, uint32 cols, int outskew, int inskew);
52         bool EncodeBody(TIFF *m_tif, bool multipage=false, int page=0, int pagecount=0);
53         TIFF *m_tif2;
54         bool m_multipage;
55         int  m_pages;
56         void MoveBits( BYTE* dest, BYTE* from, int count, int bpp );
57         void MoveBitsPal( BYTE* dest, BYTE*from, int count, int bpp, RGBQUAD* pal );
58 };
59
60 #endif
61
62 #endif