7#include <glibmm/i18n.h>
29namespace LivePathEffect {
33 uri(
"Store the uri of mask",
"",
"uri", &wr, this,
"false", false),
34 invert(_(
"Invert mask"), _(
"Invert mask"),
"invert", &wr, this, false),
36 hide_mask(_(
"Hide mask"), _(
"Hide mask"),
"hide_mask", &wr, this, false),
37 background(_(
"Add background to mask"), _(
"Add background to mask"),
"background", &wr, this, false),
38 background_color(_(
"Background color and opacity"), _(
"Set color and opacity of the background"),
"background_color", &wr, this, Colors::
Color(0xffffffff))
60 for (
auto &lperef : path_effect_list) {
66 g_warning(
"SPLPEItem::performPathEffect - NULL lpeobj in list!");
76 item->removeCurrentPathEffect(
false);
78 Glib::ustring newmask =
getId();
79 Glib::ustring
uri = Glib::ustring(
"url(#") + newmask + Glib::ustring(
")");
94 Glib::ustring newmask =
getId();
95 Glib::ustring
uri = Glib::ustring(
"url(#") + newmask + Glib::ustring(
")");
113 }
else if (!
hide_mask && !mask && !uri_str.empty()) {
136 if (!document || !mask) {
144 item->removeCurrentPathEffect(
false);
153 if (!document || !mask) {
160 Glib::ustring mask_id =
getId();
161 Glib::ustring box_id = mask_id + (Glib::ustring)
"_box";
162 Glib::ustring filter_id = mask_id + (Glib::ustring)
"_inverse";
163 Glib::ustring filter_label = (Glib::ustring)
"filter" + mask_id;
164 Glib::ustring filter_uri = (Glib::ustring)
"url(#" + filter_id + (Glib::ustring)
")";
178 Glib::ustring primitive1_id = (mask_id + (Glib::ustring)
"_primitive1").c_str();
184 Glib::ustring primitive2_id = (mask_id + (Glib::ustring)
"_primitive2").c_str();
186 primitive2->
setAttribute(
"values",
"-1 0 0 0 1 0 -1 0 0 1 0 0 -1 0 1 0 0 0 1 0 ");
195 Glib::ustring g_data_id = mask_id + (Glib::ustring)
"_container";
197 std::vector<SPItem*> item_list = cast<SPGroup>(elemref)->item_list();
198 for (
auto iter : item_list) {
206 std::vector<SPObject*> mask_list = mask->
childList(
true);
207 for (
auto iter : mask_list) {
208 auto mask_data = cast<SPItem>(iter);
210 if (! strcmp(mask_data->getId(), box_id.c_str())){
213 Glib::ustring mask_data_id = (Glib::ustring)mask_data->getId();
219 if(!filter || !strcmp(filter, filter_uri.c_str())) {
225 Glib::ustring css_str;
247 if(!filter || !strcmp(filter, filter_uri.c_str())) {
291 Glib::ustring mask_id =
getId();
292 Glib::ustring filter_id = mask_id + (Glib::ustring)
"_inverse";
305 auto selList = sel->
items();
306 for(
auto i = boost::rbegin(selList); i != boost::rend(selList); ++i) {
307 auto lpeitem = cast<SPLPEItem>(*i);
309 SPMask *mask = lpeitem->getMaskObject();
312 Effect* lpe = lpeitem->getCurrentLPE();
328 auto selList = sel->
items();
329 for (
auto i = boost::rbegin(selList); i != boost::rend(selList); ++i) {
330 auto lpeitem = cast<SPLPEItem>(*i);
332 if (lpeitem->hasPathEffect() && lpeitem->pathEffectsEnabled()) {
334 for (
auto &lperef : path_effect_list) {
341 g_warning(
"SPLPEItem::performPathEffect - NULL lpeobj in list!");
345 lpeitem->setCurrentPathEffect(lperef);
346 lpeitem->removeCurrentPathEffect(
false);
TODO: insert short description here.
void expandBy(C amount)
Expand the rectangle in both directions by the specified amount.
Axis-aligned rectangle that can be empty.
Sequence of contiguous curves, aka spline.
void clear()
Remove all curves from the path.
Axis aligned, non-empty rectangle.
RAII-style mechanism for creating a temporary undo-insensitive context.
void param_setValue(bool newvalue)
std::optional< Colors::Color > get_value() const
void registerParameter(Parameter *param)
static void createAndApply(const char *name, SPDocument *doc, SPItem *item)
LivePathEffectObject * lpeobj
Inkscape::XML::Node * getRepr()
LivePathEffectObject * getLPEObj()
void param_setValue(Glib::ustring newvalue, bool write=false)
Glib::ustring param_getSVGValue() const override
LPEPowerMask(LivePathEffectObject *lpeobject)
void doEffect(Geom::PathVector &curve) override
std::optional< Colors::Color > previous_color
void doOnApply(SPLPEItem const *lpeitem) override
Is performed a single time when the effect is freshly applied to a path.
void doOnVisibilityToggled(SPLPEItem const *lpeitem) override
void doBeforeEffect(SPLPEItem const *lpeitem) override
Is performed each time before the effect is updated.
ColorPickerParam background_color
void doOnRemove(SPLPEItem const *) override
SPItemRange items()
Returns a range of selected SPItems.
bool isEmpty()
Returns true if no items are selected.
Preference storage class.
bool getBool(Glib::ustring const &pref_path, bool def=false)
Retrieve a Boolean value.
static Preferences * get()
Access the singleton Preferences object.
The set of selected SPObjects for a given document and layer model.
void detach()
Detaches from the currently attached URI target, if any; the current referrent is signaled as NULL.
bool try_attach(char const *uri)
Try to attach to a URI.
Interface for refcounted XML nodes.
virtual void setPosition(int pos)=0
Set the position of this node in parent's child order.
virtual void appendChild(Node *child)=0
Append a node as the last child of this node.
void setAttribute(Util::const_char_ptr key, Util::const_char_ptr value)
Change an attribute of this node.
virtual Node * duplicate(Document *doc) const =0
Create a duplicate of this node.
virtual char const * attribute(char const *key) const =0
Get the string representation of a node's attribute.
virtual void removeChild(Node *child)=0
Remove a child of this node.
Inkscape::LivePathEffect::EffectType effecttype
Typed SVG document implementation.
SPObject * getObjectById(std::string const &id) const
SPDefs * getDefs()
Return the main defs object for the document.
Inkscape::XML::Document * getReprDoc()
Our Inkscape::XML::Document.
SPMaskReference & getMaskRef()
SPMask * getMaskObject() const
Geom::OptRect visualBounds(Geom::Affine const &transform=Geom::identity(), bool wfilter=true, bool wclip=true, bool wmask=true) const
Get item's visual bounding box in this item's coordinate system.
bool hasPathEffect() const
bool pathEffectsEnabled() const
PathEffectList * path_effect_list
SPObject is an abstract base class of all of the document nodes at the SVG document level.
void setAttribute(Inkscape::Util::const_char_ptr key, Inkscape::Util::const_char_ptr value)
std::vector< SPObject * > childList(bool add_ref, Action action=ActionGeneral)
Retrieves the children as a std vector object, optionally ref'ing the children in the process,...
void deleteObject(bool propagate, bool propagate_descendants)
Deletes an object, unparenting it from its parent.
Inkscape::XML::Node * getRepr()
Returns the XML representation of tree.
char const * getAttribute(char const *name) const
SPObject * appendChildRepr(Inkscape::XML::Node *repr)
Append repr as child of this object.
void requestDisplayUpdate(unsigned int flags)
Queues an deferred update of this object's display.
std::shared_ptr< Css const > css
static R & release(R &r)
Decrements the reference count of a anchored object.
void sp_inverse_powermask(Inkscape::Selection *sel)
const EnumEffectDataConverter< EffectType > LPETypeConverter
defined in effect.cpp
void sp_remove_powermask(Inkscape::Selection *sel)
Helper class to stream background task notifications as a series of messages.
Singleton class to access the preferences file in a convenient way.
SPCSSAttr * sp_repr_css_attr_new()
Creates an empty SPCSSAttr (a class for manipulating CSS style properties).
void sp_repr_css_write_string(SPCSSAttr *css, Glib::ustring &str)
Write a style attribute string from a list of properties stored in an SPCSAttr object.
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...
void sp_repr_css_set_property_double(SPCSSAttr *css, gchar const *name, double value)
Set a style property to a new float value (e.g.
void sp_repr_css_attr_unref(SPCSSAttr *css)
Unreferences an SPCSSAttr (will be garbage collected if no references remain).
void sp_repr_css_set_property_string(SPCSSAttr *css, char const *name, std::string const &value)
Set a style property to a standard string.
char const * sp_repr_css_property(SPCSSAttr *css, gchar const *name, gchar const *defval)
Returns a character string of the value of a given style property or a default value if the attribute...
void sp_repr_css_set_property(SPCSSAttr *css, gchar const *name, gchar const *value)
Set a style property to a new value (e.g.
void sp_repr_css_attr_add_from_string(SPCSSAttr *css, gchar const *p)
Use libcroco to parse a string for CSS properties and then merge them into an existing SPCSSAttr.
std::list< PathEffectSharedPtr > PathEffectList
void invert(const double v[16], double alpha[16])
Interface for XML documents.
virtual Node * createElement(char const *name)=0
static void sp_svg_write_path(Inkscape::SVG::PathString &str, Geom::Path const &p, bool normalize=false)
TODO: insert short description here.
std::string extract_uri(char const *s, char const **endptr)
Parse functional URI notation, as per 4.3.4 of CSS 2.1.
URI functions as per 4.3.4 of CSS 2.1 http://www.w3.org/TR/CSS21/syndata.html#uri.