Krita Source Code Documentation
Loading...
Searching...
No Matches
kis_gradient_painter.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2004 Adrian Page <adrian@pagenet.plus.com>
3 * SPDX-FileCopyrightText: 2021 L. E. Segovia <amy@amyspark.me>
4 *
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 */
7#ifndef KIS_GRADIENT_PAINTER_H_
8#define KIS_GRADIENT_PAINTER_H_
9
10#include <QScopedPointer>
11
12#include <KoColor.h>
13
14#include "kis_types.h"
15#include "kis_painter.h"
16
17#include <kritaimage_export.h>
18
19
23class KRITAIMAGE_EXPORT KisGradientPainter : public KisPainter
24{
25
26public:
27
31
32 ~KisGradientPainter() override;
33
45
51
59
60 static constexpr int defaultDitherSteps = 2;
61
62 void setGradientShape(enumGradientShape shape);
63
64 void precalculateShape();
65
69 bool paintGradient(const QPointF& gradientVectorStart,
70 const QPointF& gradientVectorEnd,
71 enumGradientRepeat repeat,
72 double antiAliasThreshold,
73 bool reverseGradient,
74 qint32 startx,
75 qint32 starty,
76 qint32 width,
77 qint32 height,
78 enumDither dither = DitherNone,
79 int ditherSteps = defaultDitherSteps);
80
81 // convenience overload
82 bool paintGradient(const QPointF& gradientVectorStart,
83 const QPointF& gradientVectorEnd,
84 enumGradientRepeat repeat,
85 double antiAliasThreshold,
86 bool reverseGradient,
87 const QRect &applyRect,
88 enumDither dither = DitherNone,
89 int ditherSteps = defaultDitherSteps);
90
91 template <class T>
92 bool paintGradient(const QPointF& gradientVectorStart,
93 const QPointF& gradientVectorEnd,
94 enumGradientRepeat repeat,
95 double antiAliasThreshold,
96 bool reverseGradient,
97 enumDither dither,
98 int ditherSteps,
99 const QRect &applyRect,
100 T & paintPolicy);
101
102 static bool isBayerDither(enumDither dither);
103
104private:
105 struct Private;
106 const QScopedPointer<Private> m_d;
107};
108#endif //KIS_GRADIENT_PAINTER_H_
const QScopedPointer< Private > m_d