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-06-17
0007  * Description : A TIFF IO file for DImg framework
0008  *
0009  * SPDX-FileCopyrightText: 2005      by Renchi Raju <renchi dot raju at gmail dot com>
0010  * SPDX-FileCopyrightText: 2006-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0011  *
0012  * SPDX-License-Identifier: GPL-2.0-or-later
0013  *
0014  * ============================================================ */
0015 
0016 // C ANSI includes
0017 extern "C"
0018 {
0019 #include <tiffvers.h>
0020 }
0021 
0022 // C++ includes
0023 
0024 #include <cstdio>
0025 
0026 // Qt includes
0027 
0028 #include <QFile>
0029 #include <QByteArray>
0030 
0031 // Local includes
0032 
0033 #include "digikam_config.h"
0034 #include "digikam_debug.h"
0035 #include "dimgloaderobserver.h"
0036 #include "dimgtiffloader.h"     //krazy:exclude=includes
0037 
0038 namespace DigikamTIFFDImgPlugin
0039 {
0040 
0041 // To manage Errors/Warnings handling provide by libtiff
0042 
0043 void DImgTIFFLoader::dimg_tiff_warning(const char* module, const char* format, va_list warnings)
0044 {
0045     if (DIGIKAM_DIMG_LOG_TIFF().isDebugEnabled())
0046     {
0047         char message[4096];
0048         vsnprintf(message, 4096, format, warnings);
0049         qCDebug(DIGIKAM_DIMG_LOG_TIFF) << module <<  "::" <<  message;
0050     }
0051 }
0052 
0053 void DImgTIFFLoader::dimg_tiff_error(const char* module, const char* format, va_list errors)
0054 {
0055     if (DIGIKAM_DIMG_LOG_TIFF().isDebugEnabled())
0056     {
0057         char message[4096];
0058         vsnprintf(message, 4096, format, errors);
0059         qCDebug(DIGIKAM_DIMG_LOG_TIFF) << module << "::" << message;
0060     }
0061 }
0062 
0063 DImgTIFFLoader::DImgTIFFLoader(DImg* const image)
0064     : DImgLoader(image)
0065 {
0066     m_hasAlpha   = false;
0067     m_sixteenBit = false;
0068 }
0069 
0070 DImgTIFFLoader::~DImgTIFFLoader()
0071 {
0072 }
0073 
0074 bool DImgTIFFLoader::hasAlpha() const
0075 {
0076     return m_hasAlpha;
0077 }
0078 
0079 bool DImgTIFFLoader::sixteenBit() const
0080 {
0081     return m_sixteenBit;
0082 }
0083 
0084 bool DImgTIFFLoader::isReadOnly() const
0085 {
0086     return false;
0087 }
0088 
0089 } // namespace DigikamTIFFDImgPlugin