62  std::unique_ptr< QgsGradientColorRamp > tempRamp;
 
   70    QColor transparentColor = 
mColor;
 
   71    transparentColor.setAlpha( 0 );
 
   73    ramp = tempRamp.get();
 
  111    p.setRenderHint( QPainter::Antialiasing );
 
  112    p.setCompositionMode( QPainter::CompositionMode_DestinationIn );
 
  117  QPainter *painter = context.
painter();
 
 
  126  props.insert( QStringLiteral( 
"enabled" ), 
mEnabled ? 
"1" : 
"0" );
 
  127  props.insert( QStringLiteral( 
"draw_mode" ), QString::number( 
int( 
mDrawMode ) ) );
 
  128  props.insert( QStringLiteral( 
"blend_mode" ), QString::number( 
int( 
mBlendMode ) ) );
 
  129  props.insert( QStringLiteral( 
"opacity" ), QString::number( 
mOpacity ) );
 
  130  props.insert( QStringLiteral( 
"blur_level" ), QString::number( 
mBlurLevel ) );
 
  133  props.insert( QStringLiteral( 
"spread" ), QString::number( 
mSpread ) );
 
  136  props.insert( QStringLiteral( 
"color_type" ), QString::number( 
static_cast< int >( 
mColorType ) ) );
 
 
  150  const QPainter::CompositionMode mode = 
static_cast< QPainter::CompositionMode 
>( props.value( QStringLiteral( 
"blend_mode" ) ).toInt( &ok ) );
 
  155  if ( props.contains( QStringLiteral( 
"transparency" ) ) )
 
  157    const double transparency = props.value( QStringLiteral( 
"transparency" ) ).toDouble( &ok );
 
  165    const double opacity = props.value( QStringLiteral( 
"opacity" ) ).toDouble( &ok );
 
  171  mEnabled = props.value( QStringLiteral( 
"enabled" ), QStringLiteral( 
"1" ) ).toInt();
 
  173  const double level = props.value( QStringLiteral( 
"blur_level" ) ).toDouble( &ok );
 
  177    if ( !props.contains( QStringLiteral( 
"blur_unit" ) ) )
 
  185  const double spread = props.value( QStringLiteral( 
"spread" ) ).toDouble( &ok );
 
  197  if ( props.contains( QStringLiteral( 
"single_color" ) ) )
 
 
@ ForceVector
Always force vector-based rendering, even when the result will be visually different to a raster-base...
 
@ RequiresRasterization
The effect requires raster-based rendering.
 
@ GlowSpread
Glow spread size.
 
QFlags< PaintEffectFlag > PaintEffectFlags
Flags which control how paint effects behave.
 
Abstract base class for color ramps.
 
virtual QVariantMap properties() const =0
Returns a string map containing all the color ramp's properties.
 
virtual QgsColorRamp * clone() const =0
Creates a clone of the color ramp.
 
static QColor colorFromString(const QString &string)
Decodes a string into a color value.
 
static QString colorToString(const QColor &color)
Encodes a color into a string value.
 
static QgsColorRamp * create(const QVariantMap &properties=QVariantMap())
Creates the symbol layer.
 
static QString typeString()
Returns the string identifier for QgsCptCityColorRamp.
 
bool isCanceled() const
Tells whether the operation has been canceled already.
 
Base class for paint effects which draw a glow inside or outside a picture.
 
QgsGlowEffect & operator=(const QgsGlowEffect &rhs)
 
QgsMapUnitScale mBlurMapUnitScale
 
~QgsGlowEffect() override
 
Qgis::RenderUnit mSpreadUnit
 
void draw(QgsRenderContext &context) override
Handles drawing of the effect's result on to the specified render context.
 
double spread() const
Returns the spread distance used for drawing the glow effect.
 
virtual bool shadeExterior() const =0
Specifies whether the glow is drawn outside the picture or within the picture.
 
const QgsMapUnitScale & spreadMapUnitScale() const
Returns the map unit scale used for the spread distance.
 
GlowColorType
Color sources for the glow.
 
@ ColorRamp
Use colors from a color ramp.
 
QPainter::CompositionMode blendMode() const
Returns the blend mode for the effect.
 
void readProperties(const QVariantMap &props) override
Reads a string map of an effect's properties and restores the effect to the state described by the pr...
 
