23 #include <boost/checked_delete.hpp>
24 #include <libopenraw/libopenraw.h>
27 #include <libopenraw++/rawfile.h>
28 #include <libopenraw++/bitmapdata.h>
38 #define CHECK_PTR(p,r) \
39 if(p == NULL) { return r; }
41 const char **or_get_file_extensions()
43 return RawFile::fileExtensions();
47 or_rawfile_new(
const char* filename, or_rawfile_type type)
49 CHECK_PTR(filename, NULL);
50 RawFile * rawfile = RawFile::newRawFile(filename, type);
51 return reinterpret_cast<ORRawFileRef
>(rawfile);
55 or_rawfile_new_from_memory(
const uint8_t *buffer, uint32_t len, or_rawfile_type type)
57 CHECK_PTR(buffer, NULL);
58 RawFile * rawfile = RawFile::newRawFileFromMemory(buffer, len, type);
59 return reinterpret_cast<ORRawFileRef
>(rawfile);
64 or_rawfile_release(ORRawFileRef rawfile)
66 CHECK_PTR(rawfile, OR_ERROR_NOTAREF);
67 boost::checked_delete(reinterpret_cast<RawFile *>(rawfile));
72 or_rawfile_get_type(ORRawFileRef rawfile)
74 CHECK_PTR(rawfile, OR_RAWFILE_TYPE_UNKNOWN);
76 return prawfile->
type();
80 or_rawfile_get_thumbnail(ORRawFileRef rawfile, uint32_t _preferred_size,
83 CHECK_PTR(rawfile, OR_ERROR_NOTAREF);
86 *reinterpret_cast<Thumbnail*>(thumb));
90 or_rawfile_get_rawdata(ORRawFileRef rawfile, ORRawDataRef rawdata,
94 CHECK_PTR(rawfile, OR_ERROR_NOTAREF);
95 return prawfile->
getRawData(*reinterpret_cast<RawData*>(rawdata), options);
99 or_rawfile_get_rendered_image(ORRawFileRef rawfile, ORBitmapDataRef bitmapdata,
103 CHECK_PTR(rawfile, OR_ERROR_NOTAREF);
104 return prawfile->
getRenderedImage(*reinterpret_cast<BitmapData*>(bitmapdata), options);
108 or_rawfile_get_orientation(ORRawFileRef rawfile)
111 CHECK_PTR(rawfile, 0);