From 5a422aba704c375a307a902bafe658342e209906 Mon Sep 17 00:00:00 2001 From: scuri Date: Fri, 17 Oct 2008 06:10:15 +0000 Subject: First commit - moving from LuaForge to SourceForge --- src/im_fileraw.cpp | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 src/im_fileraw.cpp (limited to 'src/im_fileraw.cpp') 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 +#include + + +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; +} -- cgit v1.2.3