libopenraw
thumbnail.cpp
1 /*
2  * libopenraw - thumbnail.cpp
3  *
4  * Copyright (C) 2005-2007 Hubert Figuiere
5  *
6  * This library is free software: you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public License
8  * as published by the Free Software Foundation, either version 3 of
9  * the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library. If not, see
18  * <http://www.gnu.org/licenses/>.
19  */
20 
21 #include <cstdlib>
22 #include <cstring>
23 #include <iostream>
24 
25 #include "trace.h"
26 
27 #include <libopenraw/libopenraw.h>
28 #include <libopenraw++/rawfile.h>
29 #include <libopenraw++/thumbnail.h>
30 
31 using namespace Debug;
32 
33 namespace OpenRaw {
34 
37  public:
38  Private()
39  {
40  }
41 
42  ~Private()
43  {
44  }
45  private:
46  Private(const Private &);
47  Private & operator=(const Private &);
48  };
49 
50  Thumbnail::Thumbnail()
51  : BitmapData(),
52  d(new Thumbnail::Private())
53  {
54  }
55 
56  Thumbnail::~Thumbnail()
57  {
58  delete d;
59  }
60 
61  Thumbnail *
62  Thumbnail::getAndExtractThumbnail(const char* _filename,
63  uint32_t preferred_size,
64  or_error & err)
65  {
66  err = OR_ERROR_NONE;
67  Thumbnail *thumb = NULL;
68 
69  RawFile *file = RawFile::newRawFile(_filename);
70  if (file) {
71  thumb = new Thumbnail();
72  err = file->getThumbnail(preferred_size, *thumb);
73  delete file;
74  }
75  else {
76  err = OR_ERROR_CANT_OPEN; // file error
77  }
78  return thumb;
79  }
80 
81 
82 }
CIFF is the container for CRW files. It is an attempt from Canon to make this a standard. I guess it failed.
Definition: arwfile.cpp:33
::or_error getThumbnail(uint32_t size, Thumbnail &thumbnail)
Definition: rawfile.cpp:322
static Thumbnail * getAndExtractThumbnail(const char *_filename, uint32_t preferred_size,::or_error &err)
Definition: thumbnail.cpp:62
Definition: trace.cpp:28
static RawFile * newRawFile(const char *_filename, Type _typeHint=OR_RAWFILE_TYPE_UNKNOWN)
Definition: rawfile.cpp:135