filters

kis_tiff_converter.h
1/*
2 * Copyright (c) 2005-2006 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_TIFF_CONVERTER_H_
21#define _KIS_TIFF_CONVERTER_H_
22
23#include <stdio.h>
24#include <tiffio.h>
25
26#include <tqvaluevector.h>
27
28#include <tdeio/job.h>
29
30#include <kis_progress_subject.h>
31
32#include "kis_types.h"
33#include "kis_global.h"
34#include "kis_annotation.h"
35class KisDoc;
36class KisUndoAdapter;
37
41enum KisImageBuilder_Result {
42 KisImageBuilder_RESULT_FAILURE = -400,
43 KisImageBuilder_RESULT_NOT_EXIST = -300,
44 KisImageBuilder_RESULT_NOT_LOCAL = -200,
45 KisImageBuilder_RESULT_BAD_FETCH = -100,
46 KisImageBuilder_RESULT_INVALID_ARG = -50,
47 KisImageBuilder_RESULT_OK = 0,
48 KisImageBuilder_RESULT_PROGRESS = 1,
49 KisImageBuilder_RESULT_EMPTY = 100,
50 KisImageBuilder_RESULT_BUSY = 150,
51 KisImageBuilder_RESULT_NO_URI = 200,
52 KisImageBuilder_RESULT_UNSUPPORTED = 300,
53 KisImageBuilder_RESULT_INTR = 400,
54 KisImageBuilder_RESULT_PATH = 500,
55 KisImageBuilder_RESULT_UNSUPPORTED_COLORSPACE = 600
56};
57
58struct KisTIFFOptions {
59 TQ_UINT16 compressionType;
60 TQ_UINT16 predictor;
61 bool alpha;
62 bool flatten;
63 TQ_UINT16 jpegQuality;
64 TQ_UINT16 deflateCompress;
65 TQ_UINT16 faxMode;
66 TQ_UINT16 pixarLogCompress;
67};
68
69class KisTIFFConverter : public KisProgressSubject {
70 TQ_OBJECT
71
72 public:
73 KisTIFFConverter(KisDoc *doc, KisUndoAdapter *adapter);
74 virtual ~KisTIFFConverter();
75 public:
76 KisImageBuilder_Result buildImage(const KURL& uri);
77 KisImageBuilder_Result buildFile(const KURL& uri, KisImageSP layer, KisTIFFOptions);
80 KisImageSP image();
81 public slots:
82 virtual void cancel();
83 private:
84 KisImageBuilder_Result decode(const KURL& uri);
85 KisImageBuilder_Result readTIFFDirectory( TIFF* image);
86 private:
87 KisImageSP m_img;
88 KisDoc *m_doc;
89 KisUndoAdapter *m_adapter;
90 bool m_stop;
91 TDEIO::TransferJob *m_job;
92};
93
94#endif