File indexing completed on 2024-04-28 15:50:41
0001 /* 0002 SPDX-FileCopyrightText: 2008-2015 Gilles Caulier <caulier dot gilles at gmail dot com> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #ifndef KDCRAWPRIVATE_H 0008 #define KDCRAWPRIVATE_H 0009 0010 // Qt includes 0011 0012 #include <QByteArray> 0013 0014 // Pragma directives to reduce warnings from LibRaw header files. 0015 #if !defined(__APPLE__) && defined(__GNUC__) 0016 #pragma GCC diagnostic push 0017 #pragma GCC diagnostic ignored "-Wdeprecated-declarations" 0018 #endif 0019 0020 #if defined(__APPLE__) && defined(__clang__) 0021 #pragma clang diagnostic push 0022 #pragma clang diagnostic ignored "-Wdeprecated-declarations" 0023 #endif 0024 0025 // LibRaw includes 0026 0027 #include <libraw.h> 0028 0029 // Restore warnings 0030 #if !defined(__APPLE__) && defined(__GNUC__) 0031 #pragma GCC diagnostic pop 0032 #endif 0033 0034 #if defined(__APPLE__) && defined(__clang__) 0035 #pragma clang diagnostic pop 0036 #endif 0037 0038 // Local includes 0039 0040 #include "dcrawinfocontainer.h" 0041 #include "kdcraw.h" 0042 0043 namespace KDcrawIface 0044 { 0045 0046 extern "C" 0047 { 0048 int callbackForLibRaw(void* data, enum LibRaw_progress p, int iteration, int expected); 0049 } 0050 0051 class KDcrawPrivate 0052 { 0053 0054 public: 0055 0056 explicit KDcrawPrivate(KDcraw* const p); 0057 ~KDcrawPrivate(); 0058 0059 public: 0060 0061 int progressCallback(enum LibRaw_progress p, int iteration, int expected); 0062 0063 void setProgress(double value); 0064 double progressValue() const; 0065 0066 bool loadFromLibraw(const QString& filePath, QByteArray& imageData, 0067 int& width, int& height, int& rgbmax); 0068 0069 public: 0070 0071 static void createPPMHeader(QByteArray& imgData, libraw_processed_image_t* const img); 0072 0073 static void fillIndentifyInfo(LibRaw* const raw, DcrawInfoContainer& identify); 0074 0075 static bool loadEmbeddedPreview(QByteArray&, LibRaw&); 0076 0077 static bool loadHalfPreview(QImage&, LibRaw&); 0078 0079 private: 0080 0081 double m_progress; 0082 0083 KDcraw* const m_parent; 0084 0085 friend class KDcraw; 0086 }; 0087 0088 } // namespace KDcrawIface 0089 0090 #endif /* KDCRAWPRIVATE_H */