File indexing completed on 2025-01-19 03:51:03

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2005-11-01
0007  * Description : A digital camera RAW files loader for DImg
0008  *               framework using an external dcraw instance.
0009  *
0010  * SPDX-FileCopyrightText: 2005-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0011  * SPDX-FileCopyrightText: 2005-2012 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
0012  *
0013  * SPDX-License-Identifier: GPL-2.0-or-later
0014  *
0015  * ============================================================ */
0016 
0017 #ifndef DIGIKAM_DIMG_RAW_LOADER_H
0018 #define DIGIKAM_DIMG_RAW_LOADER_H
0019 
0020 // Local includes
0021 
0022 #include "dimg.h"
0023 #include "drawdecoder.h"
0024 #include "dimgloader.h"
0025 #include "drawdecoding.h"
0026 #include "rawprocessingfilter.h"
0027 
0028 using namespace Digikam;
0029 
0030 namespace DigikamRAWDImgPlugin
0031 {
0032 
0033 class DImgRAWLoader : public DRawDecoder,
0034                       public DImgLoader
0035 {
0036     Q_OBJECT
0037 
0038 public:
0039 
0040     explicit DImgRAWLoader(DImg* const image, const DRawDecoding& rawDecodingSettings = DRawDecoding());
0041     ~DImgRAWLoader()                                                                 override;
0042 
0043     bool load(const QString& filePath, DImgLoaderObserver* const observer = nullptr) override;
0044     bool save(const QString&, DImgLoaderObserver* const)                             override;
0045 
0046     bool hasAlpha()   const                                                          override;
0047     bool isReadOnly() const                                                          override;
0048     bool sixteenBit() const                                                          override;
0049 
0050     void postProcess(DImgLoaderObserver* const observer);
0051 
0052     FilterAction filterAction() const;
0053 
0054 private:
0055 
0056     bool loadedFromRawData(const QByteArray& data,
0057                            int width,
0058                            int height,
0059                            int rgbmax,
0060                            DImgLoaderObserver* const observer);
0061 
0062     bool checkToCancelWaitingData()                                                 override;
0063     void setWaitingDataProgress(double value)                                       override;
0064 
0065 private:
0066 
0067     // Disable
0068     explicit DImgRAWLoader(QObject*)               = delete;
0069     DImgRAWLoader(const DImgRAWLoader&)            = delete;
0070     DImgRAWLoader& operator=(const DImgRAWLoader&) = delete;
0071 
0072 private:
0073 
0074     DImgLoaderObserver*  m_observer;
0075     RawProcessingFilter* m_filter;
0076 };
0077 
0078 } // namespace DigikamRAWDImgPlugin
0079 
0080 #endif // DIGIKAM_DIMG_RAW_LOADER_H