29 , mTransparency( 0.5 )
31 , mBlendMode(
QPainter::CompositionMode_SourceOver )
32 , mColorType( SingleColor )
39 , mSpread( other.spread() )
40 , mSpreadUnit( other.spreadUnit() )
41 , mSpreadMapUnitScale( other.spreadMapUnitScale() )
43 , mBlurLevel( other.blurLevel() )
44 , mTransparency( other.transparency() )
45 , mColor( other.color() )
46 , mBlendMode( other.blendMode() )
47 , mColorType( other.colorType() )
142 QPainter::CompositionMode mode = ( QPainter::CompositionMode )props.
value(
"blend_mode" ).toInt( &ok );
154 int level = props.
value(
"blur_level" ).toInt( &ok );
159 double spread = props.
value(
"spread" ).toDouble( &ok );
171 if ( props.
contains(
"single_color" ) )
211 return rect.
adjusted( -spread, -spread, spread, spread );
static QString encodeOutputUnit(QgsSymbolV2::OutputUnit unit)
QgsVectorColorRampV2 * ramp() const
Returns the color ramp used for the glow.
QgsSymbolV2::OutputUnit mSpreadUnit
virtual QgsPaintEffect * clone() const override
Duplicates an effect by creating a deep copy of the effect.
bool contains(const Key &key) const
void setCompositionMode(CompositionMode mode)
virtual ~QgsOuterGlowEffect()
static void multiplyOpacity(QImage &image, const double factor)
Multiplies opacity of image pixel values by a factor.
void setRenderHint(RenderHint hint, bool on)
QMap< Key, T > & unite(const QMap< Key, T > &other)
static QString encodeColor(const QColor &color)
static void distanceTransform(QImage &image, const DistanceTransformProperties &properties)
Performs a distance transform on the source image and shades the result using a color ramp...
double transparency() const
Returns the transparency for the effect.
QPainter::CompositionMode mBlendMode
QgsGlowEffect & operator=(const QgsGlowEffect &rhs)
bool enabled() const
Returns whether the effect is enabled.
Base class for visual effects which can be applied to QPicture drawings.
virtual void draw(QgsRenderContext &context) override
Handles drawing of the effect's result on to the specified render context.
virtual QgsStringMap properties() const =0
static QString encodeMapUnitScale(const QgsMapUnitScale &mapUnitScale)
QImage copy(const QRect &rectangle) const
virtual bool shadeExterior() const =0
Specifies whether the glow is drawn outside the picture or within the picture.
Base class for paint effect which draw a glow inside or outside a 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)
QString number(int n, int base)
double spread() const
Returns the spread distance used for drawing the glow effect.
virtual QString type() const =0
Returns the effect type.
virtual QgsVectorColorRampV2 * clone() const =0
static QgsPaintEffect * create(const QgsStringMap &map)
Creates a new QgsOuterGlowEffect effect from a properties string map.
QgsVectorColorRampV2 * mRamp
GlowColorType
Color sources for the glow.
QPointF imageOffset(const QgsRenderContext &context) const
Returns the offset which should be used when drawing the source image on to a destination render cont...
A paint effect which draws a glow outside of a picture.
DrawMode
Drawing modes for effects.
virtual ~QgsInnerGlowEffect()
static QgsVectorColorRampV2 * create(const QgsStringMap &properties=QgsStringMap())
void setRamp(QgsVectorColorRampV2 *ramp)
Sets the color ramp for the glow.
Contains information about the context of a rendering operation.
void drawImage(const QRectF &target, const QImage &image, const QRectF &source, QFlags< Qt::ImageConversionFlag > flags)
int blurLevel() const
Returns the blur level (strength) for the glow.
static void stackBlur(QImage &image, const int radius, const bool alphaOnly=false)
Performs a stack blur on an image.
QgsMapUnitScale mSpreadMapUnitScale
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...
QColor color() const
Returns the color for the glow.
GlowColorType colorType() const
Returns the color mode used for the glow.
virtual QgsStringMap properties() const override
Returns the properties describing the paint effect encoded in a string format.
virtual QgsPaintEffect * clone() const override
Duplicates an effect by creating a deep copy of the effect.
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)
A paint effect which draws a glow within a picture.
virtual QRectF boundingRect(const QRectF &rect, const QgsRenderContext &context) const override
Returns the bounding rect required for drawing the effect.
static QgsPaintEffect * create(const QgsStringMap &map)
Creates a new QgsInnerGlowEffect effect from a properties string map.
QPainter::CompositionMode blendMode() const
Returns the blend mode for the effect.
const T value(const Key &key) const