template<typename _channel_type_, typename traits>
class KisDesaturateAdjustment< _channel_type_, traits >
Definition at line 25 of file kis_desaturate_adjustment.cpp.
template<typename _channel_type_ , typename traits >
This function apply the transformation on a given number of pixels.
- Parameters
-
| src | a pointer to the source pixels |
| dst | a pointer to the destination pixels |
| nPixels | the number of pixels |
This function may or may not be thread safe. You need to create one KoColorTransformation per thread.
Implements KoColorTransformation.
Definition at line 37 of file kis_desaturate_adjustment.cpp.
38 {
42 while (nPixels > 0) {
43
47
48
50 case 0:
51 {
52 gray = (qMax(qMax(r, g), b) + qMin(qMin(r, g), b)) / 2;
53 break;
54 }
55 case 1:
56 {
57 gray =
r * 0.2126 + g * 0.7152 +
b * 0.0722;
58 break;
59
60 }
61
62 case 2:
63 {
64 gray =
r * 0.299 + g * 0.587 +
b * 0.114;
65 break;
66
67 }
68 case 3:
69 {
70 gray = (
r + g +
b) / 3;
71 break;
72 }
73 case 4:
74 {
75 gray = qMin(qMin(r, g), b);
76 break;
77 }
78 case 5:
79 {
80 gray = qMax(qMax(r, g), b);
81 break;
82 }
83
84 default:
85 gray = 0;
86 }
90 dst->alpha =
src->alpha;
91
92 --nPixels;
94 ++dst;
95 }
96 }
#define SCALE_FROM_FLOAT(v)
#define SCALE_TO_FLOAT(v)
References KisDesaturateAdjustment< _channel_type_, traits >::m_type, SCALE_FROM_FLOAT, and SCALE_TO_FLOAT.