File indexing completed on 2024-05-12 15:59:08
0001 /* 0002 * SPDX-FileCopyrightText: 2017 Wolthera van Hövell tot Westerflier <griffinvalley@gmail.com> 0003 * 0004 * SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 #ifndef LIBKIS_VECTORLAYER_H 0007 #define LIBKIS_VECTORLAYER_H 0008 0009 #include <QObject> 0010 0011 #include <kis_types.h> 0012 0013 #include "kritalibkis_export.h" 0014 #include "libkis.h" 0015 0016 #include <KoShapeControllerBase.h> 0017 0018 #include "Node.h" 0019 #include "Shape.h" 0020 0021 /** 0022 * @brief The VectorLayer class 0023 * A vector layer is a special layer that stores 0024 * and shows vector shapes. 0025 * 0026 * Vector shapes all have their coordinates in points, which 0027 * is a unit that represents 1/72th of an inch. Keep this in 0028 * mind wen parsing the bounding box and position data. 0029 */ 0030 0031 class KRITALIBKIS_EXPORT VectorLayer : public Node 0032 { 0033 Q_OBJECT 0034 Q_DISABLE_COPY(VectorLayer) 0035 0036 public: 0037 explicit VectorLayer(KoShapeControllerBase* shapeController, KisImageSP image, QString name, QObject *parent = 0); 0038 explicit VectorLayer(KisShapeLayerSP layer, QObject *parent = 0); 0039 ~VectorLayer() override; 0040 public Q_SLOTS: 0041 0042 /** 0043 * @brief type Krita has several types of nodes, split in layers and masks. Group 0044 * layers can contain other layers, any layer can contain masks. 0045 * 0046 * @return vectorlayer 0047 */ 0048 virtual QString type() const override; 0049 0050 /** 0051 * @brief shapes 0052 * @return the list of top-level shapes in this vector layer. 0053 */ 0054 QList<Shape *> shapes() const; 0055 0056 /** 0057 * @brief toSvg 0058 * convert the shapes in the layer to svg. 0059 * @return the svg in a string. 0060 */ 0061 QString toSvg(); 0062 0063 /** 0064 * @brief addShapesFromSvg 0065 * add shapes to the layer from a valid svg. 0066 * @param svg valid svg string. 0067 * @return the list of shapes added to the layer from the svg. 0068 */ 0069 QList<Shape *> addShapesFromSvg(const QString &svg); 0070 0071 }; 0072 0073 #endif // LIBKIS_VECTORLAYER_H 0074