File indexing completed on 2024-12-22 04:13:04

0001 /*
0002  * This file is part of the KDE project
0003  *
0004  * SPDX-FileCopyrightText: 2019 Carl Olsson <carl.olsson@gmail.com>
0005  *
0006  *  SPDX-License-Identifier: GPL-2.0-or-later
0007  */
0008 
0009 #ifndef KIS_DITHER_UTIL_H
0010 #define KIS_DITHER_UTIL_H
0011 
0012 #include <kritaui_export.h>
0013 
0014 #include <kis_types.h>
0015 
0016 #include <KoPattern.h>
0017 
0018 class KisPropertiesConfiguration;
0019 
0020 class KRITAUI_EXPORT KisDitherUtil
0021 {
0022 public:
0023     enum ThresholdMode {
0024         Pattern,
0025         Noise
0026     };
0027     enum PatternValueMode {
0028         Auto,
0029         Lightness,
0030         Alpha
0031     };
0032 
0033     KisDitherUtil();
0034     void setConfiguration(const KisFilterConfiguration &config, const QString &prefix = "");
0035     qreal threshold(const QPoint &pos);
0036 
0037 private:
0038 
0039     void setThresholdMode(const ThresholdMode thresholdMode);
0040     void setPattern(const QString &md5sum, const QString &patternName, const PatternValueMode valueMode, KisResourcesInterfaceSP resourcesInterface);
0041     void setNoiseSeed(const quint64 &noiseSeed);
0042     void setSpread(const qreal &spread);
0043 
0044 
0045 private:
0046     ThresholdMode m_thresholdMode;
0047     PatternValueMode m_patternValueMode;
0048     KoPatternSP m_pattern;
0049     quint64 m_noiseSeed;
0050     bool m_patternUseAlpha;
0051     qreal m_spread;
0052 };
0053 
0054 #endif