File indexing completed on 2024-06-16 04:16:57

0001 /*
0002  *  SPDX-FileCopyrightText: 2005 Cyrille Berger <cberger@cberger.net>
0003  *
0004  *  SPDX-License-Identifier: GPL-2.0-or-later
0005  */
0006 
0007 #ifndef _KIS_JPEG_CONVERTER_H_
0008 #define _KIS_JPEG_CONVERTER_H_
0009 
0010 #include <stdio.h>
0011 
0012 extern "C" {
0013 #include <jpeglib.h>
0014 }
0015 
0016 #include <QColor>
0017 #include <QVector>
0018 
0019 #include "kis_types.h"
0020 #include "kis_annotation.h"
0021 #include <KisImportExportErrorCode.h>
0022 class KisDocument;
0023 
0024 namespace KisMetaData
0025 {
0026 class Filter;
0027 }
0028 
0029 struct KisJPEGOptions {
0030     int quality;
0031     bool progressive;
0032     bool optimize;
0033     int smooth;
0034     bool baseLineJPEG;
0035     int subsampling;
0036     bool exif;
0037     bool iptc;
0038     bool xmp;
0039     QList<const KisMetaData::Filter*> filters;
0040     QColor transparencyFillColor;
0041     bool forceSRGB;
0042     bool saveProfile;
0043     bool storeDocumentMetaData; //this is for getting the metadata from the document info.
0044     bool storeAuthor; //this is for storing author data from the document info.
0045 };
0046 
0047 namespace KisMetaData
0048 {
0049 class Store;
0050 }
0051 
0052 class KisJPEGConverter : public QObject
0053 {
0054     Q_OBJECT
0055 public:
0056     KisJPEGConverter(KisDocument *doc, bool batchMode = false);
0057     ~KisJPEGConverter() override;
0058 public:
0059     KisImportExportErrorCode buildImage(QIODevice *io);
0060     KisImportExportErrorCode buildFile(QIODevice *io, KisPaintLayerSP layer, KisJPEGOptions options, KisMetaData::Store* metaData);
0061     /** Retrieve the constructed image
0062     */
0063     KisImageSP image();
0064 public Q_SLOTS:
0065     virtual void cancel();
0066 private:
0067     KisImportExportErrorCode decode(QIODevice *io);
0068 private:
0069     struct Private;
0070     QScopedPointer<Private> m_d;
0071 };
0072 
0073 #endif