30 , mTransparency( 0.5 )
32 , mBlendMode(
QPainter::CompositionMode_SourceOver )
33 , mColorType( SingleColor )
143 QPainter::CompositionMode mode =
static_cast< QPainter::CompositionMode
>( props.
value(
"blend_mode" ).toInt( &ok ) );
155 int level = props.
value(
"blur_level" ).toInt( &ok );
160 double spread = props.
value(
"spread" ).toDouble( &ok );
172 if ( props.
contains(
"single_color" ) )
212 return rect.
adjusted( -spread, -spread, spread, spread );
static QString encodeOutputUnit(QgsSymbolV2::OutputUnit unit)
QgsSymbolV2::OutputUnit mSpreadUnit
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...
QPainter::CompositionMode mBlendMode
QgsGlowEffect & operator=(const QgsGlowEffect &rhs)
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
Returns a string map containing all the color ramp's properties.
static QString encodeMapUnitScale(const QgsMapUnitScale &mapUnitScale)
QImage copy(const QRect &rectangle) const
QgsSymbolV2::OutputUnit spreadUnit() const
Returns the units used for the glow spread distance.
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)
QPointF imageOffset(const QgsRenderContext &context) const
Returns the offset which should be used when drawing the source image on to a destination render cont...
QString number(int n, int base)
virtual QString type() const =0
Returns the effect type.
virtual QgsVectorColorRampV2 * clone() const =0
Creates a clone of the color ramp.
static QgsPaintEffect * create(const QgsStringMap &map)
Creates a new QgsOuterGlowEffect effect from a properties string map.
const QgsMapUnitScale & spreadMapUnitScale() const
Returns the map unit scale used for the spread distance.
QgsVectorColorRampV2 * mRamp
bool enabled() const
Returns whether the effect is enabled.
GlowColorType
Color sources for the glow.
GlowColorType colorType() const
Returns the color mode used for the glow.
A paint effect which draws a glow outside of a picture.
DrawMode
Drawing modes for effects.
virtual ~QgsInnerGlowEffect()
virtual QgsOuterGlowEffect * clone() const override
Duplicates an effect by creating a deep copy of the effect.
static QgsVectorColorRampV2 * create(const QgsStringMap &properties=QgsStringMap())
Creates a new QgsVectorColorRampV2 from a map of properties.
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)
double spread() const
Returns the spread distance used for drawing the glow effect.
QPainter::CompositionMode blendMode() const
Returns the blend mode for the effect.
static void stackBlur(QImage &image, const int radius, const bool alphaOnly=false)
Performs a stack blur on an image.
virtual QgsInnerGlowEffect * clone() const override
Duplicates an effect by creating a deep copy of the effect.
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...
virtual QgsStringMap properties() const override
Returns the properties describing the paint effect encoded in a string format.
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.
double transparency() const
Returns the transparency for the effect.
Abstract base class for color ramps.
Gradient color ramp, which smoothly interpolates between two colors and also supports optional extra ...
virtual QRectF boundingRect(const QRectF &rect, const QgsRenderContext &context) const override
Returns the bounding rect required for drawing the effect.
QgsVectorColorRampV2 * ramp() const
Returns the color ramp used for the glow.
static QgsPaintEffect * create(const QgsStringMap &map)
Creates a new QgsInnerGlowEffect effect from a properties string map.
int blurLevel() const
Returns the blur level (strength) for the glow.
const T value(const Key &key) const
QColor color() const
Returns the color for the glow.