26 #include <boost/checked_delete.hpp>
28 #include <libopenraw/consts.h>
29 #include <libopenraw/thumbnails.h>
30 #include <libopenraw/types.h>
32 #include "rawfile.hpp"
48 #define CHECK_PTR(p, r) \
53 const char **or_get_file_extensions()
55 return RawFile::fileExtensions();
58 ORRawFileRef or_rawfile_new(
const char *filename, or_rawfile_type type)
60 CHECK_PTR(filename, NULL);
61 RawFile *rawfile = RawFile::newRawFile(filename, type);
62 return reinterpret_cast<ORRawFileRef
>(rawfile);
65 ORRawFileRef or_rawfile_new_from_memory(
const uint8_t *buffer, uint32_t len,
68 CHECK_PTR(buffer, NULL);
69 RawFile *rawfile = RawFile::newRawFileFromMemory(buffer, len, type);
70 return reinterpret_cast<ORRawFileRef
>(rawfile);
73 or_error or_rawfile_release(ORRawFileRef rawfile)
75 CHECK_PTR(rawfile, OR_ERROR_NOTAREF);
76 boost::checked_delete(
reinterpret_cast<RawFile *
>(rawfile));
80 or_rawfile_type or_rawfile_get_type(ORRawFileRef rawfile)
82 CHECK_PTR(rawfile, OR_RAWFILE_TYPE_UNKNOWN);
84 return prawfile->
type();
87 or_rawfile_typeid or_rawfile_get_typeid(ORRawFileRef rawfile)
89 CHECK_PTR(rawfile, OR_RAWFILE_TYPE_UNKNOWN);
95 or_rawfile_get_thumbnail_sizes(ORRawFileRef rawfile,
98 CHECK_PTR(rawfile,
nullptr);
99 CHECK_PTR(size,
nullptr);
109 return &(*v.begin());
112 or_error or_rawfile_get_thumbnail(ORRawFileRef rawfile,
113 uint32_t _preferred_size,
114 ORThumbnailRef thumb)
116 CHECK_PTR(rawfile, OR_ERROR_NOTAREF);
122 or_error or_rawfile_get_rawdata(ORRawFileRef rawfile, ORRawDataRef rawdata,
126 CHECK_PTR(rawfile, OR_ERROR_NOTAREF);
130 or_error or_rawfile_get_rendered_image(ORRawFileRef rawfile,
131 ORBitmapDataRef bitmapdata,
135 CHECK_PTR(rawfile, OR_ERROR_NOTAREF);
137 *
reinterpret_cast<BitmapData *
>(bitmapdata), options);
140 int32_t or_rawfile_get_orientation(ORRawFileRef rawfile)
143 CHECK_PTR(rawfile, 0);
147 or_error or_rawfile_get_colourmatrix1(ORRawFileRef rawfile,
double *matrix,
151 CHECK_PTR(rawfile, OR_ERROR_NOTAREF);
152 CHECK_PTR(size, OR_ERROR_INVALID_PARAM);
156 or_error or_rawfile_get_colourmatrix2(ORRawFileRef rawfile,
double *matrix,
160 CHECK_PTR(rawfile, OR_ERROR_NOTAREF);
161 CHECK_PTR(size, OR_ERROR_INVALID_PARAM);
162 return prawfile->getColourMatrix2(matrix, *size);
165 ExifLightsourceValue or_rawfile_get_calibration_illuminant1(ORRawFileRef rawfile)
168 CHECK_PTR(rawfile, (ExifLightsourceValue)0);
172 ExifLightsourceValue or_rawfile_get_calibration_illuminant2(ORRawFileRef rawfile)
175 CHECK_PTR(rawfile, (ExifLightsourceValue)0);
176 return prawfile->getCalibrationIlluminant2();
180 or_rawfile_get_metavalue(ORRawFileRef rawfile, int32_t meta_index)
183 CHECK_PTR(rawfile,
nullptr);
184 return reinterpret_cast<ORConstMetaValueRef
>(prawfile->getMetaValue(meta_index));