Commit ac35d0e9 authored by Simon Repp's avatar Simon Repp Committed by Halla Rempt

Consistently use "Color Sampler (Tool)" terminology in interface and code

parent 149de529
/* XPM */
static char * color_picker_image_background_xpm[] = {
static char * color_sampler_image_background_xpm[] = {
"33 31 3 1",
" c None",
". c #FFFFFF",
......
/* XPM */
static char * color_picker_image_foreground_xpm[] = {
static char * color_sampler_image_foreground_xpm[] = {
"33 31 3 1",
" c None",
". c #FFFFFF",
......
/* XPM */
static char * color_picker_layer_background_xpm[] = {
static char * color_sampler_layer_background_xpm[] = {
"33 31 3 1",
" c None",
". c #FFFFFF",
......
/* XPM */
static char * color_picker_layer_foreground_xpm[] = {
static char * color_sampler_layer_foreground_xpm[] = {
"33 31 3 1",
" c None",
". c #FFFFFF",
......
......@@ -5,10 +5,10 @@
-->
<RCC version="1.0">
<qresource>
<file>color-picker_image_background.xpm</file>
<file>color-picker_image_foreground.xpm</file>
<file>color-picker_layer_background.xpm</file>
<file>color-picker_layer_foreground.xpm</file>
<file>color-sampler_image_background.xpm</file>
<file>color-sampler_image_foreground.xpm</file>
<file>color-sampler_layer_background.xpm</file>
<file>color-sampler_layer_foreground.xpm</file>
<file>cursor-cross.xpm</file>
<file>cursor-pixel-white.xpm</file>
<file>cursor-pixel-black.xpm</file>
......@@ -27,6 +27,6 @@
<file>zoom_discrete.xpm</file>
<file>zoom_smooth.xpm</file>
<file>tool_freehand_cursor.png</file>
<file>tool_color_picker_cursor.png</file>
<file>tool_color_sampler_cursor.png</file>
</qresource>
</RCC>
......@@ -373,6 +373,6 @@ actionButtonDoubleClick=erase_action
actionGestureCircleCCW=shift_brush_color_counter_clockwise
actionGestureCircleCW=shift_brush_color_clockwise
actionGestureSwipeDown=make_brush_color_darker
actionGestureSwipeRight=KritaSelected/KisToolColorPicker
actionGestureSwipeRight=KritaSelected/KisToolColorSampler
actionGestureSwipeLeft=KritaShape/KisToolBrush
actionGestureSwipeUp=make_brush_color_lighter
......@@ -220,7 +220,7 @@ krita_filter_top edge detections=none
krita_filter_unsharp=none
krita_filter_waveletnoisereducer=none
krita_filter_wave=none
KritaSelected/KisToolColorPicker=none
KritaSelected/KisToolColorSampler=none
KritaShape/KisToolBrush=B
KritaShape/KisToolDyna=none
KritaShape/KisToolEllipse=none
......
......@@ -220,7 +220,7 @@ krita_filter_top edge detections=none
krita_filter_unsharp=none
krita_filter_waveletnoisereducer=none
krita_filter_wave=none
KritaSelected/KisToolColorPicker=I
KritaSelected/KisToolColorSampler=I
KritaShape/KisToolBrush=B
KritaShape/KisToolDyna=none
KritaShape/KisToolEllipse=none
......
......@@ -222,7 +222,7 @@ krita_filter_top edge detections=none
krita_filter_unsharp=none
krita_filter_waveletnoisereducer=none
krita_filter_wave=none
KritaSelected/KisToolColorPicker=I
KritaSelected/KisToolColorSampler=I
KritaShape/KisToolBrush=B
KritaShape/KisToolDyna=none
KritaShape/KisToolEllipse=none
......
......@@ -1402,12 +1402,12 @@
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="KritaSelected/KisToolColorPicker">
<icon>krita_tool_color_picker</icon>
<text>Color Picker</text>
<icon>krita_tool_color_sampler</icon>
<text>Color Sampler</text>
<whatsThis></whatsThis>
<toolTip>Select a color from the image or current layer</toolTip>
<iconText>Color Picker</iconText>
<toolTip>Sample a color from the image or current layer</toolTip>
<iconText>Color Sampler</iconText>
<shortcut>P</shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
......
......@@ -9,7 +9,7 @@
<file>dark_format-fill-color.svg</file>
<file>dark_krita_draw_path.svg</file>
<file>dark_krita_tool_color_fill.svg</file>
<file>dark_krita_tool_color_picker.svg</file>
<file>dark_krita_tool_color_sampler.svg</file>
<file>dark_krita_tool_dyna.svg</file>
<file>dark_krita_tool_ellipse.svg</file>
<file>dark_krita_tool_freehand.svg</file>
......@@ -43,7 +43,7 @@
<file>light_format-fill-color.svg</file>
<file>light_krita_draw_path.svg</file>
<file>light_krita_tool_color_fill.svg</file>
<file>light_krita_tool_color_picker.svg</file>
<file>light_krita_tool_color_sampler.svg</file>
<file>light_krita_tool_dyna.svg</file>
<file>light_krita_tool_ellipse.svg</file>
<file>light_krita_tool_freehand.svg</file>
......
......@@ -398,7 +398,7 @@ Q_SIGNALS:
* Emitted when this tool wants itself to temporarily be replaced by another tool.
* For instance, a paint tool could desire to be
* temporarily replaced by a pan tool which could be temporarily
* replaced by a colorpicker.
* replaced by a color sampler.
* @param id the identification of the desired tool
*/
void activateTemporary(const QString &id);
......
......@@ -18,24 +18,24 @@ namespace Acs {
class PixelCacheRenderer {
public:
/**
* \p Picker class must provide one method:
* - KoColor Picker::colorAt(float x, float y);
* \p Sampler class must provide one method:
* - KoColor Sampler::colorAt(float x, float y);
*
* How to handle High DPI:
* - pickRect - is in device independent pixels coordinates space
* - sampleRect - is in device independent pixels coordinates space
* (amount of space on the widget)
* - devicePixelRatioF - the amount of UI scaling
* - pixelCache and realPixelCache gets the size of
* pickRect.size()*devicePixelRatioF
* sampleRect.size()*devicePixelRatioF
* and sets the device pixel ratio,
* and color pickers need to take it into account.
* and color samplers need to take it into account.
* That way you can paint on the cache the same way you'd paint on a low dpi display
* and then just use painter->drawImage() and it works.
*/
template <class Picker>
static void render(Picker *picker,
template <class Sampler>
static void render(Sampler *sampler,
const KisDisplayColorConverter *converter,
const QRect &pickRect,
const QRect &sampleRect,
KisPaintDeviceSP &realPixelCache,
QImage &pixelCache,
QPoint &pixelCacheOffset,
......@@ -50,11 +50,11 @@ namespace Acs {
KoColor color;
QRect pickRectHighDPI = QRect(pickRect.topLeft(), pickRect.size()*devicePixelRatioF);
KisSequentialIterator it(realPixelCache, pickRectHighDPI);
QRect sampleRectHighDPI = QRect(sampleRect.topLeft(), sampleRect.size()*devicePixelRatioF);
KisSequentialIterator it(realPixelCache, sampleRectHighDPI);
while (it.nextPixel()) {
color = picker->colorAt(it.x()/devicePixelRatioF, it.y()/devicePixelRatioF);
color = sampler->colorAt(it.x()/devicePixelRatioF, it.y()/devicePixelRatioF);
memcpy(it.rawData(), color.data(), pixelSize);
}
......@@ -62,7 +62,7 @@ namespace Acs {
// NOTE: toQImage() function of the converter copies exactBounds() only!
pixelCache = converter->toQImage(realPixelCache);
pixelCache.setDevicePixelRatio(devicePixelRatioF);
pixelCacheOffset = realPixelCache->exactBounds().topLeft()/devicePixelRatioF - pickRect.topLeft();
pixelCacheOffset = realPixelCache->exactBounds().topLeft()/devicePixelRatioF - sampleRect.topLeft();
}
};
}
......
......@@ -38,7 +38,7 @@ namespace Acs {
}
template <class PaintDeviceSP>
KoColor pickColor(PaintDeviceSP device, const QPoint &pt) {
KoColor sampleColor(PaintDeviceSP device, const QPoint &pt) {
KoColor color;
if (device) {
(void) device->pixel(pt.x(), pt.y(), &color);
......
......@@ -111,7 +111,7 @@ KisBaseNode::~KisBaseNode()
delete m_d;
}
KisPaintDeviceSP KisBaseNode::colorPickSourceDevice() const
KisPaintDeviceSP KisBaseNode::colorSampleSourceDevice() const
{
return projection();
}
......
......@@ -146,11 +146,11 @@ public:
virtual KisPaintDeviceSP projection() const = 0;
/**
* @return a special device from where the color picker tool should pick
* @return a special device from where the color sampler tool should sample
* color when in layer-only mode. For most of the nodes just shortcuts
* to projection() device. TODO: can it be null?
*/
virtual KisPaintDeviceSP colorPickSourceDevice() const;
virtual KisPaintDeviceSP colorSampleSourceDevice() const;
virtual const KoColorSpace *colorSpace() const = 0;
......
......@@ -4,14 +4,14 @@
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#ifndef __KIS_CROSS_DEVICE_COLOR_PICKER_H
#define __KIS_CROSS_DEVICE_COLOR_PICKER_H
#ifndef __KIS_CROSS_DEVICE_COLOR_SAMPLER_H
#define __KIS_CROSS_DEVICE_COLOR_SAMPLER_H
#include "KoColorSpace.h"
#include "kis_random_sub_accessor.h"
struct PickerTraitReal {
struct SamplerTraitReal {
typedef qreal coord_type;
typedef KisRandomSubAccessorSP accessor_type;
static inline accessor_type createAccessor(KisPaintDeviceSP dev) {
......@@ -28,7 +28,7 @@ struct PickerTraitReal {
}
};
struct PickerTraitInt {
struct SamplerTraitInt {
typedef int coord_type;
typedef KisRandomConstAccessorSP accessor_type;
static inline accessor_type createAccessor(KisPaintDeviceSP dev) {
......@@ -46,11 +46,11 @@ struct PickerTraitInt {
};
/**
* The picker class is supposed to help to pick color from one device
* The sampler class is supposed to help to sample color from one device
* and automatically convert it to the color space of another device
*
* WARNING: Please note, that if you want to access correct rawData(),
* you shouldn't store the picker class (as well as any
* you shouldn't store the sampler class (as well as any
* random accessor class) across different calls to
* paintAt. This is related to the fact that
* KisRandomAccessor has an internal cache of the tiles, but
......@@ -59,35 +59,35 @@ struct PickerTraitInt {
*/
template <class Traits>
class KisCrossDeviceColorPickerImpl
class KisCrossDeviceColorSamplerImpl
{
public:
KisCrossDeviceColorPickerImpl(KisPaintDeviceSP src, KisPaintDeviceSP dst) {
KisCrossDeviceColorSamplerImpl(KisPaintDeviceSP src, KisPaintDeviceSP dst) {
init(src, dst);
}
KisCrossDeviceColorPickerImpl(KisPaintDeviceSP src, KisFixedPaintDeviceSP dst) {
KisCrossDeviceColorSamplerImpl(KisPaintDeviceSP src, KisFixedPaintDeviceSP dst) {
init(src, dst);
}
KisCrossDeviceColorPickerImpl(KisPaintDeviceSP src, const KoColor &dst) {
KisCrossDeviceColorSamplerImpl(KisPaintDeviceSP src, const KoColor &dst) {
init(src, &dst);
}
~KisCrossDeviceColorPickerImpl() {
~KisCrossDeviceColorSamplerImpl() {
delete[] m_data;
}
inline void pickColor(typename Traits::coord_type x,
inline void sampleColor(typename Traits::coord_type x,
typename Traits::coord_type y,
quint8 *dst) {
pickColorImpl<false>(x, y, dst);
sampleColorImpl<false>(x, y, dst);
}
inline void pickOldColor(typename Traits::coord_type x,
inline void sampleOldColor(typename Traits::coord_type x,
typename Traits::coord_type y,
quint8 *dst) {
pickColorImpl<true>(x, y, dst);
sampleColorImpl<true>(x, y, dst);
}
private:
......@@ -101,7 +101,7 @@ private:
}
template <bool useOldData>
inline void pickColorImpl(typename Traits::coord_type x,
inline void sampleColorImpl(typename Traits::coord_type x,
typename Traits::coord_type y,
quint8 *dst) {
m_accessor->moveTo(x, y);
......@@ -120,7 +120,7 @@ private:
quint8 *m_data;
};
typedef KisCrossDeviceColorPickerImpl<PickerTraitReal> KisCrossDeviceColorPicker;
typedef KisCrossDeviceColorPickerImpl<PickerTraitInt> KisCrossDeviceColorPickerInt;
typedef KisCrossDeviceColorSamplerImpl<SamplerTraitReal> KisCrossDeviceColorSampler;
typedef KisCrossDeviceColorSamplerImpl<SamplerTraitInt> KisCrossDeviceColorSamplerInt;
#endif /* __KIS_CROSS_DEVICE_COLOR_PICKER_H */
#endif /* __KIS_CROSS_DEVICE_COLOR_SAMPLER_H */
......@@ -665,13 +665,13 @@ public:
* 2) Do *not* expect that the color spaces of the destination and
* the temporary device would coincide. If you need to copy a
* single pixel from one device to another, you can use
* KisCrossDeviceColorPicker class, that will handle all the
* KisCrossDeviceColorSampler class, that will handle all the
* necessary conversions for you.
*
* \see createCompositionSourceDeviceFixed()
* \see compositionSourceColorSpace()
* \see KisCrossDeviceColorPicker
* \see KisCrossDeviceColorPickerInt
* \see KisCrossDeviceColorSampler
* \see KisCrossDeviceColorSamplerInt
*/
KisPaintDeviceSP createCompositionSourceDevice() const;
......
......@@ -464,7 +464,7 @@ KisPaintDeviceSP KisColorizeMask::coloringProjection() const
return m_d->coloringProjection;
}
KisPaintDeviceSP KisColorizeMask::colorPickSourceDevice() const
KisPaintDeviceSP KisColorizeMask::colorSampleSourceDevice() const
{
return
m_d->shouldShowColoring() && !m_d->coloringProjection->extent().isEmpty() ?
......
......@@ -50,7 +50,7 @@ public:
KisPaintDeviceSP paintDevice() const override;
KisPaintDeviceSP coloringProjection() const;
KisPaintDeviceSP colorPickSourceDevice() const override;
KisPaintDeviceSP colorSampleSourceDevice() const override;
KisNodeSP clone() const override {
return KisNodeSP(new KisColorizeMask(*this));
......
......@@ -15,7 +15,7 @@
id="svg3531"
version="1.1"
inkscape:version="0.48.3.1 r9886"
sodipodi:docname="icon-colorpicker.svg">
sodipodi:docname="icon-colorsampler.svg">
<defs
id="defs3533">
<linearGradient
......
......@@ -19,17 +19,17 @@ Panel {
height: parent.height;
width: height;
onChooseBGChanged: {
if (toolManager.currentTool !== null && toolManager.currentTool.toolId() === "KritaSelected/KisToolColorPicker") {
if (toolManager.currentTool !== null && toolManager.currentTool.toolId() === "KritaSelected/KisToolColorSampler") {
toolManager.currentTool.toForeground = !swatch.chooseBG;
}
}
},
Button {
id: colorPicker;
id: colorSampler;
width: height;
height: Constants.ToolbarButtonSize;
image: Settings.theme.icon("colorpicker");
onClicked: toolManager.requestToolChange("KritaSelected/KisToolColorPicker");
image: Settings.theme.icon("colorsampler");
onClicked: toolManager.requestToolChange("KritaSelected/KisToolColorSampler");
},
Item {
width: base.width - Constants.DefaultMargin - (Constants.ToolbarButtonSize * 3);
......@@ -47,7 +47,7 @@ Panel {
Connections {
target: toolManager;
onCurrentToolChanged: {
if (toolManager.currentTool !== null && toolManager.currentTool.toolId() === "KritaSelected/KisToolColorPicker") {
if (toolManager.currentTool !== null && toolManager.currentTool.toolId() === "KritaSelected/KisToolColorSampler") {
toolManager.currentTool.toForeground = !swatch.chooseBG;
}
}
......
......@@ -86,7 +86,7 @@
<file>images/svg/icon-visible_off.svg</file>
<file>images/svg/icon-cancel-black.svg</file>
<file>images/svg/icon-select-sub.svg</file>
<file>images/svg/icon-colorpicker.svg</file>
<file>images/svg/icon-colorsampler.svg</file>
<file>images/svg/icon-forward.svg</file>
<file>images/svg/icon-A4landscape-black.svg</file>
<file>images/svg/icon-layer_group-black.svg</file>
......
......@@ -15,7 +15,7 @@
id="svg3531"
version="1.1"
inkscape:version="0.48.3.1 r9886"
sodipodi:docname="icon-colorpicker.svg">
sodipodi:docname="icon-colorsampler.svg">
<defs
id="defs3533">
<linearGradient
......
......@@ -208,7 +208,7 @@ set(kritaui_LIB_SRCS
tool/strokes/KisStrokeEfficiencyMeasurer.cpp
tool/strokes/kis_painter_based_stroke_strategy.cpp
tool/strokes/kis_filter_stroke_strategy.cpp
tool/strokes/kis_color_picker_stroke_strategy.cpp
tool/strokes/kis_color_sampler_stroke_strategy.cpp
tool/strokes/KisFreehandStrokeInfo.cpp
tool/strokes/KisMaskedFreehandStrokePainter.cpp
tool/strokes/KisMaskingBrushRenderer.cpp
......@@ -272,7 +272,7 @@ set(kritaui_LIB_SRCS
widgets/kis_elided_label.cpp
widgets/kis_stopgradient_slider_widget.cpp
widgets/kis_preset_live_preview_view.cpp
widgets/KisScreenColorPicker.cpp
widgets/KisScreenColorSampler.cpp
widgets/KoDualColorButton.cpp
widgets/KoStrokeConfigWidget.cpp
widgets/KoFillConfigWidget.cpp
......
......@@ -98,7 +98,7 @@
#include <KisSessionResource.h>
#include <resources/KoSvgSymbolCollectionResource.h>
#include "widgets/KisScreenColorPicker.h"
#include "widgets/KisScreenColorSampler.h"
#include "KisDlgInternalColorSelector.h"
#include <dialogs/KisAsyncAnimationFramesSaveDialog.h>
......
......@@ -25,18 +25,18 @@ KisAlternateInvocationAction::KisAlternateInvocationAction()
, m_d(new Private)
{
setName(i18n("Alternate Invocation"));
setDescription(i18n("The <i>Alternate Invocation</i> action performs an alternate action with the current tool. For example, using the brush tool it picks a color from the canvas."));
setDescription(i18n("The <i>Alternate Invocation</i> action performs an alternate action with the current tool. For example, using the brush tool it samples a color from the canvas."));
QHash<QString, int> shortcuts;
shortcuts.insert(i18n("Primary Mode"), PrimaryAlternateModeShortcut);
shortcuts.insert(i18n("Secondary Mode"), SecondaryAlternateModeShortcut);
shortcuts.insert(i18n("Tertiary Mode"), TertiaryAlternateModeShortcut);
shortcuts.insert(i18n("Pick Foreground Color from Current Layer"), PickColorFgLayerModeShortcut);
shortcuts.insert(i18n("Pick Background Color from Current Layer"), PickColorBgLayerModeShortcut);
shortcuts.insert(i18n("Sample Foreground Color from Current Layer"), SampleColorFgLayerModeShortcut);
shortcuts.insert(i18n("Sample Background Color from Current Layer"), SampleColorBgLayerModeShortcut);
shortcuts.insert(i18n("Pick Foreground Color from Merged Image"), PickColorFgImageModeShortcut);
shortcuts.insert(i18n("Pick Background Color from Merged Image"), PickColorBgImageModeShortcut);
shortcuts.insert(i18n("Sample Foreground Color from Merged Image"), SampleColorFgImageModeShortcut);
shortcuts.insert(i18n("Sample Background Color from Merged Image"), SampleColorBgImageModeShortcut);
setShortcutIndexes(shortcuts);
}
......@@ -50,17 +50,17 @@ KisTool::ToolAction KisAlternateInvocationAction::shortcutToToolAction(int short
KisTool::ToolAction action = KisTool::Alternate_NONE;
switch ((Shortcut)shortcut) {
case PickColorFgLayerModeShortcut:
action = KisTool::AlternatePickFgNode;
case SampleColorFgLayerModeShortcut:
action = KisTool::AlternateSampleFgNode;
break;
case PickColorBgLayerModeShortcut:
action = KisTool::AlternatePickBgNode;
case SampleColorBgLayerModeShortcut:
action = KisTool::AlternateSampleBgNode;
break;
case PickColorFgImageModeShortcut:
action = KisTool::AlternatePickFgImage;
case SampleColorFgImageModeShortcut:
action = KisTool::AlternateSampleFgImage;
break;
case PickColorBgImageModeShortcut:
action = KisTool::AlternatePickBgImage;
case SampleColorBgImageModeShortcut:
action = KisTool::AlternateSampleBgImage;
break;
case PrimaryAlternateModeShortcut:
action = KisTool::AlternateSecondary;
......@@ -113,7 +113,7 @@ void KisAlternateInvocationAction::end(QEvent *event)
Qt::KeyboardModifiers modifiers;
switch (m_d->savedAction) {
case KisTool::AlternatePickFgNode:
case KisTool::AlternateSampleFgNode:
modifiers = Qt::ControlModifier;
break;
case KisTool::AlternateThird:
......@@ -134,7 +134,7 @@ void KisAlternateInvocationAction::inputEvent(QEvent* event)
if (event && ((event->type() == QEvent::MouseMove) || (event->type() == QEvent::TabletMove))) {
Qt::KeyboardModifiers modifiers;
switch (m_d->savedAction) {
case KisTool::AlternatePickFgNode:
case KisTool::AlternateSampleFgNode:
modifiers = Qt::ControlModifier;
break;
case KisTool::AlternateThird:
......
......@@ -15,7 +15,7 @@
* \brief Alternate Invocation implementation of KisAbstractInputAction.
*
* The Alternate Invocation action performs an alternate action with the
* current tool. For example, using the brush tool it picks a color from
* current tool. For example, using the brush tool it samples a color from
* the canvas.
*/
class KisAlternateInvocationAction : public KisAbstractInputAction
......@@ -27,10 +27,10 @@ public:
enum Shortcut {
PrimaryAlternateModeShortcut, ///< Toggle Primary mode.
SecondaryAlternateModeShortcut, ///< Toggle Secondary mode.
PickColorFgLayerModeShortcut,
PickColorBgLayerModeShortcut,
PickColorFgImageModeShortcut,
PickColorBgImageModeShortcut,
SampleColorFgLayerModeShortcut,
SampleColorBgLayerModeShortcut,
SampleColorFgImageModeShortcut,
SampleColorBgImageModeShortcut,
TertiaryAlternateModeShortcut ///< Warning: don't reorder the items of this enum, it breaks user configs!
};
......
......@@ -124,10 +124,10 @@ public:
Primary,
AlternateChangeSize,
AlternateChangeSizeSnap,
AlternatePickFgNode,
AlternatePickBgNode,
AlternatePickFgImage,
AlternatePickBgImage,
AlternateSampleFgNode,
AlternateSampleBgNode,
AlternateSampleFgImage,
AlternateSampleBgImage,
AlternateSecondary,
AlternateThird,
AlternateFourth,
......@@ -140,10 +140,10 @@ public:
enum AlternateAction {
ChangeSize = AlternateChangeSize, // Default: Shift+Left click
ChangeSizeSnap = AlternateChangeSizeSnap, // Default: Shift+Z+Left click