1 /* ============================================================
2  *
3  * This file is a part of digiKam project
4  * https://www.digikam.org
5  *
6  * Date        : 2005-24-01
7  * Description : pixels antialiasing filter
8  *
9  * Copyright (C) 2005-2021 by Gilles Caulier <caulier dot gilles at gmail dot com>
10  *
11  * This program is free software; you can redistribute it
12  * and/or modify it under the terms of the GNU General
13  * Public License as published by the Free Software Foundation;
14  * either version 2, or (at your option)
15  * any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20  * GNU General Public License for more details.
21  *
22  * ============================================================ */
23 
24 #ifndef DIGIKAM_DPIXELS_ALIAS_FILTER_H
25 #define DIGIKAM_DPIXELS_ALIAS_FILTER_H
26 
27 // C++ includes
28 
29 #include <cmath>
30 
31 // Local includes
32 
33 #include "digikam_export.h"
34 #include "digikam_globals.h"
35 #include "dimgthreadedfilter.h"
36 
37 namespace Digikam
38 {
39 
40 class DIGIKAM_EXPORT DPixelsAliasFilter
41 {
42 public:
43 
44     explicit DPixelsAliasFilter();
45     ~DPixelsAliasFilter();
46 
47 public:   // Public methods.
48 
49     void pixelAntiAliasing(uchar* const data,
50                            int Width,
51                            int Height,
52                            double X,
53                            double Y,
54                            uchar* const A,
55                            uchar* const R,
56                            uchar* const G,
57                            uchar* const B);
58 
59     void pixelAntiAliasing16(unsigned short* const data,
60                              int Width,
61                              int Height,
62                              double X,
63                              double Y,
64                              unsigned short* const A,
65                              unsigned short* const R,
66                              unsigned short* const G,
67                              unsigned short* const B);
68 
69 private:
70 
71     inline int setPositionAdjusted(int Width,
72                                    int Height,
73                                    int X,
74                                    int Y);
75 };
76 
77 } // namespace Digikam
78 
79 #endif // DIGIKAM_DPIXELS_ALIAS_FILTER_H
80