-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgraphictools.h
103 lines (91 loc) · 2.67 KB
/
graphictools.h
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
#ifndef GRAPHICTOOLS_H
#define GRAPHICTOOLS_H
#include "libda_global.h"
#include <QGraphicsBlurEffect>
#include <QGraphicsEffect>
#include <QGraphicsScene>
#include <QGraphicsPixmapItem>
#include <QPainter>
LDA_BEGIN_NAMESPACE
/**
* @brief VisualEffect class is used to perform effects on images, like blur or filters
*/
class LIBDA_SHARED_EXPORT VisualEffect {
public:
enum ColorChannel {
Red = 8,
Green = 2,
Blue = 4,
Alpha = 1
};
enum EffectType {
Blur = 1,
Masked = 2,
ChannelBlur = 4,
SplittedChannels = 8,
GrayScale = 16
};
enum ChannelSplitDirection {
Right = 1,
Left = 2,
Bottom = 4,
Top = 8
};
enum ChannelSplitMode {
Exclude = 1,
Include = 2
};
int splitPadding = 5;
EffectType type = EffectType::Blur;
int channel = ColorChannel::Green;
ChannelSplitMode splitMode = ChannelSplitMode::Exclude;
ChannelSplitDirection direction = ChannelSplitDirection::Top;
};
LDA_END_NAMESPACE
/**
* @brief Image alpha gradient on the image
* @param input
* @param edge
* @return As a magic transformed image
*/
QImage transformAlpha(QImage input, Qt::Edge edge);
/**
* @brief Split channels with the settings choosen.
* @param src
* @param channel
* @param mode
* @param direction
* @param padding
* @return Image with applyed settings
*/
QImage splitChannel(QImage src, int channel = Dtk::Addons::VisualEffect::ColorChannel::Red, Dtk::Addons::VisualEffect::ChannelSplitMode mode = Dtk::Addons::VisualEffect::ChannelSplitMode::Exclude, Dtk::Addons::VisualEffect::ChannelSplitDirection direction = Dtk::Addons::VisualEffect::ChannelSplitDirection::Left, int padding = 5);
/**
* @brief Apply the QGraphicsEffect you want
* @param src
* @param effect
* @param extent
* @return Image with applyed effects
*/
QImage applyEffectToImage(QImage src, QGraphicsEffect *effect, int extent = 0);
/**
* @brief GS Image binding
* @param src
* @return Image in gray scale without alpha (255)
*/
QImage bindToGS(QImage src);
/**
* @brief GSA Image binding
* @param src
* @return Image in gray scale with alpha (source dependent)
*/
QImage bindToGSA(QImage src);
/**
* @brief Image blur then channel split: channel blending!
* @param src
* @param channel
* @param mode
* @param radius
* @return Image with applyed settings for channels options
*/
QImage blendChannel(QImage src, int channel = Dtk::Addons::VisualEffect::ColorChannel::Red, Dtk::Addons::VisualEffect::ChannelSplitMode mode = Dtk::Addons::VisualEffect::ChannelSplitMode::Exclude, int radius = 5);
#endif // GRAPHICTOOLS_H