29 , mTransparency( 0.0 )
31 , mBlendMode(
QPainter::CompositionMode_Multiply )
66 QPointF transPt( -offsetDist * cos( angleRad +
M_PI / 2 ),
67 -offsetDist * sin( angleRad +
M_PI / 2 ) );
75 QImage innerShadowIm( colorisedIm.
width(), colorisedIm.
height(), QImage::Format_ARGB32 );
76 innerShadowIm.
fill( Qt::transparent );
77 QPainter imPainter( &innerShadowIm );
80 imPainter.
drawImage( transPt.
x(), transPt.
y(), colorisedIm );
115 QPainter::CompositionMode mode =
static_cast< QPainter::CompositionMode
>( props.
value(
"blend_mode" ).toInt( &ok ) );
127 int level = props.
value(
"blur_level" ).toInt( &ok );
132 int angle = props.
value(
"offset_angle" ).toInt( &ok );
137 double distance = props.
value(
"offset_distance" ).toDouble( &ok );
156 return rect.
adjusted( -spread, -spread, spread, spread );
static QString encodeOutputUnit(QgsSymbolV2::OutputUnit unit)
static void overlayColor(QImage &image, const QColor &color)
Overlays a color onto an image.
bool contains(const Key &key) const
void setCompositionMode(CompositionMode mode)
static void multiplyOpacity(QImage &image, const double factor)
Multiplies opacity of image pixel values by a factor.
static QString encodeColor(const QColor &color)
bool enabled() const
Returns whether the effect is enabled.
Base class for visual effects which can be applied to QPicture drawings.
virtual QgsStringMap properties() const override
Returns the properties describing the paint effect encoded in a string format.
static QString encodeMapUnitScale(const QgsMapUnitScale &mapUnitScale)
QImage copy(const QRect &rectangle) const
virtual QgsDropShadowEffect * clone() const override
Duplicates an effect by creating a deep copy of the effect.
virtual bool exteriorShadow() const =0
Specifies whether the shadow is drawn outside the picture or within the picture.
static double pixelSizeScaleFactor(const QgsRenderContext &c, QgsSymbolV2::OutputUnit u, const QgsMapUnitScale &scale=QgsMapUnitScale())
Returns scale factor painter units -> pixel dimensions.
QImage * sourceAsImage(QgsRenderContext &context)
Returns the source QPicture rendered to a new QImage.
static QgsSymbolV2::OutputUnit decodeOutputUnit(const QString &str)
QgsMapUnitScale mOffsetMapUnitScale
QString number(int n, int base)
void fill(uint pixelValue)
virtual QRectF boundingRect(const QRectF &rect, const QgsRenderContext &context) const override
Returns the bounding rect required for drawing the effect.
double transparency() const
Returns the transparency for the effect.
QPainter::CompositionMode mBlendMode
QPointF imageOffset(const QgsRenderContext &context) const
Returns the offset which should be used when drawing the source image on to a destination render cont...
virtual ~QgsShadowEffect()
A paint effect which draws an offset and optionally blurred drop shadow.
double ANALYSIS_EXPORT angle(Point3D *p1, Point3D *p2, Point3D *p3, Point3D *p4)
Calculates the angle between two segments (in 2 dimension, z-values are ignored)
virtual void draw(QgsRenderContext &context) override
Handles drawing of the effect's result on to the specified render context.
DrawMode
Drawing modes for effects.
virtual QgsInnerShadowEffect * clone() const override
Duplicates an effect by creating a deep copy of the effect.
void invertPixels(InvertMode mode)
A paint effect which draws an offset and optionally blurred drop shadow within a picture.
Contains information about the context of a rendering operation.
void drawImage(const QRectF &target, const QImage &image, const QRectF &source, QFlags< Qt::ImageConversionFlag > flags)
static void stackBlur(QImage &image, const int radius, const bool alphaOnly=false)
Performs a stack blur on an image.
QgsSymbolV2::OutputUnit mOffsetUnit
virtual void readProperties(const QgsStringMap &props) override
Reads a string map of an effect's properties and restores the effect to the state described by the pr...
virtual ~QgsDropShadowEffect()
static QgsPaintEffect * create(const QgsStringMap &map)
Creates a new QgsInnerShadowEffect effect from a properties string map.
Base class for paint effects which offset, blurred shadows.
QRectF adjusted(qreal dx1, qreal dy1, qreal dx2, qreal dy2) const
static QColor decodeColor(const QString &str)
iterator insert(const Key &key, const T &value)
const QPicture * source() const
Returns the source QPicture.
static QgsMapUnitScale decodeMapUnitScale(const QString &str)
virtual ~QgsInnerShadowEffect()
const T value(const Key &key) const
static QgsPaintEffect * create(const QgsStringMap &map)
Creates a new QgsDropShadowEffect effect from a properties string map.