digiKam
Loading...
Searching...
No Matches
shearfilter.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-07-18
7 * Description : Shear tool threaded image filter.
8 *
9 * SPDX-FileCopyrightText: 2005-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
10 * SPDX-FileCopyrightText: 2010 by Martin Klapetek <martin dot klapetek at gmail dot com>
11 *
12 * SPDX-License-Identifier: GPL-2.0-or-later
13 *
14 * ============================================================ */
15
16#pragma once
17
18// Qt includes
19
20#include <QSize>
21#include <QColor>
22
23// Local includes
24
25#include "digikam_export.h"
26#include "dimgthreadedfilter.h"
27#include "digikam_globals.h"
28
29namespace Digikam
30{
31
32class DIGIKAM_EXPORT ShearFilter : public DImgThreadedFilter
33{
34 Q_OBJECT
35
36public:
37
38 explicit ShearFilter(QObject* const parent = nullptr);
39 explicit ShearFilter(DImg* const orgImage, QObject* const parent = nullptr, float hAngle = 0.0, float vAngle = 0.0,
40 bool antialiasing = true, const QColor& backgroundColor = Qt::black, int orgW = 0, int orgH = 0);
41 ~ShearFilter() override;
42
43 QSize getNewSize() const;
44
45 static QString FilterIdentifier()
46 {
47 return QLatin1String("digikam:ShearFilter");
48 }
49
50 static QString DisplayableName();
51
52 static QList<int> SupportedVersions()
53 {
54 return QList<int>() << 1;
55 }
56
57 static int CurrentVersion()
58 {
59 return 1;
60 }
61
62 QString filterIdentifier() const override
63 {
64 return FilterIdentifier();
65 }
66
67 FilterAction filterAction() override;
68 void readParameters(const FilterAction& action) override;
69
70private:
71
72 void filterImage() override;
73
74 inline int setPosition (int Width, int X, int Y)
75 {
76 return (Y*Width*4 + 4*X);
77 };
78
79 inline bool isInside (int Width, int Height, int X, int Y)
80 {
81 bool bIsWOk = ((X < 0) ? false : (X >= Width ) ? false : true);
82 bool bIsHOk = ((Y < 0) ? false : (Y >= Height) ? false : true);
83
84 return (bIsWOk && bIsHOk);
85 };
86
87private:
88
89 class Private;
90 Private* const d = nullptr;
91};
92
93} // namespace Digikam
Definition dimgthreadedfilter.h:31
Definition dimg.h:52
Definition filteraction.h:33
Definition shearfilter.h:33
QString filterIdentifier() const override
Definition shearfilter.h:62
static QString FilterIdentifier()
Definition shearfilter.h:45
static int CurrentVersion()
Definition shearfilter.h:57
static QList< int > SupportedVersions()
Definition shearfilter.h:52
#define X
Definition datefolderview.cpp:34