double blurLevel() const
Returns the blur level (radius) for the glow.
 
double opacity() const
Returns the opacity for the effect.
 
Qgis::RenderUnit mBlurUnit
 
QColor color() const
Returns the color for the glow.
 
QgsColorRamp * ramp() const
Returns the color ramp used for the glow.
 
Qgis::RenderUnit spreadUnit() const
Returns the units used for the glow spread distance.
 
QPainter::CompositionMode mBlendMode
 
QgsMapUnitScale mSpreadMapUnitScale
 
void setRamp(QgsColorRamp *ramp)
Sets the color ramp for the glow.
 
QVariantMap properties() const override
Returns the properties describing the paint effect encoded in a string format.
 
QRectF boundingRect(const QRectF &rect, const QgsRenderContext &context) const override
Returns the bounding rect required for drawing the effect.
 
GlowColorType colorType() const
Returns the color mode used for the glow.
 
Qgis::PaintEffectFlags flags() const override
Returns flags which specify how the paint effect behaves.
 
Gradient color ramp, which smoothly interpolates between two colors and also supports optional extra ...
 
static QgsColorRamp * create(const QVariantMap &properties=QVariantMap())
Creates a new QgsColorRamp from a map of properties.
 
static void multiplyOpacity(QImage &image, double factor, QgsFeedback *feedback=nullptr)
Multiplies opacity of image pixel values by a factor.
 
static void distanceTransform(QImage &image, const QgsImageOperation::DistanceTransformProperties &properties, QgsFeedback *feedback=nullptr)
Performs a distance transform on the source image and shades the result using a color ramp.
 
static QImage * gaussianBlur(QImage &image, int radius, QgsFeedback *feedback=nullptr)
Performs a gaussian blur on an image.
 
static void stackBlur(QImage &image, int radius, bool alphaOnly=false, QgsFeedback *feedback=nullptr)
Performs a stack blur on an image.
 
A paint effect which draws a glow within a picture.
 
QgsInnerGlowEffect * clone() const override
Duplicates an effect by creating a deep copy of the effect.
 
static QgsPaintEffect * create(const QVariantMap &map)
Creates a new QgsInnerGlowEffect effect from a properties string map.
 
A paint effect which draws a glow outside of a picture.
 
QgsOuterGlowEffect * clone() const override
Duplicates an effect by creating a deep copy of the effect.
 
static QgsPaintEffect * create(const QVariantMap &map)
Creates a new QgsOuterGlowEffect effect from a properties string map.
 
Base class for visual effects which can be applied to QPicture drawings.
 
void drawSource(QPainter &painter)
Draws the source QPicture onto the specified painter.
 
QImage sourceAsImage(QgsRenderContext &context)
Returns the source QPicture rendered to a new QImage.
 
const QPicture & source() const
Returns the source QPicture.
 
QPointF imageOffset(const QgsRenderContext &context) const
Returns the offset which should be used when drawing the source image on to a destination render cont...
 
bool enabled() const
Returns whether the effect is enabled.
 
DrawMode
Drawing modes for effects.
 
virtual QString type() const =0
Returns the effect type.
 
Contains information about the context of a rendering operation.
 
double convertToPainterUnits(double size, Qgis::RenderUnit unit, const QgsMapUnitScale &scale=QgsMapUnitScale(), Qgis::RenderSubcomponentProperty property=Qgis::RenderSubcomponentProperty::Generic) const
Converts a size from the specified units to painter units (pixels).
 
QPainter * painter()
Returns the destination QPainter for the render operation.
 
QgsFeedback * feedback() const
Returns the feedback object that can be queried regularly during rendering to check if rendering shou...
 
Qgis::RasterizedRenderingPolicy rasterizedRenderingPolicy() const
Returns the policy controlling when rasterisation of content during renders is permitted.
 
Scoped object for saving and restoring a QPainter object's state.
 
static QString encodeMapUnitScale(const QgsMapUnitScale &mapUnitScale)
 
static QgsMapUnitScale decodeMapUnitScale(const QString &str)
 
static Q_INVOKABLE Qgis::RenderUnit decodeRenderUnit(const QString &string, bool *ok=nullptr)
Decodes a render unit from a string.
 
static Q_INVOKABLE QString encodeUnit(Qgis::DistanceUnit unit)
Encodes a distance unit to a string.