[18608] | 1 | /* vim: set sw=4: -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ |
---|
[17276] | 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 |
---|
[18274] | 8 | modify it under the terms of the GNU Library General Public License as |
---|
[17276] | 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 |
---|
[18274] | 15 | Library General Public License for more details. |
---|
[17276] | 16 | |
---|
[18274] | 17 | You should have received a copy of the GNU Library General Public |
---|
[17276] | 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 | |
---|
[18274] | 30 | G_BEGIN_DECLS |
---|
[17276] | 31 | |
---|
[18274] | 32 | typedef enum { |
---|
| 33 | RSVG_ERROR_FAILED |
---|
| 34 | } RsvgError; |
---|
[17276] | 35 | |
---|
[18274] | 36 | #define RSVG_ERROR (rsvg_error_quark ()) |
---|
| 37 | GQuark rsvg_error_quark (void) G_GNUC_CONST; |
---|
| 38 | |
---|
| 39 | typedef struct RsvgHandle RsvgHandle; |
---|
| 40 | |
---|
[18804] | 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 | */ |
---|
[18274] | 48 | typedef void (* RsvgSizeFunc) (gint *width, |
---|
[18804] | 49 | gint *height, |
---|
| 50 | gpointer user_data); |
---|
[18274] | 51 | |
---|
| 52 | |
---|
[18608] | 53 | void rsvg_set_default_dpi (double dpi); |
---|
| 54 | |
---|
[18274] | 55 | RsvgHandle *rsvg_handle_new (void); |
---|
[18608] | 56 | void rsvg_handle_set_dpi (RsvgHandle * handle, double dpi); |
---|
[18274] | 57 | void rsvg_handle_set_size_callback (RsvgHandle *handle, |
---|
[18804] | 58 | RsvgSizeFunc size_func, |
---|
| 59 | gpointer user_data, |
---|
| 60 | GDestroyNotify user_data_destroy); |
---|
[18274] | 61 | gboolean rsvg_handle_write (RsvgHandle *handle, |
---|
[18804] | 62 | const guchar *buf, |
---|
| 63 | gsize count, |
---|
| 64 | GError **error); |
---|
[18274] | 65 | gboolean rsvg_handle_close (RsvgHandle *handle, |
---|
[18804] | 66 | GError **error); |
---|
[18274] | 67 | GdkPixbuf *rsvg_handle_get_pixbuf (RsvgHandle *handle); |
---|
| 68 | void rsvg_handle_free (RsvgHandle *handle); |
---|
| 69 | |
---|
| 70 | /* convenience API */ |
---|
[18804] | 71 | |
---|
[18274] | 72 | GdkPixbuf *rsvg_pixbuf_from_file (const gchar *file_name, |
---|
[18804] | 73 | GError **error); |
---|
[18274] | 74 | GdkPixbuf *rsvg_pixbuf_from_file_at_zoom (const gchar *file_name, |
---|
[18804] | 75 | double x_zoom, |
---|
| 76 | double y_zoom, |
---|
| 77 | GError **error); |
---|
[18274] | 78 | GdkPixbuf *rsvg_pixbuf_from_file_at_size (const gchar *file_name, |
---|
[18804] | 79 | gint width, |
---|
| 80 | gint height, |
---|
| 81 | GError **error); |
---|
[18274] | 82 | GdkPixbuf *rsvg_pixbuf_from_file_at_max_size (const gchar *file_name, |
---|
[18804] | 83 | gint max_width, |
---|
| 84 | gint max_height, |
---|
| 85 | GError **error); |
---|
[18274] | 86 | GdkPixbuf *rsvg_pixbuf_from_file_at_zoom_with_max (const gchar *file_name, |
---|
[18804] | 87 | double x_zoom, |
---|
| 88 | double y_zoom, |
---|
| 89 | gint max_width, |
---|
| 90 | gint max_height, |
---|
| 91 | GError **error); |
---|
[18274] | 92 | |
---|
[18804] | 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 | |
---|
[18274] | 121 | G_END_DECLS |
---|
| 122 | |
---|
[18608] | 123 | #endif /* RSVG_H */ |
---|