summaryrefslogtreecommitdiff
path: root/im/src/im_fileraw.cpp
diff options
context:
space:
mode:
authorPixel <pixel@nobis-crew.org>2009-11-04 11:56:41 -0800
committerPixel <pixel@nobis-crew.org>2009-11-04 11:59:33 -0800
commitd577d991b97ae2b5ee1af23641bcffc3f83af5b2 (patch)
tree590639d50205d1bcfaff2a7d2dc6ebf3f373c7ed /im/src/im_fileraw.cpp
Initial import. Contains the im, cd and iup librairies, and a "working" Makefile for them under linux.
Diffstat (limited to 'im/src/im_fileraw.cpp')
-rwxr-xr-xim/src/im_fileraw.cpp66
1 files changed, 66 insertions, 0 deletions
diff --git a/im/src/im_fileraw.cpp b/im/src/im_fileraw.cpp
new file mode 100755
index 0000000..91be826
--- /dev/null
+++ b/im/src/im_fileraw.cpp
@@ -0,0 +1,66 @@
+/** \file
+ * \brief RAW File Format Open/New Functions
+ *
+ * See Copyright Notice in im_lib.h
+ * $Id: im_fileraw.cpp,v 1.3 2009/09/10 17:33:35 scuri Exp $
+ */
+
+#include "im.h"
+#include "im_image.h"
+#include "im_util.h"
+#include "im_counter.h"
+#include "im_raw.h"
+#include "im_format.h"
+#include "im_format_raw.h"
+
+#include <stdlib.h>
+#include <assert.h>
+
+
+imFile* imFileOpenRaw(const char* file_name, int *error)
+{
+ assert(file_name);
+
+ imFormat* iformat = imFormatInitRAW();
+ imFileFormatBase* ifileformat = iformat->Create();
+ *error = ifileformat->Open(file_name);
+ if (*error)
+ {
+ delete ifileformat;
+ return NULL;
+ }
+
+ imFileClear(ifileformat);
+
+ ifileformat->attrib_table = new imAttribTable(599);
+
+ ifileformat->counter = imCounterBegin(file_name);
+
+ return ifileformat;
+}
+
+imFile* imFileNewRaw(const char* file_name, int *error)
+{
+ assert(file_name);
+
+ imFormat* iformat = imFormatInitRAW();
+ imFileFormatBase* ifileformat = iformat->Create();
+ *error = ifileformat->New(file_name);
+ if (*error)
+ {
+ delete ifileformat;
+ return NULL;
+ }
+
+ imFileClear(ifileformat);
+
+ ifileformat->is_new = 1;
+ ifileformat->image_count = 0;
+ ifileformat->compression[0] = 0;
+
+ ifileformat->attrib_table = new imAttribTable(101);
+
+ ifileformat->counter = imCounterBegin(file_name);
+
+ return ifileformat;
+}