-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGraphics.cpp
More file actions
48 lines (38 loc) · 920 Bytes
/
Graphics.cpp
File metadata and controls
48 lines (38 loc) · 920 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include "Graphics.h"
#include <QPainter>
#include <QPainterPath>
static QFont font("Times", 13, QFont::Bold);
Graphics::Graphics()
{
this->painter_path = new QPainterPath;
}
void Graphics::setPainter(QPainter *painter)
{
this->painter = painter;
}
void Graphics::beginFill(uint32_t color, double)
{
painter->setPen(QPen(color));
//painter_path
}
void Graphics::moveTo(double x, double y)
{
painter_path->moveTo(x, y);
}
void Graphics::lineTo(double x, double y)
{
painter_path->lineTo(x, y);
}
void Graphics::drawString(const QString &text, int x, int y)
{
painter_path->addText(x, y, font, text);
}
void Graphics::end(uint32_t color)
{
painter->setPen(QPen(color));
painter->drawPath(*painter_path);
this->painter_path->~QPainterPath();
new(this->painter_path) QPainterPath;
//delete this->painter_path;
//this->painter_path = new QPainterPath;
}