Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
dropper-tool.h
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-2.0-or-later
2#ifndef INKSCAPE_UI_TOOLS_DROPPER_TOOL_H
3#define INKSCAPE_UI_TOOLS_DROPPER_TOOL_H
4
5/*
6 * Tool for picking colors from drawing
7 *
8 * Authors:
9 * Lauris Kaplinski <lauris@kaplinski.com>
10 *
11 * Copyright (C) 1999-2002 Authors
12 *
13 * Released under GNU GPL v2+, read the file 'COPYING' for more information.
14 */
15
17#include "ui/tools/tool-base.h"
18
19namespace Inkscape { class CanvasItemBpath; }
20namespace Inkscape::UI::Tools {
21
22class DropperTool : public ToolBase
23{
24public:
26 ~DropperTool() override;
27
28 std::optional<Colors::Color> get_color(bool invert = false, bool non_dropping = false) const;
29 sigc::signal<void (Colors::Color const &)> onetimepick_signal;
30
31protected:
32 bool root_handler(CanvasEvent const &event) override;
33
34private:
35 // Stored color.
36 std::optional<Colors::Color> stored_color;
37
38 // Stored color taken from canvas. Used by clipboard.
39 // Identical to stored_color if dropping disabled.
40 std::optional<Colors::Color> non_dropping_color;
41
42 bool invert = false;
43 bool stroke = false;
44 bool dropping = false;
45 // bool dragging = false; ///< When true, get average color for region on canvas, instead of a single point
46
47 double radius = 0.0;
50};
51
52} // namespace Inkscape::UI::Tools
53
54#endif // INKSCAPE_UI_TOOLS_DROPPER_TOOL_H
55
56/*
57 Local Variables:
58 mode:c++
59 c-file-style:"stroustrup"
60 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
61 indent-tabs-mode:nil
62 fill-column:99
63 End:
64*/
65// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
std::unique_ptr< T, CanvasItemUnlinkDeleter > CanvasItemPtr
Smart pointer used to hold CanvasItems, like std::unique_ptr.
Two-dimensional point that doubles as a vector.
Definition point.h:66
sigc::signal< void(Colors::Color const &)> onetimepick_signal
bool root_handler(CanvasEvent const &event) override
CanvasItemPtr< CanvasItemBpath > area
Circle depicting region's borders in dragging mode.
double radius
Size of region under dragging mode.
std::optional< Colors::Color > get_color(bool invert=false, bool non_dropping=false) const
Returns the current dropper context color.
std::optional< Colors::Color > stored_color
bool stroke
Set to stroke color. In dropping mode, set from stroke color.
bool invert
Set color to inverse rgb value.
bool dropping
When true, get color from selected objects instead of canvas.
std::optional< Colors::Color > non_dropping_color
Geom::Point centre
Center of region in dragging mode.
Base class for Event processors.
Definition tool-base.h:95
To do: update description of desktop.
Definition desktop.h:149
Helper class to stream background task notifications as a series of messages.
Abstract base class for events.
SPDesktop * desktop