digiKam
charcoalfilter.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 : Charcoal threaded image filter.
8  *
9  * Copyright (C) 2005-2022 by Gilles Caulier <caulier dot gilles at gmail dot com>
10  * Copyright (C) 2010 by Martin Klapetek <martin dot klapetek at gmail dot com>
11  *
12  * This program is free software; you can redistribute it
13  * and/or modify it under the terms of the GNU General
14  * Public License as published by the Free Software Foundation;
15  * either version 2, or (at your option)
16  * any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * ============================================================ */
24 
25 #ifndef DIGIKAM_CHARCOAL_FILTER_H
26 #define DIGIKAM_CHARCOAL_FILTER_H
27 
28 // Local includes
29 
30 #include "digikam_export.h"
31 #include "dimgthreadedfilter.h"
32 #include "digikam_globals.h"
33 
34 namespace Digikam
35 {
36 
37 class DIGIKAM_EXPORT CharcoalFilter : public DImgThreadedFilter
38 {
39  Q_OBJECT
40 
41 public:
42 
43  explicit CharcoalFilter(QObject* const parent = nullptr);
44  explicit CharcoalFilter(DImg* const orgImage,
45  QObject* const parent = nullptr,
46  double pencil = 5.0,
47  double smooth = 10.0);
48  ~CharcoalFilter() override;
49 
50  static QString FilterIdentifier()
51  {
52  return QLatin1String("digikam:CharcoalFilter");
53  }
54 
55  static QString DisplayableName();
56 
58  {
59  return QList<int>() << 1;
60  }
61 
62  static int CurrentVersion()
63  {
64  return 1;
65  }
66 
67  QString filterIdentifier() const override
68  {
69  return FilterIdentifier();
70  }
71 
72  FilterAction filterAction() override;
73  void readParameters(const FilterAction& action) override;
74 
75 private:
76 
77  void filterImage() override;
78  bool convolveImage(const unsigned int order, const double* kernel);
79  int getOptimalKernelWidth(double radius, double sigma);
80  void convolveImageMultithreaded(uint start,
81  uint stop,
82  double* normal_kernel,
83  double kernelWidth);
84 
85 private:
86 
87  class Private;
88  Private* const d;
89 };
90 
91 } // namespace Digikam
92 
93 #endif // DIGIKAM_CHARCOAL_FILTER_H
Definition: charcoalfilter.h:38
static QString FilterIdentifier()
Definition: charcoalfilter.h:50
QString filterIdentifier() const override
Definition: charcoalfilter.h:67
static QList< int > SupportedVersions()
Definition: charcoalfilter.h:57
static int CurrentVersion()
Definition: charcoalfilter.h:62
Definition: dimgthreadedfilter.h:41
Definition: dimg.h:62
Definition: filteraction.h:43
Definition: datefolderview.cpp:43