32 for (
int i = 0; i < other.
count(); ++i )
56 for (
int i = 0; i < rhs.
count(); ++i )
81 for (
int i = mEffectList.
count() - 1; i >= 0; --i )
90 if ( effect->
type() ==
"drawSource" )
106 effect->
render( *pic, context );
110 results << resultPic;
113 currentPic = resultPic;
121 for (
int i = 0; i < mEffectList.
count(); ++i )
123 if ( !mEffectList[i]->
enabled() )
182 for (
int i = 0; i < childNodes.
size(); ++i )
203 void QgsEffectStack::clearStack()
205 qDeleteAll( mEffectList );
211 mEffectList.
append( effect );
216 if ( index < 0 || index > mEffectList.
count() )
221 mEffectList.
insert( index, effect );
227 if ( index < 0 || index >= mEffectList.
count() )
232 delete mEffectList.
at( index );
239 if ( index < 0 || index >= mEffectList.
count() )
242 return mEffectList.
takeAt( index );
252 if ( index >= 0 && index < mEffectList.
count() )
254 return mEffectList.
at( index );
QDomNode appendChild(const QDomNode &newChild)
QString attribute(const QString &name, const QString &defValue) const
const T & at(int i) const
bool enabled() const
Returns whether the effect is enabled.
Base class for visual effects which can be applied to QPicture drawings.
virtual QString type() const override
Returns the effect type.
virtual void draw(QgsRenderContext &context) override
Handles drawing of the effect's result on to the specified render context.
QDomNodeList childNodes() const
virtual bool saveProperties(QDomDocument &doc, QDomElement &element) const override
Saves the current state of the effect to a DOM element.
virtual bool readProperties(const QDomElement &element) override
Restores the effect to the state described by a DOM element.
virtual QgsPaintEffect * clone() const =0
Duplicates an effect by creating a deep copy of the effect.
static QgsPaintEffect * create(const QgsStringMap &map)
Creates a new QgsEffectStack effect.
QDomElement toElement() const
int count(const T &value) const
void append(const T &value)
int count() const
Returns count of effects contained by the stack.
static QgsPaintEffectRegistry * instance()
Returns a reference to the singleton instance of the paint effect registry.
virtual QString type() const =0
Returns the effect type.
void setAttribute(const QString &name, const QString &value)
void setPainter(QPainter *p)
void fixQPictureDpi(QPainter *painter) const
Applies a workaround to a QPainter to avoid an issue with incorrect scaling when drawing QPictures...
A paint effect which consists of a stack of other chained paint effects.
virtual QgsEffectStack * clone() const override
Duplicates an effect by creating a deep copy of the effect.
bool changeEffect(const int index, QgsPaintEffect *effect)
Replaces the effect at a specified position within the stack.
bool insertEffect(const int index, QgsPaintEffect *effect)
Inserts an effect at a specified index within the stack.
void appendEffect(QgsPaintEffect *effect)
Appends an effect to the end of the stack.
bool requiresQPainterDpiFix
virtual bool saveProperties(QDomDocument &doc, QDomElement &element) const
Saves the current state of the effect to a DOM element.
Contains information about the context of a rendering operation.
void insert(int i, const T &value)
virtual ~QgsEffectStack()
QList< QgsPaintEffect * > * effectList()
Returns a pointer to the list of effects currently contained by the stack.
QgsEffectStack & operator=(const QgsEffectStack &rhs)
virtual void render(QPicture &picture, QgsRenderContext &context)
Renders a picture using the effect.
void drawPicture(const QPointF &point, const QPicture &picture)
const QPicture * source() const
Returns the source QPicture.
QDomElement createElement(const QString &tagName)
virtual QgsStringMap properties() const override
Unused for QgsEffectStack, will always return an empty string map.
QgsPaintEffect * effect(int index) const
Returns a pointer to the effect at a specified index within the stack.
QgsPaintEffect * createEffect(const QString &name, const QgsStringMap &properties=QgsStringMap()) const
Creates a new paint effect given the effect name and properties map.
QDomNode at(int index) const
QgsPaintEffect * takeEffect(const int index)
Removes an effect from the stack and returns a pointer to it.