1 /*
2     SPDX-FileCopyrightText: 2016 Artem Fedoskin <afedoskin3@gmail.com>
3     SPDX-License-Identifier: GPL-2.0-or-later
4 */
5 
6 #pragma once
7 
8 #include <QColor>
9 #include <QSGNode>
10 
11 class QSGFlatColorMaterial;
12 class QSGGeometry;
13 class QSGGeometryNode;
14 
15 /**
16  * @class EllipseNode
17  * @short QSGTransformNode derived node used to draw ellipses
18  *
19  * @author Artem Fedoskin
20  * @version 1.0
21  */
22 class EllipseNode : public QSGTransformNode
23 {
24   public:
25     explicit EllipseNode(const QColor &color = QColor(), int width = 1);
26 
27     void setColor(QColor color);
28     void setLineWidth(int width);
29     /**
30      * @short Redraw ellipse with the given width, height and positions (x,y)
31      * @param x position by x
32      * @param y position by y
33      * @param width the width
34      * @param height the height
35      * @param filled - if true the ellipse will be filled with color
36      */
37     void updateGeometry(float x, float y, int width, int height, bool filled);
38 
39   private:
40     QSGGeometryNode *m_geometryNode { nullptr };
41     QSGGeometry *m_geometry { nullptr };
42     QSGFlatColorMaterial *m_material { nullptr };
43     int m_width { -1 };
44     int m_height { -1 };
45     float m_x { -1 };
46     float m_y { -1 };
47 };
48