rsvg.h 5.17 KB
Newer Older
1
/* vim: set sw=4: -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
2 3 4 5 6 7
/* 
   rsvg.h: SAX-based renderer for SVG files into a GdkPixbuf.
 
   Copyright (C) 2000 Eazel, Inc.
  
   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 10 11 12 13 14
   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
15
   Library General Public License for more details.
16
  
17
   You should have received a copy of the GNU Library General Public
18 19 20 21 22 23 24 25 26 27
   License along with this program; if not, write to the
   Free Software Foundation, Inc., 59 Temple Place - Suite 330,
   Boston, MA 02111-1307, USA.
  
   Author: Raph Levien <raph@artofcode.com>
*/

#ifndef RSVG_H
#define RSVG_H

28 29
#include <gdk-pixbuf/gdk-pixbuf.h>

30 31
G_BEGIN_DECLS

32 33 34
typedef enum {
	RSVG_ERROR_FAILED
} RsvgError;
35

36 37 38 39 40
#define RSVG_ERROR (rsvg_error_quark ())
GQuark rsvg_error_quark (void) G_GNUC_CONST;

typedef struct RsvgHandle RsvgHandle;

41
/**
42 43 44 45 46
 * RsvgSizeFunc ():
 * @width: Pointer to where to set/store the width
 * @height: Pointer to where to set/store the height
 * @user_data: User data pointer
 *
47
 * Function to let a user of the library specify the SVG's dimensions
48 49 50
 * @width: the ouput width the SVG should be
 * @height: the output height the SVG should be
 * @user_data: user data
51
 */
52
typedef void (* RsvgSizeFunc) (gint     *width,
53 54
							   gint     *height,
							   gpointer  user_data);
55 56


Dom Lachowicz's avatar
Dom Lachowicz committed
57 58 59 60 61
#ifndef RSVG_DISABLE_DEPRECATED
void        rsvg_set_default_dpi          (double dpi);
void        rsvg_handle_set_dpi           (RsvgHandle * handle, double dpi);
#endif

62 63 64
void        rsvg_init (void);
void        rsvg_term (void);

Dom Lachowicz's avatar
Dom Lachowicz committed
65 66
void        rsvg_set_default_dpi_x_y          (double dpi_x, double dpi_y);
void        rsvg_handle_set_dpi_x_y           (RsvgHandle * handle, double dpi_x, double dpi_y);
Dom Lachowicz's avatar
Dom Lachowicz committed
67

68 69
RsvgHandle *rsvg_handle_new               (void);
void        rsvg_handle_set_size_callback (RsvgHandle      *handle,
70 71 72
										   RsvgSizeFunc     size_func,
										   gpointer         user_data,
										   GDestroyNotify   user_data_destroy);
73
gboolean    rsvg_handle_write             (RsvgHandle      *handle,
74 75 76
										   const guchar    *buf,
										   gsize            count,
										   GError         **error);
77
gboolean    rsvg_handle_close             (RsvgHandle      *handle,
78
										   GError         **error);
79 80 81
GdkPixbuf  *rsvg_handle_get_pixbuf        (RsvgHandle      *handle);
void        rsvg_handle_free              (RsvgHandle      *handle);

Dom Lachowicz's avatar
Dom Lachowicz committed
82 83 84 85 86 87
G_CONST_RETURN char *
rsvg_handle_get_base_uri (RsvgHandle *handle);
void rsvg_handle_set_base_uri (RsvgHandle *handle,
							   const char *base_uri);


88
/* Convenience API */
89

90
GdkPixbuf  *rsvg_pixbuf_from_file                  (const gchar  *file_name,
91
													GError      **error);
92
GdkPixbuf  *rsvg_pixbuf_from_file_at_zoom          (const gchar  *file_name,
93 94 95
													double        x_zoom,
													double        y_zoom,
													GError      **error);
96
GdkPixbuf  *rsvg_pixbuf_from_file_at_size          (const gchar  *file_name,
97 98 99
													gint          width,
													gint          height,
													GError      **error);
100
GdkPixbuf  *rsvg_pixbuf_from_file_at_max_size      (const gchar  *file_name,
101 102 103
													gint          max_width,
													gint          max_height,
													GError      **error);
104
GdkPixbuf  *rsvg_pixbuf_from_file_at_zoom_with_max (const gchar  *file_name,
105 106 107 108 109
													double        x_zoom,
													double        y_zoom,
													gint          max_width,
													gint          max_height,
													GError      **error);
110

111 112 113 114
/* Accessibility API */

G_CONST_RETURN char *rsvg_handle_get_title         (RsvgHandle *handle);
G_CONST_RETURN char *rsvg_handle_get_desc          (RsvgHandle *handle);
Dom Lachowicz's avatar
Dom Lachowicz committed
115
G_CONST_RETURN char *rsvg_handle_get_metadata      (RsvgHandle *handle);
116 117

/* Extended Convenience API */
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144

GdkPixbuf  * rsvg_pixbuf_from_file_at_size_ex (RsvgHandle * handle,
											   const gchar  *file_name,
											   gint          width,
											   gint          height,
											   GError      **error);
GdkPixbuf  * rsvg_pixbuf_from_file_ex (RsvgHandle * handle,
									   const gchar  *file_name,
									   GError      **error);
GdkPixbuf  * rsvg_pixbuf_from_file_at_zoom_ex (RsvgHandle * handle,
											   const gchar  *file_name,
											   double        x_zoom,
											   double        y_zoom,
											   GError      **error);
GdkPixbuf  * rsvg_pixbuf_from_file_at_max_size_ex (RsvgHandle * handle,
												   const gchar  *file_name,
												   gint          max_width,
												   gint          max_height,
												   GError      **error);
GdkPixbuf  * rsvg_pixbuf_from_file_at_zoom_with_max_ex (RsvgHandle * handle,
														const gchar  *file_name,
														double        x_zoom,
														double        y_zoom,
														gint          max_width,
														gint          max_height,
														GError      **error);

145
G_END_DECLS
146

147
#endif /* RSVG_H */