1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
|
#ifndef SEEN_SP_STYLE_H
#define SEEN_SP_STYLE_H
/** \file
* SPStyle - a style object for SPItem objects
*/
/* Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
* Jon A. Cruz <jon@joncruz.org>
*
* Copyright (C) 2010 Jon A. Cruz
* Copyright (C) 2001-2002 Lauris Kaplinski
* Copyright (C) 2001 Ximian, Inc.
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#include "style-enums.h"
#include "style-internal.h"
#include <stddef.h>
#include <sigc++/connection.h>
namespace Inkscape {
namespace XML {
class Node;
}
}
/// An SVG style object.
struct SPStyle {
int refcount;
/** Object we are attached to */
SPObject *object;
/** Document we are associated with */
SPDocument *document;
/** Our text style component */
SPTextStyle *text;
unsigned text_private : 1;
/* CSS2 */
/* Font */
/** Size of the font */
SPIFontSize font_size;
/** Style of the font */
SPIEnum font_style;
/** Which substyle of the font */
SPIEnum font_variant;
/** Weight of the font */
SPIEnum font_weight;
/** Stretch of the font */
SPIEnum font_stretch;
/** First line indent of paragraphs (css2 16.1) */
SPILength text_indent;
/** text alignment (css2 16.2) (not to be confused with text-anchor) */
SPIEnum text_align;
/** text decoration (css2 16.3.1) is now handled as a subset of css3 2.4 */
// SPITextDecoration text_decoration;
/** CSS 3 2.1, 2.2, 2.3 */
/** Not done yet, test_decoration3 = css3 2.4*/
SPITextDecorationLine text_decoration_line;
SPIPaint text_decoration_color;
SPITextDecorationStyle text_decoration_style;
// used to implement text_decoration, not saved to or read from SVG file
SPITextDecorationData text_decoration_data;
// 16.3.2 is text-shadow. That's complicated.
/** Line spacing (css2 10.8.1) */
SPILengthOrNormal line_height;
/** letter spacing (css2 16.4) */
SPILengthOrNormal letter_spacing;
/** word spacing (also css2 16.4) */
SPILengthOrNormal word_spacing;
/** capitalization (css2 16.5) */
SPIEnum text_transform;
/* CSS3 Text */
/** text direction (css3 text 3.2) */
SPIEnum direction;
/** block progression (css3 text 3.2) */
SPIEnum block_progression;
/** Writing mode (css3 text 3.2 and svg1.1 10.7.2) */
SPIEnum writing_mode;
/** Baseline shift (svg1.1 10.9.2) */
SPIBaselineShift baseline_shift;
/* SVG */
/** Anchor of the text (svg1.1 10.9.1) */
SPIEnum text_anchor;
/* Misc attributes */
unsigned clip_set : 1;
unsigned color_set : 1;
unsigned cursor_set : 1;
unsigned overflow_set : 1;
unsigned clip_path_set : 1;
unsigned mask_set : 1;
/** clip-rule: 0 nonzero, 1 evenodd */
SPIEnum clip_rule;
/** display */
SPIEnum display;
/** overflow */
SPIEnum overflow;
/** visibility */
SPIEnum visibility;
/** opacity */
SPIScale24 opacity;
/** mix-blend-mode: CSS Compositing and Blending Level 1 */
SPIEnum isolation;
// Could be shared with Filter blending mode
SPIEnum blend_mode;
/** color */
SPIPaint color;
/** color-interpolation */
SPIEnum color_interpolation;
/** color-interpolation-filters */
SPIEnum color_interpolation_filters;
/** fill */
SPIPaint fill;
/** fill-opacity */
SPIScale24 fill_opacity;
/** fill-rule: 0 nonzero, 1 evenodd */
SPIEnum fill_rule;
/** stroke */
SPIPaint stroke;
/** stroke-width */
SPILength stroke_width;
/** stroke-linecap */
SPIEnum stroke_linecap;
/** stroke-linejoin */
SPIEnum stroke_linejoin;
/** stroke-miterlimit */
SPIFloat stroke_miterlimit;
/** stroke-dasharray */
SPIDashArray stroke_dasharray;
/** stroke-dashoffset */
SPILength stroke_dashoffset;
/** stroke-opacity */
SPIScale24 stroke_opacity;
/** Marker list */
SPIString marker[SP_MARKER_LOC_QTY];
SPIPaintOrder paint_order;
/** Filter effect */
SPIFilter filter;
SPIEnum filter_blend_mode;
/** normally not used, but duplicates the Gaussian blur deviation (if any) from the attached
filter when the style is used for querying */
SPILength filter_gaussianBlur_deviation;
/** hints on how to render: e.g. speed vs. accuracy.
* As of April, 2013, only image_rendering used. */
SPIEnum color_rendering;
SPIEnum image_rendering;
SPIEnum shape_rendering;
SPIEnum text_rendering;
/** enable-background, used for defining where filter effects get
* their background image */
SPIEnum enable_background;
/// style belongs to a cloned object
bool cloned;
sigc::connection release_connection;
sigc::connection filter_modified_connection;
sigc::connection fill_ps_modified_connection;
sigc::connection stroke_ps_modified_connection;
SPObject *getFilter() { return (filter.href) ? filter.href->getObject() : NULL; }
SPObject const *getFilter() const { return (filter.href) ? filter.href->getObject() : NULL; }
gchar const *getFilterURI() const { return (filter.href) ? filter.href->getURI()->toString() : NULL; }
SPPaintServer *getFillPaintServer() { return (fill.value.href) ? fill.value.href->getObject() : NULL; }
SPPaintServer const *getFillPaintServer() const { return (fill.value.href) ? fill.value.href->getObject() : NULL; }
gchar const *getFillURI() const { return (fill.value.href) ? fill.value.href->getURI()->toString() : NULL; }
SPPaintServer *getStrokePaintServer() { return (stroke.value.href) ? stroke.value.href->getObject() : NULL; }
SPPaintServer const *getStrokePaintServer() const { return (stroke.value.href) ? stroke.value.href->getObject() : NULL; }
gchar const *getStrokeURI() const { return (stroke.value.href) ? stroke.value.href->getURI()->toString() : NULL; }
};
SPStyle *sp_style_new(SPDocument *document);
SPStyle *sp_style_new_from_object(SPObject *object);
SPStyle *sp_style_ref(SPStyle *style);
SPStyle *sp_style_unref(SPStyle *style);
void sp_style_read_from_object(SPStyle *style, SPObject *object);
void sp_style_read_from_prefs(SPStyle *style, Glib::ustring const &path);
void sp_style_merge_from_style_string(SPStyle *style, gchar const *p);
void sp_style_merge_from_parent(SPStyle *style, SPStyle const *parent);
void sp_style_merge_from_dying_parent(SPStyle *style, SPStyle const *parent);
gchar *sp_style_write_string(SPStyle const *style, guint flags = SP_STYLE_FLAG_IFSET);
gchar *sp_style_write_difference(SPStyle const *from, SPStyle const *to);
void sp_style_set_to_uri_string (SPStyle *style, bool isfill, const gchar *uri);
gchar const *sp_style_get_css_unit_string(int unit);
double sp_style_css_size_px_to_units(double size, int unit);
double sp_style_css_size_units_to_px(double size, int unit);
SPCSSAttr *sp_css_attr_from_style (SPStyle const *const style, guint flags);
SPCSSAttr *sp_css_attr_from_object(SPObject *object, guint flags = SP_STYLE_FLAG_IFSET);
SPCSSAttr *sp_css_attr_unset_text(SPCSSAttr *css);
SPCSSAttr *sp_css_attr_unset_uris(SPCSSAttr *css);
SPCSSAttr *sp_css_attr_scale(SPCSSAttr *css, double ex);
void sp_style_unset_property_attrs(SPObject *o);
void sp_style_set_property_url (SPObject *item, gchar const *property, SPObject *linked, bool recursive);
gchar *attribute_unquote(gchar const *val);
Glib::ustring css2_escape_quote(gchar const *val);
#endif // SEEN_SP_STYLE_H
/*
Local Variables:
mode:c++
c-file-style:"stroustrup"
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
indent-tabs-mode:nil
fill-column:99
End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
|