File indexing completed on 2025-01-05 03:57:11
0001 /* ============================================================ 0002 * 0003 * This file is a part of digiKam project 0004 * https://www.digikam.org 0005 * 0006 * Date : 2008-10-09 0007 * Description : internal private container for DRawDecoder 0008 * 0009 * SPDX-FileCopyrightText: 2008-2024 by Gilles Caulier <caulier dot gilles at gmail dot com> 0010 * 0011 * SPDX-License-Identifier: GPL-2.0-or-later 0012 * 0013 * ============================================================ */ 0014 0015 #ifndef DIGIKAM_DRAW_DECODER_PRIVATE_H 0016 #define DIGIKAM_DRAW_DECODER_PRIVATE_H 0017 0018 #include "digikam_config.h" 0019 0020 // Qt includes 0021 0022 #include <QByteArray> 0023 #include <QFile> 0024 #include <QFileInfo> 0025 #include <QStringList> 0026 #include <QUrl> 0027 #include <QPointer> 0028 0029 // Local includes 0030 0031 #include "digikam_debug.h" 0032 #include "digikam_config.h" 0033 #include "drawinfo.h" 0034 #include "drawdecoder.h" 0035 #include "drawfiles.h" 0036 0037 // LibRaw includes 0038 0039 #include "libraw_version.h" 0040 #include "libraw_config.h" 0041 0042 // Pragma directives to reduce warnings from LibRaw and LCMS2 headers 0043 0044 #if !defined(Q_OS_DARWIN) && defined(Q_CC_GNU) 0045 # pragma GCC diagnostic push 0046 # pragma GCC diagnostic ignored "-Wdeprecated-declarations" 0047 #endif 0048 0049 #if defined(Q_CC_CLANG) 0050 # pragma clang diagnostic push 0051 # pragma clang diagnostic ignored "-Wdeprecated-declarations" 0052 # pragma clang diagnostic ignored "-Wundef" 0053 # pragma clang diagnostic ignored "-Wdeprecated-register" 0054 # pragma clang diagnostic ignored "-Wmacro-redefined" 0055 #endif 0056 0057 // LibRaw includes 0058 0059 #include "libraw.h" 0060 0061 // Restore warnings 0062 #if !defined(Q_OS_DARWIN) && defined(Q_CC_GNU) 0063 # pragma GCC diagnostic pop 0064 #endif 0065 0066 #if defined(Q_CC_CLANG) 0067 # pragma clang diagnostic pop 0068 #endif 0069 0070 namespace Digikam 0071 { 0072 0073 extern "C" 0074 { 0075 int s_progressCallbackForLibRaw(void* context, enum LibRaw_progress p, int iteration, int expected); 0076 void s_exifParserCallbackForLibRaw(void* context, int tag, int type, int len, unsigned int ord, void* ifp, INT64 base); 0077 } 0078 0079 class Q_DECL_HIDDEN DRawDecoder::Private 0080 { 0081 0082 public: 0083 0084 explicit Private(DRawDecoder* const p); 0085 ~Private(); 0086 0087 public: 0088 0089 int progressCallback(enum LibRaw_progress p, int iteration, int expected); 0090 void exifParserCallback(int tag, int type, int len, unsigned int ord, void* ifp, INT64 base); 0091 0092 void setProgress(double value); 0093 double progressValue() const; 0094 0095 bool loadFromLibraw(const QString& filePath, QByteArray& imageData, 0096 int& width, int& height, int& rgbmax); 0097 0098 public: 0099 0100 static void createPPMHeader(QByteArray& imgData, libraw_processed_image_t* const img); 0101 0102 static void fillIndentifyInfo(LibRaw* const raw, DRawInfo& identify); 0103 0104 static bool loadEmbeddedPreview(QByteArray&, LibRaw* const raw); 0105 0106 static bool loadHalfPreview(QImage&, LibRaw* const raw, bool rotate = true); 0107 0108 private: 0109 0110 double m_progress; 0111 0112 DRawDecoder* m_parent; 0113 0114 friend class DRawDecoder; 0115 }; 0116 0117 } // namespace Digikam 0118 0119 #endif // DIGIKAM_DRAW_DECODER_PRIVATE_H