00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00025 #include <libopenraw/libopenraw.h>
00026
00027 #include <libopenraw++/thumbnail.h>
00028
00029 using OpenRaw::Thumbnail;
00030
00031 extern "C" {
00032
00033
00034
00035 or_error or_get_extract_thumbnail(const char* _filename,
00036 uint32_t _preferred_size,
00037 ORThumbnailRef *_thumb)
00038 {
00039 or_error ret = OR_ERROR_NONE;
00040
00041 Thumbnail ** pThumbnail = reinterpret_cast<Thumbnail **>(_thumb);
00042 *pThumbnail = Thumbnail::getAndExtractThumbnail(_filename,
00043 _preferred_size, ret);
00044 return ret;
00045 }
00046
00047
00048 ORThumbnailRef or_thumbnail_new(void)
00049 {
00050 Thumbnail *thumb = new Thumbnail();
00051 return reinterpret_cast<ORThumbnailRef>(thumb);
00052 }
00053
00054
00055 or_error
00056 or_thumbnail_release(ORThumbnailRef thumb)
00057 {
00058 if (thumb == NULL) {
00059 return OR_ERROR_NOTAREF;
00060 }
00061 delete reinterpret_cast<Thumbnail *>(thumb);
00062 return OR_ERROR_NONE;
00063 }
00064
00065
00066 or_data_type
00067 or_thumbnail_format(ORThumbnailRef thumb)
00068 {
00069 return reinterpret_cast<Thumbnail *>(thumb)->dataType();
00070 }
00071
00072
00073 void *
00074 or_thumbnail_data(ORThumbnailRef thumb)
00075 {
00076 return reinterpret_cast<Thumbnail *>(thumb)->data();
00077 }
00078
00079 size_t
00080 or_thumbnail_data_size(ORThumbnailRef thumb)
00081 {
00082 return reinterpret_cast<Thumbnail *>(thumb)->size();
00083 }
00084
00085 void
00086 or_thumbnail_dimensions(ORThumbnailRef thumb,
00087 uint32_t *x, uint32_t *y)
00088 {
00089 Thumbnail* t = reinterpret_cast<Thumbnail *>(thumb);
00090 if (x != NULL) {
00091 *x = t->x();
00092 }
00093 if (y != NULL) {
00094 *y = t->y();
00095 }
00096 }
00097
00098
00099 }
00100