File indexing completed on 2024-05-12 03:45:46
0001 /* 0002 SPDX-FileCopyrightText: 2016 Artem Fedoskin <afedoskin3@gmail.com> 0003 SPDX-License-Identifier: GPL-2.0-or-later 0004 */ 0005 0006 #pragma once 0007 0008 #include <QColor> 0009 #include <QSGNode> 0010 0011 class QSGFlatColorMaterial; 0012 class QSGGeometry; 0013 class QSGGeometryNode; 0014 0015 /** 0016 * @class EllipseNode 0017 * @short QSGTransformNode derived node used to draw ellipses 0018 * 0019 * @author Artem Fedoskin 0020 * @version 1.0 0021 */ 0022 class EllipseNode : public QSGTransformNode 0023 { 0024 public: 0025 explicit EllipseNode(const QColor &color = QColor(), int width = 1); 0026 0027 void setColor(QColor color); 0028 void setLineWidth(int width); 0029 /** 0030 * @short Redraw ellipse with the given width, height and positions (x,y) 0031 * @param x position by x 0032 * @param y position by y 0033 * @param width the width 0034 * @param height the height 0035 * @param filled - if true the ellipse will be filled with color 0036 */ 0037 void updateGeometry(float x, float y, int width, int height, bool filled); 0038 0039 private: 0040 QSGGeometryNode *m_geometryNode { nullptr }; 0041 QSGGeometry *m_geometry { nullptr }; 0042 QSGFlatColorMaterial *m_material { nullptr }; 0043 int m_width { -1 }; 0044 int m_height { -1 }; 0045 float m_x { -1 }; 0046 float m_y { -1 }; 0047 };