1 #ifndef __SP_MARKER_H__
2 #define __SP_MARKER_H__
4 /*
5 * SVG <marker> implementation
6 *
7 * Authors:
8 * Lauris Kaplinski <lauris@kaplinski.com>
9 *
10 * Copyright (C) 1999-2003 Lauris Kaplinski
11 * Copyright (C) 2008 Johan Engelen
12 *
13 * Released under GNU GPL, read the file 'COPYING' for more information
14 */
16 /*
17 * This is quite similar in logic to <svg>
18 * Maybe we should merge them somehow (Lauris)
19 */
21 #define SP_TYPE_MARKER (sp_marker_get_type ())
22 #define SP_MARKER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), SP_TYPE_MARKER, SPMarker))
23 #define SP_IS_MARKER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), SP_TYPE_MARKER))
25 class SPMarker;
26 class SPMarkerClass;
27 class SPMarkerView;
29 #include <2geom/rect.h>
30 #include <2geom/matrix.h>
31 #include "svg/svg-length.h"
32 #include "enums.h"
33 #include "sp-item-group.h"
34 #include "sp-marker-loc.h"
35 #include "uri-references.h"
37 struct SPMarker : public SPGroup {
38 /* units */
39 unsigned int markerUnits_set : 1;
40 unsigned int markerUnits : 1;
42 /* reference point */
43 SVGLength refX;
44 SVGLength refY;
46 /* dimensions */
47 SVGLength markerWidth;
48 SVGLength markerHeight;
50 /* orient */
51 unsigned int orient_set : 1;
52 unsigned int orient_auto : 1;
53 float orient;
55 /* viewBox; */
56 Geom::OptRect viewBox;
58 /* preserveAspectRatio */
59 unsigned int aspect_set : 1;
60 unsigned int aspect_align : 4;
61 unsigned int aspect_clip : 1;
63 /* Child to parent additional transform */
64 Geom::Matrix c2p;
66 /* Private views */
67 SPMarkerView *views;
68 };
70 struct SPMarkerClass {
71 SPGroupClass parent_class;
72 };
74 GType sp_marker_get_type (void);
76 class SPMarkerReference : public Inkscape::URIReference {
77 SPMarkerReference(SPObject *obj) : URIReference(obj) {}
78 SPMarker *getObject() const {
79 return (SPMarker *)URIReference::getObject();
80 }
81 protected:
82 virtual bool _acceptObject(SPObject *obj) const {
83 return SP_IS_MARKER(obj);
84 }
85 };
87 void sp_marker_show_dimension (SPMarker *marker, unsigned int key, unsigned int size);
88 NRArenaItem *sp_marker_show_instance (SPMarker *marker, NRArenaItem *parent,
89 unsigned int key, unsigned int pos,
90 Geom::Matrix const &base, float linewidth);
91 void sp_marker_hide (SPMarker *marker, unsigned int key);
92 const gchar *generate_marker (GSList *reprs, Geom::Rect bounds, SPDocument *document, Geom::Matrix transform, Geom::Matrix move);
95 #endif