diff options
author | scuri <scuri> | 2008-12-03 15:45:33 +0000 |
---|---|---|
committer | scuri <scuri> | 2008-12-03 15:45:33 +0000 |
commit | 5cb32502b777eb0dec8ec2d8a8c9714ed487b86f (patch) | |
tree | dd4da12c768ade65115f260c1d12d64aa180861b /src/im_format_tiff.cpp | |
parent | 41d2b4d6fbb26092580fe06cd997c238366eb532 (diff) |
*** empty log message ***
Diffstat (limited to 'src/im_format_tiff.cpp')
-rw-r--r-- | src/im_format_tiff.cpp | 47 |
1 files changed, 28 insertions, 19 deletions
diff --git a/src/im_format_tiff.cpp b/src/im_format_tiff.cpp index 98467f9..1c55a55 100644 --- a/src/im_format_tiff.cpp +++ b/src/im_format_tiff.cpp @@ -3,7 +3,7 @@ * * See Copyright Notice in im_lib.h * See libTIFF Copyright Notice in tiff.h - * $Id: im_format_tiff.cpp,v 1.1 2008/10/17 06:10:16 scuri Exp $ + * $Id: im_format_tiff.cpp,v 1.2 2008/12/03 15:45:34 scuri Exp $ */ #include "im_format.h" @@ -590,7 +590,7 @@ static void iTIFFWriteAttributes(TIFF* tiff, imAttribTable* attrib_table) iTIFFWriteCustomTags(tiff, attrib_table); } -class imFormatTIFF: public imFormat +class imFileFormatTIFF: public imFileFormatBase { TIFF* tiff; int invert, // must invert black and white reference @@ -606,6 +606,22 @@ class imFormatTIFF: public imFormat int ReadTileline(void* line_buffer, int row, int plane); public: + imFileFormatTIFF(const imFormat* _iformat): imFileFormatBase(_iformat) {} + ~imFileFormatTIFF() {} + + int Open(const char* file_name); + int New(const char* file_name); + void Close(); + void* Handle(int index); + int ReadImageInfo(int index); + int ReadImageData(void* data); + int WriteImageInfo(); + int WriteImageData(void* data); +}; + +class imFormatTIFF: public imFormat +{ +public: imFormatTIFF() :imFormat("TIFF", "Tagged Image File Format", @@ -616,14 +632,7 @@ public: {} ~imFormatTIFF() {} - int Open(const char* file_name); - int New(const char* file_name); - void Close(); - void* Handle(int index); - int ReadImageInfo(int index); - int ReadImageData(void* data); - int WriteImageInfo(); - int WriteImageData(void* data); + imFileFormatBase* Create(void) const { return new imFileFormatTIFF(this); } int CanWrite(const char* compression, int color_mode, int data_type) const; }; @@ -639,7 +648,7 @@ void imFormatRegisterTIFF(void) imFormatRegister(new imFormatTIFF()); } -int imFormatTIFF::Open(const char* file_name) +int imFileFormatTIFF::Open(const char* file_name) { this->tiff = TIFFOpen(file_name, "r"); if (this->tiff == NULL) @@ -659,7 +668,7 @@ int imFormatTIFF::Open(const char* file_name) return IM_ERR_NONE; } -int imFormatTIFF::New(const char* file_name) +int imFileFormatTIFF::New(const char* file_name) { this->tiff = TIFFOpen(file_name, "w"); if (this->tiff == NULL) @@ -670,7 +679,7 @@ int imFormatTIFF::New(const char* file_name) return IM_ERR_NONE; } -void imFormatTIFF::Close() +void imFileFormatTIFF::Close() { if (this->tile_buf) { @@ -682,7 +691,7 @@ void imFormatTIFF::Close() TIFFClose(this->tiff); } -void* imFormatTIFF::Handle(int index) +void* imFileFormatTIFF::Handle(int index) { if (index == 0) return (void*)this->tiff->tif_fd; @@ -692,7 +701,7 @@ void* imFormatTIFF::Handle(int index) return NULL; } -int imFormatTIFF::ReadImageInfo(int index) +int imFileFormatTIFF::ReadImageInfo(int index) { this->cpx_int = 0; this->invert = 0; @@ -1011,7 +1020,7 @@ int imFormatTIFF::ReadImageInfo(int index) return IM_ERR_NONE; } -int imFormatTIFF::WriteImageInfo() +int imFileFormatTIFF::WriteImageInfo() { this->file_color_mode = this->user_color_mode; this->file_data_type = this->user_data_type; @@ -1254,7 +1263,7 @@ static void iTIFFLabFix(void* line_buffer, int width, int data_type, int is_new) // Do NOT know how it is encoded for other data types. } -int imFormatTIFF::ReadTileline(void* line_buffer, int row, int plane) +int imFileFormatTIFF::ReadTileline(void* line_buffer, int row, int plane) { int t; @@ -1295,7 +1304,7 @@ int imFormatTIFF::ReadTileline(void* line_buffer, int row, int plane) return 1; } -int imFormatTIFF::ReadImageData(void* data) +int imFileFormatTIFF::ReadImageData(void* data) { int count = imFileLineBufferCount(this); @@ -1348,7 +1357,7 @@ int imFormatTIFF::ReadImageData(void* data) return IM_ERR_NONE; } -int imFormatTIFF::WriteImageData(void* data) +int imFileFormatTIFF::WriteImageData(void* data) { int count = imFileLineBufferCount(this); |