Class VectorLayer
Build from VectorLayer.h
Krita 4.0.0Krita master

The VectorLayer class A vector layer is a special layer that stores and shows vector shapes.

Vector shapes all have their coordinates in points, which is a unit that represents 1/72th of an inch. Keep this in mind wen parsing the bounding box and position data.

Methods

addShapesFromSvg(svg: str)list[Shape] createGroupShape(name: str, shapes: list[Shape])Shape isAntialiased()bool setAntialiased(antialiased: bool) shapeAtPosition(position: QPointF)Shape shapes()list[Shape] shapesInRect(rect: QRectF, omitHiddenShapes: bool = True, containedMode: bool = False)list[Shape] toSvg()str

Re-implemented methods

type()str

Member documentation

addShapesFromSvg(svg: str)list[Shape]
Krita 5.0.0

add shapes to the layer from a valid svg.

Parameters

svg

valid svg string.

Return

the list of shapes added to the layer from the svg.

createGroupShape(name: str, shapes: list[Shape])Shape
Krita 5.2.0

combine a list of top level shapes into a group.

Parameters

name

the name of the shape.

shapes

list of top level shapes.

Return

if successful, a GroupShape object will be returned.

isAntialiased()bool
Krita master

return antialiasing status for the Vector layer

Return

True if antialiasing is active for the layer

setAntialiased(antialiased: bool)
Krita master

set antialiasing status for the Vector layer

Parameters

antialiased

set to True to activate antialiasing

shapeAtPosition(position: QPointF)Shape
Krita 5.2.0

shapeAtPoint check if the position is located within any non-group shape's boundingBox() on the current layer.

Parameters

position

a QPointF of the position.

Return

the shape at the position, or None if no shape is found.

shapes()list[Shape]
Krita 4.0.0

Return

the list of top-level shapes in this vector layer.

shapesInRect(rect: QRectF, omitHiddenShapes: bool = True, containedMode: bool = False)list[Shape]
Krita 5.2.0

shapeInRect get all non-group shapes that the shape's boundingBox() intersects or is contained within a given rectangle on the current layer.

Parameters

rect

a QRectF

omitHiddenShapes

true if non-visible() shapes should be omitted, false if they should be included. \p omitHiddenShapes defaults to true.

containedMode

false if only shapes that are within or intersect with the outline should be included, true if only shapes that are fully contained within the outline should be included. \p containedMode defaults to false

Return

returns a list of shapes.

toSvg()str
Krita 5.0.0

convert the shapes in the layer to svg.

Return

the svg in a string.

type()str
Krita 4.0.0

Krita has several types of nodes, split in layers and masks. Group layers can contain other layers, any layer can contain masks.

Return

vectorlayer