libs/flake

KoFilterEffect.h

Go to the documentation of this file.
00001 /* This file is part of the KDE project
00002  * Copyright (c) 2009 Cyrille Berger <cberger@cberger.net>
00003  * Copyright (c) 2009 Jan Hambrecht <jaham@gmx.net>
00004  *
00005  * This library is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU Lesser General Public
00007  * License as published by the Free Software Foundation; either
00008  * version 2 of the License, or (at your option) any later version.
00009  *
00010  * This library is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013  * Library General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU Lesser General Public License
00016  * along with this library; see the file COPYING.LIB.  If not, write to
00017  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00018  * Boston, MA 02110-1301, USA.
00019  */
00020 
00021 #ifndef _KO_FILTER_EFFECT_H_
00022 #define _KO_FILTER_EFFECT_H_
00023 
00024 class QImage;
00025 class QString;
00026 class QRect;
00027 class QRectF;
00028 class KoViewConverter;
00029 class KoXmlWriter;
00030 class KoFilterEffectRenderContext;
00031 class KoFilterEffectLoadingContext;
00032 class KoXmlElement;
00033 
00034 #include "flake_export.h"
00035 #include <QtCore/QList>
00036 #include <QtGui/QImage>
00037 
00049 class FLAKE_EXPORT KoFilterEffect
00050 {
00051 public:
00052     KoFilterEffect(const QString &id, const QString &name);
00053     virtual ~KoFilterEffect();
00054 
00056     QString name() const;
00057 
00059     QString id() const;
00060 
00062     void setFilterRect(const QRectF &filterRect);
00063 
00065     QRectF filterRect() const;
00066 
00068     QRectF filterRectForBoundingRect(const QRectF &boundingRect) const;
00069 
00078     void setOutput(const QString &output);
00079 
00081     QString output() const;
00082 
00094     QList<QString> inputs() const;
00095 
00097     void addInput(const QString &input);
00098 
00100     void insertInput(int index, const QString &input);
00101 
00103     void setInput(int index, const QString &input);
00104 
00106     void removeInput(int index);
00107 
00114     int requiredInputCount() const;
00115 
00122     int maximalInputCount() const;
00123 
00129     virtual QImage processImage(const QImage &image, const KoFilterEffectRenderContext &context) const = 0;
00130 
00136     virtual QImage processImages(const QList<QImage> &images, const KoFilterEffectRenderContext &context) const;
00137 
00144     virtual bool load(const KoXmlElement &element, const KoFilterEffectLoadingContext &context) = 0;
00145 
00150     virtual void save(KoXmlWriter &writer) = 0;
00151 
00152 protected:
00154     void setRequiredInputCount(int count);
00155 
00157     void setMaximalInputCount(int count);
00158 
00166     void saveCommonAttributes(KoXmlWriter &writer);
00167 
00168 private:
00169     class Private;
00170     Private* const d;
00171 };
00172 
00173 #endif // _KO_FILTER_EFFECT_H_