59 double width =
module->get_param_float("blur-width");
60 int steps =
module->get_param_int("num-steps");
63 double old_offset = prefs->
getDouble(
"/options/defaultoffsetwidth/value", 1.0,
"px");
66 std::vector<SPItem*>
items(selection->
items().begin(), selection->
items().end());
69 for(
auto spitem :
items) {
70 std::vector<Inkscape::XML::Node *> new_items(steps);
76 char opacity_string[64];
77 g_ascii_formatd(opacity_string,
sizeof(opacity_string),
"%f",
78 orig_opacity / (steps));
80 for (
int i = 0; i < steps; i++) {
83 new_items[i] = spitem->getRepr()->duplicate(xml_doc);
90 selection->
add(new_items[i]);
100 }
else if (
offset > 0.0) {
111 prefs->
setDoubleUnit(
"/options/defaultoffsetwidth/value", old_offset,
"px");
122 return module->autogui(nullptr, nullptr, changeSignal);
132 "<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI
"\">\n"
133 "<name>" N_(
"Inset/Outset Halo")
"</name>\n"
134 "<id>org.inkscape.effect.bluredge</id>\n"
135 "<param name=\"blur-width\" gui-text=\"" N_(
"Width:")
"\" gui-description=\"" N_(
"Width in px of the halo")
"\" type=\"float\" min=\"1.0\" max=\"50.0\">1.0</param>\n"
136 "<param name=\"num-steps\" gui-text=\"" N_(
"Number of steps:")
"\" gui-description=\"" N_(
"Number of inset/outset copies of the object to make")
"\" type=\"int\" min=\"5\" max=\"100\">11</param>\n"
138 "<object-type>all</object-type>\n"
140 "<submenu name=\"" N_(
"Generate from Path")
"\" />\n"
143 "</inkscape-extension>\n" , std::make_unique<BlurEdge>());
Effects are extensions that take a document and do something to it in place.
The object that is the basis for the Extension system.
A cache for the document and this implementation.
void effect(Inkscape::Extension::Effect *module, ExecutionEnv *executionEnv, SPDesktop *desktop, Inkscape::Extension::Implementation::ImplementationDocumentCache *docCache) override
This actually blurs the edge.
bool load(Inkscape::Extension::Extension *module) override
A function to allocated anything – just an example here.
Gtk::Widget * prefs_effect(Inkscape::Extension::Effect *module, SPDesktop *desktop, sigc::signal< void()> *changeSignal, Inkscape::Extension::Implementation::ImplementationDocumentCache *docCache) override
Find out information about the file.
SPItemRange items()
Returns a range of selected SPItems.
void removeLPESRecursive(bool keep_paths)
void clear()
Unselects all selected objects.
void toCurves(bool skip_undo=false, bool clonesjustunlink=false)
bool unlinkRecursive(const bool skip_undo=false, const bool force=false, const bool silent=false)
Recursively unlink any clones present in the current selection, including clones which are used to cl...
Preference storage class.
void setDoubleUnit(Glib::ustring const &pref_path, double value, Glib::ustring const &unit_abbr)
Set a floating point value with unit.
double getDouble(Glib::ustring const &pref_path, double def=0.0, Glib::ustring const &unit="")
Retrieve a floating point value.
static Preferences * get()
Access the singleton Preferences object.
The set of selected SPObjects for a given document and layer model.
void add(XML::Node *repr)
Add an XML node's SPObject to the set of selected objects.
Interface for refcounted XML nodes.
virtual Node * parent()=0
Get the parent of this node.
virtual void appendChild(Node *child)=0
Append a node as the last child of this node.
To do: update description of desktop.
Inkscape::Selection * getSelection() const
Inkscape::XML::Document * getReprDoc()
Our Inkscape::XML::Document.
A way to clear the N_ macro, which is defined as an inline function.
std::shared_ptr< Css const > css
Editable view implementation.
void build_from_mem(gchar const *buffer, std::unique_ptr< Implementation::Implementation > in_imp)
Create a module from a buffer holding an XML description.
static R & release(R &r)
Decrements the reference count of a anchored object.
Helper class to stream background task notifications as a series of messages.
void sp_selected_path_offset(SPDesktop *desktop)
void sp_selected_path_inset(SPDesktop *desktop)
Singleton class to access the preferences file in a convenient way.
void sp_repr_css_change(Node *repr, SPCSSAttr *css, gchar const *attr)
Creates a new SPCSAttr with the values filled from a repr, merges in properties from the given SPCSAt...
double sp_repr_css_double_property(SPCSSAttr *css, gchar const *name, double defval)
Return the value of a style property if property define, or a default value if not.
SPCSSAttr * sp_repr_css_attr(Node const *repr, gchar const *attr)
Creates a new SPCSSAttr with one attribute (i.e.
void sp_repr_css_set_property(SPCSSAttr *css, gchar const *name, gchar const *value)
Set a style property to a new value (e.g.
Some things pertinent to all visible shapes: SPItem, SPItemView, SPItemCtx.
Interface for XML documents.
virtual Node * createElement(char const *name)=0