Code

Move declaration of sp_svg_read_color,sp_svg_write_color from svg/svg.h to new file...
[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 "svg/svg-length.h"
16 #include "svg/svg-color.h"
17 #include <vector>
19 struct NArtBpath;
20 struct NRMatrix;
21 namespace NR {
22     class Matrix;
23 }
25 /* Generic */
27 /*
28  * These are very-very simple:
29  * - they accept everything libc strtod accepts
30  * - no valid end character checking
31  * Return FALSE and let val untouched on error
32  */
33  
34 unsigned int sp_svg_number_read_f (const gchar *str, float *val);
35 unsigned int sp_svg_number_read_d (const gchar *str, double *val);
37 /*
38  * No buffer overflow checking is done, so better wrap them if needed
39  */
40 unsigned int sp_svg_number_write_de (gchar *buf, double val, unsigned int tprec, unsigned int padf);
42 /* Length */
44 /*
45  * Parse number with optional unit specifier:
46  * - for px, pt, pc, mm, cm, computed is final value accrding to SVG spec
47  * - for em, ex, and % computed is left untouched
48  * - % is divided by 100 (i.e. 100% is 1.0)
49  * !isalnum check is done at the end
50  * Any return value pointer can be NULL
51  */
53 unsigned int sp_svg_length_read_computed_absolute (const gchar *str, float *length);
54 std::vector<SVGLength> sp_svg_length_list_read (const gchar *str);
55 unsigned int sp_svg_length_read_ldd (const gchar *str, SVGLength::Unit *unit, double *value, double *computed);
57 std::string sp_svg_length_write_with_units(SVGLength const &length);
59 bool sp_svg_transform_read(gchar const *str, NR::Matrix *transform);
61 unsigned sp_svg_transform_write(gchar str[], unsigned size, NR::Matrix const &transform);
62 unsigned sp_svg_transform_write(gchar str[], unsigned size, NRMatrix const *transform);
64 double sp_svg_read_percentage (const char * str, double def);
66 /* NB! As paths can be long, we use here dynamic string */
68 NArtBpath * sp_svg_read_path (const char * str);
69 char * sp_svg_write_path (const NArtBpath * bpath);
72 #endif
74 /*
75   Local Variables:
76   mode:c++
77   c-file-style:"stroustrup"
78   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
79   indent-tabs-mode:nil
80   fill-column:99
81   End:
82 */
83 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :