libopenraw
thumbnail.cpp
1 /*
2  * libopenraw - thumbnail.cpp
3  *
4  * Copyright (C) 2005-2016 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 <stdint.h>
22 #include <cstdlib>
23 #include <memory>
24 
25 #include <libopenraw/consts.h>
26 
27 #include "bitmapdata.hpp"
28 #include "rawfile.hpp"
29 #include "thumbnail.hpp"
30 
31 namespace OpenRaw {
32 
35 public:
36  Private() {}
37 
38  ~Private() {}
39 
40  Private(const Private &) = delete;
41  Private &operator=(const Private &) = delete;
42 };
43 
44 Thumbnail::Thumbnail() : BitmapData(), d(new Thumbnail::Private())
45 {
46 }
47 
48 Thumbnail::~Thumbnail()
49 {
50  delete d;
51 }
52 
54  uint32_t preferred_size,
55  or_error &err)
56 {
57  err = OR_ERROR_NONE;
58  Thumbnail *thumb = NULL;
59 
60  std::unique_ptr<RawFile> file(RawFile::newRawFile(_filename));
61  if (file) {
62  thumb = new Thumbnail();
63  err = file->getThumbnail(preferred_size, *thumb);
64  } else {
65  err = OR_ERROR_CANT_OPEN; // file error
66  }
67  return thumb;
68 }
69 }
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:30
static Thumbnail * getAndExtractThumbnail(const char *_filename, uint32_t preferred_size, ::or_error &err)
Definition: thumbnail.cpp:53
static RawFile * newRawFile(const char *_filename, Type _typeHint=OR_RAWFILE_TYPE_UNKNOWN)
Definition: rawfile.cpp:164