sp-item.cpp revision 34521350d3cff94d8cf939eceb15d17dc05b52b8
691N/A#ifdef HAVE_CONFIG_H
691N/A#include "display/drawing-item.h"
691N/A#include "attributes.h"
691N/A#include "document.h"
691N/A#include "inkscape.h"
691N/A#include "desktop-handles.h"
691N/A#include "sp-clippath.h"
691N/A#include "sp-item-rm-unsatisfied-cns.h"
691N/A#include "sp-pattern.h"
691N/A#include "sp-paint-server.h"
691N/A#include "sp-switch.h"
691N/A#include "sp-guide-constraint.h"
691N/A#include "gradient-chemistry.h"
691N/A#include "preferences.h"
691N/A#include "conn-avoid-ref.h"
691N/A#include "conditions.h"
691N/A#include "sp-filter-reference.h"
691N/A#include "filter-chemistry.h"
691N/A#include "sp-guide.h"
691N/A#include "sp-title.h"
691N/A#include "util/find-last-if.h"
691N/A#include "util/reverse-list.h"
691N/A#include "extract-uri.h"
691N/A#include "live_effects/lpeobject.h"
691N/A#include "live_effects/effect.h"
691N/A#include "live_effects/lpeobject-reference.h"
691N/A#define noSP_ITEM_DEBUG_IDLE
691N/A sizeof(SPItemClass),
691N/A transform_center_x = 0;
691N/A transform_center_y = 0;
691N/A _is_evaluated = true;
691N/A freeze_stroke_width = false;
691N/A updateRepr();
691N/A if (!isEvaluated())
691N/A updateRepr();
691N/A if (!isEvaluated())
691N/A return _is_evaluated;
691N/A updateRepr();
691N/A * Sets the transform_center_x and transform_center_y properties to retain the rotation centre
691N/A transform_center_x = 0;
691N/A transform_center_y = 0;
691N/A transform_center_x = 0;
691N/A transform_center_y = 0;
691N/A if (next_higher) {
691N/A if (next_lower) {
691N/A ++next_lower;
691N/A case SP_ATTR_TRANSFORM: {
691N/A case SP_PROP_CLIP_PATH: {
691N/A case SP_PROP_MASK: {
691N/A SPItemView *v;
691N/A // any of the modifications defined in sp-object.h might change bbox,
691N/A if (flags & (SP_OBJECT_CHILD_MODIFIED_FLAG | SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG)) {
691N/AInkscape::XML::Node *SPItem::sp_item_write(SPObject *const object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags)
691N/A bbox = ((SPItemClass *) G_OBJECT_GET_CLASS(this))->bbox(this, transform, SPItem::GEOMETRIC_BBOX);
691N/A if ( style && style->filter.href && style->getFilter() && SP_IS_FILTER(style->getFilter())) {
691N/A bbox = ((SPItemClass *) G_OBJECT_GET_CLASS(this))->bbox(this, Geom::identity(), SPItem::VISUAL_BBOX);
691N/A bbox = ((SPItemClass *) G_OBJECT_GET_CLASS(this))->bbox(this, transform, SPItem::VISUAL_BBOX);
691N/A if (!bbox_valid) {
691N/A bbox_valid = true;
691N/A return documentGeometricBounds();
691N/A return documentVisualBounds();
691N/A return desktopGeometricBounds();
691N/A return desktopVisualBounds();
691N/Avoid SPItem::sp_item_private_snappoints(SPItem const *item, std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs)
691N/A * see for example sp_genericellipse_snappoints in sp-ellipse.cpp
691N/Avoid SPItem::getSnappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs) const
691N/A if (snapprefs != NULL && snapprefs->isTargetSnappable(Inkscape::SNAPTARGET_ROTATION_CENTER)) {
691N/A p.push_back(Inkscape::SnapCandidatePoint(getCenter(), Inkscape::SNAPSOURCE_ROTATION_CENTER, Inkscape::SNAPTARGET_ROTATION_CENTER));
691N/A for (std::list<SPObject const *>::const_iterator o = clips_and_masks.begin(); o != clips_and_masks.end(); o++) {
691N/A for (std::vector<Inkscape::SnapCandidatePoint>::const_iterator p_orig = p_clip_or_mask.begin(); p_orig != p_clip_or_mask.end(); p_orig++) {
691N/A p.push_back(Inkscape::SnapCandidatePoint(pt, (*p_orig).getSourceType(), (*p_orig).getTargetType()));
691N/AInkscape::DrawingItem *SPItem::invoke_show(Inkscape::Drawing &drawing, unsigned key, unsigned flags)
691N/A SPGradient *gradient = sp_gradient_convert_to_userspace( SP_GRADIENT(server), this, "fill" );
691N/A SPGradient *gradient = sp_gradient_convert_to_userspace( SP_GRADIENT(server), this, "stroke");
691N/A if (freeze_stroke_width) {
691N/A updateRepr();
691N/A if (SP_IS_ITEM(o)) {
691N/A if (SP_IS_ITEM(o)) {
691N/A if (SP_IS_ITEM(o))
691N/Avoid SPItem::adjust_paint_recursive (Geom::Affine advertized_transform, Geom::Affine t_ancestors, bool is_pattern)
691N/A// _After_ full pattern/gradient transform: t_paint_new * t_item * t_ancestors * advertised_transform
691N/A Geom::Affine paint_delta = t_item * t_ancestors * advertized_transform * t_ancestors.inverse() * t_item.inverse();
691N/A// Within text, we do not fork gradients, and so must not recurse to avoid double compensation;
691N/A if (SP_IS_ITEM(o)) {
691N/A// and paintservers on leaves inheriting their values from ancestors could adjust themselves properly
691N/A if (is_pattern) {
691N/A if ( SP_IS_LPE_ITEM(this) ) {
691N/Avoid SPItem::doWriteTransform(Inkscape::XML::Node *repr, Geom::Affine const &transform, Geom::Affine const *adv, bool compensate)
691N/A if (compensate) {
691N/A // recursively compensating for stroke scaling will not work, because it can be scaled to zero or infinite
691N/A // from which we cannot ever recover by applying an inverse scale; therefore we temporarily block any changes
691N/A // (as reported in https://bugs.launchpad.net/inkscape/+bug/825840/comments/4)
691N/A // This will only work if the item has a set_transform method (in this method adjust_stroke() will be called)
691N/A // We will still have to apply the inverse scaling to other items, not having a set_transform method
691N/A /// \todo FIXME: add the same else branch as for gradients below, to convert patterns to userSpaceOnUse as well
691N/A ((SPItemClass *) G_OBJECT_GET_CLASS(this))->set_transform && // it does have a set_transform method
691N/A !(!transform.isTranslation() && style && style->getFilter()) // the object does not have a filter, or the transform is translation (which is supposed to not affect filters)
691N/A freeze_stroke_width_recursive(false);
691N/A freeze_stroke_width_recursive(false);
691N/A if (compensate) {
691N/A // (As to why we need to do this, see the comment a few lines above near the freeze_stroke_width_recursive(true) call)
691N/A updateRepr();
691N/A sp_item_rm_unsatisfied_cns(*this);
691N/A * Returns the accumulated transformation of the item and all its ancestors, including root's viewport.
691N/ASPItemView *SPItem::sp_item_view_new_prepend(SPItemView *list, SPItem *item, unsigned flags, unsigned key, Inkscape::DrawingItem *drawing_item)