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
|
/*
* This file is part of the KDE project
*
* Copyright (c) Michael Thaler <[email protected]>
*
* 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 Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_DROPSHADOW_H_
#define _KIS_DROPSHADOW_H_
#include <kis_progress_subject.h>
#include <kis_paint_device.h>
typedef enum
{
BLUR_IIR,
BLUR_RLE
} BlurMethod;
class TQColor;
class KisView;
class KisProgressDisplayInterface;
class KisDropshadow : public KisProgressSubject {
Q_OBJECT
TQ_OBJECT
public:
KisDropshadow(KisView * view);
virtual ~KisDropshadow() {};
void dropshadow(KisProgressDisplayInterface * progress, TQ_INT32 xoffset, TQ_INT32 yoffset, TQ_INT32 blurradius, TQColor color, TQ_UINT8 opacity, bool allowResize);
public: // Implement KisProgressSubject
virtual void cancel() { m_cancelRequested = true; }
private:
void gaussianblur (KisPaintDeviceSP src, KisPaintDeviceSP dst,
TQRect& rect, double horz, double vert,
BlurMethod method,
KisProgressDisplayInterface * progressDisplay);
//gaussian blur helper functions
void find_constants(double n_p[], double n_m[], double d_p[], double d_m[], double bd_p[], double bd_m[], double std_dev);
void transfer_pixels(double *src1, double *src2, TQ_UINT8 *dest, TQ_INT32 bytes, TQ_INT32 width);
TQ_INT32* make_curve(double sigma, TQ_INT32 *length);
void run_length_encode (TQ_UINT8 *src, TQ_INT32 *dest, TQ_INT32 bytes, TQ_INT32 width);
void multiply_alpha (TQ_UINT8 *buf, TQ_INT32 width, TQ_INT32 bytes);
void separate_alpha (TQ_UINT8 *buf, TQ_INT32 width, TQ_INT32 bytes);
private:
KisView * m_view;
bool m_cancelRequested;
};
#endif
|