summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 1f938f7)
raw | patch | inline | side by side (parent: 1f938f7)
| author | johanengelen <johanengelen@users.sourceforge.net> | |
| Wed, 13 Dec 2006 20:42:26 +0000 (20:42 +0000) | ||
| committer | johanengelen <johanengelen@users.sourceforge.net> | |
| Wed, 13 Dec 2006 20:42:26 +0000 (20:42 +0000) |
| src/sp-item-group.cpp | patch | blob | history | |
| src/sp-item.cpp | patch | blob | history | |
| src/sp-item.h | patch | blob | history |
diff --git a/src/sp-item-group.cpp b/src/sp-item-group.cpp
index ba96ed0d1b37364187bff01509aca25bdf3ac2b5..5cbf68fff2eea21c878dbf1b6b1ce534c9cf8e4f 100644 (file)
--- a/src/sp-item-group.cpp
+++ b/src/sp-item-group.cpp
* Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
* bulia byak <buliabyak@users.sf.net>
+ * Johan Engelen <j.b.c.engelen@ewi.utwente.nl>
*
- * Copyright (C) 1999-2005 authors
+ * Copyright (C) 1999-2006 authors
* Copyright (C) 2000-2001 Ximian, Inc.
*
* Released under GNU GPL, read the file 'COPYING' for more information
// fill in the children list if non-null
SPItem *item = (SPItem *) doc->getObjectByRepr(repr);
- /* Optimize the transform matrix if requested. */
- // No compensations are required because this is supposed to be a non-transformation visually.
- // FIXME: this if is wholly lifted from sp_item_write_transform and should stay in sync
- NR::Matrix transform_attr (item->transform);
- if ( // run the object's set_transform (i.e. embed transform) only if:
- ((SPItemClass *) G_OBJECT_GET_CLASS(item))->set_transform && // it does have a set_transform method
- !preserve && // user did not chose to preserve all transforms
- !item->clip_ref->getObject() && // the object does not have a clippath
- !item->mask_ref->getObject() && // the object does not have a mask
- !(!transform_attr.is_translation() && SP_OBJECT_STYLE(item) && SP_OBJECT_STYLE(item)->filter.filter)
- // the object does not have a filter, or the transform is translation (which is supposed to not affect filters)
- ) {
- transform_attr = ((SPItemClass *) G_OBJECT_GET_CLASS(item))->set_transform(item, item->transform);
- }
- sp_item_set_item_transform(item, transform_attr);
-
+ sp_item_write_transform(item, repr, item->transform, NULL, false);
+
Inkscape::GC::release(repr);
if (children && SP_IS_ITEM (item))
*children = g_slist_prepend (*children, item);
diff --git a/src/sp-item.cpp b/src/sp-item.cpp
index 5a138c866082a1f759dc64125979510094ba50c2..e5e2bb0853492b17b03f90456419ef2d33f803b1 100644 (file)
--- a/src/sp-item.cpp
+++ b/src/sp-item.cpp
* Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
* bulia byak <buliabyak@users.sf.net>
+ * Johan Engelen <j.b.c.engelen@ewi.utwente.nl>
*
- * Copyright (C) 2001-2005 authors
+ * Copyright (C) 2001-2006 authors
* Copyright (C) 2001 Ximian, Inc.
*
* Released under GNU GPL, read the file 'COPYING' for more information
@@ -1180,7 +1181,7 @@ sp_item_write_transform(SPItem *item, Inkscape::XML::Node *repr, NRMatrix const
* the repr is updated with the new transform.
*/
void
-sp_item_write_transform(SPItem *item, Inkscape::XML::Node *repr, NR::Matrix const &transform, NR::Matrix const *adv)
+sp_item_write_transform(SPItem *item, Inkscape::XML::Node *repr, NR::Matrix const &transform, NR::Matrix const *adv, bool compensate)
{
g_return_if_fail(item != NULL);
g_return_if_fail(SP_IS_ITEM(item));
@@ -1193,31 +1194,35 @@ sp_item_write_transform(SPItem *item, Inkscape::XML::Node *repr, NR::Matrix cons
} else {
advertized_transform = sp_item_transform_repr (item).inverse() * transform;
}
-
- // recursively compensate for stroke scaling, depending on user preference
- if (prefs_get_int_attribute("options.transform", "stroke", 1) == 0) {
- double const expansion = 1. / NR::expansion(advertized_transform);
- sp_item_adjust_stroke_width_recursive(item, expansion);
- }
-
- // recursively compensate rx/ry of a rect if requested
- if (prefs_get_int_attribute("options.transform", "rectcorners", 1) == 0) {
- sp_item_adjust_rects_recursive(item, advertized_transform);
- }
-
- // recursively compensate pattern fill if it's not to be transformed
- if (prefs_get_int_attribute("options.transform", "pattern", 1) == 0) {
- sp_item_adjust_paint_recursive (item, advertized_transform.inverse(), NR::identity(), true);
- }
- /// \todo FIXME: add the same else branch as for gradients below, to convert patterns to userSpaceOnUse as well
- /// recursively compensate gradient fill if it's not to be transformed
- if (prefs_get_int_attribute("options.transform", "gradient", 1) == 0) {
- sp_item_adjust_paint_recursive (item, advertized_transform.inverse(), NR::identity(), false);
- } else {
- // this converts the gradient/pattern fill/stroke, if any, to userSpaceOnUse; we need to do
- // it here _before_ the new transform is set, so as to use the pre-transform bbox
- sp_item_adjust_paint_recursive (item, NR::identity(), NR::identity(), false);
- }
+
+ if (compensate) {
+
+ // recursively compensate for stroke scaling, depending on user preference
+ if (prefs_get_int_attribute("options.transform", "stroke", 1) == 0) {
+ double const expansion = 1. / NR::expansion(advertized_transform);
+ sp_item_adjust_stroke_width_recursive(item, expansion);
+ }
+
+ // recursively compensate rx/ry of a rect if requested
+ if (prefs_get_int_attribute("options.transform", "rectcorners", 1) == 0) {
+ sp_item_adjust_rects_recursive(item, advertized_transform);
+ }
+
+ // recursively compensate pattern fill if it's not to be transformed
+ if (prefs_get_int_attribute("options.transform", "pattern", 1) == 0) {
+ sp_item_adjust_paint_recursive (item, advertized_transform.inverse(), NR::identity(), true);
+ }
+ /// \todo FIXME: add the same else branch as for gradients below, to convert patterns to userSpaceOnUse as well
+ /// recursively compensate gradient fill if it's not to be transformed
+ if (prefs_get_int_attribute("options.transform", "gradient", 1) == 0) {
+ sp_item_adjust_paint_recursive (item, advertized_transform.inverse(), NR::identity(), false);
+ } else {
+ // this converts the gradient/pattern fill/stroke, if any, to userSpaceOnUse; we need to do
+ // it here _before_ the new transform is set, so as to use the pre-transform bbox
+ sp_item_adjust_paint_recursive (item, NR::identity(), NR::identity(), false);
+ }
+
+ } // endif(compensate)
gint preserve = prefs_get_int_attribute("options.preservetransform", "value", 0);
NR::Matrix transform_attr (transform);
diff --git a/src/sp-item.h b/src/sp-item.h
index 43d2d8aa3f67685d15c07077dccf5c4a2e2a1e98..fc368d5b9223ffad5c13b0bf215dc6703b0ea82d 100644 (file)
--- a/src/sp-item.h
+++ b/src/sp-item.h
* Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
* bulia byak <buliabyak@users.sf.net>
+ * Johan Engelen <j.b.c.engelen@ewi.utwente.nl>
*
- * Copyright (C) 1999-2005 authors
+ * Copyright (C) 1999-2006 authors
* Copyright (C) 2001-2002 Ximian, Inc.
* Copyright (C) 2004 Monash University
*
void sp_item_adjust_paint_recursive(SPItem *item, NR::Matrix advertized_transform, NR::Matrix t_ancestors, bool is_pattern);
void sp_item_write_transform(SPItem *item, Inkscape::XML::Node *repr, NRMatrix const *transform, NR::Matrix const *adv = NULL);
-void sp_item_write_transform(SPItem *item, Inkscape::XML::Node *repr, NR::Matrix const &transform, NR::Matrix const *adv = NULL);
+void sp_item_write_transform(SPItem *item, Inkscape::XML::Node *repr, NR::Matrix const &transform, NR::Matrix const *adv = NULL, bool compensate = true);
void sp_item_set_item_transform(SPItem *item, NR::Matrix const &transform);