QGIS API Documentation
3.14.0-Pi (9f7028fd23)
|
Go to the documentation of this file.
17 #ifndef QGSPAINTEFFECT_H
18 #define QGSPAINTEFFECT_H
20 #include "qgis_core.h"
24 #include <QDomDocument>
25 #include <QDomElement>
58 if ( sipCpp->type() ==
"drawSource" &&
dynamic_cast<QgsDrawSourceEffect *
>( sipCpp ) != NULL )
60 sipType = sipType_QgsDrawSourceEffect;
62 else if ( sipCpp->type() ==
"effectStack" &&
dynamic_cast<QgsEffectStack *
>( sipCpp ) != NULL )
64 sipType = sipType_QgsEffectStack;
66 else if ( sipCpp->type() ==
"blur" &&
dynamic_cast<QgsBlurEffect *
>( sipCpp ) != NULL )
68 sipType = sipType_QgsBlurEffect;
70 else if ( sipCpp->type() ==
"dropShadow" &&
dynamic_cast<QgsDropShadowEffect *
>( sipCpp ) != NULL )
72 sipType = sipType_QgsDropShadowEffect;
74 else if ( sipCpp->type() ==
"outerGlow" &&
dynamic_cast<QgsOuterGlowEffect *
>( sipCpp ) != NULL )
76 sipType = sipType_QgsOuterGlowEffect;
78 else if ( sipCpp->type() ==
"innerGlow" &&
dynamic_cast<QgsInnerGlowEffect *
>( sipCpp ) != NULL )
80 sipType = sipType_QgsInnerGlowEffect;
82 else if ( sipCpp->type() ==
"transform" &&
dynamic_cast<QgsTransformEffect *
>( sipCpp ) != NULL )
84 sipType = sipType_QgsTransformEffect;
86 else if ( sipCpp->type() ==
"color" &&
dynamic_cast<QgsColorEffect *
>( sipCpp ) != NULL )
88 sipType = sipType_QgsColorEffect;
123 virtual QString type()
const = 0;
146 virtual void readProperties(
const QgsStringMap &props ) = 0;
157 virtual bool saveProperties( QDomDocument &doc, QDomElement &element )
const;
165 virtual bool readProperties(
const QDomElement &element );
205 void setEnabled(
bool enabled );
221 void setDrawMode( DrawMode drawMode );
225 bool mEnabled =
true;
227 bool requiresQPainterDpiFix =
true;
245 void drawSource( QPainter &painter );
254 const QPicture *
source()
const {
return mPicture; }
287 virtual QRectF boundingRect(
const QRectF &rect,
const QgsRenderContext &context )
const;
295 void fixQPictureDpi( QPainter *painter )
const;
299 const QPicture *mPicture =
nullptr;
300 QImage *mSourceImage =
nullptr;
301 bool mOwnsImage =
false;
303 QPainter *mPrevPainter =
nullptr;
304 QPainter *mEffectPainter =
nullptr;
305 QPicture *mTempPicture =
nullptr;
342 QString
type()
const override {
return QStringLiteral(
"drawSource" ); }
345 void readProperties( const
QgsStringMap &props ) override;
353 void setOpacity( const
double opacity ) { mOpacity = opacity; }
369 void setBlendMode(
const QPainter::CompositionMode mode ) { mBlendMode = mode; }
377 QPainter::CompositionMode
blendMode()
const {
return mBlendMode; }
385 double mOpacity = 1.0;
386 QPainter::CompositionMode mBlendMode = QPainter::CompositionMode_SourceOver;
432 QPainter *operator->() {
return mPainter; }
441 QPainter *mPainter =
nullptr;
445 #endif // QGSPAINTEFFECT_H
DrawMode
Drawing modes for effects.
A paint effect which blurs a source picture, using a number of different blur methods.
A class to manager painter saving and restoring required for effect drawing.
void setBlendMode(const QPainter::CompositionMode mode)
Sets the blend mode for the effect.
A paint effect which draws the source picture with minor or no alterations.
A paint effect which alters the colors (e.g., brightness, contrast) in a source picture.
@ Modifier
The result of the effect is not rendered, but is passed on to following effects in the stack.
@ Render
The result of the effect is rendered on the destination, but does not affect subsequent effects in th...
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
A paint effect which draws an offset and optionally blurred drop shadow.
virtual QgsPaintEffect * clone() const =0
Duplicates an effect by creating a deep copy of the effect.
DrawMode drawMode() const
Returns the draw mode for the effect.
A paint effect which draws a glow within a picture.
#define SIP_NODEFAULTCTORS
QMap< QString, QString > QgsStringMap
const QPicture * source() const
Returns the source QPicture.
QPainter::CompositionMode blendMode() const
Returns the blend mode for the effect.
Base class for visual effects which can be applied to QPicture drawings.
A paint effect which draws a glow outside of a picture.
bool enabled() const
Returns whether the effect is enabled.
QgsEffectStack & operator=(const QgsEffectStack &rhs)
double opacity() const
Returns the opacity for the effect.
virtual void draw(QgsRenderContext &context)=0
Handles drawing of the effect's result on to the specified render context.
QString type() const override
Returns the effect type.
A paint effect which consists of a stack of other chained paint effects.