kis_jpeg_converter.h
1/*
2 * Copyright (c) 2005 Cyrille Berger <cberger@cberger.net>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18 */
19
20#ifndef _KIS_JPEG_CONVERTER_H_
21#define _KIS_JPEG_CONVERTER_H_
22
23#include <stdio.h>
24
25extern "C" {
26#include <jpeglib.h>
27}
28
29#include <tqvaluevector.h>
30
31#include <tdeio/job.h>
32
33#include <kis_progress_subject.h>
34
35#include "kis_types.h"
36#include "kis_global.h"
37#include "kis_annotation.h"
38class KisDoc;
39class KisUndoAdapter;
40class KisExifInfo;
41
45enum KisImageBuilder_Result {
46 KisImageBuilder_RESULT_FAILURE = -400,
47 KisImageBuilder_RESULT_NOT_EXIST = -300,
48 KisImageBuilder_RESULT_NOT_LOCAL = -200,
49 KisImageBuilder_RESULT_BAD_FETCH = -100,
50 KisImageBuilder_RESULT_INVALID_ARG = -50,
51 KisImageBuilder_RESULT_OK = 0,
52 KisImageBuilder_RESULT_PROGRESS = 1,
53 KisImageBuilder_RESULT_EMPTY = 100,
54 KisImageBuilder_RESULT_BUSY = 150,
55 KisImageBuilder_RESULT_NO_URI = 200,
56 KisImageBuilder_RESULT_UNSUPPORTED = 300,
57 KisImageBuilder_RESULT_INTR = 400,
58 KisImageBuilder_RESULT_PATH = 500,
59 KisImageBuilder_RESULT_UNSUPPORTED_COLORSPACE = 600
60};
61
62struct KisJPEGOptions {
63 int quality;
64 bool progressive;
65};
66
67class KisJPEGConverter : public KisProgressSubject {
68 TQ_OBJECT
69
70 public:
71 KisJPEGConverter(KisDoc *doc, KisUndoAdapter *adapter);
72 virtual ~KisJPEGConverter();
73 public:
74 KisImageBuilder_Result buildImage(const KURL& uri);
75 KisImageBuilder_Result buildFile(const KURL& uri, KisPaintLayerSP layer, vKisAnnotationSP_it annotationsStart, vKisAnnotationSP_it annotationsEnd, KisJPEGOptions options, KisExifInfo* exifInfo);
78 KisImageSP image();
79 public slots:
80 virtual void cancel();
81 private:
82 KisImageBuilder_Result decode(const KURL& uri);
83 private:
84 KisImageSP m_img;
85 KisDoc *m_doc;
86 KisUndoAdapter *m_adapter;
87 bool m_stop;
88 TDEIO::TransferJob *m_job;
89};
90
91#endif