Class: QgsRasterFillSymbolLayer

class qgis.core.QgsRasterFillSymbolLayer

Bases: QgsImageFillSymbolLayer

A class for filling symbols with a repeated raster image.

New in version 2.7.

QgsRasterFillSymbolLayer(imageFilePath: str = ‘’) Constructor for QgsRasterFillSymbolLayer, using a raster fill from the specified imageFilePath.

Enums

FillCoordinateMode

alias of SymbolCoordinateReference

Methods

applyBrushTransformFromContext

param context

applyDataDefinedSettings

param context

clone

rtype

QgsRasterFillSymbolLayer

color

rtype

QColor

coordinateMode

Coordinate mode for fill.

copyDataDefinedProperties

Copies all data defined properties of this layer to another symbol layer.

copyPaintEffect

Copies paint effect of this layer to another symbol layer

create

Creates a new QgsRasterFillSymbolLayer from a properties map.

estimateMaxBleed

param context

imageFilePath

The path to the raster image used for the fill.

layerType

rtype

str

offset

Returns the offset for the fill.

offsetMapUnitScale

Returns the map unit scale for the fill's offset.

offsetUnit

Returns the units for the fill's offset.

opacity

Returns the opacity for the raster image used in the fill.

properties

rtype

Dict[str, Any]

renderPolygon

param points

resolvePaths

Turns relative paths in properties map to absolute when reading and vice versa when writing.

restoreOldDataDefinedProperties

Restores older data defined properties from string map.

setCoordinateMode

Set the coordinate mode for fill.

setImageFilePath

Sets the path to the raster image used for the fill.

setOffset

Sets the offset for the fill.

setOffsetMapUnitScale

Sets the map unit scale for the fill's offset.

setOffsetUnit

Sets the units for the fill's offset.

setOpacity

Sets the opacity for the raster image used in the fill.

setSubSymbol

param symbol

setWidth

Sets the width for scaling the image used in the fill.

setWidthMapUnitScale

Sets the map unit scale for the image's width.

setWidthUnit

Sets the units for the image's width.

startRender

param context

stopRender

param context

subSymbol

rtype

QgsSymbol

usesMapUnits

rtype

bool

width

Returns the width used for scaling the image used in the fill.

widthMapUnitScale

Returns the map unit scale for the image's width.

widthUnit

Returns the units for the image's width.

FillCoordinateMode

alias of SymbolCoordinateReference

applyBrushTransformFromContext(self, context: QgsSymbolRenderContext = None) bool
Parameters

context (QgsSymbolRenderContext = None) –

Return type

bool

applyDataDefinedSettings(self, context: QgsSymbolRenderContext)
Parameters

context (QgsSymbolRenderContext) –

clone(self) QgsRasterFillSymbolLayer
Return type

QgsRasterFillSymbolLayer

color(self) QColor
Return type

QColor

coordinateMode(self) Qgis.SymbolCoordinateReference

Coordinate mode for fill. Controls how the top left corner of the image fill is positioned relative to the feature.

Return type

Qgis.SymbolCoordinateReference

Returns

coordinate mode

copyDataDefinedProperties(self, destLayer: QgsSymbolLayer)

Copies all data defined properties of this layer to another symbol layer.

Parameters

destLayer – destination layer

copyPaintEffect(self, destLayer: QgsSymbolLayer)

Copies paint effect of this layer to another symbol layer

Parameters

destLayer – destination layer

New in version 2.9.

create(properties: Dict[str, Any] = {}) QgsSymbolLayer

Creates a new QgsRasterFillSymbolLayer from a properties map. The caller takes ownership of the returned object.

Parameters

