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 * SPDX-License-Identifier: GPL-2.0-or-later 0012 * 0013 * ============================================================ */ 0014 0015 #include "dimgjpeg2000loader.h" 0016 0017 // Local includes 0018 0019 #include "digikam_debug.h" 0020 0021 // Jasper includes 0022 0023 #ifndef Q_CC_MSVC 0024 extern "C" 0025 { 0026 #endif 0027 0028 #if defined(Q_OS_DARWIN) && defined(Q_CC_CLANG) 0029 # pragma clang diagnostic push 0030 # pragma clang diagnostic ignored "-Wshift-negative-value" 0031 #endif 0032 0033 #include <jasper/jasper.h> 0034 #include <jasper/jas_version.h> 0035 0036 #if defined(Q_OS_DARWIN) && defined(Q_CC_CLANG) 0037 # pragma clang diagnostic pop 0038 #endif 0039 0040 #ifndef Q_CC_MSVC 0041 } 0042 #endif 0043 0044 namespace DigikamJPEG2000DImgPlugin 0045 { 0046 0047 DImgJPEG2000Loader::DImgJPEG2000Loader(DImg* const image) 0048 : DImgLoader(image) 0049 { 0050 m_hasAlpha = false; 0051 m_sixteenBit = false; 0052 } 0053 0054 DImgJPEG2000Loader::~DImgJPEG2000Loader() 0055 { 0056 } 0057 0058 bool DImgJPEG2000Loader::hasAlpha() const 0059 { 0060 return m_hasAlpha; 0061 } 0062 0063 bool DImgJPEG2000Loader::sixteenBit() const 0064 { 0065 return m_sixteenBit; 0066 } 0067 0068 bool DImgJPEG2000Loader::isReadOnly() const 0069 { 0070 return false; 0071 } 0072 0073 int DImgJPEG2000Loader::initJasper() 0074 { 0075 0076 #if defined JAS_VERSION_MAJOR && JAS_VERSION_MAJOR >= 3 0077 0078 return jas_init_thread(); 0079 0080 #else 0081 0082 return jas_init(); 0083 0084 #endif 0085 0086 } 0087 0088 void DImgJPEG2000Loader::cleanupJasper() 0089 { 0090 0091 #if defined JAS_VERSION_MAJOR && JAS_VERSION_MAJOR >= 3 0092 0093 jas_cleanup_thread(); 0094 0095 #else 0096 0097 jas_cleanup(); 0098 0099 #endif 0100 0101 } 0102 0103 } // namespace DigikamJPEG2000DImgPlugin