summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--html/en/rep_guide.html4
-rw-r--r--include/im_format_all.h2
-rw-r--r--include/im_format_raw.h8
-rw-r--r--src/im_fileraw.cpp38
-rw-r--r--src/im_format_raw.cpp20
5 files changed, 44 insertions, 28 deletions
diff --git a/html/en/rep_guide.html b/html/en/rep_guide.html
index 144c11f..5c70790 100644
--- a/html/en/rep_guide.html
+++ b/html/en/rep_guide.html
@@ -35,9 +35,9 @@ void* buffer = malloc(size);</pre>
<pre>float value;
if (is_packed)
-value = idata[y*width*depth + x*depth + d]
+ value = idata[y*width*depth + x*depth + d]
else
-value = idata[d*width*height + y*width + x]</pre>
+ value = idata[d*width*height + y*width + x]</pre>
</div>
<div align="left">
diff --git a/include/im_format_all.h b/include/im_format_all.h
index 3a7cbb6..bb43816 100644
--- a/include/im_format_all.h
+++ b/include/im_format_all.h
@@ -477,7 +477,7 @@ void imFormatRegisterTGA(void);
Description (string)
Comments:
- In fact ASCII is an expansion...
+ In fact ASCII is an expansion, not a compression, because the file will be larger than binary data.
\endverbatim
* \ingroup format */
void imFormatRegisterPNM(void);
diff --git a/include/im_format_raw.h b/include/im_format_raw.h
index fdb07f8..80a8203 100644
--- a/include/im_format_raw.h
+++ b/include/im_format_raw.h
@@ -22,8 +22,9 @@ extern "C" {
* \par
* Internal Implementation.
* \par
- * Supports RAW binary images. You must know image parameters a priori. \n
- * You must set the IM_INT attributes "Width", "Height", "ColorMode", "DataType" before the imFileReadImageInfo/imFileWriteImageInfo functions.
+ * Supports RAW binary images. This is a unstructured and uncompressed binary data.
+ * It is NOT a Camera RAW file generated in many professional digital cameras. \n
+ * You must know image parameters a priori and must set the IM_INT attributes "Width", "Height", "ColorMode", "DataType" before the imFileReadImageInfo/imFileWriteImageInfo functions.
* \par
* The data must be in binary form, but can start in an arbitrary offset from the begining of the file, use attribute "StartOffset".
* The default is at 0 offset.
@@ -54,8 +55,9 @@ extern "C" {
ImageCount[1], StartOffset[0], SwitchType[FALSE], ByteOrder[IM_LITTLEENDIAN], Padding[0] IM_INT (1)
\endverbatim
* \ingroup format */
-imFileFormatBase* imFormatInitRAW(void);
+imFormat* imFormatInitRAW(void);
+void imFormatFinishRAW(void);
#if defined(__cplusplus)
}
diff --git a/src/im_fileraw.cpp b/src/im_fileraw.cpp
index 530b6c9..91be826 100644
--- a/src/im_fileraw.cpp
+++ b/src/im_fileraw.cpp
@@ -2,7 +2,7 @@
* \brief RAW File Format Open/New Functions
*
* See Copyright Notice in im_lib.h
- * $Id: im_fileraw.cpp,v 1.2 2008/12/03 15:45:34 scuri Exp $
+ * $Id: im_fileraw.cpp,v 1.3 2009/09/10 17:33:35 scuri Exp $
*/
#include "im.h"
@@ -21,44 +21,46 @@ imFile* imFileOpenRaw(const char* file_name, int *error)
{
assert(file_name);
- imFileFormatBase* iformat = imFormatInitRAW();
- *error = iformat->Open(file_name);
+ imFormat* iformat = imFormatInitRAW();
+ imFileFormatBase* ifileformat = iformat->Create();
+ *error = ifileformat->Open(file_name);
if (*error)
{
- delete iformat;
+ delete ifileformat;
return NULL;
}
- imFileClear(iformat);
+ imFileClear(ifileformat);
- iformat->attrib_table = new imAttribTable(599);
+ ifileformat->attrib_table = new imAttribTable(599);
- iformat->counter = imCounterBegin(file_name);
+ ifileformat->counter = imCounterBegin(file_name);
- return iformat;
+ return ifileformat;
}
imFile* imFileNewRaw(const char* file_name, int *error)
{
assert(file_name);
- imFileFormatBase* iformat = imFormatInitRAW();
- *error = iformat->New(file_name);
+ imFormat* iformat = imFormatInitRAW();
+ imFileFormatBase* ifileformat = iformat->Create();
+ *error = ifileformat->New(file_name);
if (*error)
{
- delete iformat;
+ delete ifileformat;
return NULL;
}
- imFileClear(iformat);
+ imFileClear(ifileformat);
- iformat->is_new = 1;
- iformat->image_count = 0;
- iformat->compression[0] = 0;
+ ifileformat->is_new = 1;
+ ifileformat->image_count = 0;
+ ifileformat->compression[0] = 0;
- iformat->attrib_table = new imAttribTable(101);
+ ifileformat->attrib_table = new imAttribTable(101);
- iformat->counter = imCounterBegin(file_name);
+ ifileformat->counter = imCounterBegin(file_name);
- return iformat;
+ return ifileformat;
}
diff --git a/src/im_format_raw.cpp b/src/im_format_raw.cpp
index 5f8d2e5..6a6a7fd 100644
--- a/src/im_format_raw.cpp
+++ b/src/im_format_raw.cpp
@@ -2,7 +2,7 @@
* \brief RAW File Format
*
* See Copyright Notice in im_lib.h
- * $Id: im_format_raw.cpp,v 1.3 2009/07/10 18:39:37 scuri Exp $
+ * $Id: im_format_raw.cpp,v 1.4 2009/09/10 17:33:35 scuri Exp $
*/
#include "im_format.h"
@@ -58,11 +58,23 @@ public:
int CanWrite(const char* compression, int color_mode, int data_type) const;
};
+static imFormat* raw_format = NULL;
-imFileFormatBase* imFormatInitRAW(void)
+void imFormatFinishRAW(void)
{
- imFormatRAW iformat;
- return iformat.Create();
+ if (raw_format)
+ {
+ delete raw_format;
+ raw_format = NULL;
+ }
+}
+
+imFormat* imFormatInitRAW(void)
+{
+ if (!raw_format)
+ raw_format = new imFormatRAW();
+
+ return raw_format;
}
int imFileFormatRAW::Open(const char* file_name)