digiKam
dimgbuiltinfilter.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 : 2010-11-10
7  * Description : basic filter management for DImg builtin methods
8  *
9  * Copyright (C) 2010-2011 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
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_DIMG_BUILT_IN_FILTERS_H
26 #define DIGIKAM_DIMG_BUILT_IN_FILTERS_H
27 
28 // Qt includes
29 
30 #include <QVariant>
31 
32 // Local includes
33 
34 #include "digikam_export.h"
35 
36 namespace Digikam
37 {
38 
39 class DImg;
40 class DImgThreadedFilter;
41 class FilterAction;
42 
43 class DIGIKAM_EXPORT DImgBuiltinFilter
44 {
45 public:
46 
47  enum Type
48  {
55  Crop,
58  ConvertTo16Bit
59  };
60 
61 public:
62 
67 
72  explicit DImgBuiltinFilter(const FilterAction& action);
73 
78  explicit DImgBuiltinFilter(Type type, const QVariant& arg = QVariant());
79 
83  void setAction(const FilterAction& action);
84  void setAction(Type type, const QVariant& arg = QVariant());
85 
90  DImgBuiltinFilter reverseFilter() const;
91  bool isReversible() const;
92 
96  bool isValid() const;
97 
101  void apply(DImg& image) const;
102 
111  FilterAction filterAction() const;
112 
116  QString displayableName() const;
117  QString i18nDisplayableName() const;
118  QString filterIcon() const;
119 
123  DImgThreadedFilter* createThreadedFilter(QObject* const parent = nullptr) const;
124  DImgThreadedFilter* createThreadedFilter(DImg* const orgImage, QObject* const parent = nullptr) const;
125 
126 public:
127 
128  static QString i18nDisplayableName(const QString& filterIdentifier);
129  static QString filterIcon(const QString& filterIdentifier);
130 
131  static QStringList supportedFilters();
132 
136  static QList<int> supportedVersions(const QString& filterIdentifier);
137 
141  static bool isSupported(const QString& filterIdentifier);
142  static bool isSupported(const QString& filterIdentifier, int version);
143 
144 protected:
145 
147  QVariant m_arg;
148 };
149 
150 } // namespace Digikam
151 
152 #endif // DIGIKAM_DIMG_BUILT_IN_FILTERS_H
Definition: dimgbuiltinfilter.h:44
QVariant m_arg
Definition: dimgbuiltinfilter.h:147
Type m_type
Definition: dimgbuiltinfilter.h:146
Type
Definition: dimgbuiltinfilter.h:48
@ FlipVertically
Definition: dimgbuiltinfilter.h:54
@ Resize
Argument: QSize.
Definition: dimgbuiltinfilter.h:56
@ Rotate90
Definition: dimgbuiltinfilter.h:50
@ Rotate270
Definition: dimgbuiltinfilter.h:52
@ NoOperation
Definition: dimgbuiltinfilter.h:49
@ FlipHorizontally
Definition: dimgbuiltinfilter.h:53
@ ConvertTo8Bit
Definition: dimgbuiltinfilter.h:57
@ Crop
Argument: QRect.
Definition: dimgbuiltinfilter.h:55
@ Rotate180
Definition: dimgbuiltinfilter.h:51
Definition: dimgthreadedfilter.h:41
Definition: dimg.h:62
Definition: filteraction.h:43
Definition: datefolderview.cpp:43
Type
Definition: gpsitemcontainer.h:45