16#include <QApplication>
24#include <klocalizedstring.h>
56 setObjectName(
"tool_gradient");
129 if (event->
modifiers() == Qt::ShiftModifier) {
174 [resources, startPos, endPos,
175 shape, repeat, reverse, antiAliasThreshold, dither] ()
mutable {
190 repeat, antiAliasThreshold,
208 if (fabs(comparison.x()) > fabs(comparison.y())) {
209 result.setX(point.x());
213 result.setY(point.y());
226 path.moveTo(viewStartPos);
227 path.lineTo(viewStartEnd);
244 widget->setObjectName(
toolId() +
" option widget");
249 m_lbShape =
new QLabel(i18n(
"Shape:"), widget);
252 m_cmbShape->addItem(i18nc(
"the gradient will be drawn linearly",
"Linear"));
253 m_cmbShape->addItem(i18nc(
"the gradient will be drawn bilinearly",
"Bi-Linear"));
254 m_cmbShape->addItem(i18nc(
"the gradient will be drawn radially",
"Radial"));
255 m_cmbShape->addItem(i18nc(
"the gradient will be drawn in a square around a centre",
"Square"));
256 m_cmbShape->addItem(i18nc(
"the gradient will be drawn as an asymmetric cone",
"Conical"));
257 m_cmbShape->addItem(i18nc(
"the gradient will be drawn as a symmetric cone",
"Conical Symmetric"));
258 m_cmbShape->addItem(i18nc(
"the gradient will be drawn as a spiral",
"Spiral"));
259 m_cmbShape->addItem(i18nc(
"the gradient will be drawn as a reverse spiral",
"Reverse Spiral"));
260 m_cmbShape->addItem(i18nc(
"the gradient will be drawn in a selection outline",
"Shaped"));
264 m_lbRepeat =
new QLabel(i18n(
"Repeat:"), widget);
267 m_cmbRepeat->addItem(i18nc(
"The gradient will not repeat",
"None"));
268 m_cmbRepeat->addItem(i18nc(
"The gradient will repeat forwards",
"Forwards"));
269 m_cmbRepeat->addItem(i18nc(
"The gradient will repeat alternatingly",
"Alternating"));
282 m_ckReverse =
new QCheckBox(i18nc(
"the gradient will be drawn with the color order reversed",
"Reverse"), widget);
287 m_ckDither =
new QCheckBox(i18nc(
"the gradient will be dithered",
"Dither"), widget);
292 widget->setFixedHeight(widget->sizeHint().height());
float value(const T *src, size_t ch)
connect(this, SIGNAL(optionsChanged()), this, SLOT(saveOptions()))
void updateCanvas(const QRectF &rc) override
KisViewManager * viewManager() const
static QCursor load(const QString &cursorName, 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.
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...
bool paintGradient(const QPointF &gradientVectorStart, const QPointF &gradientVectorEnd, enumGradientRepeat repeat, double antiAliasThreshold, bool reverseGradient, qint32 startx, qint32 starty, qint32 width, qint32 height, bool useDithering=false)
void setGradientShape(enumGradientShape shape)