1 // SPDX-License-Identifier: GPL-2.0-or-later
2 #ifndef __SP_SPRAY_CONTEXT_H__
3 #define __SP_SPRAY_CONTEXT_H__
4 
5 /*
6  * Spray Tool
7  *
8  * Authors:
9  *   Pierre-Antoine MARC
10  *   Pierre CACLIN
11  *   Aurel-Aimé MARMION
12  *   Julien LERAY
13  *   Benoît LAVORATA
14  *   Vincent MONTAGNE
15  *   Pierre BARBRY-BLOT
16  *   Jabiertxo ARRAIZA
17  *   Adrian Boguszewski
18  *
19  * Copyright (C) 2009 authors
20  *
21  * Released under GNU GPL v2+, read the file 'COPYING' for more information.
22  */
23 
24 #include <2geom/point.h>
25 #include "ui/tools/tool-base.h"
26 #include "object/object-set.h"
27 
28 #define SP_SPRAY_CONTEXT(obj) (dynamic_cast<Inkscape::UI::Tools::SprayTool*>((Inkscape::UI::Tools::ToolBase*)obj))
29 #define SP_IS_SPRAY_CONTEXT(obj) (dynamic_cast<const Inkscape::UI::Tools::SprayTool*>((const Inkscape::UI::Tools::ToolBase*)obj) != NULL)
30 
31 namespace Inkscape {
32   class CanvasItemBpath;
33   namespace UI {
34       namespace Dialog {
35           class Dialog;
36       }
37   }
38 }
39 
40 
41 #define SAMPLING_SIZE 8        /* fixme: ?? */
42 
43 #define TC_MIN_PRESSURE      0.0
44 #define TC_MAX_PRESSURE      1.0
45 #define TC_DEFAULT_PRESSURE  0.35
46 
47 namespace Inkscape {
48 namespace UI {
49 namespace Tools {
50 
51 enum {
52     SPRAY_MODE_COPY,
53     SPRAY_MODE_CLONE,
54     SPRAY_MODE_SINGLE_PATH,
55     SPRAY_MODE_ERASER,
56     SPRAY_OPTION,
57 };
58 
59 class SprayTool : public ToolBase {
60 public:
61     SprayTool();
62     ~SprayTool() override;
63 
64     //ToolBase event_context;
65     /* extended input data */
66     gdouble pressure;
67 
68     /* attributes */
69     bool dragging;           /* mouse state: mouse is dragging */
70     bool usepressurewidth;
71     bool usepressurepopulation;
72     bool usepressurescale;
73     bool usetilt;
74     bool usetext;
75 
76     double width;
77     double ratio;
78     double tilt;
79     double rotation_variation;
80     double population;
81     double scale_variation;
82     double scale;
83     double mean;
84     double standard_deviation;
85 
86     gint distrib;
87 
88     gint mode;
89 
90     bool is_drawing;
91 
92     bool is_dilating;
93     bool has_dilated;
94     Geom::Point last_push;
95     Inkscape::CanvasItemBpath *dilate_area;
96     bool no_overlap;
97     bool picker;
98     bool pick_center;
99     bool pick_inverse_value;
100     bool pick_fill;
101     bool pick_stroke;
102     bool pick_no_overlap;
103     bool over_transparent;
104     bool over_no_transparent;
105     double offset;
106     int pick;
107     bool do_trace;
108     bool pick_to_size;
109     bool pick_to_presence;
110     bool pick_to_color;
111     bool pick_to_opacity;
112     bool invert_picked;
113     double gamma_picked;
114     double rand_picked;
115     sigc::connection style_set_connection;
116 
117     static const std::string prefsPath;
118 
119     void setup() override;
120     void set(const Inkscape::Preferences::Entry& val) override;
121     virtual void setCloneTilerPrefs();
122     bool root_handler(GdkEvent* event) override;
123 
124     const std::string& getPrefsPath() override;
125 
126     void update_cursor(bool /*with_shift*/);
127 
objectSet()128     ObjectSet* objectSet() {
129         return &object_set;
130     }
131 
132 private:
133     ObjectSet object_set;
134 };
135 
136 }
137 }
138 }
139 
140 #endif
141 
142 /*
143   Local Variables:
144   mode:c++
145   c-file-style:"stroustrup"
146   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
147   indent-tabs-mode:nil
148   fill-column:99
149   End:
150 */
151 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
152 
153