1 | /* vim: set sw=4: -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ |
---|
2 | /* |
---|
3 | rsvg.h: SAX-based renderer for SVG files into a GdkPixbuf. |
---|
4 | |
---|
5 | Copyright (C) 2000 Eazel, Inc. |
---|
6 | |
---|
7 | This program is free software; you can redistribute it and/or |
---|
8 | modify it under the terms of the GNU Library General Public License as |
---|
9 | published by the Free Software Foundation; either version 2 of the |
---|
10 | License, or (at your option) any later version. |
---|
11 | |
---|
12 | This program is distributed in the hope that it will be useful, |
---|
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
15 | Library General Public License for more details. |
---|
16 | |
---|
17 | You should have received a copy of the GNU Library General Public |
---|
18 | License along with this program; if not, write to the |
---|
19 | Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
---|
20 | Boston, MA 02111-1307, USA. |
---|
21 | |
---|
22 | Author: Raph Levien <raph@artofcode.com> |
---|
23 | */ |
---|
24 | |
---|
25 | #ifndef RSVG_H |
---|
26 | #define RSVG_H |
---|
27 | |
---|
28 | #include <gdk-pixbuf/gdk-pixbuf.h> |
---|
29 | |
---|
30 | G_BEGIN_DECLS |
---|
31 | |
---|
32 | typedef enum { |
---|
33 | RSVG_ERROR_FAILED |
---|
34 | } RsvgError; |
---|
35 | |
---|
36 | #define RSVG_ERROR (rsvg_error_quark ()) |
---|
37 | GQuark rsvg_error_quark (void) G_GNUC_CONST; |
---|
38 | |
---|
39 | typedef struct RsvgHandle RsvgHandle; |
---|
40 | |
---|
41 | /** |
---|
42 | * RsvgSizeFunc |
---|
43 | * Function to let a user of the library specify the SVG's dimensions |
---|
44 | * @width: the ouput width the SVG should be |
---|
45 | * @height: the output height the SVG should be |
---|
46 | * @user_data: user data |
---|
47 | */ |
---|
48 | typedef void (* RsvgSizeFunc) (gint *width, |
---|
49 | gint *height, |
---|
50 | gpointer user_data); |
---|
51 | |
---|
52 | |
---|
53 | void rsvg_set_default_dpi (double dpi); |
---|
54 | |
---|
55 | RsvgHandle *rsvg_handle_new (void); |
---|
56 | void rsvg_handle_set_dpi (RsvgHandle * handle, double dpi); |
---|
57 | void rsvg_handle_set_size_callback (RsvgHandle *handle, |
---|
58 | RsvgSizeFunc size_func, |
---|
59 | gpointer user_data, |
---|
60 | GDestroyNotify user_data_destroy); |
---|
61 | gboolean rsvg_handle_write (RsvgHandle *handle, |
---|
62 | const guchar *buf, |
---|
63 | gsize count, |
---|
64 | GError **error); |
---|
65 | gboolean rsvg_handle_close (RsvgHandle *handle, |
---|
66 | GError **error); |
---|
67 | GdkPixbuf *rsvg_handle_get_pixbuf (RsvgHandle *handle); |
---|
68 | void rsvg_handle_free (RsvgHandle *handle); |
---|
69 | |
---|
70 | /* convenience API */ |
---|
71 | |
---|
72 | GdkPixbuf *rsvg_pixbuf_from_file (const gchar *file_name, |
---|
73 | GError **error); |
---|
74 | GdkPixbuf *rsvg_pixbuf_from_file_at_zoom (const gchar *file_name, |
---|
75 | double x_zoom, |
---|
76 | double y_zoom, |
---|
77 | GError **error); |
---|
78 | GdkPixbuf *rsvg_pixbuf_from_file_at_size (const gchar *file_name, |
---|
79 | gint width, |
---|
80 | gint height, |
---|
81 | GError **error); |
---|
82 | GdkPixbuf *rsvg_pixbuf_from_file_at_max_size (const gchar *file_name, |
---|
83 | gint max_width, |
---|
84 | gint max_height, |
---|
85 | GError **error); |
---|
86 | GdkPixbuf *rsvg_pixbuf_from_file_at_zoom_with_max (const gchar *file_name, |
---|
87 | double x_zoom, |
---|
88 | double y_zoom, |
---|
89 | gint max_width, |
---|
90 | gint max_height, |
---|
91 | GError **error); |
---|
92 | |
---|
93 | /* "New" convenience API (2.2.2+) */ |
---|
94 | |
---|
95 | GdkPixbuf * rsvg_pixbuf_from_file_at_size_ex (RsvgHandle * handle, |
---|
96 | const gchar *file_name, |
---|
97 | gint width, |
---|
98 | gint height, |
---|
99 | GError **error); |
---|
100 | GdkPixbuf * rsvg_pixbuf_from_file_ex (RsvgHandle * handle, |
---|
101 | const gchar *file_name, |
---|
102 | GError **error); |
---|
103 | GdkPixbuf * rsvg_pixbuf_from_file_at_zoom_ex (RsvgHandle * handle, |
---|
104 | const gchar *file_name, |
---|
105 | double x_zoom, |
---|
106 | double y_zoom, |
---|
107 | GError **error); |
---|
108 | GdkPixbuf * rsvg_pixbuf_from_file_at_max_size_ex (RsvgHandle * handle, |
---|
109 | const gchar *file_name, |
---|
110 | gint max_width, |
---|
111 | gint max_height, |
---|
112 | GError **error); |
---|
113 | GdkPixbuf * rsvg_pixbuf_from_file_at_zoom_with_max_ex (RsvgHandle * handle, |
---|
114 | const gchar *file_name, |
---|
115 | double x_zoom, |
---|
116 | double y_zoom, |
---|
117 | gint max_width, |
---|
118 | gint max_height, |
---|
119 | GError **error); |
---|
120 | |
---|
121 | G_END_DECLS |
---|
122 | |
---|
123 | #endif /* RSVG_H */ |
---|