void nr_arena_group_set_style (NRArenaGroup *group, SPStyle *style) { g_return_if_fail(group != NULL); g_return_if_fail(NR_IS_ARENA_GROUP(group)); if (style) sp_style_ref(style); if (group->style) sp_style_unref(group->style); group->style = style; //if group has a filter if (style->filter.set && style->getFilter()) { if (!group->filter) { int primitives = sp_filter_primitive_count(SP_FILTER(style->getFilter())); group->filter = new Inkscape::Filters::Filter(primitives); } sp_filter_build_renderer(SP_FILTER(style->getFilter()), group->filter); } else { //no filter set for this group delete group->filter; group->filter = NULL; } if (style && style->enable_background.set && style->enable_background.value == SP_CSS_BACKGROUND_NEW) { group->background_new = true; } }
/** * Process information related to the new style. * * Note: _style is not used by DrawingGlyphs which uses its parent style. */ void DrawingItem::setStyle(SPStyle *style, SPStyle *context_style) { // std::cout << "DrawingItem::setStyle: " << name() << " " << style // << " " << context_style << std::endl; if( style != _style ) { if (style) sp_style_ref(style); if (_style) sp_style_unref(_style); _style = style; } if (style && style->filter.set && style->getFilter()) { if (!_filter) { int primitives = sp_filter_primitive_count(SP_FILTER(style->getFilter())); _filter = new Inkscape::Filters::Filter(primitives); } sp_filter_build_renderer(SP_FILTER(style->getFilter()), _filter); } else { // no filter set for this group delete _filter; _filter = NULL; } if (style && style->enable_background.set) { if (style->enable_background.value == SP_CSS_BACKGROUND_NEW && !_background_new) { _background_new = true; _markForUpdate(STATE_BACKGROUND, true); } else if (style->enable_background.value == SP_CSS_BACKGROUND_ACCUMULATE && _background_new) { _background_new = false; _markForUpdate(STATE_BACKGROUND, true); } } if (context_style != NULL) { _context_style = context_style; } else if (_parent != NULL) { _context_style = _parent->_context_style; } _markForUpdate(STATE_ALL, false); }