thumbnail.cpp
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include <cstdlib>
00022 #include <cstring>
00023 #include <iostream>
00024
00025 #include "debug.h"
00026
00027 #include <libopenraw/libopenraw.h>
00028 #include <libopenraw++/rawfile.h>
00029 #include <libopenraw++/thumbnail.h>
00030
00031 using namespace Debug;
00032
00033 namespace OpenRaw {
00034
00036 class Thumbnail::Private {
00037 public:
00038 Private()
00039 {
00040 }
00041
00042 ~Private()
00043 {
00044 }
00045 private:
00046 Private(const Private &);
00047 Private & operator=(const Private &);
00048 };
00049
00050 Thumbnail::Thumbnail()
00051 : BitmapData(),
00052 d(new Thumbnail::Private())
00053 {
00054 }
00055
00056 Thumbnail::~Thumbnail()
00057 {
00058 delete d;
00059 }
00060
00061 Thumbnail *
00062 Thumbnail::getAndExtractThumbnail(const char* _filename,
00063 uint32_t preferred_size,
00064 or_error & err)
00065 {
00066 err = OR_ERROR_NONE;
00067 Thumbnail *thumb = NULL;
00068
00069 RawFile *file = RawFile::newRawFile(_filename);
00070 if (file) {
00071 thumb = new Thumbnail();
00072 err = file->getThumbnail(preferred_size, *thumb);
00073 delete file;
00074 }
00075 else {
00076 err = OR_ERROR_CANT_OPEN;
00077 }
00078 return thumb;
00079 }
00080
00081
00082 }