Newer
Older
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
#include "identiconstyle.h"
IdenticonStyle::IdenticonStyle()
{
}
IdenticonStyle::IdenticonStyle(IdenticonStyle &other)
{
hues_ = other.hues();
backColor_ = other.backCol();
padding_ = other.padding();
colorSaturation_ = other.colorSaturation();
grayscaleSaturation_ = other.grayscaleSaturation();
minColorLightness_ = other.minColorLightness();
maxColorLightness_ = other.maxColorLightness();
minGrayLightness_ = other.minGrayLightness();
maxGrayLightness_ = other.maxGrayLightness();
}
void
IdenticonStyle::setHues(QList<qreal> &hues)
{
hues_ = hues;
}
void
IdenticonStyle::setBackCol(QColor &color)
{
backColor_ = color;
}
void
IdenticonStyle::setPadding(qreal padding)
{
if (padding < 0.0 || padding > 0.4)
{
throw new std::out_of_range("Only padding values in the range [0.0, 0.4] are valid.");
}
padding_ = padding;
}
void
IdenticonStyle::setColorSaturation(qreal saturation)
{
if (saturation < 0 || saturation > 1)
{
throw new std::out_of_range(
"Only saturation values in the range [0.0, 1.0] are allowed.");
}
colorSaturation_ = saturation;
}
void
IdenticonStyle::setGrayscaleSaturation(qreal saturation)
{
if (saturation < 0 || saturation > 1)
{
throw new std::out_of_range(
"Only saturation values in the range [0.0, 1.0] are allowed.");
}
grayscaleSaturation_ = saturation;
}
void
IdenticonStyle::setMinColorLightness(qreal lightness)
{
if (lightness < 0.0)
{
throw new std::out_of_range(
"Only lightness values between [0.0, 1.0] are allowed.");
}
minColorLightness_ = lightness;
}
void
IdenticonStyle::setMaxColorLightness(qreal lightness)
{
if (lightness > 1.0)
{
throw new std::out_of_range(
"Only lightness values between [0.0, 1.0] are allowed.");
}
maxColorLightness_ = lightness;
}
void
IdenticonStyle::setMinGrayLightness(qreal lightness)
{
if (lightness < 0.0)
{
throw new std::out_of_range(
"Only lightness values between [0.0, 1.0] are allowed.");
}
minGrayLightness_ = lightness;
}
void
IdenticonStyle::setMaxGrayLightness(qreal lightness)
{
if (lightness > 1.0)
{
throw new std::out_of_range(
"Only lightness values between [0.0, 1.0] are allowed.");
}
maxGrayLightness_ = lightness;
}