Krita

VectorLayer.h
1/*
2 * SPDX-FileCopyrightText: 2017 Wolthera van Hövell tot Westerflier <griffinvalley@gmail.com>
3 *
4 * SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6#ifndef LIBKIS_VECTORLAYER_H
7#define LIBKIS_VECTORLAYER_H
8
9#include <QObject>
10
11#include <kis_types.h>
12
13#include "kritalibkis_export.h"
14#include "libkis.h"
15
16#include <KoShapeControllerBase.h>
17
18#include "Node.h"
19#include "Shape.h"
20
21/**
22 * @brief The VectorLayer class
23 * A vector layer is a special layer that stores
24 * and shows vector shapes.
25 *
26 * Vector shapes all have their coordinates in points, which
27 * is a unit that represents 1/72th of an inch. Keep this in
28 * mind wen parsing the bounding box and position data.
29 */
30
31class KRITALIBKIS_EXPORT VectorLayer : public Node
32{
33 Q_OBJECT
34 Q_DISABLE_COPY(VectorLayer)
35
36public:
37 explicit VectorLayer(KoShapeControllerBase* shapeController, KisImageSP image, QString name, QObject *parent = 0);
38 explicit VectorLayer(KisShapeLayerSP layer, QObject *parent = 0);
39 ~VectorLayer() override;
40public Q_SLOTS:
41
42 /**
43 * @brief type Krita has several types of nodes, split in layers and masks. Group
44 * layers can contain other layers, any layer can contain masks.
45 *
46 * @return vectorlayer
47 */
48 virtual QString type() const override;
49
50 /**
51 * @brief shapes
52 * @return the list of top-level shapes in this vector layer.
53 */
54 QList<Shape *> shapes() const;
55
56 /**
57 * @brief toSvg
58 * convert the shapes in the layer to svg.
59 * @return the svg in a string.
60 */
61 QString toSvg();
62
63 /**
64 * @brief addShapesFromSvg
65 * add shapes to the layer from a valid svg.
66 * @param svg valid svg string.
67 * @return the list of shapes added to the layer from the svg.
68 */
69 QList<Shape *> addShapesFromSvg(const QString &svg);
70
71 /**
72 * @brief shapeAtPoint
73 * check if the position is located within any non-group shape's boundingBox() on the current layer.
74 * @param position a QPointF of the position.
75 * @return the shape at the position, or None if no shape is found.
76 */
77 Shape* shapeAtPosition(const QPointF &position) const;
78
79 /**
80 * @brief shapeInRect
81 * get all non-group shapes that the shape's boundingBox() intersects or is contained within a given rectangle on the current layer.
82 * @param rect a QRectF
83 * @param omitHiddenShapes true if non-visible() shapes should be omitted, false if they should be included. \p omitHiddenShapes defaults to true.
84 * @param 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
85 * @return returns a list of shapes.
86 */
87 QList<Shape *> shapesInRect(const QRectF &rect, bool omitHiddenShapes = true, bool containedMode = false) const;
88
89 /**
90 * @brief createGroupShape
91 * combine a list of top level shapes into a group.
92 * @param name the name of the shape.
93 * @param shapes list of top level shapes.
94 * @return if successful, a GroupShape object will be returned.
95 */
96 Shape* createGroupShape(const QString &name, QList<Shape *> shapes) const;
97
98 /**
99 * @brief return antialiasing status for the Vector layer
100 * @return True if antialiasing is active for the layer
101 */
102 bool isAntialiased() const;
103
104 /**
105 * @brief set antialiasing status for the Vector layer
106 * @param antialiased set to True to activate antialiasing
107 */
108 void setAntialiased(const bool antialiased);
109};
110
111#endif // LIBKIS_VECTORLAYER_H
112
Node represents a layer or mask in a Krita image's Node hierarchy.
Definition Node.h:24
virtual QString type() const
type Krita has several types of nodes, split in layers and masks.
Definition Node.cpp:462
The Shape class The shape class is a wrapper around Krita's vector objects.
Definition Shape.h:38
The VectorLayer class A vector layer is a special layer that stores and shows vector shapes.
Definition VectorLayer.h:32
Q_SLOTSQ_SLOTS
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:18:59 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.