diff --git a/src/marker.cpp b/src/marker.cpp
index 2efcde1b99e6b03b5c22192cfcfbc09c29939b73..0ec92a1ff2147b00573ad9703e86d10a7628083c 100644 (file)
--- a/src/marker.cpp
+++ b/src/marker.cpp
-#define __MARKER_C__
-
/*
* SVG <marker> implementation
*
* Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
* Bryce Harrington <bryce@bryceharrington.org>
+ * Abhishek Sharma
*
* Copyright (C) 1999-2003 Lauris Kaplinski
* 2004-2006 Bryce Harrington
static void sp_marker_class_init (SPMarkerClass *klass);
static void sp_marker_init (SPMarker *marker);
-static void sp_marker_build (SPObject *object, Document *document, Inkscape::XML::Node *repr);
+static void sp_marker_build (SPObject *object, SPDocument *document, Inkscape::XML::Node *repr);
static void sp_marker_release (SPObject *object);
static void sp_marker_set (SPObject *object, unsigned int key, const gchar *value);
static void sp_marker_update (SPObject *object, SPCtx *ctx, guint flags);
* \see sp_object_build()
*/
static void
-sp_marker_build (SPObject *object, Document *document, Inkscape::XML::Node *repr)
+sp_marker_build (SPObject *object, SPDocument *document, Inkscape::XML::Node *repr)
{
SPGroup *group;
SPMarker *marker;
@@ -141,14 +140,14 @@ sp_marker_build (SPObject *object, Document *document, Inkscape::XML::Node *repr
group = (SPGroup *) object;
marker = (SPMarker *) object;
- sp_object_read_attr (object, "markerUnits");
- sp_object_read_attr (object, "refX");
- sp_object_read_attr (object, "refY");
- sp_object_read_attr (object, "markerWidth");
- sp_object_read_attr (object, "markerHeight");
- sp_object_read_attr (object, "orient");
- sp_object_read_attr (object, "viewBox");
- sp_object_read_attr (object, "preserveAspectRatio");
+ object->readAttr( "markerUnits" );
+ object->readAttr( "refX" );
+ object->readAttr( "refY" );
+ object->readAttr( "markerWidth" );
+ object->readAttr( "markerHeight" );
+ object->readAttr( "orient" );
+ object->readAttr( "viewBox" );
+ object->readAttr( "preserveAspectRatio" );
if (((SPObjectClass *) parent_class)->build)
((SPObjectClass *) parent_class)->build (object, document, repr);
}
}
- {
- Geom::Matrix q;
- /* Compose additional transformation from scale and position */
- q[0] = width / vb.width();
- q[1] = 0.0;
- q[2] = 0.0;
- q[3] = height / vb.height();
- q[4] = -vb.min()[Geom::X] * q[0] + x;
- q[5] = -vb.min()[Geom::Y] * q[3] + y;
- /* Append viewbox transformation */
- marker->c2p = q * marker->c2p;
- }
-
- /* Append reference translation */
- /* fixme: lala (Lauris) */
- marker->c2p = Geom::Translate(-marker->refX.computed, -marker->refY.computed) * marker->c2p;
+ // viewbox transformation and reference translation
+ marker->c2p = Geom::Translate(-marker->refX.computed, -marker->refY.computed) *
+ Geom::Scale(width / vb.width(), height / vb.height());
rctx.i2doc = marker->c2p * rctx.i2doc;
@@ -537,8 +523,10 @@ sp_marker_write (SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::X
repr->setAttribute("orient", NULL);
}
/* fixme: */
- repr->setAttribute("viewBox", object->repr->attribute("viewBox"));
- repr->setAttribute("preserveAspectRatio", object->repr->attribute("preserveAspectRatio"));
+ //XML Tree being used directly here while it shouldn't be....
+ repr->setAttribute("viewBox", object->getRepr()->attribute("viewBox"));
+ //XML Tree being used directly here while it shouldn't be....
+ repr->setAttribute("preserveAspectRatio", object->getRepr()->attribute("preserveAspectRatio"));
if (((SPObjectClass *) (parent_class))->write)
((SPObjectClass *) (parent_class))->write (object, xml_doc, repr, flags);
@@ -722,11 +710,10 @@ sp_marker_view_remove (SPMarker *marker, SPMarkerView *view, unsigned int destro
delete view;
}
-const gchar *
-generate_marker (GSList *reprs, Geom::Rect bounds, Document *document, Geom::Matrix /*transform*/, Geom::Matrix move)
+const gchar *generate_marker(GSList *reprs, Geom::Rect bounds, SPDocument *document, Geom::Matrix /*transform*/, Geom::Matrix move)
{
- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(document);
- Inkscape::XML::Node *defsrepr = SP_OBJECT_REPR (SP_DOCUMENT_DEFS (document));
+ Inkscape::XML::Document *xml_doc = document->getReprDoc();
+ Inkscape::XML::Node *defsrepr = SP_DOCUMENT_DEFS(document)->getRepr();
Inkscape::XML::Node *repr = xml_doc->createElement("svg:marker");
@@ -753,7 +740,7 @@ generate_marker (GSList *reprs, Geom::Rect bounds, Document *document, Geom::Mat
dup_transform = Geom::identity();
dup_transform *= move;
- sp_item_write_transform(copy, SP_OBJECT_REPR(copy), dup_transform);
+ copy->doWriteTransform(SP_OBJECT_REPR(copy), dup_transform);
}
Inkscape::GC::release(repr);