Krita

Filter.h
1 /*
2  * SPDX-FileCopyrightText: 2016 Boudewijn Rempt <[email protected]>
3  *
4  * SPDX-License-Identifier: LGPL-2.0-or-later
5  */
6 #ifndef LIBKIS_FILTER_H
7 #define LIBKIS_FILTER_H
8 
9 #include <QObject>
10 
11 #include "kritalibkis_export.h"
12 #include "libkis.h"
13 #include <kis_filter_configuration.h>
14 
15 /**
16  * Filter: represents a filter and its configuration. A filter is identified by
17  * an internal name. The configuration for each filter is defined as an InfoObject:
18  * a map of name and value pairs.
19  *
20  * Currently available filters are:
21  *
22  * 'autocontrast', 'blur', 'bottom edge detections', 'brightnesscontrast', 'burn', 'colorbalance', 'colortoalpha', 'colortransfer',
23  * 'desaturate', 'dodge', 'emboss', 'emboss all directions', 'emboss horizontal and vertical', 'emboss horizontal only',
24  * 'emboss laplascian', 'emboss vertical only', 'gaussian blur', 'gaussiannoisereducer', 'gradientmap', 'halftone', 'hsvadjustment',
25  * 'indexcolors', 'invert', 'left edge detections', 'lens blur', 'levels', 'maximize', 'mean removal', 'minimize', 'motion blur',
26  * 'noise', 'normalize', 'oilpaint', 'perchannel', 'phongbumpmap', 'pixelize', 'posterize', 'raindrops', 'randompick',
27  * 'right edge detections', 'roundcorners', 'sharpen', 'smalltiles', 'sobel', 'threshold', 'top edge detections', 'unsharp',
28  * 'wave', 'waveletnoisereducer']
29  */
30 class KRITALIBKIS_EXPORT Filter : public QObject
31 {
32  Q_OBJECT
34 
35 public:
36  /**
37  * @brief Filter: create an empty filter object. Until a name is set, the filter cannot
38  * be applied.
39  */
40  explicit Filter();
41  ~Filter() override;
42 
43  bool operator==(const Filter &other) const;
44  bool operator!=(const Filter &other) const;
45 
46 public Q_SLOTS:
47 
48  /**
49  * @brief name the internal name of this filter.
50  * @return the name.
51  */
52  QString name() const;
53 
54  /**
55  * @brief setName set the filter's name to the given name.
56  */
57  void setName(const QString &name);
58 
59  /**
60  * @return the configuration object for the filter
61  */
62  InfoObject* configuration() const;
63 
64  /**
65  * @brief setConfiguration set the configuration object for the filter
66  */
67  void setConfiguration(InfoObject* value);
68 
69  /**
70  * @brief Apply the filter to the given node.
71  * @param node the node to apply the filter to
72  * @param x
73  * @param y
74  * @param w
75  * @param h describe the rectangle the filter should be apply.
76  * This is always in image pixel coordinates and not relative to the x, y
77  * of the node.
78  * @return @c true if the filter was applied successfully, or
79  * @c false if the filter could not be applied because the node is locked or
80  * does not have an editable paint device.
81  */
82  bool apply(Node *node, int x, int y, int w, int h);
83 
84  /**
85  * @brief startFilter starts the given filter on the given node.
86  *
87  * @param node the node to apply the filter to
88  * @param x
89  * @param y
90  * @param w
91  * @param h describe the rectangle the filter should be apply.
92  * This is always in image pixel coordinates and not relative to the x, y
93  * of the node.
94  */
95  bool startFilter(Node *node, int x, int y, int w, int h);
96 
97 private:
98  friend class FilterLayer;
99  friend class FilterMask;
100 
101  struct Private;
102  Private *const d;
103 
104  KisFilterConfigurationSP filterConfig();
105 
106 };
107 
108 #endif // LIBKIS_FILTER_H
InfoObject wrap a properties map.
Definition: InfoObject.h:19
Q_SLOTSQ_SLOTS
bool operator==(const Qt3DRender::QGraphicsApiFilter &reference, const Qt3DRender::QGraphicsApiFilter &sample)
Filter: represents a filter and its configuration.
Definition: Filter.h:30
bool operator!=(const Qt3DRender::QGraphicsApiFilter &reference, const Qt3DRender::QGraphicsApiFilter &sample)
Node represents a layer or mask in a Krita image's Node hierarchy.
Definition: Node.h:21
QString name(StandardShortcut id)
KGuiItem apply()
The FilterMask class A filter mask, unlike a filter layer, will add a non-destructive filter to the c...
Definition: FilterMask.h:28
Q_DISABLE_COPY(Class)
The FilterLayer class A filter layer will, when compositing, take the composited image up to the poin...
Definition: FilterLayer.h:33
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Thu Oct 6 2022 04:17:36 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.