-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstructuralElements.cpp
More file actions
46 lines (31 loc) · 962 Bytes
/
structuralElements.cpp
File metadata and controls
46 lines (31 loc) · 962 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
#include "mainwindow.h"
// Структурные элементы
QImage* MainWindow::
ring (int radius, const QColor color)
{
int size = radius * 2 - 1;
QImage *ring = new QImage(size, size, QImage::Format_ARGB32);
ring->fill(Qt::transparent);
QPainter painter;
painter.begin(ring);
painter.setRenderHint(QPainter::Antialiasing, false);
painter.setPen(color);
painter.drawEllipse(0, 0, size, size);
painter.end();
return ring;
}
QImage* MainWindow::
disk (int radius, const QColor color)
{
int size = radius * 2 - 1;
QImage *disk = new QImage(radius * 2 - 1, radius * 2 - 1, QImage::Format_ARGB32);
disk->fill(Qt::transparent);
QPainter painter;
painter.begin(disk);
painter.setRenderHint(QPainter::Antialiasing, false);
painter.setPen(color);
painter.setBrush(QColor(color));
painter.drawEllipse(0, 0, size, size);
painter.end();
return disk;
}