-
Notifications
You must be signed in to change notification settings - Fork 58
Expand file tree
/
Copy pathlayer.cpp
More file actions
executable file
·91 lines (74 loc) · 1.16 KB
/
layer.cpp
File metadata and controls
executable file
·91 lines (74 loc) · 1.16 KB
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
#include "layer.h"
Layer::Layer(const QSize &size)
:lock_(false),
hide_(false),
select_(false),
access_(true)
{
img_ = QSharedPointer<QPixmap>(new QPixmap(size));
img_->fill(Qt::transparent);
}
Layer::~Layer()
{
img_.clear();
}
bool Layer::isLocked()
{
return lock_;
}
bool Layer::isHided()
{
return hide_;
}
bool Layer::isSelected()
{
return select_;
}
void Layer::lock()
{
lock_ = true;
}
void Layer::unlock()
{
lock_ = false;
}
void Layer::hide()
{
hide_ = true;
}
void Layer::show()
{
hide_ = false;
}
void Layer::select()
{
select_ = true;
}
void Layer::deselect()
{
select_ = false;
}
QPixmap* Layer::imagePtr()
{
return img_.data();
}
const QPixmap* Layer::imageConstPtr()
{
return img_.data();
}
void Layer::resize(const QSize &size)
{
if(!img_.isNull()){
if (img_->size() == size)
return;
*img_ = img_->scaled(size, Qt::KeepAspectRatio);
}
}
QString Layer::name()
{
return name_;
}
void Layer::rename(const QString &new_name)
{
name_ = new_name;
}