summaryrefslogtreecommitdiff
path: root/src/im_format_sgi.cpp
diff options
context:
space:
mode:
authorscuri <scuri>2008-12-03 15:45:33 +0000
committerscuri <scuri>2008-12-03 15:45:33 +0000
commit5cb32502b777eb0dec8ec2d8a8c9714ed487b86f (patch)
treedd4da12c768ade65115f260c1d12d64aa180861b /src/im_format_sgi.cpp
parent41d2b4d6fbb26092580fe06cd997c238366eb532 (diff)
*** empty log message ***
Diffstat (limited to 'src/im_format_sgi.cpp')
-rw-r--r--src/im_format_sgi.cpp49
1 files changed, 29 insertions, 20 deletions
diff --git a/src/im_format_sgi.cpp b/src/im_format_sgi.cpp
index 1b0ac0a..08bbf4d 100644
--- a/src/im_format_sgi.cpp
+++ b/src/im_format_sgi.cpp
@@ -2,7 +2,7 @@
* \brief SGI - Silicon Graphics Image File Format
*
* See Copyright Notice in im_lib.h
- * $Id: im_format_sgi.cpp,v 1.1 2008/10/17 06:10:16 scuri Exp $
+ * $Id: im_format_sgi.cpp,v 1.2 2008/12/03 15:45:34 scuri Exp $
*/
#include "im_format.h"
@@ -133,15 +133,31 @@ static const char* iSGICompTable[2] =
"RLE"
};
-class imFormatSGI: public imFormat
+class imFileFormatSGI: public imFileFormatBase
{
imBinFile* handle; /* the binary file handle */
unsigned char comp_type, /* sgi compression information */
bpc; /* bytes per channels */
- unsigned int *starttab, /* compression control buffer */
- *lengthtab; /* compression control buffer */
+ unsigned int *starttab, /* compression control buffer */
+ *lengthtab; /* compression control buffer */
public:
+ imFileFormatSGI(const imFormat* _iformat): imFileFormatBase(_iformat) {}
+ ~imFileFormatSGI() {}
+
+ 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 imFormatSGI: public imFormat
+{
+public:
imFormatSGI()
:imFormat("SGI",
"Silicon Graphics Image File Format",
@@ -152,14 +168,7 @@ public:
{}
~imFormatSGI() {}
- 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 imFileFormatSGI(this); }
int CanWrite(const char* compression, int color_mode, int data_type) const;
};
@@ -168,7 +177,7 @@ void imFormatRegisterSGI(void)
imFormatRegister(new imFormatSGI());
}
-int imFormatSGI::Open(const char* file_name)
+int imFileFormatSGI::Open(const char* file_name)
{
unsigned short word_value;
@@ -213,7 +222,7 @@ int imFormatSGI::Open(const char* file_name)
return IM_ERR_NONE;
}
-int imFormatSGI::New(const char* file_name)
+int imFileFormatSGI::New(const char* file_name)
{
/* opens the binary file for writing with motorola byte order */
handle = imBinFileNew(file_name);
@@ -230,14 +239,14 @@ int imFormatSGI::New(const char* file_name)
return IM_ERR_NONE;
}
-void imFormatSGI::Close()
+void imFileFormatSGI::Close()
{
if (this->starttab) free(this->starttab);
if (this->lengthtab) free(this->lengthtab);
imBinFileClose(handle);
}
-void* imFormatSGI::Handle(int index)
+void* imFileFormatSGI::Handle(int index)
{
if (index == 0)
return (void*)this->handle;
@@ -245,7 +254,7 @@ void* imFormatSGI::Handle(int index)
return NULL;
}
-int imFormatSGI::ReadImageInfo(int index)
+int imFileFormatSGI::ReadImageInfo(int index)
{
(void)index;
unsigned short word_value, dimension, depth;
@@ -378,7 +387,7 @@ int imFormatSGI::ReadImageInfo(int index)
return IM_ERR_NONE;
}
-int imFormatSGI::WriteImageInfo()
+int imFileFormatSGI::WriteImageInfo()
{
unsigned int dword_value;
unsigned short word_value;
@@ -487,7 +496,7 @@ int imFormatSGI::WriteImageInfo()
return IM_ERR_NONE;
}
-int imFormatSGI::ReadImageData(void* data)
+int imFileFormatSGI::ReadImageData(void* data)
{
int count = imFileLineBufferCount(this);
@@ -533,7 +542,7 @@ int imFormatSGI::ReadImageData(void* data)
return IM_ERR_NONE;
}
-int imFormatSGI::WriteImageData(void* data)
+int imFileFormatSGI::WriteImageData(void* data)
{
int count = imFileLineBufferCount(this);