diff options
author | scuri <scuri> | 2008-10-17 06:10:15 +0000 |
---|---|---|
committer | scuri <scuri> | 2008-10-17 06:10:15 +0000 |
commit | 5a422aba704c375a307a902bafe658342e209906 (patch) | |
tree | 5005011e086bb863d8fb587ad3319bbec59b2447 /src/im_fileraw.cpp |
First commit - moving from LuaForge to SourceForge
Diffstat (limited to 'src/im_fileraw.cpp')
-rw-r--r-- | src/im_fileraw.cpp | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/src/im_fileraw.cpp b/src/im_fileraw.cpp new file mode 100644 index 0000000..da7ef81 --- /dev/null +++ b/src/im_fileraw.cpp @@ -0,0 +1,64 @@ +/** \file + * \brief RAW File Format Open/New Functions + * + * See Copyright Notice in im_lib.h + * $Id: im_fileraw.cpp,v 1.1 2008/10/17 06:10:16 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(); + *error = iformat->Open(file_name); + if (*error) + { + delete iformat; + return NULL; + } + + imFileClear(iformat); + + iformat->attrib_table = new imAttribTable(599); + + iformat->counter = imCounterBegin(file_name); + + return iformat; +} + +imFile* imFileNewRaw(const char* file_name, int *error) +{ + assert(file_name); + + imFormat* iformat = imFormatInitRAW(); + *error = iformat->New(file_name); + if (*error) + { + delete iformat; + return NULL; + } + + imFileClear(iformat); + + iformat->is_new = 1; + iformat->image_count = 0; + iformat->compression[0] = 0; + + iformat->attrib_table = new imAttribTable(101); + + iformat->counter = imCounterBegin(file_name); + + return iformat; +} |