digiKam
Loading...
Searching...
No Matches
hotpixelfixer.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-03-27
7 * Description : Threaded image filter to fix hot pixels
8 *
9 * SPDX-FileCopyrightText: 2005-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
10 * SPDX-FileCopyrightText: 2005-2006 by Unai Garro <ugarro at users dot sourceforge dot net>
11 *
12 * SPDX-License-Identifier: GPL-2.0-or-later
13 *
14 * ============================================================ */
15
16#pragma once
17
18// Qt includes
19
20#include <QList>
21#include <QImage>
22#include <QObject>
23#include <QRect>
24#include <QString>
25
26// Local includes
27
28#include "digikam_export.h"
29#include "dimgthreadedfilter.h"
30#include "hotpixelprops.h"
31#include "hotpixelsweights.h"
32#include "hotpixelcontainer.h"
33
34using namespace Digikam;
35
36namespace Digikam
37{
38
39class DIGIKAM_EXPORT HotPixelFixer : public DImgThreadedFilter
40{
41 Q_OBJECT
42
43public:
44
45 explicit HotPixelFixer(QObject* const parent = nullptr);
46 explicit HotPixelFixer(DImg* const orgImage,
47 QObject* const parent,
48 const HotPixelContainer& settings);
49 ~HotPixelFixer() override;
50
51 static QString FilterIdentifier()
52 {
53 return QLatin1String("digikam:HotPixelFilter");
54 }
55
56 static QString DisplayableName();
57
58 static QList<int> SupportedVersions()
59 {
60 return QList<int>() << 1;
61 }
62
63 static int CurrentVersion()
64 {
65 return 1;
66 }
67
68 void readParameters(const FilterAction& action) override;
69
70 QString filterIdentifier() const override
71 {
72 return FilterIdentifier();
73 }
74
75 Digikam::FilterAction filterAction() override;
76
77private:
78
79 void filterImage() override;
80
81 void interpolate(DImg& img,
82 const HotPixelProps& hp,
83 int method);
84
85 void weightPixels(DImg& img,
86 const HotPixelProps& px,
87 int method,
89 int maxComponent);
90
91 inline bool validPoint(const DImg& img, const QPoint& p)
92 {
93 return (
94 (p.x() >= 0) &&
95 (p.y() >= 0) &&
96 (p.x() < (long) img.width()) &&
97 (p.y() < (long) img.height())
98 );
99 };
100
101
102private:
103
104 QList<HotPixelsWeights> m_weightList;
105
106 HotPixelContainer m_settings;
107};
108
109} // namespace Digikam
Definition dimgthreadedfilter.h:31
Definition dimg.h:52
unsigned int height
Definition dimg_p.h:135
unsigned int width
Definition dimg_p.h:134
Definition filteraction.h:33
Definition hotpixelcontainer.h:34
Direction
Definition hotpixelcontainer.h:47
Definition hotpixelfixer.h:40
static int CurrentVersion()
Definition hotpixelfixer.h:63
QString filterIdentifier() const override
Definition hotpixelfixer.h:70
static QList< int > SupportedVersions()
Definition hotpixelfixer.h:58
static QString FilterIdentifier()
Definition hotpixelfixer.h:51
Definition hotpixelprops.h:31
Definition datefolderview.cpp:34