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

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2006-06-14
0007  * Description : A JPEG-2000 IO file for DImg framework
0008  *
0009  * SPDX-FileCopyrightText: 2006-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0010  *
0011  * Others Linux JPEG-2000 Loader implementation:
0012  *    https://github.com/ImageMagick/ImageMagick/blob/master/coders/jp2.c
0013  *    https://github.com/GNOME/gimp/blob/master/plug-ins/common/file-jp2-load.c
0014  *    https://invent.kde.org/kde/krita/tree/fc1d4dce1c12a1a663d02436cde15a77e067af2c/plugins/impex/jp2
0015  *    https://github.com/darktable-org/darktable/blob/master/src/imageio/format/j2k.c
0016  *
0017  * SPDX-License-Identifier: GPL-2.0-or-later
0018  *
0019  * ============================================================ */
0020 
0021 #ifndef DIGIKAM_DIMG_JPEG_2000_LOADER_H
0022 #define DIGIKAM_DIMG_JPEG_2000_LOADER_H
0023 
0024 // Local includes
0025 
0026 #include "dimg.h"
0027 #include "dimgloader.h"
0028 
0029 using namespace Digikam;
0030 
0031 namespace DigikamJPEG2000DImgPlugin
0032 {
0033 
0034 class DImgJPEG2000Loader : public DImgLoader
0035 {
0036 
0037 public:
0038 
0039     explicit DImgJPEG2000Loader(DImg* const image);
0040     ~DImgJPEG2000Loader()                                                  override;
0041 
0042     bool load(const QString& filePath, DImgLoaderObserver* const observer) override;
0043     bool save(const QString& filePath, DImgLoaderObserver* const observer) override;
0044 
0045     bool hasAlpha()                                                  const override;
0046     bool sixteenBit()                                                const override;
0047     bool isReadOnly()                                                const override;
0048 
0049 private:
0050 
0051     int  initJasper();
0052     void cleanupJasper();
0053 
0054 private:
0055 
0056     bool m_sixteenBit;
0057     bool m_hasAlpha;
0058 };
0059 
0060 } // namespace DigikamJPEG2000DImgPlugin
0061 
0062 #endif // DIGIKAM_DIMG_JPEG_2000_LOADER_H