36 lines
1.2 KiB
C++
36 lines
1.2 KiB
C++
#pragma once
|
|
#include <QOpenGLFunctions>
|
|
#include <QOpenGLWidget>
|
|
#include <QPainter>
|
|
#include "Renderer/Preview/ElementRenderer.h"
|
|
#include "Editor/ThirdPartyLib/qquick/qquicksvgparser_p.h"
|
|
#include "Renderer/Painting/MaterialStyleStroke.h"
|
|
#include "Renderer/Painting/ElementStyle.h"
|
|
|
|
namespace UnitTest
|
|
{
|
|
class TestGLWidget : public QOpenGLWidget, protected QOpenGLFunctions
|
|
{
|
|
Q_OBJECT
|
|
private:
|
|
Renderer::ElementRenderer renderer;
|
|
public:
|
|
TestGLWidget(QWidget* parent = nullptr) : QOpenGLWidget(parent), renderer(this) {};
|
|
void initializeGL() override
|
|
{
|
|
initializeOpenGLFunctions();
|
|
renderer.initialize();
|
|
};
|
|
void paintGL() override
|
|
{
|
|
glClearColor(1.0, 1.0, 1.0, 1.0);
|
|
glClear(GL_COLOR_BUFFER_BIT);
|
|
QPainterPath path;
|
|
QQuickSvgParser::parsePathDataFast("M100,100C-.5,100,0,100.5,0,0L40,.07C40,59.5,39.5,60,100,60Z", path);
|
|
auto [img, pos] = renderer.drawElement(path, Renderer::ElementStyleStrokeDemo(2), 1, false);
|
|
QPainter painter(this);
|
|
painter.drawImage(pos, img);
|
|
};
|
|
void resizeGL(int w, int h) override {};
|
|
};
|
|
} |