blob: da7ef81c0d6ba60d28d0c844e9719988478e5131 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
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;
}
|