Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.
C++
Add KisHandlePalette to KisHandleStyle, convert for HDR canvas and implement in text tool.
Wolthera van Hövell tot Westerflieree613b10c52d
diff --git a/libs/flake/text/KoSvgTextShapeOutlineHelper.cpp b/libs/flake/text/KoSvgTextShapeOutlineHelper.cppindex 620bce10f5..109b547ac7 100644--- a/libs/flake/text/KoSvgTextShapeOutlineHelper.cpp+++ b/libs/flake/text/KoSvgTextShapeOutlineHelper.cpp@@ -34,6 +34,8 @@ struct KoSvgTextShapeOutlineHelper::Private {bool drawOutline = false;bool textWrappingAreasHovered = false;+ KisHandlePalette handlePalette;+KoSvgTextShape *getTextModeShape() {return dynamic_cast<KoSvgTextShape*>(canvas->currentShapeManagerOwnerShape());}@@ -117,12 +119,11 @@ QList<QLineF> getTextAreaOrderArrows(QList<QPainterPath> areas) {}void KoSvgTextShapeOutlineHelper::paintTextShape(QPainter *painter, const KoViewConverter &converter,- const QPalette &pal, KoSvgTextShape *text,- bool contourModeActive) {+ const QPalette &pal, KoSvgTextShape *text, bool contourModeActive) {painter->save();KisHandlePainterHelper helper =KoShape::createHandlePainterHelperView(painter, text, converter, d->handleRadius, d->decorationThickness);- helper.setHandleStyle(KisHandleStyle::secondarySelection());+ helper.setHandleStyle(KisHandleStyle::secondarySelection(d->handlePalette));if (contourModeActive) {if (d->drawOutline) {@@ -146,7 +147,7 @@ void KoSvgTextShapeOutlineHelper::paintTextShape(QPainter *painter, const KoView}if (d->drawTextWrappingArea) {if (d->textWrappingAreasHovered) {- helper.setHandleStyle(KisHandleStyle::partiallyHighlightedPrimaryHandles());+ helper.setHandleStyle(KisHandleStyle::partiallyHighlightedPrimaryHandles(d->handlePalette));}QList<QPainterPath> areas = text->textWrappingAreas();Q_FOREACH(QLineF arrow, getTextAreaOrderArrows(areas)) {@@ -245,6 +246,11 @@ void KoSvgTextShapeOutlineHelper::setDecorationThickness(int thickness)d->decorationThickness = thickness;}+void KoSvgTextShapeOutlineHelper::setHandlePalette(KisHandlePalette handlePalette)+{+ d->handlePalette = handlePalette;+}+KoSvgTextShape *KoSvgTextShapeOutlineHelper::contourModeButtonHovered(const QPointF &point){KoSvgTextShape *text = d->getTextModeShape();diff --git a/libs/flake/text/KoSvgTextShapeOutlineHelper.h b/libs/flake/text/KoSvgTextShapeOutlineHelper.hindex ca6b8b96c3..603f66a5ee 100644--- a/libs/flake/text/KoSvgTextShapeOutlineHelper.h+++ b/libs/flake/text/KoSvgTextShapeOutlineHelper.h@@ -14,6 +14,7 @@#include <QScopedPointer>#include <kritaflake_export.h>+#include <KisHandleStyle.h>class KoSvgTextShape;/**@@ -62,6 +63,8 @@ public:void setHandleRadius(int radius);void setDecorationThickness(int thickness);+ void setHandlePalette(KisHandlePalette handlePalette);+KoSvgTextShape *contourModeButtonHovered(const QPointF &point);/**diff --git a/libs/global/KisHandleStyle.cpp b/libs/global/KisHandleStyle.cppindex 82177d13d4..b351cbf5b8 100644--- a/libs/global/KisHandleStyle.cpp+++ b/libs/global/KisHandleStyle.cpp@@ -8,12 +8,10 @@#include "kis_painting_tweaks.h"namespace {-void initDashedStyle(const QColor &baseColor, const QColor &handleFill, KisHandleStyle *style) {+void initDashedStyle(const QColor &baseColor, const QColor &handleFill, KisHandleStyle *style, const QColor &white = QColor(Qt::white)) {QPen ants;QPen outline;- KisPaintingTweaks::initAntsPen(&ants, &outline);-- ants.setColor(baseColor);+ KisPaintingTweaks::initAntsPen(&ants, &outline, 4, 4, baseColor, white);style->lineIterations << KisHandleStyle::IterationStyle(outline, Qt::NoBrush);style->lineIterations << KisHandleStyle::IterationStyle(ants, Qt::NoBrush);@@ -26,13 +24,6 @@ void initDashedStyle(const QColor &baseColor, const QColor &handleFill, KisHandlstyle->handleIterations << KisHandleStyle::IterationStyle(handlePen, handleFill);}-static const QColor primaryColor(0, 0, 90, 180);-static const QColor secondaryColor(0, 0, 255, 127);-static const QColor gradientFillColor(255, 197, 39);-static const QColor highlightColor(255, 100, 100);-static const QColor highlightOutlineColor(155, 0, 0);-static const QColor selectionColor(164, 227, 243);-}@@ -49,70 +40,70 @@ KisHandleStyle &KisHandleStyle::inheritStyle()return *style;}-KisHandleStyle &KisHandleStyle::primarySelection()+KisHandleStyle &KisHandleStyle::primarySelection(KisHandlePalette palette){static QScopedPointer<KisHandleStyle> style;if (!style) {style.reset(new KisHandleStyle());- initDashedStyle(primaryColor, Qt::white, style.data());+ initDashedStyle(palette.primaryColor, palette.white, style.data(), palette.white);}return *style;}-KisHandleStyle &KisHandleStyle::secondarySelection()+KisHandleStyle &KisHandleStyle::secondarySelection(KisHandlePalette palette){static QScopedPointer<KisHandleStyle> style;if (!style) {style.reset(new KisHandleStyle());- initDashedStyle(secondaryColor, Qt::white, style.data());+ initDashedStyle(palette.secondaryColor, palette.white, style.data(), palette.white);}return *style;}-KisHandleStyle &KisHandleStyle::gradientHandles()+KisHandleStyle &KisHandleStyle::gradientHandles(KisHandlePalette palette){static QScopedPointer<KisHandleStyle> style;if (!style) {style.reset(new KisHandleStyle());- initDashedStyle(primaryColor, gradientFillColor, style.data());+ initDashedStyle(palette.primaryColor, palette.gradientFillColor, style.data(), palette.white);}return *style;}-KisHandleStyle &KisHandleStyle::gradientArrows()+KisHandleStyle &KisHandleStyle::gradientArrows(KisHandlePalette palette){- return primarySelection();+ return primarySelection(palette);}-KisHandleStyle &KisHandleStyle::highlightedPrimaryHandles()+KisHandleStyle &KisHandleStyle::highlightedPrimaryHandles(KisHandlePalette palette){static QScopedPointer<KisHandleStyle> style;if (!style) {style.reset(new KisHandleStyle());- initDashedStyle(highlightOutlineColor, highlightColor, style.data());+ initDashedStyle(palette.highlightOutlineColor, palette.highlightColor, style.data(), palette.white);}return *style;}-KisHandleStyle &KisHandleStyle::highlightedPrimaryHandlesWithSolidOutline()+KisHandleStyle &KisHandleStyle::highlightedPrimaryHandlesWithSolidOutline(KisHandlePalette palette){static QScopedPointer<KisHandleStyle> style;if (!style) {style.reset(new KisHandleStyle());- QPen h = QPen(highlightOutlineColor, 2);+ QPen h = QPen(palette.highlightOutlineColor, 2);h.setCosmetic(true);- style->handleIterations << KisHandleStyle::IterationStyle(h, highlightColor);- QPen l = QPen(highlightOutlineColor, 1);+ style->handleIterations << KisHandleStyle::IterationStyle(h, palette.highlightColor);+ QPen l = QPen(palette.highlightOutlineColor, 1);l.setCosmetic(true);l.setJoinStyle(Qt::RoundJoin);style->lineIterations << KisHandleStyle::IterationStyle(l, Qt::NoBrush);@@ -121,25 +112,25 @@ KisHandleStyle &KisHandleStyle::highlightedPrimaryHandlesWithSolidOutline()return *style;}-KisHandleStyle &KisHandleStyle::partiallyHighlightedPrimaryHandles()+KisHandleStyle &KisHandleStyle::partiallyHighlightedPrimaryHandles(KisHandlePalette palette){static QScopedPointer<KisHandleStyle> style;if (!style) {style.reset(new KisHandleStyle());- initDashedStyle(highlightOutlineColor, selectionColor, style.data());+ initDashedStyle(palette.highlightOutlineColor, palette.selectionColor, style.data(), palette.white);}return *style;}-KisHandleStyle &KisHandleStyle::selectedPrimaryHandles()+KisHandleStyle &KisHandleStyle::selectedPrimaryHandles(KisHandlePalette palette){static QScopedPointer<KisHandleStyle> style;if (!style) {style.reset(new KisHandleStyle());- initDashedStyle(primaryColor, selectionColor, style.data());+ initDashedStyle(palette.primaryColor, palette.selectionColor, style.data(), palette.white);}return *style;diff --git a/libs/global/KisHandleStyle.h b/libs/global/KisHandleStyle.hindex f27a5ffc52..60c8229027 100644--- a/libs/global/KisHandleStyle.h+++ b/libs/global/KisHandleStyle.h@@ -13,6 +13,27 @@#include "kritaglobal_export.h"+struct KRITAGLOBAL_EXPORT KisHandlePalette+{+ KisHandlePalette()+ : primaryColor(QColor(0, 0, 90, 180))+ , secondaryColor(QColor(0, 0, 255, 127))+ , gradientFillColor(QColor(255, 197, 39))+ , highlightColor(QColor(255, 100, 100))+ , highlightOutlineColor(QColor(155, 0, 0))+ , selectionColor(QColor(164, 227, 243))+ , white(Qt::white)+ {+ }++ QColor primaryColor;+ QColor secondaryColor;+ QColor gradientFillColor;+ QColor highlightColor;+ QColor highlightOutlineColor;+ QColor selectionColor;+ QColor white;+};/*** A special class that defines a set of predefined styles for painting handles.@@ -32,47 +53,47 @@ public:* Main style. Used for showing a single selection or a boundary box of* multiple selected objects.*/- static KisHandleStyle& primarySelection();+ static KisHandleStyle& primarySelection(KisHandlePalette palette = KisHandlePalette());/*** Secondary style. Used for highlighting objects inside a multiple* selection.*/- static KisHandleStyle& secondarySelection();+ static KisHandleStyle& secondarySelection(KisHandlePalette palette = KisHandlePalette());/*** Style for painting gradient handles*/- static KisHandleStyle& gradientHandles();+ static KisHandleStyle& gradientHandles(KisHandlePalette palette = KisHandlePalette());/*** Style for painting linear gradient arrows*/- static KisHandleStyle& gradientArrows();+ static KisHandleStyle& gradientArrows(KisHandlePalette palette = KisHandlePalette());/*** Same as primary style, but the handles are filled with red color to show* that the user is hovering them.*/- static KisHandleStyle& highlightedPrimaryHandles();+ static KisHandleStyle& highlightedPrimaryHandles(KisHandlePalette palette = KisHandlePalette());/*** Same as primary style, but the handles are filled with red color to show* that the user is hovering them and the outline is solid*/- static KisHandleStyle& highlightedPrimaryHandlesWithSolidOutline();+ static KisHandleStyle& highlightedPrimaryHandlesWithSolidOutline(KisHandlePalette palette = KisHandlePalette());/*** Used for nodes, which control points are highlighted (the node itself* is not highlighted)*/- static KisHandleStyle& partiallyHighlightedPrimaryHandles();+ static KisHandleStyle& partiallyHighlightedPrimaryHandles(KisHandlePalette palette = KisHandlePalette());/*** Same as primary style, but the handles are filled with green color to show* that they are selected.*/- static KisHandleStyle& selectedPrimaryHandles();+ static KisHandleStyle& selectedPrimaryHandles(KisHandlePalette palette = KisHandlePalette());struct IterationStyle {IterationStyle() : isValid(false) {}diff --git a/libs/ui/canvas/kis_display_color_converter.cpp b/libs/ui/canvas/kis_display_color_converter.cppindex 9747c9727f..759f4fdb25 100644--- a/libs/ui/canvas/kis_display_color_converter.cpp+++ b/libs/ui/canvas/kis_display_color_converter.cpp@@ -156,6 +156,8 @@ struct KisDisplayColorConverter::PrivateKisNodeSP connectedNode;KisImageSP image;+ KisHandlePalette handlePalette;+inline KoColor approximateFromQColor(const QColor &qcolor);inline QColor approximateToQColor(const KoColor &color);@@ -240,6 +242,8 @@ KisDisplayColorConverter::KisDisplayColorConverter(KoCanvasResourceProvider *resm_d->paintingColorSpace = KoColorSpaceRegistry::instance()->rgb8();m_d->setCurrentNode(0);setDisplayFilter(QSharedPointer<KisDisplayFilter>(0));+ updateKisHandlePalette();+ connect(this, SIGNAL(displayConfigurationChanged()), this, SLOT(updateKisHandlePalette()));}KisDisplayColorConverter::KisDisplayColorConverter()@@ -332,6 +336,34 @@ void KisDisplayColorConverter::Private::slotUpdateCurrentNodeColorSpace()setCurrentNode(connectedNode);}+void KisDisplayColorConverter::updateKisHandlePalette()+{+ KisHandlePalette palette;+ KoColor c;+ c.fromQColor(palette.gradientFillColor);+ palette.gradientFillColor = convertColorToDisplayColorSpace(c);++ c.fromQColor(palette.highlightColor);+ palette.highlightColor = convertColorToDisplayColorSpace(c);++ c.fromQColor(palette.highlightOutlineColor);+ palette.highlightOutlineColor = convertColorToDisplayColorSpace(c);++ c.fromQColor(palette.primaryColor);+ palette.primaryColor = convertColorToDisplayColorSpace(c);++ c.fromQColor(palette.secondaryColor);+ palette.secondaryColor = convertColorToDisplayColorSpace(c);++ c.fromQColor(palette.selectionColor);+ palette.selectionColor = convertColorToDisplayColorSpace(c);++ c.fromQColor(palette.white);+ palette.white = convertColorToDisplayColorSpace(c);++ m_d->handlePalette = palette;+}+inline KisPaintDeviceSP findValidDevice(KisNodeSP node) {return node->paintDevice() ? node->paintDevice() : node->original();}@@ -652,6 +684,11 @@ QColor KisDisplayColorConverter::convertColorToDisplayColorSpace(const KoColor creturn QColor::fromRgbF(sorted[0], sorted[1], sorted[2], sorted[3]);}+KisHandlePalette KisDisplayColorConverter::handlePaletteForDisplayColorSpace() const+{+ return m_d->handlePalette;+}+KoColor KisDisplayColorConverter::Private::approximateFromQColor(const QColor &qcolor){if (!useOcio()) {diff --git a/libs/ui/canvas/kis_display_color_converter.h b/libs/ui/canvas/kis_display_color_converter.hindex d398a37b4a..7bf1345a00 100644--- a/libs/ui/canvas/kis_display_color_converter.h+++ b/libs/ui/canvas/kis_display_color_converter.h@@ -12,6 +12,7 @@#include <KoColorDisplayRendererInterface.h>#include <KoColorConversionTransformation.h>+#include "KisHandleStyle.h"#include "kis_types.h"#include "canvas/kis_display_filter.h"@@ -78,6 +79,8 @@ public:*/QColor convertColorToDisplayColorSpace(const KoColor color) const;+ KisHandlePalette handlePaletteForDisplayColorSpace() const;+/*** Converts the exactBounds() (!) of the \p srcDevice into QImage* properly rendered into display RGB space. Please note that the@@ -121,6 +124,7 @@ private:Q_PRIVATE_SLOT(m_d, void slotCanvasResourceChanged(int key, const QVariant &v));Q_PRIVATE_SLOT(m_d, void selectPaintingColorSpace());Q_PRIVATE_SLOT(m_d, void slotUpdateCurrentNodeColorSpace());+ Q_SLOT void updateKisHandlePalette();private:struct Private;diff --git a/plugins/tools/defaulttool/defaulttool/SelectionDecorator.cpp b/plugins/tools/defaulttool/defaulttool/SelectionDecorator.cppindex 63f396fe7e..58bf467c1d 100644--- a/plugins/tools/defaulttool/defaulttool/SelectionDecorator.cpp+++ b/plugins/tools/defaulttool/defaulttool/SelectionDecorator.cpp@@ -83,6 +83,7 @@ void SelectionDecorator::setCurrentMeshGradientHandles(const KoShapeMeshGradientvoid SelectionDecorator::paint(QPainter &painter, const KoViewConverter &converter){+ KisHandlePalette palette;QList<KoShape*> selectedShapes = m_selection->selectedVisibleShapes();if (selectedShapes.isEmpty()) return;diff --git a/plugins/tools/svgtexttool/SvgCreateTextStrategy.cpp b/plugins/tools/svgtexttool/SvgCreateTextStrategy.cppindex 61208f2319..fd47732a80 100644--- a/plugins/tools/svgtexttool/SvgCreateTextStrategy.cpp+++ b/plugins/tools/svgtexttool/SvgCreateTextStrategy.cpp@@ -31,11 +31,12 @@#include <KoPathShape.h>#include <KoPathSegment.h>-SvgCreateTextStrategy::SvgCreateTextStrategy(SvgTextTool *tool, const QPointF &clicked, KoShape *shape)+SvgCreateTextStrategy::SvgCreateTextStrategy(SvgTextTool *tool, const QPointF &clicked, KisHandlePalette handlePalette, KoShape *shape): KoInteractionStrategy(tool), m_dragStart(clicked), m_dragEnd(clicked), m_flowShape(shape)+ , m_handlePalette(handlePalette){KoSvgTextProperties properties = tool->propertiesForNewText();properties.inheritFrom(KoSvgTextProperties::defaultProperties(), true);@@ -52,7 +53,7 @@ void SvgCreateTextStrategy::paint(QPainter &painter, const KoViewConverter &convKisHandlePainterHelper handlePainter(&painter, originalPainterTransform, 0.0, decorationThickness());const QPolygonF poly(QRectF(m_dragStart, m_dragEnd));- handlePainter.setHandleStyle(KisHandleStyle::primarySelection());+ handlePainter.setHandleStyle(KisHandleStyle::primarySelection(m_handlePalette));handlePainter.drawRubberLine(poly);}diff --git a/plugins/tools/svgtexttool/SvgCreateTextStrategy.h b/plugins/tools/svgtexttool/SvgCreateTextStrategy.hindex 90f1fb8413..00502370e3 100644--- a/plugins/tools/svgtexttool/SvgCreateTextStrategy.h+++ b/plugins/tools/svgtexttool/SvgCreateTextStrategy.h@@ -11,6 +11,7 @@#include <QPointF>#include <QSizeF>+#include <KisHandleStyle.h>class SvgTextTool;@@ -20,7 +21,7 @@ class KoShape;class SvgCreateTextStrategy : public KoInteractionStrategy{public:- SvgCreateTextStrategy(SvgTextTool *tool, const QPointF &clicked, KoShape *shape = nullptr);+ SvgCreateTextStrategy(SvgTextTool *tool, const QPointF &clicked, KisHandlePalette palette = KisHandlePalette(), KoShape *shape = nullptr);~SvgCreateTextStrategy() override = default;void paint(QPainter &painter, const KoViewConverter &converter) override;@@ -37,6 +38,7 @@ private:QPointF m_dragEnd;QSizeF m_minSizeInline;KoShape *m_flowShape;+ KisHandlePalette m_handlePalette;Qt::KeyboardModifiers m_modifiers;};diff --git a/plugins/tools/svgtexttool/SvgTextCursor.cpp b/plugins/tools/svgtexttool/SvgTextCursor.cppindex cdb1c17c54..370f1e98b9 100644--- a/plugins/tools/svgtexttool/SvgTextCursor.cpp+++ b/plugins/tools/svgtexttool/SvgTextCursor.cpp@@ -831,12 +831,16 @@ void SvgTextCursor::deselectText()setPos(d->pos, d->pos);}-static QColor bgColorForCaret(QColor c, int opacity = 64) {+static QColor bgColorForCaret(QColor c, KisHandlePalette handlePalette, int opacity = 64) {- return KisPaintingTweaks::luminosityCoarse(c) > 0.8? QColor(0, 0, 0, opacity) : QColor(255, 255, 255, opacity);+ if (KisPaintingTweaks::luminosityCoarse(c) > 0.8) {+ return QColor(0, 0, 0, opacity);+ } else {+ return handlePalette.white;+ }}-void SvgTextCursor::paintDecorations(QPainter &gc, QColor selectionColor, int decorationThickness, qreal handleRadius)+void SvgTextCursor::paintDecorations(QPainter &gc, QColor selectionColor, int decorationThickness, qreal handleRadius, KisHandlePalette handlePalette){if (d->shape) {gc.save();@@ -855,7 +859,7 @@ void SvgTextCursor::paintDecorations(QPainter &gc, QColor selectionColor, int deQPen pen;pen.setCosmetic(true);QColor c = d->cursorColor.isValid()? d->cursorColor: Qt::black;- pen.setColor(bgColorForCaret(c));+ pen.setColor(bgColorForCaret(c, handlePalette));pen.setWidth((d->cursorWidth + 2) * decorationThickness);gc.setPen(pen);gc.drawPath(d->cursorShape);@@ -877,8 +881,8 @@ void SvgTextCursor::paintDecorations(QPainter &gc, QColor selectionColor, int ded->handleRadius = handleRadius;QTransform painterTf = gc.transform();KisHandlePainterHelper helper(&gc, handleRadius, decorationThickness);- const KisHandleStyle highlight = KisHandleStyle::partiallyHighlightedPrimaryHandles();- const KisHandleStyle regular = KisHandleStyle::secondarySelection();+ const KisHandleStyle highlight = KisHandleStyle::partiallyHighlightedPrimaryHandles(handlePalette);+ const KisHandleStyle regular = KisHandleStyle::secondarySelection(handlePalette);QMap<SvgTextCursor::TypeSettingModeHandle, QPainterPath> paths= d->typeSettingDecor.testBaselines(d->lastKnownModifiers)? d->typeSettingDecor.baselines: d->typeSettingDecor.paths;@@ -924,7 +928,7 @@ void SvgTextCursor::paintDecorations(QPainter &gc, QColor selectionColor, int defont.setHintingPreference(QFont::PreferFullHinting);textP.addText(painterTf.map(d->typeSettingDecor.closestBaselinePoint).toPoint(), font, name);gc.save();- QPen pen(bgColorForCaret(selectionColor, 255));+ QPen pen(bgColorForCaret(selectionColor, handlePalette, 255));pen.setCosmetic(true);pen.setWidth(decorationThickness);gc.setPen(pen);diff --git a/plugins/tools/svgtexttool/SvgTextCursor.h b/plugins/tools/svgtexttool/SvgTextCursor.hindex b31f5ff5bd..72c6615714 100644--- a/plugins/tools/svgtexttool/SvgTextCursor.h+++ b/plugins/tools/svgtexttool/SvgTextCursor.h@@ -14,6 +14,7 @@#include <QPainter>#include <KoShape.h>#include "kritatoolsvgtext_export.h"+#include <KisHandleStyle.h>class KoCanvasBase;class SvgTextInsertCommand;@@ -267,7 +268,7 @@ public:void deselectText();/// Paint all decorations and blinkingcursors.- void paintDecorations(QPainter &gc, QColor selectionColor, int decorationThickness = 1, qreal handleRadius = 5.0);+ void paintDecorations(QPainter &gc, QColor selectionColor, int decorationThickness = 1, qreal handleRadius = 5.0, KisHandlePalette handlePalette = KisHandlePalette());/// Process an input method query and return the requested result.QVariant inputMethodQuery(Qt::InputMethodQuery query) const;diff --git a/plugins/tools/svgtexttool/SvgTextOnPathDecorationHelper.cpp b/plugins/tools/svgtexttool/SvgTextOnPathDecorationHelper.cppindex 043b0ba812..8624d671aa 100644--- a/plugins/tools/svgtexttool/SvgTextOnPathDecorationHelper.cpp+++ b/plugins/tools/svgtexttool/SvgTextOnPathDecorationHelper.cpp@@ -86,7 +86,7 @@ bool SvgTextOnPathDecorationHelper::hitTest(QPointF mouseInPts, const QTransformreturn hit;}-void SvgTextOnPathDecorationHelper::paint(QPainter *p, const KoViewConverter &converter)+void SvgTextOnPathDecorationHelper::paint(QPainter *p, const KoViewConverter &converter, KisHandlePalette handlePalette){if (!d->shape) return;KoSvgTextNodeIndex index = d->shape->topLevelNodeForPos(d->pos);@@ -99,11 +99,11 @@ void SvgTextOnPathDecorationHelper::paint(QPainter *p, const KoViewConverter &coKoShape::createHandlePainterHelperView(p, d->shape, converter, d->handleRadius, d->decorationThickness);if (d->isActive) {- helper.setHandleStyle(KisHandleStyle::selectedPrimaryHandles());+ helper.setHandleStyle(KisHandleStyle::selectedPrimaryHandles(handlePalette));} else if (d->isHovered) {- helper.setHandleStyle(KisHandleStyle::highlightedPrimaryHandles());+ helper.setHandleStyle(KisHandleStyle::highlightedPrimaryHandles(handlePalette));} else {- helper.setHandleStyle(KisHandleStyle::primarySelection());+ helper.setHandleStyle(KisHandleStyle::primarySelection(handlePalette));}helper.drawConnectionLine(line);diff --git a/plugins/tools/svgtexttool/SvgTextOnPathDecorationHelper.h b/plugins/tools/svgtexttool/SvgTextOnPathDecorationHelper.hindex 8b2464746c..06b24e46bb 100644--- a/plugins/tools/svgtexttool/SvgTextOnPathDecorationHelper.h+++ b/plugins/tools/svgtexttool/SvgTextOnPathDecorationHelper.h@@ -8,6 +8,7 @@#include <QPointF>#include <QPainter>+#include <KisHandleStyle.h>class KoSvgTextShape;@@ -51,7 +52,7 @@ public:* @brief paint* Paint the handles for the text path.*/- void paint(QPainter *painter, const KoViewConverter &converter);+ void paint(QPainter *painter, const KoViewConverter &converter, KisHandlePalette handlePalette);/*** @brief decorationRectdiff --git a/plugins/tools/svgtexttool/SvgTextTool.cpp b/plugins/tools/svgtexttool/SvgTextTool.cppindex 28949c2c4d..daf578d250 100644--- a/plugins/tools/svgtexttool/SvgTextTool.cpp+++ b/plugins/tools/svgtexttool/SvgTextTool.cpp@@ -77,6 +77,7 @@#include "kis_tool_utils.h"#include "kis_debug.h"#include <commands/KoKeepShapesSelectedCommand.h>+#include <kis_display_color_converter.h>#ifdef Q_OS_ANDROID#include <QMenuBar>@@ -232,7 +233,8 @@ QVariant SvgTextTool::inputMethodQuery(Qt::InputMethodQuery query) constvoid SvgTextTool::inputMethodEvent(QInputMethodEvent *event){- m_textCursor.inputMethodEvent(event);+ m_textCursor.+ inputMethodEvent(event);}QWidget *SvgTextTool::createOptionWidget()@@ -683,6 +685,12 @@ void SvgTextTool::paint(QPainter &gc, const KoViewConverter &converter){if (!isActivated()) return;+ KisHandlePalette handlePalette;+ KisCanvas2* kisCanvas = dynamic_cast<KisCanvas2*>(canvas());+ if (kisCanvas) {+ handlePalette = kisCanvas->displayColorConverter()->handlePaletteForDisplayColorSpace();+ }+if (m_dragging == DragMode::Create || m_dragging == DragMode::InShapeOffset) {m_interactionStrategy->paint(gc, converter);}@@ -693,7 +701,7 @@ void SvgTextTool::paint(QPainter &gc, const KoViewConverter &converter)KoShape::createHandlePainterHelperView(&gc, shape, converter, handleRadius(), decorationThickness());if (m_dragging != DragMode::InlineSizeHandle && m_dragging != DragMode::Move && m_dragging != DragMode::TypeSetting) {- handlePainter.setHandleStyle(KisHandleStyle::primarySelection());+ handlePainter.setHandleStyle(KisHandleStyle::primarySelection(handlePalette));QPainterPath path;path.addRect(shape->outlineRect());handlePainter.drawPath(path);@@ -702,52 +710,53 @@ void SvgTextTool::paint(QPainter &gc, const KoViewConverter &converter)qreal pxlToPt = canvas()->viewConverter()->viewToDocumentX(1.0);qreal length = (INLINE_SIZE_DASHES_PATTERN_A + INLINE_SIZE_DASHES_PATTERN_B) * INLINE_SIZE_DASHES_PATTERN_LENGTH;if (std::optional<InlineSizeInfo> info = InlineSizeInfo::fromShape(shape, length * pxlToPt)) {- handlePainter.setHandleStyle(KisHandleStyle::secondarySelection());+ handlePainter.setHandleStyle(KisHandleStyle::secondarySelection(handlePalette));handlePainter.drawConnectionLine(info->baselineLineLocal());if (m_highlightItem == HighlightItem::InlineSizeStartHandle) {- handlePainter.setHandleStyle(m_dragging == DragMode::InlineSizeHandle? KisHandleStyle::partiallyHighlightedPrimaryHandles()- : KisHandleStyle::highlightedPrimaryHandles());+ handlePainter.setHandleStyle(m_dragging == DragMode::InlineSizeHandle? KisHandleStyle::partiallyHighlightedPrimaryHandles(handlePalette)+ : KisHandleStyle::highlightedPrimaryHandles(handlePalette));}QVector<qreal> dashPattern = {INLINE_SIZE_DASHES_PATTERN_A, INLINE_SIZE_DASHES_PATTERN_B};handlePainter.drawHandleLine(info->startLineLocal());handlePainter.drawHandleLine(info->startLineDashes(), INLINE_SIZE_HANDLE_THICKNESS, dashPattern, INLINE_SIZE_DASHES_PATTERN_A);- handlePainter.setHandleStyle(KisHandleStyle::secondarySelection());+ handlePainter.setHandleStyle(KisHandleStyle::secondarySelection(handlePalette));if (m_highlightItem == HighlightItem::InlineSizeEndHandle) {- handlePainter.setHandleStyle(m_dragging == DragMode::InlineSizeHandle? KisHandleStyle::partiallyHighlightedPrimaryHandles()- : KisHandleStyle::highlightedPrimaryHandles());+ handlePainter.setHandleStyle(m_dragging == DragMode::InlineSizeHandle? KisHandleStyle::partiallyHighlightedPrimaryHandles(handlePalette)+ : KisHandleStyle::highlightedPrimaryHandles(handlePalette));}handlePainter.drawHandleLine(info->endLineLocal());handlePainter.drawHandleLine(info->endLineDashes(), INLINE_SIZE_HANDLE_THICKNESS, dashPattern, INLINE_SIZE_DASHES_PATTERN_A);}if (m_highlightItem == HighlightItem::MoveBorder) {- handlePainter.setHandleStyle(KisHandleStyle::highlightedPrimaryHandles());+ handlePainter.setHandleStyle(KisHandleStyle::highlightedPrimaryHandles(handlePalette));} else {- handlePainter.setHandleStyle(KisHandleStyle::primarySelection());+ handlePainter.setHandleStyle(KisHandleStyle::primarySelection(handlePalette));}handlePainter.drawHandleCircle(QPointF(), KoToolBase::handleRadius() * 0.75);}m_textOutlineHelper->setDecorationThickness(decorationThickness());m_textOutlineHelper->setHandleRadius(handleRadius());+ m_textOutlineHelper->setHandlePalette(handlePalette);m_textOutlineHelper->paint(&gc, converter);m_textOnPathHelper.setDecorationThickness(decorationThickness());m_textOnPathHelper.setHandleRadius(handleRadius());- m_textOnPathHelper.paint(&gc, converter);+ m_textOnPathHelper.paint(&gc, converter, handlePalette);gc.setTransform(converter.documentToView(), true);{KisHandlePainterHelper handlePainter(&gc, handleRadius(), decorationThickness());if (!m_hoveredShapeHighlightRect.isEmpty()) {- handlePainter.setHandleStyle(KisHandleStyle::highlightedPrimaryHandlesWithSolidOutline());+ handlePainter.setHandleStyle(KisHandleStyle::highlightedPrimaryHandlesWithSolidOutline(handlePalette));QPainterPath path;path.addPath(m_hoveredShapeHighlightRect);handlePainter.drawPath(path);}}if (shape) {- m_textCursor.paintDecorations(gc, qApp->palette().color(QPalette::Highlight), decorationThickness(), handleRadius());+ m_textCursor.paintDecorations(gc, qApp->palette().color(QPalette::Highlight), decorationThickness(), handleRadius(), handlePalette);}if (m_interactionStrategy) {gc.save();@@ -787,6 +796,12 @@ void SvgTextTool::mousePressEvent(KoPointerEvent *event)return;}+ KisHandlePalette handlePalette;+ KisCanvas2* kisCanvas = dynamic_cast<KisCanvas2*>(canvas());+ if (kisCanvas) {+ handlePalette = kisCanvas->displayColorConverter()->handlePaletteForDisplayColorSpace();+ }+KoSvgTextShape *selectedShape = this->selectedShape();if (selectedShape) {@@ -846,7 +861,7 @@ void SvgTextTool::mousePressEvent(KoPointerEvent *event)if (!selectedShape && !hoveredShape && !hoveredFlowShape && !crossLayerPossible) {QPointF point = canvas()->snapGuide()->snap(event->point, event->modifiers());- m_interactionStrategy.reset(new SvgCreateTextStrategy(this, point));+ m_interactionStrategy.reset(new SvgCreateTextStrategy(this, point, handlePalette));m_dragging = DragMode::Create;event->accept();} else if (hoveredShape) {@@ -860,7 +875,7 @@ void SvgTextTool::mousePressEvent(KoPointerEvent *event)event->accept();} else if (hoveredFlowShape) {QPointF point = canvas()->snapGuide()->snap(event->point, event->modifiers());- m_interactionStrategy.reset(new SvgCreateTextStrategy(this, point, hoveredFlowShape));+ m_interactionStrategy.reset(new SvgCreateTextStrategy(this, point, handlePalette, hoveredFlowShape));m_dragging = DragMode::Create;event->accept();} else if (crossLayerPossible) {