File indexing completed on 2024-05-12 04:33:19
0001 /* 0002 SPDX-FileCopyrightText: 2009-2010 Patrick Spendrin <ps_ml@gmx.de> 0003 SPDX-FileCopyrightText: 2007-2018 Gilles Caulier <caulier dot gilles at gmail dot com> 0004 0005 SPDX-License-Identifier: GPL-2.0-or-later 0006 */ 0007 0008 #ifndef KIPIWRITEHELP_H 0009 #define KIPIWRITEHELP_H 0010 0011 // C++ includes 0012 0013 #include <cstdio> 0014 0015 // Qt includes 0016 0017 #include <QIODevice> 0018 0019 // C ANSI includes 0020 0021 extern "C" 0022 { 0023 #include <jpeglib.h> 0024 #include <png.h> 0025 } 0026 0027 namespace KXMLKipiCmd 0028 { 0029 0030 /** 0031 * a replacement function for jpeg_stdio_dest 0032 * for convenience reasons, it uses a QIODevice instead of a QFile, but the main advantage is to not give over 0033 * a FILE* pointer on Windows which can break due to different MS C Runtime libraries. 0034 * 0035 * Prepare for output to a QIODevice. 0036 * The caller must have already opened the device, and is responsible 0037 * for closing it after finishing compression. 0038 */ 0039 void kipi_jpeg_qiodevice_dest(j_compress_ptr cinfo, QIODevice* const outfile); 0040 0041 /** 0042 * a replacement function for jpeg_stdio_src 0043 * for convenience reasons, it uses a QIODevice instead of a QFile, but the main advantage is to not give over 0044 * a FILE* pointer on Windows which can break due to different MS C Runtime libraries. 0045 * 0046 * Prepare for input from a QIODevice. 0047 * The caller must have already opened the device, and is responsible 0048 * for closing it after finishing reading. 0049 */ 0050 void kipi_jpeg_qiodevice_src(j_decompress_ptr cinfo, QIODevice* const infile); 0051 0052 /** 0053 * a callback function for writing a png image 0054 */ 0055 void kipi_png_write_fn(png_structp png_ptr, png_bytep data, png_size_t length); 0056 0057 /** 0058 * a callback function for flushing the buffers, currently unused, since no buffering happens 0059 */ 0060 void kipi_png_flush_fn(png_structp png_ptr); 0061 0062 /** 0063 * To manage Errors/Warnings handling provide by libtiff 0064 */ 0065 void kipi_tiff_warning(const char* module, const char* format, va_list warnings); 0066 void kipi_tiff_error(const char* module, const char* format, va_list errors); 0067 0068 } // namespace KXMLKipiCmd 0069 0070 #endif // KIPIWRITEHELP_H