Code

merge gsoc2008_johan_path2geom into trunk
[inkscape.git] / src / svg / svg.h
1 #ifndef __SP_SVG_H__
2 #define __SP_SVG_H__
4 /*
5  * SVG data parser
6  *
7  * Authors:
8  *   Lauris Kaplinski <lauris@kaplinski.com>
9  *
10  * Copyright (C) 1999-2002 Lauris Kaplinski
11  *
12  * Released under GNU GPL, read the file 'COPYING' for more information
13  */
14 #include <glib/gtypes.h>
15 #include <vector>
16 #include <cstring>
17 #include <string>
19 #include "svg/svg-length.h"
20 #include "libnr/nr-forward.h"
21 #include <2geom/forward.h>
23 /* Generic */
25 /*
26  * These are very-very simple:
27  * - they accept everything libc strtod accepts
28  * - no valid end character checking
29  * Return FALSE and let val untouched on error
30  */
31  
32 unsigned int sp_svg_number_read_f (const gchar *str, float *val);
33 unsigned int sp_svg_number_read_d (const gchar *str, double *val);
35 /*
36  * No buffer overflow checking is done, so better wrap them if needed
37  */
38 unsigned int sp_svg_number_write_de (gchar *buf, double val, unsigned int tprec, int min_exp, unsigned int padf);
40 /* Length */
42 /*
43  * Parse number with optional unit specifier:
44  * - for px, pt, pc, mm, cm, computed is final value accrding to SVG spec
45  * - for em, ex, and % computed is left untouched
46  * - % is divided by 100 (i.e. 100% is 1.0)
47  * !isalnum check is done at the end
48  * Any return value pointer can be NULL
49  */
51 unsigned int sp_svg_length_read_computed_absolute (const gchar *str, float *length);
52 std::vector<SVGLength> sp_svg_length_list_read (const gchar *str);
53 unsigned int sp_svg_length_read_ldd (const gchar *str, SVGLength::Unit *unit, double *value, double *computed);
55 std::string sp_svg_length_write_with_units(SVGLength const &length);
57 bool sp_svg_transform_read(gchar const *str, NR::Matrix *transform);
59 gchar *sp_svg_transform_write(NR::Matrix const &transform);
60 gchar *sp_svg_transform_write(NR::Matrix const *transform);
62 double sp_svg_read_percentage (const char * str, double def);
64 /* NB! As paths can be long, we use here dynamic string */
66 NArtBpath * sp_svg_read_path (const char * str);
67 Geom::PathVector sp_svg_read_pathv (char const * str);
68 gchar * sp_svg_write_path (const NArtBpath * bpath);
69 gchar * sp_svg_write_path (Geom::PathVector const &p);
71 #endif
73 /*
74   Local Variables:
75   mode:c++
76   c-file-style:"stroustrup"
77   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
78   indent-tabs-mode:nil
79   fill-column:99
80   End:
81 */
82 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :