libopenraw
|
00001 /* 00002 * libopenraw - thumbnail.cpp 00003 * 00004 * Copyright (C) 2005-2007 Hubert Figuiere 00005 * 00006 * This library is free software: you can redistribute it and/or 00007 * modify it under the terms of the GNU Lesser General Public License 00008 * as published by the Free Software Foundation, either version 3 of 00009 * the License, or (at your option) any later version. 00010 * 00011 * This library is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * Lesser General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Lesser General Public 00017 * License along with this library. If not, see 00018 * <http://www.gnu.org/licenses/>. 00019 */ 00020 00021 #include <cstdlib> 00022 #include <cstring> 00023 #include <iostream> 00024 00025 #include "trace.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; // file error 00077 } 00078 return thumb; 00079 } 00080 00081 00082 }