digiKam
drawdecoder.h
Go to the documentation of this file.
1 /* ============================================================
2  *
3  * This file is a part of digiKam project
4  * https://www.digikam.org
5  *
6  * Date : 2006-12-09
7  * Description : a tread-safe libraw Qt interface
8  *
9  * Copyright (C) 2006-2022 by Gilles Caulier <caulier dot gilles at gmail dot com>
10  * Copyright (C) 2006-2013 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
11  * Copyright (C) 2007-2008 by Guillaume Castagnino <casta at xwing dot info>
12  *
13  * This program is free software; you can redistribute it
14  * and/or modify it under the terms of the GNU General
15  * Public License as published by the Free Software Foundation;
16  * either version 2, or (at your option)
17  * any later version.
18  *
19  * This program is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22  * GNU General Public License for more details.
23  *
24  * ============================================================ */
25 
26 #ifndef DIGIKAM_DRAW_DECODER_H
27 #define DIGIKAM_DRAW_DECODER_H
28 
29 // C++ includes
30 
31 #include <cmath>
32 
33 // Qt includes
34 
35 #include <QBuffer>
36 #include <QString>
37 #include <QObject>
38 #include <QImage>
39 
40 // Local includes
41 
42 #include "drawdecodersettings.h"
43 #include "drawinfo.h"
44 #include "digikam_export.h"
45 
46 namespace Digikam
47 {
48 
49 class DIGIKAM_EXPORT DRawDecoder : public QObject
50 {
51  Q_OBJECT
52 
53 public:
54 
58  DRawDecoder();
59 
63  ~DRawDecoder() override;
64 
65 public:
66 
71  static bool loadRawPreview(QImage& image, const QString& path);
72 
77  static bool loadRawPreview(QByteArray& imgData, const QString& path);
78 
83  static bool loadRawPreview(QByteArray& imgData, const QBuffer& inBuffer);
84 
89  static bool loadEmbeddedPreview(QByteArray& imgData, const QString& path);
90 
95  static bool loadEmbeddedPreview(QImage& image, const QString& path);
96 
101  static bool loadEmbeddedPreview(QByteArray& imgData, const QBuffer& inBuffer);
102 
107  static bool loadHalfPreview(QImage& image, const QString& path);
108 
113  static bool loadHalfPreview(QByteArray& imgData, const QString& path);
114 
119  static bool loadHalfPreview(QByteArray& imgData, const QBuffer& inBuffer);
120 
125  static bool loadFullImage(QImage& image,
126  const QString& path,
127  const DRawDecoderSettings& settings = DRawDecoderSettings());
128 
134  static bool rawFileIdentify(DRawInfo& identify, const QString& path);
135 
139  static QString rawFiles();
140 
145  static QStringList rawFilesList();
146 
152  static int rawFilesVersion();
153 
157  static QStringList supportedCamera();
158 
162  static QString librawVersion();
163 
168  static int librawUseGomp();
169 
170  static bool isRawFile(const QUrl& url);
171 
172 public:
173 
185  bool extractRAWData(const QString& filePath,
186  QByteArray& rawData,
187  DRawInfo& identify,
188  unsigned int shotSelect=0);
189 
205  bool decodeHalfRAWImage(const QString& filePath,
207  QByteArray& imageData,
208  int& width,
209  int& height,
210  int& rgbmax);
211 
227  bool decodeRAWImage(const QString& filePath,
229  QByteArray& imageData,
230  int& width,
231  int& height,
232  int& rgbmax);
233 
238  void cancel();
239 
240 protected:
241 
246  bool m_cancel;
247 
253 
254 protected:
255 
261  virtual bool checkToCancelWaitingData();
262 
268  virtual void setWaitingDataProgress(double value);
269 
270 public:
271 
272  // NOTE: declared public to be called externally by s_progressCallbackForLibRaw() static method.
273  class Private;
274 
275 private:
276 
277  // Disabled
278  explicit DRawDecoder(QObject*) = delete;
279 
280  Private* const d;
281 
282  friend class Private;
283 };
284 
285 } // namespace Digikam
286 
287 #endif // DIGIKAM_DRAW_DECODER_H
Definition: drawdecodersettings.h:43
Definition: drawdecoder_p.h:75
Definition: drawdecoder.h:50
static bool loadRawPreview(QByteArray &imgData, const QString &path)
DRawDecoderSettings m_decoderSettings
Definition: drawdecoder.h:252
bool m_cancel
Definition: drawdecoder.h:246
static bool loadRawPreview(QByteArray &imgData, const QBuffer &inBuffer)
Definition: drawinfo.h:47
qulonglong value
Definition: itemviewutilities.cpp:592
Definition: datefolderview.cpp:43