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 KoXmlElement;
00032 
00033 #include "flake_export.h"
00034 #include <QtCore/QList>
00035 #include <QtGui/QImage>
00036 
00048 class FLAKE_EXPORT KoFilterEffect
00049 {
00050 public:
00051     KoFilterEffect( const QString& id, const QString& name );
00052     virtual ~KoFilterEffect();
00053 
00055     QString name() const;
00056 
00058     QString id() const;
00059 
00061     void setFilterRect(const QRectF &filterRect);
00062 
00064     QRectF filterRect() const;
00065 
00067     QRectF filterRectForBoundingRect(const QRectF &boundingRect) const;
00068 
00077     void setOutput(const QString &output);
00078 
00080     QString output() const;
00081 
00093     QList<QString> inputs() const;
00094 
00096     void addInput(const QString &input);
00097 
00099     void insertInput(int index, const QString &input);
00100 
00102     void setInput(int index, const QString &input);
00103 
00105     void removeInput(int index);
00106 
00113     int requiredInputCount() const;
00114 
00121     int maximalInputCount() const;
00122 
00128     virtual QImage processImage(const QImage &image, const KoFilterEffectRenderContext &context) const = 0;
00129 
00135     virtual QImage processImages(const QList<QImage> &images, const KoFilterEffectRenderContext &context) const;
00136 
00143     virtual bool load(const KoXmlElement &element, const QMatrix &matrix = QMatrix()) = 0;
00144 
00149     virtual void save(KoXmlWriter &writer) = 0;
00150 
00151 protected:
00153     void setRequiredInputCount(int count);
00154 
00156     void setMaximalInputCount(int count);
00157 
00165     void saveCommonAttributes(KoXmlWriter &writer);
00166 
00167 private:
00168     struct Private;
00169     Private* const d;
00170 };
00171 
00172 #endif // _KO_FILTER_EFFECT_H_