filters

kis_png_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_PNG_CONVERTER_H_
21#define _KIS_PNG_CONVERTER_H_
22
23#include <png.h>
24
25#include <tqvaluevector.h>
26
27#include <tdeio/job.h>
28
29#include <kis_progress_subject.h>
30
31#include "kis_types.h"
32#include "kis_global.h"
33#include "kis_annotation.h"
34class KisDoc;
35class KisUndoAdapter;
36
40enum KisImageBuilder_Result {
41 KisImageBuilder_RESULT_FAILURE = -400,
42 KisImageBuilder_RESULT_NOT_EXIST = -300,
43 KisImageBuilder_RESULT_NOT_LOCAL = -200,
44 KisImageBuilder_RESULT_BAD_FETCH = -100,
45 KisImageBuilder_RESULT_INVALID_ARG = -50,
46 KisImageBuilder_RESULT_OK = 0,
47 KisImageBuilder_RESULT_PROGRESS = 1,
48 KisImageBuilder_RESULT_EMPTY = 100,
49 KisImageBuilder_RESULT_BUSY = 150,
50 KisImageBuilder_RESULT_NO_URI = 200,
51 KisImageBuilder_RESULT_UNSUPPORTED = 300,
52 KisImageBuilder_RESULT_INTR = 400,
53 KisImageBuilder_RESULT_PATH = 500,
54 KisImageBuilder_RESULT_UNSUPPORTED_COLORSPACE = 600
55};
56
57class KisPNGConverter : public KisProgressSubject {
58 TQ_OBJECT
59
60 public:
61 KisPNGConverter(KisDoc *doc, KisUndoAdapter *adapter);
62 virtual ~KisPNGConverter();
63 public:
64 KisImageBuilder_Result buildImage(const KURL& uri);
65 KisImageBuilder_Result buildFile(const KURL& uri, KisPaintLayerSP layer, vKisAnnotationSP_it annotationsStart, vKisAnnotationSP_it annotationsEnd, int compression, bool interlace, bool alpha);
68 KisImageSP image();
69 public slots:
70 virtual void cancel();
71 private:
72 KisImageBuilder_Result decode(const KURL& uri);
73 void progress(png_structp png_ptr, png_uint_32 row_number, int pass);
74 private:
75 png_uint_32 m_max_row;
76 KisImageSP m_img;
77 KisDoc *m_doc;
78 KisUndoAdapter *m_adapter;
79 bool m_stop;
80};
81
82#endif