-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhsopbrushgui.cpp
125 lines (102 loc) · 2.72 KB
/
hsopbrushgui.cpp
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
#include "hsopbrushgui.h"
#include "ui_hsopbrushgui.h"
#include <QPainter>
HSOPBrushGui::HSOPBrushGui(QWidget *parent) :
QWidget(parent),
ui(new Ui::HSOPBrushGui)
{
ui->setupUi(this);
}
HSOPBrushGui::~HSOPBrushGui()
{
delete ui;
}
bool HSOPBrushGui::get_height_enabled(){
return ui->checkBoxNormal->isChecked();
}
bool HSOPBrushGui::get_parallax_enabled(){
return ui->checkBoxParallax->isChecked();
}
bool HSOPBrushGui::get_specular_enabled(){
return ui->checkBoxSpecular->isChecked();
}
bool HSOPBrushGui::get_occlussion_enabled(){
return ui->checkBoxOcclussion->isChecked();
}
void HSOPBrushGui::brush_sprite_updated(QImage sprite){
QImage fill(QSize(200,200),QImage::Format_RGBA8888);
fill.fill(QColor(51,51,77,255));
QPainter p(&fill);
if (sprite.width() > 200 || sprite.height() > 200) sprite = sprite.scaled(200,200);
p.drawImage(QPointF(100-sprite.width()/2.0,100-sprite.height()/2.0),sprite);
// p.setPen(QColor(153,153,255));
// p.drawEllipse(100-sprite.width()/2.0,100-sprite.height()/2.0,sprite.width(),sprite.height());
ui->imageLabel->resize(sprite.size());
ui->imageLabel->setPixmap(QPixmap::fromImage(fill));
}
void HSOPBrushGui::on_sizeSlider_valueChanged(int value)
{
size_changed(value);
}
void HSOPBrushGui::on_hardnessSlider_valueChanged(int value)
{
hardness_changed(value);
}
void HSOPBrushGui::on_sliderNormal_valueChanged(int value)
{
height_changed(value);
}
void HSOPBrushGui::on_mixSlider_valueChanged(int value)
{
mix_changed(value);
}
void HSOPBrushGui::on_sliderSpecular_valueChanged(int value)
{
specular_changed(value);
}
void HSOPBrushGui::on_sliderOcclussion_valueChanged(int value)
{
occlussion_changed(value);
}
void HSOPBrushGui::on_sliderParallax_valueChanged(int value)
{
parallax_changed(value);
}
void HSOPBrushGui::unselect_all(){
ui->buttonPeak->setChecked(false);
ui->buttonRounded->setChecked(false);
ui->buttonEraser->setChecked(false);
}
void HSOPBrushGui::on_buttonRounded_toggled(bool checked)
{
if (checked){
ui->buttonPeak->setChecked(false);
ui->buttonEraser->setChecked(false);
}
selected_changed(checked);
}
void HSOPBrushGui::on_buttonPeak_toggled(bool checked)
{
if (checked){
ui->buttonRounded->setChecked(false);
ui->buttonEraser->setChecked(false);
}
selected_changed(checked);
}
void HSOPBrushGui::on_buttonEraser_toggled(bool checked)
{
if (checked){
ui->buttonRounded->setChecked(false);
ui->buttonPeak->setChecked(false);
}
selected_changed(checked);
}
bool HSOPBrushGui::get_button_eraser(){
return ui->buttonEraser->isChecked();
}
bool HSOPBrushGui::get_button_rounded(){
return ui->buttonRounded->isChecked();
}
bool HSOPBrushGui::get_button_peak(){
return ui->buttonPeak->isChecked();
}