svg.h revision 9932d3f124c047d557a978fb6b035214a09c086a
4812N/A#ifndef __SP_SVG_H__
4812N/A#define __SP_SVG_H__
4812N/A
4812N/A/*
4812N/A * SVG data parser
4812N/A *
4812N/A * Authors:
4812N/A * Lauris Kaplinski <lauris@kaplinski.com>
4812N/A *
4812N/A * Copyright (C) 1999-2002 Lauris Kaplinski
4812N/A *
4812N/A * Released under GNU GPL, read the file 'COPYING' for more information
4812N/A */
4812N/A#include <glib/gtypes.h>
4812N/A#include <vector>
4812N/A#include <cstring>
4812N/A#include <string>
4812N/A
4812N/A#include "svg/svg-length.h"
4812N/A#include "libnr/nr-forward.h"
4812N/A#include <2geom/forward.h>
4812N/A
4812N/A/* Generic */
4812N/A
4812N/A/*
4812N/A * These are very-very simple:
4812N/A * - they accept everything libc strtod accepts
4812N/A * - no valid end character checking
4812N/A * Return FALSE and let val untouched on error
4812N/A */
4812N/A
4812N/Aunsigned int sp_svg_number_read_f (const gchar *str, float *val);
4812N/Aunsigned int sp_svg_number_read_d (const gchar *str, double *val);
4812N/A
4812N/A/*
4812N/A * No buffer overflow checking is done, so better wrap them if needed
4812N/A */
4812N/Aunsigned int sp_svg_number_write_de (gchar *buf, double val, unsigned int tprec, int min_exp, unsigned int padf);
4812N/A
4812N/A/* Length */
4812N/A
/*
* Parse number with optional unit specifier:
* - for px, pt, pc, mm, cm, computed is final value accrding to SVG spec
* - for em, ex, and % computed is left untouched
* - % is divided by 100 (i.e. 100% is 1.0)
* !isalnum check is done at the end
* Any return value pointer can be NULL
*/
unsigned int sp_svg_length_read_computed_absolute (const gchar *str, float *length);
std::vector<SVGLength> sp_svg_length_list_read (const gchar *str);
unsigned int sp_svg_length_read_ldd (const gchar *str, SVGLength::Unit *unit, double *value, double *computed);
std::string sp_svg_length_write_with_units(SVGLength const &length);
bool sp_svg_transform_read(gchar const *str, Geom::Matrix *transform);
bool sp_svg_transform_read(gchar const *str, NR::Matrix *transform);
gchar *sp_svg_transform_write(Geom::Matrix const &transform);
gchar *sp_svg_transform_write(Geom::Matrix const *transform);
gchar *sp_svg_transform_write(NR::Matrix const &transform);
gchar *sp_svg_transform_write(NR::Matrix const *transform);
double sp_svg_read_percentage (const char * str, double def);
/* NB! As paths can be long, we use here dynamic string */
NArtBpath * sp_svg_read_path (const char * str);
Geom::PathVector sp_svg_read_pathv (char const * str);
gchar * sp_svg_write_path (const NArtBpath * bpath);
gchar * sp_svg_write_path (Geom::PathVector const &p);
#endif
/*
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:encoding=utf-8:textwidth=99 :