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 *
12 * Released under GNU GPL, read the file 'COPYING' for more information
13 */
15 /*
16 * This is quite similar in logic to <svg>
17 * Maybe we should merge them somehow (Lauris)
18 */
20 #define SP_TYPE_MARKER (sp_marker_get_type ())
21 #define SP_MARKER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), SP_TYPE_MARKER, SPMarker))
22 #define SP_IS_MARKER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), SP_TYPE_MARKER))
24 class SPMarker;
25 class SPMarkerClass;
26 class SPMarkerView;
28 #include <libnr/nr-matrix.h>
29 #include <libnr/nr-rect.h>
30 #include "svg/svg-length.h"
31 #include "enums.h"
32 #include "sp-item-group.h"
33 #include "sp-marker-loc.h"
34 #include "uri-references.h"
36 struct SPMarker : public SPGroup {
37 /* units */
38 unsigned int markerUnits_set : 1;
39 unsigned int markerUnits : 1;
41 /* reference point */
42 SVGLength refX;
43 SVGLength refY;
45 /* dimensions */
46 SVGLength markerWidth;
47 SVGLength markerHeight;
49 /* orient */
50 unsigned int orient_set : 1;
51 unsigned int orient_auto : 1;
52 float orient;
54 /* viewBox; */
55 unsigned int viewBox_set : 1;
56 NRRect 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 NRMatrix 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 NR::Matrix const &base, float linewidth);
91 void sp_marker_hide (SPMarker *marker, unsigned int key);
93 #endif