File indexing completed on 2024-05-12 15:58:28

0001 /*
0002  *  SPDX-FileCopyrightText: 2008 Cyrille Berger <cberger@cberger.net>
0003  *
0004  *  SPDX-License-Identifier: GPL-2.0-or-later
0005  */
0006 
0007 #ifndef _KIS_NODE_FILTER_INTERFACE_H_
0008 #define _KIS_NODE_FILTER_INTERFACE_H_
0009 
0010 #include <kritaimage_export.h>
0011 #include <kis_types.h>
0012 
0013 /**
0014  * Define an interface for nodes that are associated with a filter.
0015  */
0016 class KRITAIMAGE_EXPORT KisNodeFilterInterface
0017 {
0018 public:
0019     KisNodeFilterInterface(KisFilterConfigurationSP filterConfig);
0020     KisNodeFilterInterface(const KisNodeFilterInterface &rhs);
0021     virtual ~KisNodeFilterInterface();
0022 
0023     /**
0024      * @return safe shared pointer to the filter configuration
0025      *         associated with this node
0026      */
0027     virtual KisFilterConfigurationSP filter() const;
0028 
0029     /**
0030      * Sets the filter configuration for this node. The filter might
0031      * differ from the filter that is currently set up on this node.
0032      *
0033      * WARNING: the filterConfig becomes *owned* by the node right
0034      * after you've set it. Don't try to access the configuration
0035      * after you've associated it with the node.
0036      *
0037      * @param filterConfig the new configruation object
0038      * @param checkCompareConfig if true, the update code will check whether the config is
0039      * the same as the old config, and if so, do nothing. If false, the filter node will be
0040      * updated always.
0041      */
0042     virtual void setFilter(KisFilterConfigurationSP filterConfig, bool checkCompareConfig = true);
0043 
0044     virtual void notifyColorSpaceChanged();
0045 
0046 // the child classes should access the filter with the filter() method
0047 private:
0048     KisNodeFilterInterface& operator=(const KisNodeFilterInterface &other);
0049 
0050     KisFilterConfigurationSP m_filterConfiguration;
0051 };
0052 
0053 #endif