Subgroup: other

Class: QgsDrawSourceEffect

class qgis.core.QgsDrawSourceEffect

Bases: qgis._core.QgsPaintEffect

A paint effect which draws the source picture with minor or no alterations

The draw source effect can be used to draw an unaltered copy of the original source picture. Minor changes like lowering the opacity and applying a blend mode are supported, however these changes will force the resultant output to be rasterized. If no alterations are performed then the original picture will be rendered as a vector.

New in version 2.9: Methods

begin Begins intercepting paint operations to a render context.
blendMode Returns the blend mode for the effect
boundingRect
clone
create Creates a new QgsDrawSource effect from a properties string map.
draw
drawMode Returns the draw mode for the effect.
drawSource
enabled Returns whether the effect is enabled
end Ends interception of paint operations to a render context, and draws the result to the render context after being modified by the effect.
fixQPictureDpi
imageOffset
opacity Returns the opacity for the effect
properties
readProperties
render Renders a picture using the effect.
saveProperties Saves the current state of the effect to a DOM element.
setBlendMode Sets the blend mode for the effect
setDrawMode Sets the draw mode for the effect.
setEnabled Sets whether the effect is enabled
setOpacity Sets the opacity for the effect.
source
sourceAsImage
type

Attributes

Modifier
ModifyAndRender
Render
blendMode(self) → QPainter.CompositionMode

Returns the blend mode for the effect

Returns:blend mode used for drawing the source on to a destination

paint device

See also

setBlendMode()

boundingRect()
clone(self) → QgsDrawSourceEffect
create(map: Dict[str, str]) → QgsPaintEffect

Creates a new QgsDrawSource effect from a properties string map.

Parameters:map – encoded properties string map
Returns:new QgsDrawSourceEffect
draw(self, context: QgsRenderContext)
drawSource()
fixQPictureDpi()
imageOffset()
opacity(self) → float

Returns the opacity for the effect

Returns:opacity value between 0 and 1 inclusive, where 0 is fully transparent

and 1 is fully opaque

See also

setOpacity()

properties(self) → Dict[str, str]
readProperties(self, props: Dict[str, str])
setBlendMode(self, mode: QPainter.CompositionMode)

Sets the blend mode for the effect

Parameters:mode – blend mode used for drawing the source on to a destination

paint device

See also

blendMode()

setOpacity(self, opacity: float)

Sets the opacity for the effect.

Parameters:opacity – double between 0 and 1 inclusive, where 0 is fully transparent

and 1 is fully opaque

See also

opacity()

source()
sourceAsImage()
type(self) → str