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