31 , mTransparency( 0.0 )
32 , mBlendMode(
QPainter::CompositionMode_SourceOver )
37 , mColorizeOn( false )
38 , mColorizeColor(
QColor::fromRgb( 255, 128, 128 ) )
39 , mColorizeStrength( 100 )
85 props.
insert(
"colorize", mColorizeOn ?
"1" :
"0" );
95 QPainter::CompositionMode mode =
static_cast< QPainter::CompositionMode
>( props.
value(
"blend_mode" ).toInt( &ok ) );
108 mBrightness = props.
value(
"brightness",
"0" ).toInt();
109 mContrast = props.
value(
"contrast",
"0" ).toInt();
110 mSaturation = props.
value(
"saturation",
"1.0" ).toDouble();
112 mColorizeOn = props.
value(
"colorize",
"0" ).toInt();
113 if ( props.
contains(
"colorize_color" ) )
117 mColorizeStrength = props.
value(
"colorize_strength",
"100" ).toInt();
Contains operations and filters which apply to QImages.
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 void convertToGrayscale(QImage &image, const GrayscaleMode mode=GrayscaleLuminosity)
Convert a QImage to a grayscale image.
static QString encodeColor(const QColor &color)
void setColorizeColor(const QColor &colorizeColor)
Sets the color used for colorizing a picture.
Base class for visual effects which can be applied to QPicture drawings.
QImage copy(const QRect &rectangle) const
QImage * sourceAsImage(QgsRenderContext &context)
Returns the source QPicture rendered to a new QImage.
static void adjustBrightnessContrast(QImage &image, const int brightness, const double contrast)
Alter the brightness or contrast of a QImage.
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)
bool enabled() const
Returns whether the effect is enabled.
DrawMode
Drawing modes for effects.
virtual QgsColorEffect * clone() const override
Duplicates an effect by creating a deep copy of the effect.
virtual QgsStringMap properties() const override
Returns the properties describing the paint effect encoded in a string format.
static void adjustHueSaturation(QImage &image, const double saturation, const QColor &colorizeColor=QColor(), const double colorizeStrength=1.0)
Alter the hue or saturation of a QImage.
Contains information about the context of a rendering operation.
virtual ~QgsColorEffect()
void drawImage(const QRectF &target, const QImage &image, const QRectF &source, QFlags< Qt::ImageConversionFlag > flags)
virtual void draw(QgsRenderContext &context) override
Handles drawing of the effect's result on to the specified render context.
A paint effect which alters the colors (eg brightness, contrast) in a source picture.
static QgsPaintEffect * create(const QgsStringMap &map)
Creates a new QgsColorEffect effect from a properties string map.
static QColor decodeColor(const QString &str)
iterator insert(const Key &key, const T &value)
const QPicture * source() const
Returns the source QPicture.
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...
double transparency() const
Returns the transparency for the effect.
GrayscaleMode
Modes for converting a QImage to grayscale.
QColor colorizeColor() const
Returns the color used for colorizing a picture.
const T value(const Key &key) const