dia_svg.h 2.14 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14
/* dia -- an diagram creation/manipulation program
 * Copyright (C) 1998 Alexander Larsson
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
15 16
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 18
 */

19 20 21
#ifndef DIA_SVG_H
#define DIA_SVG_H

22 23 24 25 26 27 28 29 30
#include "dia_xml.h"
#include "font.h"

/* special colours */
enum DiaSvgColours
{
  DIA_SVG_COLOUR_NONE = -1,
  DIA_SVG_COLOUR_FOREGROUND = -2,
  DIA_SVG_COLOUR_BACKGROUND = -3,
31
  DIA_SVG_COLOUR_TEXT = -4,
32 33
  /* used for initlaization only */
  DIA_SVG_COLOUR_DEFAULT = -5
34 35
};

36 37
typedef struct _DiaSvgStyle DiaSvgStyle;
struct _DiaSvgStyle {
38 39
  real line_width;
  gint32 stroke;
40
  real   stroke_opacity;
41
  gint32 fill;
42
  real   fill_opacity;
43 44 45 46 47 48 49 50 51

  LineCaps linecap;
  LineJoin linejoin;
  LineStyle linestyle;
  real dashlength;

  DiaFont *font;
  real font_height;
  Alignment alignment;
52 53 54

  gint32 stop_color;
  real   stop_opacity;
55 56
};

57 58
void dia_svg_style_init (DiaSvgStyle *gs, DiaSvgStyle *parent_style);
void dia_svg_style_copy (DiaSvgStyle *dest, DiaSvgStyle *src);
Hans Breuer's avatar
Hans Breuer committed
59
gboolean dia_svg_parse_color(const gchar *str, Color *color);
60
void dia_svg_parse_style(xmlNodePtr node, DiaSvgStyle *s, real user_scale);
61
void dia_svg_parse_style_string (DiaSvgStyle *s, real user_scale, const gchar *str);
62
/* parse the svg sub format for pathes int an array of BezPoint */
63 64
gboolean dia_svg_parse_path(GArray *points, const gchar *path_str, gchar **unparsed,
			    gboolean *closed, Point *current_point);
65 66
DiaMatrix *dia_svg_parse_transform(const gchar *trans, real scale);
gchar *dia_svg_from_matrix(const DiaMatrix *matrix, real scale);
67 68

#endif /* DIA_SVG_H */