forked from ZiQiangWang/ImagePorc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
FilterRadialBlur.cpp
85 lines (70 loc) · 2.25 KB
/
FilterRadialBlur.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
#include "FilterRadialBlur.h"
#include "ui_FilterRadialBlur.h"
#include "Types.h"
#include "Picture.h"
#include "Commands.h"
FilterRadialBlur::FilterRadialBlur(Picture *pic, QWidget *parent) :
QDialog(parent),
ui(new Ui::FilterRadialBlur)
{
ui->setupUi(this);
this->setAttribute(Qt::WA_DeleteOnClose);
this->move(20,100);
m_pic = pic;
blur = new _RadialBlur(2,0.0,0.0);
connect(this,&FilterRadialBlur::state_changed,pic,&Picture::RadialBlur);
connect(this,&FilterRadialBlur::rejected,pic,&Picture::PopUpRecord);
connect(this,&FilterRadialBlur::accepted,this,&FilterRadialBlur::proc_accept);
pic->PushBackRecord();
pic->RadialBlur(blur);
}
FilterRadialBlur::~FilterRadialBlur()
{
delete ui;
delete blur;
}
void FilterRadialBlur::proc_accept()
{
QUndoCommand *command = new CommandImage(m_pic,"滤镜-旋转模糊");
m_pic->getUndoStack()->push(command);
}
void FilterRadialBlur::on_horizontalSlider_angle_valueChanged(int value)
{
blur->angle = value;
emit state_changed(blur);
}
void FilterRadialBlur::on_horizontalSlider_center_x_valueChanged(int value)
{
blur->center_x = (double)value/100;
ui->doubleSpinBox_center_x->setValue((double)value/100);
emit state_changed(blur);
}
void FilterRadialBlur::on_doubleSpinBox_center_x_valueChanged(const QString &value)
{
QString temp = value;
int num = temp.remove(QChar('.'),Qt::CaseInsensitive).toInt();
ui->horizontalSlider_center_x->setValue(num);
}
void FilterRadialBlur::on_horizontalSlider_center_y_valueChanged(int value)
{
blur->center_y = (double)value/100;
ui->doubleSpinBox_center_y->setValue((double)value/100);
emit state_changed(blur);
}
void FilterRadialBlur::on_doubleSpinBox_center_y_valueChanged(const QString &value)
{
QString temp = value;
int num = temp.remove(QChar('.'),Qt::CaseInsensitive).toInt();
ui->horizontalSlider_center_y->setValue(num);
}
void FilterRadialBlur::on_pushButton_reset_center_clicked()
{
ui->horizontalSlider_center_x->setValue(0);
ui->horizontalSlider_center_y->setValue(0);
}
void FilterRadialBlur::on_pushButton_reset_clicked()
{
ui->horizontalSlider_angle->setValue(2);
ui->horizontalSlider_center_x->setValue(0);
ui->horizontalSlider_center_y->setValue(0);
}