Code

reintroducing code that initially committed in revision 18594 and the have been rever...
[inkscape.git] / src / marker.h
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 <libnr/nr-matrix.h>
30 #include <libnr/nr-rect.h>
31 #include <2geom/forward.h>
32 #include "svg/svg-length.h"
33 #include "enums.h"
34 #include "sp-item-group.h"
35 #include "sp-marker-loc.h"
36 #include "uri-references.h"
38 struct SPMarker : public SPGroup {
39         /* units */
40         unsigned int markerUnits_set : 1;
41         unsigned int markerUnits : 1;
43         /* reference point */
44         SVGLength refX;
45         SVGLength refY;
47         /* dimensions */
48         SVGLength markerWidth;
49         SVGLength markerHeight;
51         /* orient */
52         unsigned int orient_set : 1;
53         unsigned int orient_auto : 1;
54         float orient;
56         /* viewBox; */
57         unsigned int viewBox_set : 1;
58         NRRect viewBox;
60         /* preserveAspectRatio */
61         unsigned int aspect_set : 1;
62         unsigned int aspect_align : 4;
63         unsigned int aspect_clip : 1;
65         /* Child to parent additional transform */
66         NR::Matrix c2p;
68         /* Private views */
69         SPMarkerView *views;
70 };
72 struct SPMarkerClass {
73         SPGroupClass parent_class;
74 };
76 GType sp_marker_get_type (void);
78 class SPMarkerReference : public Inkscape::URIReference {
79         SPMarkerReference(SPObject *obj) : URIReference(obj) {}
80         SPMarker *getObject() const {
81                 return (SPMarker *)URIReference::getObject();
82         }
83 protected:
84         virtual bool _acceptObject(SPObject *obj) const {
85                 return SP_IS_MARKER(obj);
86         }
87 };
89 void sp_marker_show_dimension (SPMarker *marker, unsigned int key, unsigned int size);
90 NRArenaItem *sp_marker_show_instance (SPMarker *marker, NRArenaItem *parent,
91                                       unsigned int key, unsigned int pos,
92                                       Geom::Matrix const &base, float linewidth);
93 void sp_marker_hide (SPMarker *marker, unsigned int key);
94 const gchar *generate_marker (GSList *reprs, NR::Rect bounds, SPDocument *document, NR::Matrix transform, NR::Matrix move);
97 #endif