properties (Dict[str) –

Return type

QgsSymbolLayer

estimateMaxBleed(self, context: QgsRenderContext) float
Parameters

context (QgsRenderContext) –

Return type

float

imageFilePath(self) str

The path to the raster image used for the fill.

Return type

str

Returns

path to image file

layerType(self) str
Return type

str

offset(self) QPointF

Returns the offset for the fill.

Return type

QPointF

Returns

offset for fill

See also

setOffset()

See also

offsetUnit()

offsetMapUnitScale(self) QgsMapUnitScale

Returns the map unit scale for the fill’s offset.

Return type

QgsMapUnitScale

Returns

map unit scale for offset

See also

offset()

See also

offsetUnit()

offsetUnit(self) QgsUnitTypes.RenderUnit

Returns the units for the fill’s offset.

Return type

QgsUnitTypes.RenderUnit

Returns

units for offset

See also

setOffsetUnit()

See also

offset()

opacity(self) float

Returns the opacity for the raster image used in the fill.

Return type

float

Returns

opacity value between 0 (fully transparent) and 1 (fully opaque)

See also

setOpacity()

properties(self) Dict[str, Any]
Return type

Dict[str, Any]

renderPolygon(self, points: QPolygonF, rings: Iterable[QPolygonF], context: QgsSymbolRenderContext)
Parameters
resolvePaths(properties: Dict[str, Any], pathResolver: QgsPathResolver, saving: bool)

Turns relative paths in properties map to absolute when reading and vice versa when writing. Used internally when reading/writing symbols.

New in version 3.0.

Parameters
  • properties (Dict[str) –

  • pathResolver (QgsPathResolver) –

  • saving (bool) –

restoreOldDataDefinedProperties(self, stringMap: Dict[str, Any])

Restores older data defined properties from string map.

New in version 3.0.

setCoordinateMode(self, mode: Qgis.SymbolCoordinateReference)

Set the coordinate mode for fill. Controls how the top left corner of the image fill is positioned relative to the feature.

Parameters

mode (Qgis.SymbolCoordinateReference) – coordinate mode

See also

coordinateMode()

setImageFilePath(self, imagePath: str)

Sets the path to the raster image used for the fill.

Parameters

imagePath (str) – path to image file

See also

imageFilePath()

setOffset(self, offset: Union[QPointF, QPoint])

Sets the offset for the fill.

Parameters

offset (Union[QPointF) – offset for fill

See also

offset()

See also

setOffsetUnit()

setOffsetMapUnitScale(self, scale: QgsMapUnitScale)

Sets the map unit scale for the fill’s offset.

Parameters

scale (QgsMapUnitScale) – map unit scale for offset

See also

setOffset()

See also

setOffsetUnit()

setOffsetUnit(self, unit: QgsUnitTypes.RenderUnit)

Sets the units for the fill’s offset.

Parameters

unit (QgsUnitTypes.RenderUnit) – units for offset

See also

offsetUnit()

See also

setOffset()

setOpacity(self, opacity: float)

Sets the opacity for the raster image used in the fill.

Parameters

opacity (float) – opacity value between 0 (fully transparent) and 1 (fully opaque)

See also

opacity()

setSubSymbol(self, symbol: QgsSymbol) bool
Parameters

symbol (QgsSymbol) –

Return type

bool

setWidth(self, width: float)

Sets the width for scaling the image used in the fill. The image’s height will also be scaled to maintain the image’s aspect ratio.

Parameters

width (float) – width for scaling the image

See also

width()

See also

setWidthUnit()

setWidthMapUnitScale(self, scale: QgsMapUnitScale)

Sets the map unit scale for the image’s width.

Parameters

scale (QgsMapUnitScale) – map unit scale for width

See also

setWidth()

See also

setWidthUnit()

setWidthUnit(self, unit: QgsUnitTypes.RenderUnit)

Sets the units for the image’s width.

Parameters

unit (QgsUnitTypes.RenderUnit) – units for width

See also

widthUnit()

See also

setWidth()

startRender(self, context: QgsSymbolRenderContext)
Parameters

context (QgsSymbolRenderContext) –

stopRender(self, context: QgsSymbolRenderContext)
Parameters

context (QgsSymbolRenderContext) –

subSymbol(self) QgsSymbol
Return type

QgsSymbol

usesMapUnits(self) bool
Return type

bool

width(self) float

Returns the width used for scaling the image used in the fill. The image’s height is scaled to maintain the image’s aspect ratio.

Return type

float

Returns

width used for scaling the image

See also

setWidth()

See also

widthUnit()

widthMapUnitScale(self) QgsMapUnitScale

Returns the map unit scale for the image’s width.

Return type

QgsMapUnitScale

Returns

map unit scale for width

See also

width()

See also

widthUnit()

widthUnit(self) QgsUnitTypes.RenderUnit

Returns the units for the image’s width.

Return type

QgsUnitTypes.RenderUnit

Returns

units for width

See also

setWidthUnit()

See also

width()