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
|
/*
* Copyright (c) Dejan Noveski <dr.mote@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include <QtGui/QImage>
#include <Qt>
#include <QRgb>
#include "imageeffect.h"
#include <qimageblitz/qimageblitz.h>
void ImageEffect::grey(QImage &i) {
Blitz::grayscale(i, true);
}
void ImageEffect::invert(QImage &i) {
Blitz::invert(i);
}
void ImageEffect::equalize(QImage &i) {
Blitz::equalize(i);
}
void ImageEffect::smurf(QImage &i) {
i = i.rgbSwapped();
}
void ImageEffect::implode(QImage &i) {
i = Blitz::implode(i, 0.3);
}
void ImageEffect::explode(QImage &i) {
i = Blitz::implode(i, -0.3);
}
void ImageEffect::charcoal(QImage &i) {
i = Blitz::charcoal(i);
}
void ImageEffect::edge(QImage &i) {
i = Blitz::edge(i);
}
void ImageEffect::emboss(QImage &i) {
i = Blitz::emboss(i, 0, 0.8, Blitz::Low);
}
void ImageEffect::swirl(QImage &i) {
i = Blitz::swirl(i);
}
void ImageEffect::oilPaint(QImage &i) {
i = Blitz::oilPaint(i, 0, Blitz::Low);
}
void ImageEffect::wave(QImage &i) {
i = Blitz::wave(i);
}
void ImageEffect::applyEffect(QImage &i, int effect) {
switch(effect)
{
case ImageEffect::Effect_None:
break;
case ImageEffect::Effect_Grey:
grey(i); break;
case ImageEffect::Effect_Invert:
invert(i); break;
case ImageEffect::Effect_Equalize:
equalize(i); break;
case ImageEffect::Effect_Smurf:
smurf(i); break;
case ImageEffect::Effect_Implode:
implode(i); break;
case ImageEffect::Effect_Explode:
explode(i); break;
case ImageEffect::Effect_Charcoal:
charcoal(i); break;
case ImageEffect::Effect_Edge:
edge(i); break;
case ImageEffect::Effect_Emboss:
emboss(i); break;
case ImageEffect::Effect_Swirl:
swirl(i); break;
case ImageEffect::Effect_OilPaint:
oilPaint(i); break;
case ImageEffect::Effect_Wave:
wave(i); break;
}
}
|