source: trunk/third/librsvg/rsvg-private.h @ 20920

Revision 20920, 4.5 KB checked in by ghudson, 20 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r20919, which included commits to RCS files with non-trunk default branches.
Line 
1/* vim: set sw=4: -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
2/*
3   rsvg-private.h: Internals of RSVG
4
5   Copyright (C) 2000 Eazel, Inc.
6   Copyright (C) 2002 Dom Lachowicz <cinamod@hotmail.com>
7
8   This program is free software; you can redistribute it and/or
9   modify it under the terms of the GNU Library General Public License as
10   published by the Free Software Foundation; either version 2 of the
11   License, or (at your option) any later version.
12
13   This program is distributed in the hope that it will be useful,
14   but WITHOUT ANY WARRANTY; without even the implied warranty of
15   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16   Library General Public License for more details.
17
18   You should have received a copy of the GNU Library General Public
19   License along with this program; if not, write to the
20   Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21   Boston, MA 02111-1307, USA.
22
23   Author: Raph Levien <raph@artofcode.com>
24*/
25
26#ifndef RSVG_PRIVATE_H
27#define RSVG_PRIVATE_H
28
29#include "rsvg.h"
30
31#include <libxml/SAX.h>
32#include <libxml/xmlmemory.h>
33#include <pango/pango.h>
34#include <libart_lgpl/art_rect.h>
35#include <glib/gslist.h>
36
37G_BEGIN_DECLS
38
39typedef struct RsvgSaxHandler RsvgSaxHandler;
40typedef struct _RsvgPropertyBag RsvgPropertyBag;
41typedef struct _RsvgState RsvgState;
42typedef struct _RsvgDefs RsvgDefs;
43typedef struct _RsvgDefVal RsvgDefVal;
44typedef struct _RsvgFilter RsvgFilter;
45
46/* prepare for gettext */
47#ifndef _
48#define _(X) X
49#endif
50
51struct RsvgSaxHandler {
52        void (*free) (RsvgSaxHandler *self);
53        void (*start_element) (RsvgSaxHandler *self, const xmlChar *name, RsvgPropertyBag *atts);
54        void (*end_element) (RsvgSaxHandler *self, const xmlChar *name);
55        void (*characters) (RsvgSaxHandler *self, const xmlChar *ch, int len);
56};
57
58struct RsvgHandle {
59        RsvgSizeFunc size_func;
60        gpointer user_data;
61        GDestroyNotify user_data_destroy;
62        GdkPixbuf *pixbuf;
63        ArtIRect bbox;
64
65        /* stack; there is a state for each element */
66
67        GSList * state;
68       
69        RsvgDefs *defs;
70        guint in_defs;
71        guint nest_level;
72        void *current_defs_group;
73
74        guint in_switch;
75
76        GHashTable *css_props;
77       
78        /* not a handler stack. each nested handler keeps
79         * track of its parent
80         */
81        RsvgSaxHandler *handler;
82        int handler_nest;
83       
84        GHashTable *entities; /* g_malloc'd string -> xmlEntityPtr */
85       
86        PangoContext *pango_context;
87        xmlParserCtxtPtr ctxt;
88        GError **error;
89       
90        int width;
91        int height;
92        double dpi_x;
93        double dpi_y;
94       
95        GString * title;
96        GString * desc;
97       
98        gchar * base_uri;
99
100        void * currentfilter;
101        void * currentsubfilter;
102
103        GMemChunk * state_allocator;
104
105        /* virtual fns */
106        gboolean (* write) (RsvgHandle    *handle,
107                                                const guchar  *buf,
108                                                gsize          count,
109                                                GError       **error);
110       
111        gboolean (* close) (RsvgHandle  *handle,
112                                                GError     **error);
113
114        void (* free) (RsvgHandle * handle);
115};
116
117void rsvg_linear_gradient_free (RsvgDefVal *self);
118void rsvg_radial_gradient_free (RsvgDefVal *self);
119void rsvg_pattern_free (RsvgDefVal *self);
120
121/* "super"/parent calls */
122void rsvg_handle_init (RsvgHandle * handle);
123gboolean rsvg_handle_write_impl (RsvgHandle    *handle,
124                                                                 const guchar  *buf,
125                                                                 gsize          count,
126                                                                 GError       **error);
127gboolean rsvg_handle_close_impl (RsvgHandle  *handle,
128                                                                 GError     **error);
129void rsvg_handle_free_impl (RsvgHandle *handle);
130
131typedef enum {
132        RSVG_SIZE_ZOOM,
133        RSVG_SIZE_WH,
134        RSVG_SIZE_WH_MAX,
135        RSVG_SIZE_ZOOM_MAX
136} RsvgSizeType;
137
138typedef enum {
139        objectBoundingBox, userSpaceOnUse
140} RsvgCoordUnits;
141
142struct RsvgSizeCallbackData
143{
144        RsvgSizeType type;
145        double x_zoom;
146        double y_zoom;
147        gint width;
148        gint height;
149
150        gboolean keep_aspect_ratio;
151};
152
153struct _RsvgPropertyBag
154{
155        GHashTable * props;
156};
157
158RsvgPropertyBag *
159rsvg_property_bag_new (const xmlChar **atts);
160
161void
162rsvg_property_bag_free (RsvgPropertyBag *bag);
163
164G_CONST_RETURN char *
165rsvg_property_bag_lookup (RsvgPropertyBag *bag, const char * key);
166
167guint
168rsvg_property_bag_size (RsvgPropertyBag *bag);
169
170GdkPixbuf *
171rsvg_pixbuf_from_data_with_size_data (const guchar * buff,
172                                                                          size_t len,
173                                                                          struct RsvgSizeCallbackData * data,
174                                                                          const char * base_uri,
175                                                                          GError ** error);
176
177G_CONST_RETURN char *
178rsvg_handle_get_base_uri (RsvgHandle *handle);
179
180void rsvg_handle_set_base_uri (RsvgHandle *handle,
181                                                           const char *base_uri);
182
183gboolean
184rsvg_eval_switch_attributes (RsvgPropertyBag *atts, gboolean * p_has_cond);
185
186GdkPixbuf *
187_rsvg_pixbuf_new_cleared (GdkColorspace colorspace, gboolean has_alpha, int bits_per_sample,
188                                                  int width, int height);
189
190G_END_DECLS
191
192#endif
Note: See TracBrowser for help on using the repository browser.