From d577d991b97ae2b5ee1af23641bcffc3f83af5b2 Mon Sep 17 00:00:00 2001 From: Pixel Date: Wed, 4 Nov 2009 11:56:41 -0800 Subject: Initial import. Contains the im, cd and iup librairies, and a "working" Makefile for them under linux. --- im/src/im_fileraw.cpp | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100755 im/src/im_fileraw.cpp (limited to 'im/src/im_fileraw.cpp') 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 +#include + + +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; +} -- cgit v1.2.3