libs/flake
KoFilterEffect Class Reference
This is the base for filter effect (blur, invert. More...
#include <KoFilterEffect.h>
Public Member Functions | |
| KoFilterEffect (const QString &id, const QString &name) | |
| virtual | ~KoFilterEffect () |
| void | addInput (const QString &input) |
| QRectF | filterRect () const |
| QRectF | filterRectForBoundingRect (const QRectF &boundingRect) const |
| QString | id () const |
| QList< QString > | inputs () const |
| void | insertInput (int index, const QString &input) |
| virtual bool | load (const KoXmlElement &element, const QMatrix &matrix=QMatrix())=0 |
| int | maximalInputCount () const |
| QString | name () const |
| QString | output () const |
| virtual QImage | processImage (const QImage &image, const KoFilterEffectRenderContext &context) const =0 |
| virtual QImage | processImages (const QList< QImage > &images, const KoFilterEffectRenderContext &context) const |
| void | removeInput (int index) |
| int | requiredInputCount () const |
| virtual void | save (KoXmlWriter &writer)=0 |
| void | setFilterRect (const QRectF &filterRect) |
| void | setInput (int index, const QString &input) |
| void | setOutput (const QString &output) |
Protected Member Functions | |
| void | saveCommonAttributes (KoXmlWriter &writer) |
| void | setMaximalInputCount (int count) |
| void | setRequiredInputCount (int count) |
Detailed Description
This is the base for filter effect (blur, invert.
..) that can be applied on a shape. All sizes and coordinates of the filter effect are stored in object bounding box coordinates, where (0,0) refers to the top-left corner of a shapes bounding rect and (1,1) refers to the bottom-right corner. When loading, a transformation matrix is given to convert from user space coordinates. Another transformation matrix is given via the render context to convert back to user space coordinates when applying the effect. Using object bounding box coordinates internally makes it easy to share effects between shapes or even between users via the filter effect resources.
Definition at line 48 of file KoFilterEffect.h.
Constructor & Destructor Documentation
Definition at line 45 of file KoFilterEffect.cpp.
| KoFilterEffect::~KoFilterEffect | ( | ) | [virtual] |
Definition at line 52 of file KoFilterEffect.cpp.
Member Function Documentation
| void KoFilterEffect::addInput | ( | const QString & | input | ) |
Adds a new input at the end of the input list.
Definition at line 91 of file KoFilterEffect.cpp.
| QRectF KoFilterEffect::filterRect | ( | ) | const |
Returns the region this filter is applied to in bounding box units.
Definition at line 72 of file KoFilterEffect.cpp.
Returns the region this filter is applied to for the given bounding rect.
Definition at line 77 of file KoFilterEffect.cpp.
| QString KoFilterEffect::id | ( | ) | const |
Returns the unique id of the filter.
Definition at line 62 of file KoFilterEffect.cpp.
Returns list of named input images of this filter effect.
These names identify the input images for this filter effect. These can be one of the keywords SourceGraphic, SourceAlpha, BackgroundImage, BackgroundAlpha, FillPaint or StrokePaint, as well as a named output of another filter effect in the stack. An empty input list of the first effect in the stack default to SourceGraphic, whereas on subsequent effects it defaults to the result of the previous filter effect.
Definition at line 86 of file KoFilterEffect.cpp.
| void KoFilterEffect::insertInput | ( | int | index, | |
| const QString & | input | |||
| ) |
Inserts an input at the giben position in the input list.
Definition at line 97 of file KoFilterEffect.cpp.
| virtual bool KoFilterEffect::load | ( | const KoXmlElement & | element, | |
| const QMatrix & | matrix = QMatrix() | |||
| ) | [pure virtual] |
Loads data from given xml element.
- Parameters:
-
element the xml element to load data from matrix matrix to transform to bounding box coordinates
- Returns:
- true if loading was successful, else false
| int KoFilterEffect::maximalInputCount | ( | ) | const |
Returns the maximal number of input images.
The default maximal number of input images is 1. Derived classes should call setMaximalInputCount to set a different number.
Definition at line 130 of file KoFilterEffect.cpp.
| QString KoFilterEffect::name | ( | ) | const |
Returns the user visible name of the filter.
Definition at line 57 of file KoFilterEffect.cpp.
| QString KoFilterEffect::output | ( | ) | const |
Returns the name of the output image.
Definition at line 120 of file KoFilterEffect.cpp.
| virtual QImage KoFilterEffect::processImage | ( | const QImage & | image, | |
| const KoFilterEffectRenderContext & | context | |||
| ) | const [pure virtual] |
Apply the effect on an image.
- Parameters:
-
image the image the filter should be applied to context the render context providing additional data
| QImage KoFilterEffect::processImages | ( | const QList< QImage > & | images, | |
| const KoFilterEffectRenderContext & | context | |||
| ) | const [virtual] |
Apply the effect on a list of images.
- Parameters:
-
images the images the filter should be applied to context the render context providing additional data
Definition at line 135 of file KoFilterEffect.cpp.
| void KoFilterEffect::removeInput | ( | int | index | ) |
Removes an input from the given position in the input list.
Definition at line 109 of file KoFilterEffect.cpp.
| int KoFilterEffect::requiredInputCount | ( | ) | const |
Return the required number of input images.
The default required number of input images is 1. Derived classes should call setRequiredInputCount to set a different number.
Definition at line 125 of file KoFilterEffect.cpp.
| virtual void KoFilterEffect::save | ( | KoXmlWriter & | writer | ) | [pure virtual] |
Writes custom data to given xml element.
- Parameters:
-
writer the xml writer to write data to
| void KoFilterEffect::saveCommonAttributes | ( | KoXmlWriter & | writer | ) | [protected] |
Saves common filter attributes.
Saves result, subregion and input attributes. The input attrinbute is only saved if required, maximal and actual input count equals 1. All other filters have to write inputs on their own.
Definition at line 161 of file KoFilterEffect.cpp.
| void KoFilterEffect::setFilterRect | ( | const QRectF & | filterRect | ) |
Sets the region the filter is applied to in bounding box units.
Definition at line 67 of file KoFilterEffect.cpp.
| void KoFilterEffect::setInput | ( | int | index, | |
| const QString & | input | |||
| ) |
Sets an existing input to a new value.
Definition at line 103 of file KoFilterEffect.cpp.
| void KoFilterEffect::setMaximalInputCount | ( | int | count | ) | [protected] |
Sets the maximal number of input images.
Definition at line 151 of file KoFilterEffect.cpp.
| void KoFilterEffect::setOutput | ( | const QString & | output | ) |
Sets the name of the output image.
The name is used so that other effects can reference the output of this effect as one of their input images.
- Parameters:
-
output the output image name
Definition at line 115 of file KoFilterEffect.cpp.
| void KoFilterEffect::setRequiredInputCount | ( | int | count | ) | [protected] |
Sets the required number of input images.
Definition at line 144 of file KoFilterEffect.cpp.
The documentation for this class was generated from the following files:
