61 g_return_val_if_fail(document !=
nullptr, NULL);
88 g_assert(f !=
nullptr);
115 repr->
setAttribute(
"kernelMatrix",
"0 0 0 0 0 0 0 0 0");
155 g_assert(prim !=
nullptr);
166 g_return_val_if_fail(document !=
nullptr, NULL);
192 double stdDeviation = radius;
194 stdDeviation /= expansion;
211 g_assert(f !=
nullptr);
212 g_assert(b !=
nullptr);
225 g_return_val_if_fail(document !=
nullptr, NULL);
258 double stdDeviation = radius;
260 stdDeviation /= expansion;
270 g_assert(b !=
nullptr);
273 if(strcmp(blendmode,
"normal")) {
286 if (!
root->attribute(
"enable-background")) {
291 g_assert(b !=
nullptr);
294 g_assert(f !=
nullptr);
345 double expansion = i2d.
descrim();
346 double stdDeviation = radius;
348 stdDeviation /= expansion;
358 if (strcmp(
"svg:feGaussianBlur", primitive->
name()) == 0) {
362 primitive = primitive->
next();
397 if (filt && filt->
getId()) {
398 Glib::ustring filter = filt->
getId();
399 if (!filter.rfind(
"selectable_hidder_filter", 0)) {
408 if (filt && filt->
getId()) {
409 Glib::ustring filter = filt->
getId();
410 if (!filter.rfind(
"selectable_hidder_filter", 0)) {
431 if (strcmp(
"svg:feGaussianBlur", primitive->
name()) == 0) {
435 primitive = primitive->
next();
460 size_t blurcount = 0;
461 size_t blendcount = 0;
466 auto primitive = cast<SPFilterPrimitive>(&primitive_obj);
468 if (is<SPFeBlend>(primitive)) {
469 blend = cast<SPFeBlend>(primitive);
472 if (is<SPGaussianBlur>(primitive)) {
478 if (blend && total == 2 && blurcount == 1) {
480 }
else if (total == 1 && blurcount != 1) {
498 size_t blurcount = 0;
499 size_t blendcount = 0;
503 auto primitive = cast<SPFilterPrimitive>(&primitive_obj);
505 auto spblend = cast<SPFeBlend>(primitive);
508 blend = spblend->get_blend_mode();
510 if (is<SPGaussianBlur>(primitive)) {
516 if (!((blend && total == 2 && blurcount == 1) || total == 1)) {
525 return (filter->
children.size() == 1 &&
526 is<SPGaussianBlur>(&filter->
children.front()));
532 is<SPGaussianBlur>(&filter->
children.front())) {
534 auto gb = cast<SPGaussianBlur>(filter->
firstChild());
535 double x = gb->get_std_deviation().getNumber();
536 double y = gb->get_std_deviation().getOptNumber();
537 if (x > 0 && y > 0) {
563 item->
updateRepr(SP_OBJECT_WRITE_NO_CHILDREN | SP_OBJECT_WRITE_EXT);
3x3 matrix representing an affine transformation.
Coord descrim() const
Calculate the descriminant.
const Glib::ustring & get_key(const E id) const
Interface for refcounted XML nodes.
virtual Node * next()=0
Get the next sibling of this node.
virtual void appendChild(Node *child)=0
Append a node as the last child of this node.
virtual char const * name() const =0
Get the name of the element 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 Node * firstChild()=0
Get the first child of this node.
virtual unsigned childCount() const =0
Get the number of children of this node.
bool setAttributeSvgDouble(Util::const_char_ptr key, double val)
For attributes where an exponent is allowed.
virtual Node * root()=0
Get the root node of this node's document.
Typed SVG document implementation.
SPDefs * getDefs()
Return the main defs object for the document.
Inkscape::XML::Document * getReprDoc()
Our Inkscape::XML::Document.
SPObject * getObjectByRepr(Inkscape::XML::Node *repr) const
Base class for visual SVG elements.
Geom::Affine i2dt_affine() const
Returns the transformation from item to desktop coords.
SPObject is an abstract base class of all of the document nodes at the SVG document level.
void appendChild(Inkscape::XML::Node *child)
char const * getId() const
Returns the objects current ID string.
SPStyle * style
Represents the style properties, whether from presentation attributes, the style attribute,...
Inkscape::XML::Node * updateRepr(unsigned int flags=SP_OBJECT_WRITE_EXT)
Updates the object's repr based on the object's state.
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.
T< SPAttr::ISOLATION, SPIEnum< SPIsolation > > isolation
mix-blend-mode: CSS Compositing and Blending Level 1
T< SPAttr::MIX_BLEND_MODE, SPIEnum< SPBlendMode > > mix_blend_mode
T< SPAttr::FILTER, SPIFilter > filter
Filter effect.
std::shared_ptr< Css const > css
bool filter_is_single_gaussian_blur(SPFilter *filter)
static guint count_filter_hrefs(SPObject *o, SPFilter *filter)
Count how many times the filter is used by the styles of o and its descendants.
static SPFilter * new_filter_blend_gaussian_blur(SPDocument *document, const char *blendmode, gdouble radius, double expansion)
Creates a simple filter with a blend primitive and a blur primitive of specified radius for an item w...
SPBlendMode filter_get_legacy_blend(SPObject *item)
Get if the filter have a < 1.0 blending filter @params: the item to get filtered blend.
SPFilter * new_filter_gaussian_blur(SPDocument *document, gdouble radius, double expansion)
Creates a filter with blur primitive of specified radius for an item with the given matrix expansion,...
void remove_filter_legacy_blend(SPObject *item)
Removes blend primitive from the filter attached to given item.
void remove_filter_gaussian_blur(SPObject *item)
Removes the first feGaussianBlur from the filter attached to given item.
bool has_hidder_filter(SPObject const *item)
double get_single_gaussian_blur_radius(SPFilter *filter)
void remove_filter(SPObject *item, bool recursive)
bool set_blend_mode(SPItem *item, SPBlendMode blend_mode)
SPFilterPrimitive * filter_add_primitive(SPFilter *filter, const Inkscape::Filters::FilterPrimitiveType type)
SPFilter * new_filter(SPDocument *document)
SPFilter * new_filter_simple_from_item(SPDocument *document, SPItem *item, const char *mode, gdouble radius)
Creates a simple filter for the given item with blend and blur primitives, using the specified mode a...
void remove_hidder_filter(SPObject *item)
SPFilter * modify_filter_gaussian_blur_from_item(SPDocument *document, SPItem *item, gdouble radius)
Modifies the gaussian blur applied to the item.
const EnumDataConverter< Inkscape::Filters::FilterPrimitiveType > FPConverter(FPData, Inkscape::Filters::NR_FILTER_ENDPRIMITIVETYPE)
SVG Gaussian blur filter effect.
@ NR_FILTER_COMPONENTTRANSFER
@ NR_FILTER_DISPLACEMENTMAP
@ NR_FILTER_SPECULARLIGHTING
@ NR_FILTER_DIFFUSELIGHTING
@ NR_FILTER_CONVOLVEMATRIX
static R & release(R &r)
Decrements the reference count of a anchored object.
SPCSSAttr * sp_repr_css_attr_new()
Creates an empty SPCSSAttr (a class for manipulating CSS style properties).
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_attr_unref(SPCSSAttr *css)
Unreferences an SPCSSAttr (will be garbage collected if no references remain).
void sp_repr_css_change_recursive(Node *repr, SPCSSAttr *css, gchar const *attr)
void sp_repr_css_unset_property(SPCSSAttr *css, gchar const *name)
Set a style property to "inkscape:unset".
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_unparent(Inkscape::XML::Node *repr)
Remove repr from children of its parent node.
Some things pertinent to all visible shapes: SPItem, SPItemView, SPItemCtx.
Interface for XML documents.
virtual Node * createElement(char const *name)=0
@ SP_CSS_ISOLATION_ISOLATE
SPStyle - a style object for SPItem objects.