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

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2009-06-03
0007  * Description : A PGF IO file for DImg framework
0008  *
0009  * SPDX-FileCopyrightText: 2009-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0010  *
0011  * This implementation use LibPGF API <https://www.libpgf.org>
0012  *
0013  * SPDX-License-Identifier: GPL-2.0-or-later
0014  *
0015  * ============================================================ */
0016 
0017 #ifndef DIGIKAM_DIMG_PGF_LOADER_H
0018 #define DIGIKAM_DIMG_PGF_LOADER_H
0019 
0020 // Local includes
0021 
0022 #include "dimg.h"
0023 #include "dimgloader.h"
0024 
0025 using namespace Digikam;
0026 
0027 namespace Digikam
0028 {
0029 
0030 class DImgPGFLoader : public DImgLoader
0031 {
0032 
0033 public:
0034 
0035     explicit DImgPGFLoader(DImg* const image);
0036     ~DImgPGFLoader()                                                       override;
0037 
0038     bool load(const QString& filePath, DImgLoaderObserver* const observer) override;
0039     bool save(const QString& filePath, DImgLoaderObserver* const observer) override;
0040 
0041     bool hasAlpha()                                                  const override;
0042     bool sixteenBit()                                                const override;
0043     bool isReadOnly()                                                const override;
0044 
0045 private:
0046 
0047     bool progressCallback(double percent, bool escapeAllowed);
0048 
0049     static bool CallbackForLibPGF(double percent,
0050                                   bool escapeAllowed,
0051                                   void* data);
0052 
0053 private:
0054 
0055     bool                m_sixteenBit;
0056     bool                m_hasAlpha;
0057 
0058     DImgLoaderObserver* m_observer;
0059 };
0060 
0061 } // namespace Digikam
0062 
0063 #endif // DIGIKAM_DIMG_PGF_LOADER_H