QGIS API Documentation  3.10.0-A Coruña (6c816b4204)
qgseffectstack.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgseffectstack.h
3  ----------------
4  begin : December 2014
5  copyright : (C) 2014 Nyall Dawson
6  email : nyall dot dawson at gmail dot com
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 #ifndef QGSEFFECTSTACK_H
18 #define QGSEFFECTSTACK_H
19 
20 #include "qgis_core.h"
21 #include "qgis_sip.h"
22 #include "qgspainteffect.h"
23 
44 class CORE_EXPORT QgsEffectStack : public QgsPaintEffect
45 {
46 
47  public:
48 
55  static QgsPaintEffect *create( const QgsStringMap &map ) SIP_FACTORY;
56 
60  QgsEffectStack() = default;
61 
62  QgsEffectStack( const QgsEffectStack &other );
63 
68 
75  explicit QgsEffectStack( const QgsPaintEffect &effect );
76 
77  ~QgsEffectStack() override;
78 
79  QString type() const override { return QStringLiteral( "effectStack" ); }
80  QgsEffectStack *clone() const override SIP_FACTORY;
81  bool saveProperties( QDomDocument &doc, QDomElement &element ) const override;
82  bool readProperties( const QDomElement &element ) override;
83 
87  QgsStringMap properties() const override;
88 
92  void readProperties( const QgsStringMap &props ) override;
93 
100  void appendEffect( QgsPaintEffect *effect SIP_TRANSFER );
101 
109  bool insertEffect( int index, QgsPaintEffect *effect SIP_TRANSFER );
110 
117  bool changeEffect( int index, QgsPaintEffect *effect SIP_TRANSFER );
118 
123  QgsPaintEffect *takeEffect( int index SIP_TRANSFERBACK );
124 
130  QList< QgsPaintEffect * > *effectList();
131 
136  int count() const { return mEffectList.count(); }
137 
143  QgsPaintEffect *effect( int index ) const;
144 
145  QgsEffectStack &operator=( const QgsEffectStack &rhs );
146 
147  QgsEffectStack &operator=( QgsEffectStack &&other ) SIP_SKIP;
148 
149 
150  protected:
151 
152  void draw( QgsRenderContext &context ) override;
153 
154  private:
155 
156  QList< QgsPaintEffect * > mEffectList;
157 
158  void clearStack();
159 };
160 
161 #endif // QGSEFFECTSTACK_H
162 
virtual QgsStringMap properties() const =0
Returns the properties describing the paint effect encoded in a string format.
Base class for visual effects which can be applied to QPicture drawings.
#define SIP_TRANSFERBACK
Definition: qgis_sip.h:48
QMap< QString, QString > QgsStringMap
Definition: qgis.h:612
virtual QgsPaintEffect * clone() const =0
Duplicates an effect by creating a deep copy of the effect.
int count() const
Returns count of effects contained by the stack.
#define SIP_SKIP
Definition: qgis_sip.h:126
QString type() const override
Returns the effect type.
#define SIP_TRANSFER
Definition: qgis_sip.h:36
A paint effect which consists of a stack of other chained paint effects.
#define SIP_FACTORY
Definition: qgis_sip.h:76
virtual void readProperties(const QgsStringMap &props)=0
Reads a string map of an effect&#39;s properties and restores the effect to the state described by the pr...
Contains information about the context of a rendering operation.
friend class QgsEffectStack
virtual void draw(QgsRenderContext &context)=0
Handles drawing of the effect&#39;s result on to the specified render context.
virtual bool saveProperties(QDomDocument &doc, QDomElement &element) const
Saves the current state of the effect to a DOM element.