16#include <QApplication>
24#include <klocalizedstring.h>
56 setObjectName(
"tool_gradient");
130 if (event->
modifiers() == Qt::ShiftModifier) {
184 repeat, antiAliasThreshold,
187 dither, ditherSteps);
202 if (fabs(comparison.x()) > fabs(comparison.y())) {
203 result.setX(point.x());
207 result.setY(point.y());
220 path.moveTo(viewStartPos);
221 path.lineTo(viewStartEnd);
238 widget->setObjectName(
toolId() +
" option widget");
243 m_lbShape =
new QLabel(i18n(
"Shape:"), widget);
246 m_cmbShape->addItem(i18nc(
"the gradient will be drawn linearly",
"Linear"));
247 m_cmbShape->addItem(i18nc(
"the gradient will be drawn bilinearly",
"Bi-Linear"));
248 m_cmbShape->addItem(i18nc(
"the gradient will be drawn radially",
"Radial"));
249 m_cmbShape->addItem(i18nc(
"the gradient will be drawn in a square around a centre",
"Square"));
250 m_cmbShape->addItem(i18nc(
"the gradient will be drawn as an asymmetric cone",
"Conical"));
251 m_cmbShape->addItem(i18nc(
"the gradient will be drawn as a symmetric cone",
"Conical Symmetric"));
252 m_cmbShape->addItem(i18nc(
"the gradient will be drawn as a spiral",
"Spiral"));
253 m_cmbShape->addItem(i18nc(
"the gradient will be drawn as a reverse spiral",
"Reverse Spiral"));
254 m_cmbShape->addItem(i18nc(
"the gradient will be drawn in a selection outline",
"Shaped"));
258 m_lbRepeat =
new QLabel(i18n(
"Repeat:"), widget);
261 m_cmbRepeat->addItem(i18nc(
"The gradient will not repeat",
"None"));
262 m_cmbRepeat->addItem(i18nc(
"The gradient will repeat forwards",
"Forwards"));
263 m_cmbRepeat->addItem(i18nc(
"The gradient will repeat alternatingly",
"Alternating"));
267 m_lbDither =
new QLabel(i18n(
"Dither:"), widget);
270 m_cmbDither->addItem(i18nc(
"The gradient will not be dithered",
"None"));
271 m_cmbDither->addItem(i18nc(
"The gradient will be dithered with Blue Noise",
"Blue Noise"));
272 m_cmbDither->addItem(i18nc(
"The gradient will be dithered with Bayer Matrix 2x2",
"Bayer Matrix 2x2"));
273 m_cmbDither->addItem(i18nc(
"The gradient will be dithered with Bayer Matrix 4x4",
"Bayer Matrix 4x4"));
274 m_cmbDither->addItem(i18nc(
"The gradient will be dithered with Bayer Matrix 8x8",
"Bayer Matrix 8x8"));
293 m_ckReverse =
new QCheckBox(i18nc(
"the gradient will be drawn with the color order reversed",
"Reverse"), widget);
float value(const T *src, size_t ch)
void updateCanvas(const QRectF &rc) override
KisViewManager * viewManager() const
static QCursor loadWithSize(const QString &cursorName, int width, int height, int hotspotX=-1, int hotspotY=-1)
virtual QRect bounds() const =0
This class is a spinbox in which you can click and drag to set the value. A slider like bar is displa...
void setValue(qreal newValue)
void setRange(qreal newMinimum, qreal newMaximum, int newNumberOfDecimals=0, bool computeNewFastSliderStep=true)
Set the minimum and the maximum values of the range.
The KisIntParseSpinBox class is a cleverer SpinBox, able to parse arithmetic expressions.
void setValue(int value, bool overwriteExpression=false)
Set the value of the spinbox.
KisDefaultBoundsBaseSP defaultBounds() const
KUndo2Command * endAndTakeTransaction()
void beginTransaction(const KUndo2MagicString &transactionName=KUndo2MagicString(), int timedID=-1)
Begin an undoable paint operation.
void setProgress(KoUpdater *progressUpdater)
void applyCommand(KUndo2Command *command, KisStrokeJobData::Sequentiality sequentiality=KisStrokeJobData::SEQUENTIAL, KisStrokeJobData::Exclusivity exclusivity=KisStrokeJobData::NORMAL)
KoUpdater * updater() const
The KisResourcesSnapshot class takes a snapshot of the various resources like colors and settings use...
void setupPainter(KisPainter *painter)
KisNodeSP currentNode() const
KisSelectionSP activeSelection() const
KisCanvasResourceProvider * canvasResourceProvider()
Qt::KeyboardModifiers modifiers() const
KUndo2MagicString kundo2_i18n(const char *text)
virtual KisPaintDeviceSP paintDevice() const =0
The LambdaCommand struct is a shorthand for creation of AggregateCommand commands using C++ lambda fe...
void setGradientShape(enumGradientShape shape)
static bool isBayerDither(enumDither dither)
static constexpr int defaultDitherSteps
bool paintGradient(const QPointF &gradientVectorStart, const QPointF &gradientVectorEnd, enumGradientRepeat repeat, double antiAliasThreshold, bool reverseGradient, qint32 startx, qint32 starty, qint32 width, qint32 height, enumDither dither=DitherNone, int ditherSteps=defaultDitherSteps)