filters

kis_png_converter.h

00001 /*
00002  *  Copyright (c) 2005 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_PNG_CONVERTER_H_
00021 #define _KIS_PNG_CONVERTER_H_
00022 
00023 #include <png.h>
00024 
00025 #include <qvaluevector.h>
00026 
00027 #include <kio/job.h>
00028 
00029 #include <kis_progress_subject.h>
00030 
00031 #include "kis_types.h"
00032 #include "kis_global.h"
00033 #include "kis_annotation.h"
00034 class KisDoc;
00035 class KisUndoAdapter;
00036 
00040 enum KisImageBuilder_Result {
00041         KisImageBuilder_RESULT_FAILURE = -400,
00042         KisImageBuilder_RESULT_NOT_EXIST = -300,
00043         KisImageBuilder_RESULT_NOT_LOCAL = -200,
00044         KisImageBuilder_RESULT_BAD_FETCH = -100,
00045         KisImageBuilder_RESULT_INVALID_ARG = -50,
00046         KisImageBuilder_RESULT_OK = 0,
00047         KisImageBuilder_RESULT_PROGRESS = 1,
00048         KisImageBuilder_RESULT_EMPTY = 100,
00049         KisImageBuilder_RESULT_BUSY = 150,
00050         KisImageBuilder_RESULT_NO_URI = 200,
00051         KisImageBuilder_RESULT_UNSUPPORTED = 300,
00052         KisImageBuilder_RESULT_INTR = 400,
00053         KisImageBuilder_RESULT_PATH = 500,
00054         KisImageBuilder_RESULT_UNSUPPORTED_COLORSPACE = 600
00055 };
00056 
00057 class KisPNGConverter : public KisProgressSubject {
00058         Q_OBJECT
00059     public:
00060         KisPNGConverter(KisDoc *doc, KisUndoAdapter *adapter);
00061         virtual ~KisPNGConverter();
00062     public:
00063         KisImageBuilder_Result buildImage(const KURL& uri);
00064         KisImageBuilder_Result buildFile(const KURL& uri, KisPaintLayerSP layer, vKisAnnotationSP_it annotationsStart, vKisAnnotationSP_it annotationsEnd, int compression, bool interlace, bool alpha);
00067         KisImageSP image();
00068     public slots:
00069         virtual void cancel();
00070     private:
00071         KisImageBuilder_Result decode(const KURL& uri);
00072         void progress(png_structp png_ptr, png_uint_32 row_number, int pass);
00073     private:
00074         png_uint_32 m_max_row;
00075         KisImageSP m_img;
00076         KisDoc *m_doc;
00077         KisUndoAdapter *m_adapter;
00078         bool m_stop;
00079 };
00080 
00081 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys