filters

kis_tiff_converter.h

00001 /*
00002  *  Copyright (c) 2005-2006 Cyrille Berger <cberger@cberger.net>
00003  *
00004  *  This program is free software; you can redistribute it and/or modify
00005  *  it under the terms of the GNU General Public License as published by
00006  *  the Free Software Foundation; either version 2 of the License, or
00007  *  (at your option) any later version.
00008  *
00009  *  This program is distributed in the hope that it will be useful,
00010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  *  GNU General Public License for more details.
00013  *
00014  *  You should have received a copy of the GNU General Public License
00015  *  along with this program; if not, write to the Free Software
00016  *  Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017  * Boston, MA 02110-1301, USA.
00018  */
00019 
00020 #ifndef _KIS_TIFF_CONVERTER_H_
00021 #define _KIS_TIFF_CONVERTER_H_
00022 
00023 #include <stdio.h>
00024 #include <tiffio.h>
00025 
00026 #include <qvaluevector.h>
00027 
00028 #include <kio/job.h>
00029 
00030 #include <kis_progress_subject.h>
00031 
00032 #include "kis_types.h"
00033 #include "kis_global.h"
00034 #include "kis_annotation.h"
00035 class KisDoc;
00036 class KisUndoAdapter;
00037 
00041 enum KisImageBuilder_Result {
00042         KisImageBuilder_RESULT_FAILURE = -400,
00043         KisImageBuilder_RESULT_NOT_EXIST = -300,
00044         KisImageBuilder_RESULT_NOT_LOCAL = -200,
00045         KisImageBuilder_RESULT_BAD_FETCH = -100,
00046         KisImageBuilder_RESULT_INVALID_ARG = -50,
00047         KisImageBuilder_RESULT_OK = 0,
00048         KisImageBuilder_RESULT_PROGRESS = 1,
00049         KisImageBuilder_RESULT_EMPTY = 100,
00050         KisImageBuilder_RESULT_BUSY = 150,
00051         KisImageBuilder_RESULT_NO_URI = 200,
00052         KisImageBuilder_RESULT_UNSUPPORTED = 300,
00053         KisImageBuilder_RESULT_INTR = 400,
00054         KisImageBuilder_RESULT_PATH = 500,
00055         KisImageBuilder_RESULT_UNSUPPORTED_COLORSPACE = 600
00056 };
00057 
00058 struct KisTIFFOptions {
00059     Q_UINT16 compressionType;
00060     Q_UINT16 predictor;
00061     bool alpha;
00062     bool flatten;
00063     Q_UINT16 jpegQuality;
00064     Q_UINT16 deflateCompress;
00065     Q_UINT16 faxMode;
00066     Q_UINT16 pixarLogCompress;
00067 };
00068 
00069 class KisTIFFConverter : public KisProgressSubject {
00070         Q_OBJECT
00071     public:
00072         KisTIFFConverter(KisDoc *doc, KisUndoAdapter *adapter);
00073         virtual ~KisTIFFConverter();
00074     public:
00075         KisImageBuilder_Result buildImage(const KURL& uri);
00076         KisImageBuilder_Result buildFile(const KURL& uri, KisImageSP layer, KisTIFFOptions);
00079         KisImageSP image();
00080     public slots:
00081         virtual void cancel();
00082     private:
00083         KisImageBuilder_Result decode(const KURL& uri);
00084         KisImageBuilder_Result readTIFFDirectory( TIFF* image);
00085     private:
00086         KisImageSP m_img;
00087         KisDoc *m_doc;
00088         KisUndoAdapter *m_adapter;
00089         bool m_stop;
00090         KIO::TransferJob *m_job;
00091 };
00092 
00093 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys