digiKam
oilpaintfilter.h
Go to the documentation of this file.
1 /* ============================================================
2  *
3  * This file is a part of digiKam project
4  * https://www.digikam.org
5  *
6  * Date : 2005-05-25
7  * Description : Oil Painting threaded image filter.
8  *
9  * Copyright (C) 2005-2022 by Gilles Caulier <caulier dot gilles at gmail dot com>
10  * Copyright (C) 2006-2010 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
11  * Copyright (C) 2010 by Martin Klapetek <martin dot klapetek at gmail dot com>
12  *
13  * This program is free software; you can redistribute it
14  * and/or modify it under the terms of the GNU General
15  * Public License as published by the Free Software Foundation;
16  * either version 2, or (at your option)
17  * any later version.
18  *
19  * This program is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22  * GNU General Public License for more details.
23  *
24  * ============================================================ */
25 
26 #ifndef DIGIKAM_OIL_PAINT_FILTER_H
27 #define DIGIKAM_OIL_PAINT_FILTER_H
28 
29 // Local includes
30 
31 #include "digikam_export.h"
32 #include "dimgthreadedfilter.h"
33 #include "digikam_globals.h"
34 
35 namespace Digikam
36 {
37 
38 class DIGIKAM_EXPORT OilPaintFilter : public DImgThreadedFilter
39 {
40  Q_OBJECT
41 
42 public:
43 
44  explicit OilPaintFilter(QObject* const parent = nullptr);
45  explicit OilPaintFilter(DImg* const orgImage, QObject* const parent = nullptr, int brushSize=1, int smoothness=30);
46  ~OilPaintFilter() override;
47 
48  static QString FilterIdentifier()
49  {
50  return QLatin1String("digikam:OilPaintFilter");
51  }
52 
53  static QString DisplayableName();
54 
56  {
57  return QList<int>() << 1;
58  }
59 
60  static int CurrentVersion()
61  {
62  return 1;
63  }
64 
65  QString filterIdentifier() const override
66  {
67  return FilterIdentifier();
68  }
69 
70  FilterAction filterAction() override;
71  void readParameters(const FilterAction& action) override;
72 
73 private:
74 
75  void filterImage() override;
76  void oilPaintImageMultithreaded(uint start, uint stop);
77  DColor MostFrequentColor(DImg& src, int X, int Y, int Radius, int Intensity,
78  uchar* intensityCount, uint* averageColorR, uint* averageColorG, uint* averageColorB);
79  inline double GetIntensity(uint Red, uint Green, uint Blue);
80 
81 private:
82 
83  class Private;
84  Private* const d;
85 };
86 
87 } // namespace Digikam
88 
89 #endif // DIGIKAM_OIL_PAINT_FILTER_H
Definition: dcolor.h:43
Definition: dimgthreadedfilter.h:41
Definition: dimg.h:62
Definition: filteraction.h:43
Definition: oilpaintfilter.h:39
static QList< int > SupportedVersions()
Definition: oilpaintfilter.h:55
static int CurrentVersion()
Definition: oilpaintfilter.h:60
QString filterIdentifier() const override
Definition: oilpaintfilter.h:65
static QString FilterIdentifier()
Definition: oilpaintfilter.h:48
#define X
Definition: datefolderview.cpp:43