digiKam
drawdecoder_p.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 : 2008-10-09
7  * Description : internal private container for DRawDecoder
8  *
9  * Copyright (C) 2008-2022 by Gilles Caulier <caulier dot gilles at gmail dot com>
10  *
11  * This program is free software; you can redistribute it
12  * and/or modify it under the terms of the GNU General
13  * Public License as published by the Free Software Foundation;
14  * either version 2, or (at your option)
15  * any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  * ============================================================ */
23 
24 #ifndef DIGIKAM_DRAW_DECODER_PRIVATE_H
25 #define DIGIKAM_DRAW_DECODER_PRIVATE_H
26 
27 #include "digikam_config.h"
28 
29 // Qt includes
30 
31 #include <QByteArray>
32 
33 // Pragma directives to reduce warnings from LibRaw and LCMS2 headers
34 #if !defined(Q_OS_DARWIN) && defined(Q_CC_GNU)
35 # pragma GCC diagnostic push
36 # pragma GCC diagnostic ignored "-Wdeprecated-declarations"
37 #endif
38 
39 #if defined(Q_CC_CLANG)
40 # pragma clang diagnostic push
41 # pragma clang diagnostic ignored "-Wdeprecated-declarations"
42 # pragma clang diagnostic ignored "-Wundef"
43 # pragma clang diagnostic ignored "-Wdeprecated-register"
44 # pragma clang diagnostic ignored "-Wmacro-redefined"
45 #endif
46 
47 // LibRaw includes
48 
49 #include <libraw.h>
50 
51 // Restore warnings
52 #if !defined(Q_OS_DARWIN) && defined(Q_CC_GNU)
53 # pragma GCC diagnostic pop
54 #endif
55 
56 #if defined(Q_CC_CLANG)
57 # pragma clang diagnostic pop
58 #endif
59 
60 // Local includes
61 
62 #include "drawinfo.h"
63 #include "drawdecoder.h"
64 
65 namespace Digikam
66 {
67 
68 extern "C"
69 {
70  int s_progressCallbackForLibRaw(void* context, enum LibRaw_progress p, int iteration, int expected);
71  void s_exifParserCallbackForLibRaw(void* context, int tag, int type, int len, unsigned int ord, void* ifp, INT64 base);
72 }
73 
74 class Q_DECL_HIDDEN DRawDecoder::Private
75 {
76 
77 public:
78 
79  explicit Private(DRawDecoder* const p);
80  ~Private();
81 
82 public:
83 
84  int progressCallback(enum LibRaw_progress p, int iteration, int expected);
85  void exifParserCallback(int tag, int type, int len, unsigned int ord, void* ifp, INT64 base);
86 
87  void setProgress(double value);
88  double progressValue() const;
89 
90  bool loadFromLibraw(const QString& filePath, QByteArray& imageData,
91  int& width, int& height, int& rgbmax);
92 
93 public:
94 
95  static void createPPMHeader(QByteArray& imgData, libraw_processed_image_t* const img);
96 
97  static void fillIndentifyInfo(LibRaw* const raw, DRawInfo& identify);
98 
99  static bool loadEmbeddedPreview(QByteArray&, LibRaw* const raw);
100 
101  static bool loadHalfPreview(QImage&, LibRaw* const raw);
102 
103 private:
104 
105  double m_progress;
106 
107  DRawDecoder* m_parent;
108 
109  friend class DRawDecoder;
110 };
111 
112 } // namespace Digikam
113 
114 #endif // DIGIKAM_DRAW_DECODER_PRIVATE_H
Definition: drawdecoder_p.h:75
Definition: drawdecoder.h:50
Definition: drawinfo.h:47
qulonglong value
Definition: itemviewutilities.cpp:592
Definition: datefolderview.cpp:43
int s_progressCallbackForLibRaw(void *context, enum LibRaw_progress p, int iteration, int expected)
Definition: drawdecoder_p.cpp:47
void s_exifParserCallbackForLibRaw(void *context, int tag, int type, int len, unsigned int ord, void *ifp, INT64 base)
Definition: drawdecoder_p.cpp:59