[librsvg: 1/3] Revert "Move gtk-doc comments from librsvg/rsvg-*.c to the Rust code"




commit 5d09844896303f8b9365b90036e98726d46817e0
Author: Sven Neumann <sven svenfoo org>
Date:   Tue Sep 29 13:22:07 2020 +0200

    Revert "Move gtk-doc comments from librsvg/rsvg-*.c to the Rust code"
    
    Back out this change for now as it breaks the GObject introspection
    and Vala bindings.
    
    This reverts commit 74ec6612bcfe7324f452ac5c4dabe17ef46641d0.

 Makefile.am             |    7 +
 doc/Makefile.am         |    8 +-
 librsvg/c_api.rs        | 1077 ---------------------------------------------
 librsvg/dpi.rs          |   29 --
 librsvg/pixbuf_utils.rs |   84 ----
 librsvg/rsvg-base.c     |   89 ++++
 librsvg/rsvg-handle.c   | 1102 +++++++++++++++++++++++++++++++++++++++++++++++
 librsvg/rsvg-pixbuf.c   |  114 +++++
 8 files changed, 1316 insertions(+), 1194 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index cdc509d1..fc1ff0f7 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -132,6 +132,12 @@ LIBRSVG_C_API_SRC =                                                \
        librsvg/benches/pixbuf_from_surface.rs                  \
        $(NULL)
 
+LIBRSVG_C_API_DOC_SRC =                                                \
+       librsvg/rsvg-base.c                                     \
+       librsvg/rsvg-features.c                                 \
+       librsvg/rsvg-handle.c                                   \
+       librsvg/rsvg-pixbuf.c
+
 RUST_EXTRA =                                           \
        Cargo.lock                                      \
        cargo-vendor-config                             \
@@ -270,6 +276,7 @@ dist_doc_DATA =                             \
 EXTRA_DIST =                           \
        $(LIBRSVG_INTERNALS_SRC)        \
        $(LIBRSVG_C_API_SRC)            \
+       $(LIBRSVG_C_API_DOC_SRC)        \
        $(RUST_EXTRA)                   \
        $(LIBRSVG_CRATE_SRC)            \
        librsvg.doap                    \
diff --git a/doc/Makefile.am b/doc/Makefile.am
index e0cdafb1..2da00c96 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -30,7 +30,7 @@ SCAN_OPTIONS = --deprecated-guards="RSVG_DISABLE_DEPRECATED"
 
 # Extra options to supply to gtkdoc-mkdb.
 # e.g. MKDB_OPTIONS=--sgml-mode --output-format=xml
-MKDB_OPTIONS = --xml-mode --output-format=xml --name-space=rsvg --source-suffixes=c,rs,h
+MKDB_OPTIONS = --xml-mode --output-format=xml --name-space=rsvg
 
 # Extra options to supply to gtkdoc-mktmpl
 # e.g. MKTMPL_OPTIONS=--only-section-tmpl
@@ -53,11 +53,11 @@ FIXXREF_OPTIONS = \
 # e.g. HFILE_GLOB=$(top_srcdir)/gtk/*.h
 # e.g. CFILE_GLOB=$(top_srcdir)/gtk/*.c
 HFILE_GLOB = \
-       $(top_srcdir)/librsvg/*.h       \
-       $(top_builddir)/librsvg/rsvg-version.h
+       $(top_srcdir)/librsvg/*.h \
+       $(top_builddir)/librsvg/*.h
 
 CFILE_GLOB = \
-       $(top_srcdir)/librsvg/*.rs
+       $(top_srcdir)/librsvg/*.c
 
 # Extra header to include when scanning, which are not under DOC_SOURCE_DIR
 # e.g. EXTRA_HFILES=$(top_srcdir}/contrib/extra.h
diff --git a/librsvg/c_api.rs b/librsvg/c_api.rs
index 3c458673..ca2e9aee 100644
--- a/librsvg/c_api.rs
+++ b/librsvg/c_api.rs
@@ -42,297 +42,6 @@ use crate::pixbuf_utils::{empty_pixbuf, pixbuf_from_surface};
 
 include!(concat!(env!("OUT_DIR"), "/version.rs"));
 
-/**
- * SECTION: rsvg-handle
- * @short_description: Loads SVG data into memory.
- *
- * This is the main entry point into the librsvg library.  An RsvgHandle is an
- * object that represents SVG data in memory.  Your program creates an
- * RsvgHandle from an SVG file, or from a memory buffer that contains SVG data,
- * or in the most general form, from a #GInputStream that will provide SVG data.
- *
- * Librsvg can load SVG images and render them to Cairo surfaces,
- * using a mixture of SVG's [static mode] and [secure static mode].
- * Librsvg does not do animation nor scripting, and can load
- * references to external data only in some situations; see below.
- *
- * Librsvg supports reading <ulink
- * url="https://www.w3.org/TR/SVG11/";>SVG 1.1</ulink> data, and is
- * gradually adding support for features in <ulink
- * url="https://www.w3.org/TR/SVG2/";>SVG 2</ulink>.  Librsvg also supports
- * SVGZ files, which are just an SVG stream compressed with the GZIP algorithm.
- *
- * # The "base file" and resolving references to external files
- *
- * When you load an SVG, librsvg needs to know the location of the "base file"
- * for it.  This is so that librsvg can determine the location of referenced
- * entities.  For example, say you have an SVG in <filename>/foo/bar/foo.svg</filename>
- * and that it has an image element like this:
- *
- * |[
- * <image href="resources/foo.png" .../>
- * ]|
- *
- * In this case, librsvg needs to know the location of the toplevel
- * <filename>/foo/bar/foo.svg</filename> so that it can generate the appropriate
- * reference to <filename>/foo/bar/resources/foo.png</filename>.
- *
- * ## Security and locations of referenced files
- *
- * When processing an SVG, librsvg will only load referenced files if they are
- * in the same directory as the base file, or in a subdirectory of it.  That is,
- * if the base file is <filename>/foo/bar/baz.svg</filename>, then librsvg will
- * only try to load referenced files (from SVG's
- * <literal>&lt;image&gt;</literal> element, for example, or from content
- * included through XML entities) if those files are in <filename>/foo/bar/<!--
- * -->*</filename> or in <filename>/foo/bar/<!-- -->*<!-- -->/.../<!--
- * -->*</filename>.  This is so that malicious SVG files cannot include files
- * that are in a directory above.
- *
- * The full set of rules for deciding which URLs may be loaded is as follows;
- * they are applied in order.  A referenced URL will not be loaded as soon as
- * one of these rules fails:
- *
- * <orderedlist>
- *   <listitem>
- *     All <literal>data:</literal> URLs may be loaded.  These are sometimes used
- *     to include raster image data, encoded as base-64, directly in an SVG file.
- *   </listitem>
- *
- *   <listitem>
- *     All other URL schemes in references require a base URL.  For
- *     example, this means that if you load an SVG with
- *     rsvg_handle_new_from_data() without calling rsvg_handle_set_base_uri(),
- *     then any referenced files will not be allowed (e.g. raster images to be
- *     loaded from other files will not work).
- *   </listitem>
- *
- *   <listitem>
- *     If referenced URLs are absolute, rather than relative, then they must
- *     have the same scheme as the base URL.  For example, if the base URL has a
- *     "<literal>file</literal>" scheme, then all URL references inside the SVG must
- *     also have the "<literal>file</literal>" scheme, or be relative references which
- *     will be resolved against the base URL.
- *   </listitem>
- *
- *   <listitem>
- *     If referenced URLs have a "<literal>resource</literal>" scheme, that is,
- *     if they are included into your binary program with GLib's resource
- *     mechanism, they are allowed to be loaded (provided that the base URL is
- *     also a "<literal>resource</literal>", per the previous rule).
- *   </listitem>
- *
- *   <listitem>
- *     Otherwise, non-<literal>file</literal> schemes are not allowed.  For
- *     example, librsvg will not load <literal>http</literal> resources, to keep
- *     malicious SVG data from "phoning home".
- *   </listitem>
- *
- *   <listitem>
- *     A relative URL must resolve to the same directory as the base URL, or to
- *     one of its subdirectories.  Librsvg will canonicalize filenames, by
- *     removing ".." path components and resolving symbolic links, to decide whether
- *     files meet these conditions.
- *   </listitem>
- * </orderedlist>
- *
- * # Loading an SVG with GIO
- *
- * This is the easiest and most resource-efficient way of loading SVG data into
- * an #RsvgHandle.
- *
- * If you have a #GFile that stands for an SVG file, you can simply call
- * rsvg_handle_new_from_gfile_sync() to load an RsvgHandle from it.
- *
- * Alternatively, if you have a #GInputStream, you can use
- * rsvg_handle_new_from_stream_sync().
- *
- * Both of those methods allow specifying a #GCancellable, so the loading
- * process can be cancelled from another thread.
- *
- * ## Loading an SVG from memory
- *
- * If you already have SVG data in a byte buffer in memory, you can create a
- * memory input stream with g_memory_input_stream_new_from_data() and feed that
- * to rsvg_handle_new_from_stream_sync().
- *
- * Note that in this case, it is important that you specify the base_file for
- * the in-memory SVG data.  Librsvg uses the base_file to resolve links to
- * external content, like raster images.
- *
- * # Loading an SVG without GIO
- *
- * You can load an RsvgHandle from a simple filename or URI with
- * rsvg_handle_new_from_file().  Note that this is a blocking operation; there
- * is no way to cancel it if loading a remote URI takes a long time.  Also, note that
- * this method does not let you specify #RsvgHandleFlags.
- *
- * Otherwise, loading an SVG without GIO is not recommended, since librsvg will
- * need to buffer your entire data internally before actually being able to
- * parse it.  The deprecated way of doing this is by creating a handle with
- * rsvg_handle_new() or rsvg_handle_new_with_flags(), and then using
- * rsvg_handle_write() and rsvg_handle_close() to feed the handle with SVG data.
- * Still, please try to use the GIO stream functions instead.
- *
- * # Resolution of the rendered image (dots per inch, or DPI)
- *
- * SVG images can contain dimensions like "<literal>5 cm</literal>" or
- * "<literal>2 pt</literal>" that must be converted from physical units into
- * device units.  To do this, librsvg needs to know the actual dots per inch
- * (DPI) of your target device.  You can call rsvg_handle_set_dpi() or
- * rsvg_handle_set_dpi_x_y() on an RsvgHandle to set the DPI before rendering
- * it.
- *
- * # Rendering
- *
- * The preferred way to render an already-loaded RsvgHandle is to use
- * rsvg_handle_render_cairo().  Please see its documentation for details.
- *
- * Alternatively, you can use rsvg_handle_get_pixbuf() to directly obtain a
- * #GdkPixbuf with the rendered image.  This is simple, but it does not let you
- * control the size at which the SVG will be rendered.  It will just be rendered
- * at the size which rsvg_handle_get_dimensions() would return, which depends on
- * the dimensions that librsvg is able to compute from the SVG data.
- *
- * # API ordering
- *
- * Due to the way the librsvg API evolved over time, an #RsvgHandle object is available
- * for use as soon as it is constructed.  However, not all of its methods can be
- * called at any time.  For example, an #RsvgHandle just constructed with rsvg_handle_new()
- * is not loaded yet, and it does not make sense to call rsvg_handle_get_dimensions() on it
- * just at that point.
- *
- * The documentation for the available methods in #RsvgHandle may mention that a particular
- * method is only callable on a "fully loaded handle".  This means either:
- *
- * <itemizedlist>
- *   <listitem>
- *     The handle was loaded with rsvg_handle_write() and rsvg_handle_close(), and
- *     those functions returned no errors.
- *   </listitem>
- *   <listitem>
- *     The handle was loaded with rsvg_handle_read_stream_sync() and that function
- *     returned no errors.
- *   </listitem>
- * </itemizedlist>
- *
- * Before librsvg 2.46, the library did not fully verify that a handle was in a
- * fully loaded state for the methods that require it.  To preserve
- * compatibility with old code which inadvertently called the API without
- * checking for errors, or which called some methods outside of the expected
- * order, librsvg will just emit a g_critical() message in those cases.
- *
- * New methods introduced in librsvg 2.46 and later will check for the correct
- * ordering, and panic if they are called out of order.  This will abort
- * the program as if it had a failed assertion.
- */
-
-/***** Begin documentation for RsvgHandle properties *****/
-
-/**
- * RsvgHandle:flags:
- *
- * Flags from #RsvgHandleFlags.
- *
- * Since: 2.36
- */
-
-/**
- * RsvgHandle::dpi-x:
- *
- * Horizontal resolution in dots per inch.
- */
-
-/**
- * RsvgHandle::dpi-y:
- *
- * Horizontal resolution in dots per inch.
- */
-
-/**
- * RsvgHandle::base-uri:
- *
- * Base URI, to be used to resolve relative references for resources.  See the section
- */
-
-/**
- * RsvgHandle:width:
- *
- * Width, in pixels, of the rendered SVG after calling the size callback
- * as specified by rsvg_handle_set_size_callback().
- *
- * Deprecated: 2.46.  For historical reasons, this property is of integer type,
- * which cannot give the exact size of SVG images that are not pixel-aligned.
- * Moreover, reading each of the size properties causes the size of the SVG to
- * be recomputed, so reading both the <literal>width</literal> and
- * <literal>height</literal> properties will cause two such computations.
- * Please use rsvg_handle_get_intrinsic_dimensions() instead.
- */
-
-/**
- * RsvgHandle:height:
- *
- * Height, in pixels, of the rendered SVG after calling the size callback
- * as specified by rsvg_handle_set_size_callback().
- *
- * Deprecated: 2.46.  For historical reasons, this property is of integer type,
- * which cannot give the exact size of SVG images that are not pixel-aligned.
- * Moreover, reading each of the size properties causes the size of the SVG to
- * be recomputed, so reading both the <literal>width</literal> and
- * <literal>height</literal> properties will cause two such computations.
- * Please use rsvg_handle_get_intrinsic_dimensions() instead.
- */
-
-/**
- * RsvgHandle:em:
- *
- * Exact width, in pixels, of the rendered SVG before calling the size callback
- * as specified by rsvg_handle_set_size_callback().
- *
- * Deprecated: 2.46.  Reading each of the size properties causes the size of the
- * SVG to be recomputed, so reading both the <literal>em</literal> and
- * <literal>ex</literal> properties will cause two such computations.  Please
- * use rsvg_handle_get_intrinsic_dimensions() instead.
- */
-
-/**
- * RsvgHandle:ex:
- *
- * Exact height, in pixels, of the rendered SVG before calling the size callback
- * as specified by rsvg_handle_set_size_callback().
- *
- * Deprecated: 2.46.  Reading each of the size properties causes the size of the
- * SVG to be recomputed, so reading both the <literal>em</literal> and
- * <literal>ex</literal> properties will cause two such computations.  Please
- * use rsvg_handle_get_intrinsic_dimensions() instead.
- */
-
-/**
- * RsvgHandle:title:
- *
- * SVG's title.
- *
- * Deprecated: 2.36.  Reading this property always returns #NULL.
- */
-
-/**
- * RsvgHandle:desc:
- *
- * SVG's description.
- *
- * Deprecated: 2.36.  Reading this property always returns #NULL.
- */
-
-/**
- * RsvgHandle:metadata:
- *
- * SVG's metadata
- *
- * Deprecated: 2.36.  Reading this property always returns #NULL.
- */
-
-/***** End documentation for RsvgHandle properties *****/
-
 mod handle_flags {
     // The following is entirely stolen from the auto-generated code
     // for GBindingFlags, from gtk-rs/glib/src/gobject/auto/flags.rs
@@ -1400,18 +1109,6 @@ pub unsafe extern "C" fn rsvg_handle_flags_get_type() -> glib_sys::GType {
     FTYPE
 }
 
-/**
- * rsvg_handle_set_base_uri:
- * @handle: A #RsvgHandle
- * @base_uri: The base uri
- *
- * Set the base URI for this SVG.
- *
- * Note: This function may only be called before rsvg_handle_write() or
- * rsvg_handle_read_stream_sync() have been called.
- *
- * Since: 2.9
- */
 #[no_mangle]
 pub unsafe extern "C" fn rsvg_handle_set_base_uri(
     handle: *const RsvgHandle,
@@ -1432,18 +1129,6 @@ pub unsafe extern "C" fn rsvg_handle_set_base_uri(
     rhandle.set_base_url(&uri);
 }
 
-/**
- * rsvg_handle_set_base_gfile:
- * @handle: a #RsvgHandle
- * @base_file: a #GFile
- *
- * Set the base URI for @handle from @file.
- *
- * Note: This function may only be called before rsvg_handle_write() or
- * rsvg_handle_read_stream_sync() have been called.
- *
- * Since: 2.32
- */
 #[no_mangle]
 pub unsafe extern "C" fn rsvg_handle_set_base_gfile(
     handle: *const RsvgHandle,
@@ -1465,15 +1150,6 @@ pub unsafe extern "C" fn rsvg_handle_set_base_gfile(
     rhandle.set_base_gfile(&file);
 }
 
-/**
- * rsvg_handle_get_base_uri:
- * @handle: A #RsvgHandle
- *
- * Gets the base uri for this #RsvgHandle.
- *
- * Returns: the base uri, possibly null
- * Since: 2.8
- */
 #[no_mangle]
 pub unsafe extern "C" fn rsvg_handle_get_base_uri(
     handle: *const RsvgHandle,
@@ -1489,20 +1165,6 @@ pub unsafe extern "C" fn rsvg_handle_get_base_uri(
     rhandle.get_base_url_as_ptr()
 }
 
-/**
- * rsvg_handle_set_dpi:
- * @handle: An #RsvgHandle
- * @dpi: Dots Per Inch (i.e. as Pixels Per Inch)
- *
- * Sets the DPI at which the @handle will be rendered. Common values are
- * 75, 90, and 300 DPI.
- *
- * Passing a number <= 0 to @dpi will reset the DPI to whatever the default
- * value happens to be, but since rsvg_set_default_dpi() is deprecated, please
- * do not pass values <= 0 to this function.
- *
- * Since: 2.8
- */
 #[no_mangle]
 pub unsafe extern "C" fn rsvg_handle_set_dpi(handle: *const RsvgHandle, dpi: libc::c_double) {
     rsvg_return_if_fail! {
@@ -1516,21 +1178,6 @@ pub unsafe extern "C" fn rsvg_handle_set_dpi(handle: *const RsvgHandle, dpi: lib
     rhandle.set_dpi_y(dpi);
 }
 
-/**
- * rsvg_handle_set_dpi_x_y:
- * @handle: An #RsvgHandle
- * @dpi_x: Dots Per Inch (i.e. Pixels Per Inch)
- * @dpi_y: Dots Per Inch (i.e. Pixels Per Inch)
- *
- * Sets the DPI at which the @handle will be rendered. Common values are
- * 75, 90, and 300 DPI.
- *
- * Passing a number <= 0 to @dpi will reset the DPI to whatever the default
- * value happens to be, but since rsvg_set_default_dpi_x_y() is deprecated,
- * please do not pass values <= 0 to this function.
- *
- * Since: 2.8
- */
 #[no_mangle]
 pub unsafe extern "C" fn rsvg_handle_set_dpi_x_y(
     handle: *const RsvgHandle,
@@ -1548,63 +1195,6 @@ pub unsafe extern "C" fn rsvg_handle_set_dpi_x_y(
     rhandle.set_dpi_y(dpi_y);
 }
 
-/**
- * rsvg_handle_set_size_callback:
- * @handle: An #RsvgHandle
- * @size_func: (nullable): A sizing function, or %NULL
- * @user_data: User data to pass to @size_func, or %NULL
- * @user_data_destroy: Function to be called to destroy the data passed in @user_data,
- *   or %NULL.
- *
- * Sets the sizing function for the @handle, which can be used to override the
- * size that librsvg computes for SVG images.  The @size_func is called from the
- * following functions:
- *
- * <itemizedlist>
- *   <listitem>rsvg_handle_get_dimensions()</listitem>
- *   <listitem>rsvg_handle_get_dimensions_sub()</listitem>
- *   <listitem>rsvg_handle_get_position_sub()</listitem>
- *   <listitem>rsvg_handle_render_cairo()</listitem>
- *   <listitem>rsvg_handle_render_cairo_sub()</listitem>
- * </itemizedlist>
- *
- * Librsvg computes the size of the SVG being rendered, and passes it to the
- * @size_func, which may then modify these values to set the final size of the
- * generated image.
- *
- * Deprecated: 2.14.  Set up a cairo matrix and use rsvg_handle_render_cairo() instead.
- * You can call rsvg_handle_get_dimensions() to figure out the size of your SVG,
- * and then scale it to the desired size via Cairo.  For example, the following
- * code renders an SVG at a specified size, scaled proportionally from whatever
- * original size it may have had:
- *
- * |[<!-- language="C" -->
- * void
- * render_scaled_proportionally (RsvgHandle *handle, cairo_t cr, int width, int height)
- * {
- *   RsvgDimensionData dimensions;
- *   double x_factor, y_factor;
- *   double scale_factor;
- *
- *   rsvg_handle_get_dimensions (handle, &dimensions);
- *
- *   x_factor = (double) width / dimensions.width;
- *   y_factor = (double) height / dimensions.height;
- *
- *   scale_factor = MIN (x_factor, y_factor);
- *
- *   cairo_scale (cr, scale_factor, scale_factor);
- *
- *   rsvg_handle_render_cairo (handle, cr);
- * }
- * ]|
- *
- * This function was deprecated because when the @size_func is used, it makes it
- * unclear when the librsvg functions which call the @size_func will use the
- * size computed originally, or the callback-specified size, or whether it
- * refers to the whole SVG or to just a sub-element of it.  It is easier, and
- * unambiguous, to use code similar to the example above.
- **/
 #[no_mangle]
 pub unsafe extern "C" fn rsvg_handle_set_size_callback(
     handle: *const RsvgHandle,
@@ -1623,14 +1213,6 @@ pub unsafe extern "C" fn rsvg_handle_set_size_callback(
     rhandle.set_size_callback(size_func, user_data, destroy_notify);
 }
 
-/**
- * rsvg_handle_internal_set_testing:
- * @handle: a #RsvgHandle
- * @testing: Whether to enable testing mode
- *
- * Do not call this function.  This is intended for librsvg's internal
- * test suite only.
- **/
 #[no_mangle]
 pub unsafe extern "C" fn rsvg_handle_internal_set_testing(
     handle: *const RsvgHandle,
@@ -1647,31 +1229,6 @@ pub unsafe extern "C" fn rsvg_handle_internal_set_testing(
     rhandle.set_testing(from_glib(testing));
 }
 
-/**
- * rsvg_handle_read_stream_sync:
- * @handle: a #RsvgHandle
- * @stream: a #GInputStream
- * @cancellable: (nullable): a #GCancellable, or %NULL
- * @error: (optional): a location to store a #GError, or %NULL
- *
- * Reads @stream and writes the data from it to @handle.
- *
- * Before calling this function, you may need to call rsvg_handle_set_base_uri()
- * or rsvg_handle_set_base_gfile() to set the "base file" for resolving
- * references to external resources.  SVG elements like
- * <literal>&lt;image&gt;</literal> which reference external resources will be
- * resolved relative to the location you specify with those functions.
- *
- * If @cancellable is not %NULL, then the operation can be cancelled by
- * triggering the cancellable object from another thread. If the
- * operation was cancelled, the error %G_IO_ERROR_CANCELLED will be
- * returned.
- *
- * Returns: %TRUE if reading @stream succeeded, or %FALSE otherwise
- *   with @error filled in
- *
- * Since: 2.32
- */
 #[no_mangle]
 pub unsafe extern "C" fn rsvg_handle_read_stream_sync(
     handle: *const RsvgHandle,
@@ -1703,30 +1260,6 @@ pub unsafe extern "C" fn rsvg_handle_read_stream_sync(
     }
 }
 
-/**
- * rsvg_handle_write:
- * @handle: an #RsvgHandle
- * @buf: (array length=count) (element-type guchar): pointer to svg data
- * @count: length of the @buf buffer in bytes
- * @error: (optional): a location to store a #GError, or %NULL
- *
- * Loads the next @count bytes of the image.
- *
- * Before calling this function for the first time, you may need to call
- * rsvg_handle_set_base_uri() or rsvg_handle_set_base_gfile() to set the "base
- * file" for resolving references to external resources.  SVG elements like
- * <literal>&lt;image&gt;</literal> which reference external resources will be
- * resolved relative to the location you specify with those functions.
- *
- * Returns: %TRUE on success, or %FALSE on error.
- *
- * Deprecated: 2.46.  Use rsvg_handle_read_stream_sync() or the constructor
- * functions rsvg_handle_new_from_gfile_sync() or
- * rsvg_handle_new_from_stream_sync().  This function is deprecated because it
- * will accumulate data from the @buf in memory until rsvg_handle_close() gets
- * called.  To avoid a big temporary buffer, use the suggested functions, which
- * take a #GFile or a #GInputStream and do not require a temporary buffer.
- **/
 #[no_mangle]
 pub unsafe extern "C" fn rsvg_handle_write(
     handle: *const RsvgHandle,
@@ -1749,22 +1282,6 @@ pub unsafe extern "C" fn rsvg_handle_write(
     true.to_glib()
 }
 
-/**
- * rsvg_handle_close:
- * @handle: a #RsvgHandle
- * @error: (optional): a location to store a #GError, or %NULL
- *
- * Closes @handle, to indicate that loading the image is complete.  This will
- * return %TRUE if the loader closed successfully and the SVG data was parsed
- * correctly.  Note that @handle isn't freed until @g_object_unref is called.
- *
- * Returns: %TRUE on success, or %FALSE on error.
- *
- * Deprecated: 2.46.  Use rsvg_handle_read_stream_sync() or the constructor
- * functions rsvg_handle_new_from_gfile_sync() or
- * rsvg_handle_new_from_stream_sync().  See the deprecation notes for
- * rsvg_handle_write() for more information.
- **/
 #[no_mangle]
 pub unsafe extern "C" fn rsvg_handle_close(
     handle: *const RsvgHandle,
@@ -1788,24 +1305,6 @@ pub unsafe extern "C" fn rsvg_handle_close(
         }
     }
 }
-
-/**
- * rsvg_handle_has_sub:
- * @handle: a #RsvgHandle
- * @id: An element's id within the SVG, starting with "##" (a single hash
- * character), for example, "##layer1".  This notation corresponds to a URL's
- * fragment ID.
- *
- * Checks whether the element @id exists in the SVG document.
- *
- * Element IDs should look like an URL fragment identifier; for example, pass
- * "##foo" (hash <literal>foo</literal>) to get the geometry of the element that
- * has an <literal>id="foo"</literal> attribute.
- *
- * Returns: %TRUE if @id exists in the SVG document, %FALSE otherwise.
- *
- * Since: 2.22
- */
 #[no_mangle]
 pub unsafe extern "C" fn rsvg_handle_has_sub(
     handle: *const RsvgHandle,
@@ -1827,27 +1326,6 @@ pub unsafe extern "C" fn rsvg_handle_has_sub(
     rhandle.has_sub(&id).unwrap_or(false).to_glib()
 }
 
-/**
- * rsvg_handle_render_cairo:
- * @handle: A #RsvgHandle
- * @cr: A Cairo context
- *
- * Draws a loaded SVG handle to a Cairo context.  Drawing will occur with
- * respect to the @cr's current transformation:  for example, if the @cr has a
- * rotated current transformation matrix, the whole SVG will be rotated in the
- * rendered version.
- *
- * This function depends on the #RsvgHandle's DPI to compute dimensions in
- * pixels, so you should call rsvg_handle_set_dpi() beforehand.
- *
- * Note that @cr must be a Cairo context that is not in an error state, that is,
- * cairo_status() must return #CAIRO_STATUS_SUCCESS for it.  Cairo can set a
- * context to be in an error state in various situations, for example, if it was
- * passed an invalid matrix or if it was created for an invalid surface.
- *
- * Returns: %TRUE if drawing succeeded; %FALSE otherwise.
- * Since: 2.14
- */
 #[no_mangle]
 pub unsafe extern "C" fn rsvg_handle_render_cairo(
     handle: *const RsvgHandle,
@@ -1873,34 +1351,6 @@ pub unsafe extern "C" fn rsvg_handle_render_cairo(
     }
 }
 
-/**
- * rsvg_handle_render_cairo_sub:
- * @handle: A #RsvgHandle
- * @cr: A Cairo context
- * @id: (nullable): An element's id within the SVG, starting with "##" (a single
- * hash character), for example, "##layer1".  This notation corresponds to a
- * URL's fragment ID.  Alternatively, pass %NULL to render the whole SVG.
- *
- * Draws a subset of a loaded SVG handle to a Cairo context.  Drawing will occur with
- * respect to the @cr's current transformation:  for example, if the @cr has a
- * rotated current transformation matrix, the whole SVG will be rotated in the
- * rendered version.
- *
- * This function depends on the #RsvgHandle's DPI to compute dimensions in
- * pixels, so you should call rsvg_handle_set_dpi() beforehand.
- *
- * Note that @cr must be a Cairo context that is not in an error state, that is,
- * cairo_status() must return #CAIRO_STATUS_SUCCESS for it.  Cairo can set a
- * context to be in an error state in various situations, for example, if it was
- * passed an invalid matrix or if it was created for an invalid surface.
- *
- * Element IDs should look like an URL fragment identifier; for example, pass
- * "##foo" (hash <literal>foo</literal>) to get the geometry of the element that
- * has an <literal>id="foo"</literal> attribute.
- *
- * Returns: %TRUE if drawing succeeded; %FALSE otherwise.
- * Since: 2.14
- */
 #[no_mangle]
 pub unsafe extern "C" fn rsvg_handle_render_cairo_sub(
     handle: *const RsvgHandle,
@@ -1928,21 +1378,6 @@ pub unsafe extern "C" fn rsvg_handle_render_cairo_sub(
     }
 }
 
-/**
- * rsvg_handle_get_pixbuf:
- * @handle: An #RsvgHandle
- *
- * Returns the pixbuf loaded by @handle.  The pixbuf returned will be reffed, so
- * the caller of this function must assume that ref.  If insufficient data has
- * been read to create the pixbuf, or an error occurred in loading, then %NULL
- * will be returned.  Note that the pixbuf may not be complete until
- * @rsvg_handle_close has been called.
- *
- * This function depends on the #RsvgHandle's DPI to compute dimensions in
- * pixels, so you should call rsvg_handle_set_dpi() beforehand.
- *
- * Returns: (transfer full) (nullable): the pixbuf loaded by @handle, or %NULL.
- **/
 #[no_mangle]
 pub unsafe extern "C" fn rsvg_handle_get_pixbuf(
     handle: *const RsvgHandle,
@@ -1964,36 +1399,6 @@ pub unsafe extern "C" fn rsvg_handle_get_pixbuf(
     }
 }
 
-/**
- * rsvg_handle_get_pixbuf_sub:
- * @handle: An #RsvgHandle
- * @id: (nullable): An element's id within the SVG, starting with "##" (a single
- * hash character), for example, "##layer1".  This notation corresponds to a
- * URL's fragment ID.  Alternatively, pass %NULL to use the whole SVG.
- *
- * Creates a #GdkPixbuf the same size as the entire SVG loaded into @handle, but
- * only renders the sub-element that has the specified @id (and all its
- * sub-sub-elements recursively).  If @id is #NULL, this function renders the
- * whole SVG.
- *
- * This function depends on the #RsvgHandle's DPI to compute dimensions in
- * pixels, so you should call rsvg_handle_set_dpi() beforehand.
- *
- * If you need to render an image which is only big enough to fit a particular
- * sub-element of the SVG, consider using rsvg_handle_render_cairo_sub(), upon a
- * surface that is just the size returned by rsvg_handle_get_dimensions_sub().
- * You will need to offset the rendering by the amount returned in
- * rsvg_handle_get_position_sub().
- *
- * Element IDs should look like an URL fragment identifier; for example, pass
- * "##foo" (hash <literal>foo</literal>) to get the geometry of the element that
- * has an <literal>id="foo"</literal> attribute.
- *
- * Returns: (transfer full) (nullable): a pixbuf, or %NULL if an error occurs
- * during rendering.
- *
- * Since: 2.14
- **/
 #[no_mangle]
 pub unsafe extern "C" fn rsvg_handle_get_pixbuf_sub(
     handle: *const RsvgHandle,
@@ -2017,19 +1422,6 @@ pub unsafe extern "C" fn rsvg_handle_get_pixbuf_sub(
     }
 }
 
-/**
- * rsvg_handle_get_dimensions:
- * @handle: A #RsvgHandle
- * @dimension_data: (out): A place to store the SVG's size
- *
- * Get the SVG's size. Do not call from within the size_func callback, because
- * an infinite loop will occur.
- *
- * This function depends on the #RsvgHandle's DPI to compute dimensions in
- * pixels, so you should call rsvg_handle_set_dpi() beforehand.
- *
- * Since: 2.14
- */
 #[no_mangle]
 pub unsafe extern "C" fn rsvg_handle_get_dimensions(
     handle: *const RsvgHandle,
@@ -2038,28 +1430,6 @@ pub unsafe extern "C" fn rsvg_handle_get_dimensions(
     rsvg_handle_get_dimensions_sub(handle, dimension_data, ptr::null());
 }
 
-/**
- * rsvg_handle_get_dimensions_sub:
- * @handle: A #RsvgHandle
- * @dimension_data: (out): A place to store the SVG's size
- * @id: (nullable): An element's id within the SVG, starting with "##" (a single
- * hash character), for example, "##layer1".  This notation corresponds to a
- * URL's fragment ID.  Alternatively, pass %NULL to use the whole SVG.
- *
- * Get the size of a subelement of the SVG file. Do not call from within the
- * size_func callback, because an infinite loop will occur.
- *
- * This function depends on the #RsvgHandle's DPI to compute dimensions in
- * pixels, so you should call rsvg_handle_set_dpi() beforehand.
- *
- * Element IDs should look like an URL fragment identifier; for example, pass
- * "##foo" (hash <literal>foo</literal>) to get the geometry of the element that
- * has an <literal>id="foo"</literal> attribute.
- *
- * Deprecated: 2.46.  Use rsvg_handle_get_geometry_for_layer() instead.
- *
- * Since: 2.22
- */
 #[no_mangle]
 pub unsafe extern "C" fn rsvg_handle_get_dimensions_sub(
     handle: *const RsvgHandle,
@@ -2091,28 +1461,6 @@ pub unsafe extern "C" fn rsvg_handle_get_dimensions_sub(
     }
 }
 
-/**
- * rsvg_handle_get_position_sub:
- * @handle: A #RsvgHandle
- * @position_data: (out): A place to store the SVG fragment's position.
- * @id: (nullable): An element's id within the SVG, starting with "##" (a single
- * hash character), for example, "##layer1".  This notation corresponds to a
- * URL's fragment ID.  Alternatively, pass %NULL to use the whole SVG.
- *
- * Get the position of a subelement of the SVG file. Do not call from within
- * the size_func callback, because an infinite loop will occur.
- *
- * This function depends on the #RsvgHandle's DPI to compute dimensions in
- * pixels, so you should call rsvg_handle_set_dpi() beforehand.
- *
- * Element IDs should look like an URL fragment identifier; for example, pass
- * "##foo" (hash <literal>foo</literal>) to get the geometry of the element that
- * has an <literal>id="foo"</literal> attribute.
- *
- * Deprecated: 2.46.  Use rsvg_handle_get_geometry_for_layer() instead.
- *
- * Since: 2.22
- */
 #[no_mangle]
 pub unsafe extern "C" fn rsvg_handle_get_position_sub(
     handle: *const RsvgHandle,
@@ -2148,32 +1496,6 @@ pub unsafe extern "C" fn rsvg_handle_get_position_sub(
     }
 }
 
-/**
- * rsvg_handle_new:
- *
- * Returns a new rsvg handle.  Must be freed with @g_object_unref.  This
- * handle can be used to load an image.
- *
- * The preferred way of loading SVG data into the returned #RsvgHandle is with
- * rsvg_handle_read_stream_sync().
- *
- * The deprecated way of loading SVG data is with rsvg_handle_write() and
- * rsvg_handle_close(); note that these require buffering the entire file
- * internally, and for this reason it is better to use the stream functions:
- * rsvg_handle_new_from_stream_sync(), rsvg_handle_read_stream_sync(), or
- * rsvg_handle_new_from_gfile_sync().
- *
- * After loading the #RsvgHandle with data, you can render it using Cairo or get
- * a GdkPixbuf from it. When finished, free the handle with g_object_unref(). No
- * more than one image can be loaded with one handle.
- *
- * Note that this function creates an #RsvgHandle with no flags set.  If you
- * require any of #RsvgHandleFlags to be set, use any of
- * rsvg_handle_new_with_flags(), rsvg_handle_new_from_stream_sync(), or
- * rsvg_handle_new_from_gfile_sync().
- *
- * Returns: A new #RsvgHandle with no flags set.
- **/
 #[no_mangle]
 pub unsafe extern "C" fn rsvg_handle_new() -> *const RsvgHandle {
     let obj: *mut gobject_sys::GObject = glib::Object::new(CHandle::get_type(), &[])
@@ -2183,18 +1505,6 @@ pub unsafe extern "C" fn rsvg_handle_new() -> *const RsvgHandle {
     obj as *mut _
 }
 
-/**
- * rsvg_handle_new_with_flags:
- * @flags: flags from #RsvgHandleFlags
- *
- * Creates a new #RsvgHandle with flags @flags.  After calling this function,
- * you can feed the resulting handle with SVG data by using
- * rsvg_handle_read_stream_sync().
- *
- * Returns: (transfer full): a new #RsvgHandle
- *
- * Since: 2.36
- **/
 #[no_mangle]
 pub unsafe extern "C" fn rsvg_handle_new_with_flags(flags: RsvgHandleFlags) -> *const RsvgHandle {
     let obj: *mut gobject_sys::GObject =
@@ -2205,19 +1515,6 @@ pub unsafe extern "C" fn rsvg_handle_new_with_flags(flags: RsvgHandleFlags) -> *
     obj as *mut _
 }
 
-/**
- * rsvg_handle_new_from_file:
- * @filename: The file name to load, or a URI.
- * @error: (optional): return location for errors
- *
- * Loads the SVG specified by @file_name.  Note that this function, like
- * rsvg_handle_new(), does not specify any loading flags for the resulting
- * handle.  If you require the use of #RsvgHandleFlags, use
- * rsvg_handle_new_from_gfile_sync().
- *
- * Returns: A #RsvgHandle or %NULL if an error occurs.
- * Since: 2.14
- */
 #[no_mangle]
 pub unsafe extern "C" fn rsvg_handle_new_from_file(
     filename: *const libc::c_char,
@@ -2244,28 +1541,6 @@ pub unsafe extern "C" fn rsvg_handle_new_from_file(
     rsvg_handle_new_from_gfile_sync(file.to_glib_none().0, 0, ptr::null_mut(), error)
 }
 
-/**
- * rsvg_handle_new_from_gfile_sync:
- * @file: a #GFile
- * @flags: flags from #RsvgHandleFlags
- * @cancellable: (nullable): a #GCancellable, or %NULL
- * @error: (optional): a location to store a #GError, or %NULL
- *
- * Creates a new #RsvgHandle for @file.
- *
- * This function sets the "base file" of the handle to be @file itself, so SVG
- * elements like <literal>&lt;image&gt;</literal> which reference external
- * resources will be resolved relative to the location of @file.
- *
- * If @cancellable is not %NULL, then the operation can be cancelled by
- * triggering the cancellable object from another thread. If the
- * operation was cancelled, the error %G_IO_ERROR_CANCELLED will be
- * returned in @error.
- *
- * Returns: a new #RsvgHandle on success, or %NULL with @error filled in
- *
- * Since: 2.32
- */
 #[no_mangle]
 pub unsafe extern "C" fn rsvg_handle_new_from_gfile_sync(
     file: *mut gio_sys::GFile,
@@ -2306,29 +1581,6 @@ pub unsafe extern "C" fn rsvg_handle_new_from_gfile_sync(
     }
 }
 
-/**
- * rsvg_handle_new_from_stream_sync:
- * @input_stream: a #GInputStream
- * @base_file: (nullable): a #GFile, or %NULL
- * @flags: flags from #RsvgHandleFlags
- * @cancellable: (nullable): a #GCancellable, or %NULL
- * @error: (optional): a location to store a #GError, or %NULL
- *
- * Creates a new #RsvgHandle for @stream.
- *
- * This function sets the "base file" of the handle to be @base_file if
- * provided.  SVG elements like <literal>&lt;image&gt;</literal> which reference
- * external resources will be resolved relative to the location of @base_file.
- *
- * If @cancellable is not %NULL, then the operation can be cancelled by
- * triggering the cancellable object from another thread. If the
- * operation was cancelled, the error %G_IO_ERROR_CANCELLED will be
- * returned in @error.
- *
- * Returns: a new #RsvgHandle on success, or %NULL with @error filled in
- *
- * Since: 2.32
- */
 #[no_mangle]
 pub unsafe extern "C" fn rsvg_handle_new_from_stream_sync(
     input_stream: *mut gio_sys::GInputStream,
@@ -2369,20 +1621,6 @@ pub unsafe extern "C" fn rsvg_handle_new_from_stream_sync(
     }
 }
 
-/**
- * rsvg_handle_new_from_data:
- * @data: (array length=data_len): The SVG data
- * @data_len: The length of @data, in bytes
- * @error: (optional): return location for errors
- *
- * Loads the SVG specified by @data.  Note that this function creates an
- * #RsvgHandle without a base URL, and without any #RsvgHandleFlags.  If you
- * need these, use rsvg_handle_new_from_stream_sync() instead by creating
- * a #GMemoryInputStream from your data.
- *
- * Returns: A #RsvgHandle or %NULL if an error occurs.
- * Since: 2.14
- */
 #[no_mangle]
 pub unsafe extern "C" fn rsvg_handle_new_from_data(
     data: *const u8,
@@ -2444,39 +1682,11 @@ unsafe fn set_out_param<T: Copy>(
     }
 }
 
-/**
- * rsvg_handle_free:
- * @handle: An #RsvgHandle
- *
- * Frees @handle.
- * Deprecated: Use g_object_unref() instead.
- **/
 #[no_mangle]
 pub unsafe extern "C" fn rsvg_handle_free(handle: *mut RsvgHandle) {
     gobject_sys::g_object_unref(handle as *mut _);
 }
 
-/**
- * rsvg_handle_set_stylesheet:
- * @handle: A #RsvgHandle.
- * @css: (array length=css_len): String with CSS data; must be valid UTF-8.
- * @css_len: Length of the @css data in bytes.
- * @error: (optional): return location for errors.
- *
- * Sets a CSS stylesheet to use for an SVG document.
- *
- * The @css_len argument is mandatory; this function will not compute the length
- * of the @css string.  This is because a provided stylesheet, which the calling
- * program could read from a file, can have nul characters in it.
- *
- * During the CSS cascade, the specified stylesheet will be used with a "User"
- * <ulink
- * url="https://drafts.csswg.org/css-cascade-3/#cascading-origins";>origin</ulink>.
- *
- * Note that `@import` rules will not be resolved, except for `data:` URLs.
- *
- * Since: 2.48
- */
 #[no_mangle]
 pub unsafe extern "C" fn rsvg_handle_set_stylesheet(
     handle: *const RsvgHandle,
@@ -2517,50 +1727,6 @@ pub unsafe extern "C" fn rsvg_handle_set_stylesheet(
     }
 }
 
-/**
- * rsvg_handle_get_intrinsic_dimensions:
- * @handle: An #RsvgHandle
- * @out_has_width: (out)(optional): Will be set to #TRUE if the toplevel SVG has a <literal>width</literal> 
attribute
- * @out_width: (out)(optional): Will be set to the value of the <literal>width</literal> attribute in the 
toplevel SVG
- * @out_has_height: (out)(optional): Will be set to #TRUE if the toplevel SVG has a 
<literal>height</literal> attribute
- * @out_height: (out)(optional): Will be set to the value of the <literal>height</literal> attribute in the 
toplevel SVG
- * @out_has_viewbox: (out)(optional): Will be set to #TRUE if the toplevel SVG has a 
<literal>viewBox</literal> attribute
- * @out_viewbox: (out)(optional): Will be set to the value of the <literal>viewBox</literal> attribute in 
the toplevel SVG
- *
- * Queries the <literal>width</literal>, <literal>height</literal>, and
- * <literal>viewBox</literal> attributes in an SVG document.
- *
- * If you are calling this function to compute a scaling factor to render the SVG,
- * consider simply using rsvg_handle_render_document() instead; it will do the
- * scaling computations automatically.
- *
- * As an example, the following SVG element has a <literal>width</literal> of 100 pixels and a 
<literal>height</literal> of 400 pixels, but no <literal>viewBox</literal>:
- *
- * |[
- * <svg xmlns="http://www.w3.org/2000/svg"; width="100" height="400">
- * ]|
- *
- * Conversely, the following element has a <literal>viewBox</literal>, but no <literal>width</literal> or 
<literal>height</literal>:
- *
- * |[
- * <svg xmlns="http://www.w3.org/2000/svg"; viewBox="0 0 100 400">
- * ]|
- *
- * Note that the #RsvgLength return values have #RsvgUnits in them; you should
- * not assume that they are always in pixels.  For example, the following SVG element
- * will return a width value whose <literal>units</literal> field is RSVG_UNIT_MM.
- *
- * |[
- * <svg xmlns="http://www.w3.org/2000/svg"; width="210mm" height="297mm">
- * ]|
- *
- * API ordering: This function must be called on a fully-loaded @handle.  See
- * the section <ulink url="#API-ordering">API ordering</ulink> for details.
- *
- * Panics: this function will panic if the @handle is not fully-loaded.
- *
- * Since: 2.46
- */
 #[no_mangle]
 pub unsafe extern "C" fn rsvg_handle_get_intrinsic_dimensions(
     handle: *const RsvgHandle,
@@ -2592,28 +1758,6 @@ pub unsafe extern "C" fn rsvg_handle_get_intrinsic_dimensions(
     set_out_param(out_has_viewbox, out_viewbox, &r);
 }
 
-/**
- * rsvg_handle_render_document:
- * @handle: An #RsvgHandle
- * @cr: A Cairo context
- * @viewport: Viewport size at which the whole SVG would be fitted.
- * @error: (optional): a location to store a #GError, or %NULL
- *
- * Renders the whole SVG document fitted to a viewport.
- *
- * The @viewport gives the position and size at which the whole SVG
- * document will be rendered.
- *
- * The @cr must be in a #CAIRO_STATUS_SUCCESS state, or this function will not
- * render anything, and instead will return an error.
- *
- * API ordering: This function must be called on a fully-loaded @handle.  See
- * the section <ulink url="#API-ordering">API ordering</ulink> for details.
- *
- * Panics: this function will panic if the @handle is not fully-loaded.
- *
- * Since: 2.46
- */
 #[no_mangle]
 pub unsafe extern "C" fn rsvg_handle_render_document(
     handle: *const RsvgHandle,
@@ -2643,48 +1787,6 @@ pub unsafe extern "C" fn rsvg_handle_render_document(
     }
 }
 
-/**
- * rsvg_handle_get_geometry_for_layer:
- * @handle: An #RsvgHandle
- * @id: (nullable): An element's id within the SVG, starting with "##" (a single
- * hash character), for example, "##layer1".  This notation corresponds to a
- * URL's fragment ID.  Alternatively, pass %NULL to compute the geometry for the
- * whole SVG.
- * @viewport: Viewport size at which the whole SVG would be fitted.
- * @out_ink_rect: (out)(optional): Place to store the ink rectangle of the element.
- * @out_logical_rect: (out)(optional): Place to store the logical rectangle of the element.
- * @error: (optional): a location to store a #GError, or %NULL
- *
- * Computes the ink rectangle and logical rectangle of an SVG element, or the
- * whole SVG, as if the whole SVG were rendered to a specific viewport.
- *
- * Element IDs should look like an URL fragment identifier; for example, pass
- * "##foo" (hash <literal>foo</literal>) to get the geometry of the element that
- * has an <literal>id="foo"</literal> attribute.
- *
- * The "ink rectangle" is the bounding box that would be painted
- * for fully- stroked and filled elements.
- *
- * The "logical rectangle" just takes into account the unstroked
- * paths and text outlines.
- *
- * Note that these bounds are not minimum bounds; for example,
- * clipping paths are not taken into account.
- *
- * You can pass #NULL for the @id if you want to measure all
- * the elements in the SVG, i.e. to measure everything from the
- * root element.
- *
- * This operation is not constant-time, as it involves going through all
- * the child elements.
- *
- * API ordering: This function must be called on a fully-loaded @handle.  See
- * the section <ulink url="#API-ordering">API ordering</ulink> for details.
- *
- * Panics: this function will panic if the @handle is not fully-loaded.
- *
- * Since: 2.46
- */
 #[no_mangle]
 pub unsafe extern "C" fn rsvg_handle_get_geometry_for_layer(
     handle: *mut RsvgHandle,
@@ -2726,40 +1828,6 @@ pub unsafe extern "C" fn rsvg_handle_get_geometry_for_layer(
     }
 }
 
-/**
- * rsvg_handle_render_layer:
- * @handle: An #RsvgHandle
- * @cr: A Cairo context
- * @id: (nullable): An element's id within the SVG, starting with "##" (a single
- * hash character), for example, "##layer1".  This notation corresponds to a
- * URL's fragment ID.  Alternatively, pass %NULL to render the whole SVG document tree.
- * @viewport: Viewport size at which the whole SVG would be fitted.
- * @error: (optional): a location to store a #GError, or %NULL
- *
- * Renders a single SVG element in the same place as for a whole SVG document.
- *
- * This is equivalent to rsvg_handle_render_document(), but it renders only a
- * single element and its children, as if they composed an individual layer in
- * the SVG.  The element is rendered with the same transformation matrix as it
- * has within the whole SVG document.  Applications can use this to re-render a
- * single element and repaint it on top of a previously-rendered document, for
- * example.
- *
- * Element IDs should look like an URL fragment identifier; for example, pass
- * "##foo" (hash <literal>foo</literal>) to get the geometry of the element that
- * has an <literal>id="foo"</literal> attribute.
- *
- * You can pass #NULL for the @id if you want to render all
- * the elements in the SVG, i.e. to render everything from the
- * root element.
- *
- * API ordering: This function must be called on a fully-loaded @handle.  See
- * the section <ulink url="#API-ordering">API ordering</ulink> for details.
- *
- * Panics: this function will panic if the @handle is not fully-loaded.
- *
- * Since: 2.46
- */
 #[no_mangle]
 pub unsafe extern "C" fn rsvg_handle_render_layer(
     handle: *const RsvgHandle,
@@ -2791,53 +1859,6 @@ pub unsafe extern "C" fn rsvg_handle_render_layer(
     }
 }
 
-/**
- * rsvg_handle_get_geometry_for_element:
- * @handle: An #RsvgHandle
- * @id: (nullable): An element's id within the SVG, starting with "##" (a single
- * hash character), for example, "##layer1".  This notation corresponds to a
- * URL's fragment ID.  Alternatively, pass %NULL to compute the geometry for the
- * whole SVG.
- * @out_ink_rect: (out)(optional): Place to store the ink rectangle of the element.
- * @out_logical_rect: (out)(optional): Place to store the logical rectangle of the element.
- * @error: (optional): a location to store a #GError, or %NULL
- *
- * Computes the ink rectangle and logical rectangle of a single SVG element.
- *
- * While `rsvg_handle_get_geometry_for_layer` computes the geometry of an SVG element subtree with
- * its transformation matrix, this other function will compute the element's geometry
- * as if it were being rendered under an identity transformation by itself.  That is,
- * the resulting geometry is as if the element got extracted by itself from the SVG.
- *
- * This function is the counterpart to `rsvg_handle_render_element`.
- *
- * Element IDs should look like an URL fragment identifier; for example, pass
- * "##foo" (hash <literal>foo</literal>) to get the geometry of the element that
- * has an <literal>id="foo"</literal> attribute.
- *
- * The "ink rectangle" is the bounding box that would be painted
- * for fully- stroked and filled elements.
- *
- * The "logical rectangle" just takes into account the unstroked
- * paths and text outlines.
- *
- * Note that these bounds are not minimum bounds; for example,
- * clipping paths are not taken into account.
- *
- * You can pass #NULL for the @id if you want to measure all
- * the elements in the SVG, i.e. to measure everything from the
- * root element.
- *
- * This operation is not constant-time, as it involves going through all
- * the child elements.
- *
- * API ordering: This function must be called on a fully-loaded @handle.  See
- * the section <ulink url="#API-ordering">API ordering</ulink> for details.
- *
- * Panics: this function will panic if the @handle is not fully-loaded.
- *
- * Since: 2.46
- */
 #[no_mangle]
 pub unsafe extern "C" fn rsvg_handle_get_geometry_for_element(
     handle: *const RsvgHandle,
@@ -2877,41 +1898,6 @@ pub unsafe extern "C" fn rsvg_handle_get_geometry_for_element(
     }
 }
 
-/**
- * rsvg_handle_render_element:
- * @handle: An #RsvgHandle
- * @cr: A Cairo context
- * @id: (nullable): An element's id within the SVG, starting with "##" (a single
- * hash character), for example, "##layer1".  This notation corresponds to a
- * URL's fragment ID.  Alternatively, pass %NULL to render the whole SVG document tree.
- * @element_viewport: Viewport size in which to fit the element
- * @error: (optional): a location to store a #GError, or %NULL
- *
- * Renders a single SVG element to a given viewport
- *
- * This function can be used to extract individual element subtrees and render them,
- * scaled to a given @element_viewport.  This is useful for applications which have
- * reusable objects in an SVG and want to render them individually; for example, an
- * SVG full of icons that are meant to be be rendered independently of each other.
- *
- * Element IDs should look like an URL fragment identifier; for example, pass
- * "##foo" (hash <literal>foo</literal>) to get the geometry of the element that
- * has an <literal>id="foo"</literal> attribute.
- *
- * You can pass #NULL for the @id if you want to render all
- * the elements in the SVG, i.e. to render everything from the
- * root element.
- *
- * The `element_viewport` gives the position and size at which the named element will
- * be rendered.  FIXME: mention proportional scaling.
- *
- * API ordering: This function must be called on a fully-loaded @handle.  See
- * the section <ulink url="#API-ordering">API ordering</ulink> for details.
- *
- * Panics: this function will panic if the @handle is not fully-loaded.
- *
- * Since: 2.46
- */
 #[no_mangle]
 pub unsafe extern "C" fn rsvg_handle_render_element(
     handle: *const RsvgHandle,
@@ -2943,17 +1929,6 @@ pub unsafe extern "C" fn rsvg_handle_render_element(
     }
 }
 
-/**
- * rsvg_handle_get_desc:
- * @handle: An #RsvgHandle
- *
- * Returns: (nullable): This function always returns NULL.
- *
- * Since: 2.4
- *
- * Deprecated: 2.36.  Librsvg does not read the metadata/desc/title elements;
- * this function always returns #NULL.
- */
 #[no_mangle]
 pub unsafe extern "C" fn rsvg_handle_get_desc(handle: *const RsvgHandle) -> *mut libc::c_char {
     rsvg_return_val_if_fail! {
@@ -2965,17 +1940,6 @@ pub unsafe extern "C" fn rsvg_handle_get_desc(handle: *const RsvgHandle) -> *mut
     ptr::null_mut()
 }
 
-/**
- * rsvg_handle_get_metadata:
- * @handle: An #RsvgHandle
- *
- * Returns: (nullable): This function always returns #NULL.
- *
- * Since: 2.9
- *
- * Deprecated: 2.36.  Librsvg does not read the metadata/desc/title elements;
- * this function always returns #NULL.
- */
 #[no_mangle]
 pub unsafe extern "C" fn rsvg_handle_get_metadata(handle: *const RsvgHandle) -> *mut libc::c_char {
     rsvg_return_val_if_fail! {
@@ -2987,17 +1951,6 @@ pub unsafe extern "C" fn rsvg_handle_get_metadata(handle: *const RsvgHandle) ->
     ptr::null_mut()
 }
 
-/**
- * rsvg_handle_get_title:
- * @handle: An #RsvgHandle
- *
- * Returns: (nullable): This function always returns NULL.
- *
- * Since: 2.4
- *
- * Deprecated: 2.36.  Librsvg does not read the metadata/desc/title elements;
- * this function always returns #NULL.
- */
 #[no_mangle]
 pub unsafe extern "C" fn rsvg_handle_get_title(handle: *const RsvgHandle) -> *mut libc::c_char {
     rsvg_return_val_if_fail! {
@@ -3009,35 +1962,12 @@ pub unsafe extern "C" fn rsvg_handle_get_title(handle: *const RsvgHandle) -> *mu
     ptr::null_mut()
 }
 
-/**
- * rsvg_init:
- *
- * This function does nothing.
- *
- * Since: 2.9
- * Deprecated: 2.36: There is no need to initialize librsvg.
- **/
 #[no_mangle]
 pub unsafe extern "C" fn rsvg_init() {}
 
-/**
- * rsvg_term:
- *
- * This function does nothing.
- *
- * Since: 2.9
- * Deprecated: 2.36: There is no need to de-initialize librsvg.
- **/
 #[no_mangle]
 pub unsafe extern "C" fn rsvg_term() {}
 
-/**
- * rsvg_cleanup:
- *
- * Deprecated: 2.46: No-op. This function should not be called from normal programs.
- *
- * Since: 2.36
- **/
 #[no_mangle]
 pub unsafe extern "C" fn rsvg_cleanup() {}
 
@@ -3143,13 +2073,6 @@ impl ErrorDomain for RsvgError {
     }
 }
 
-/**
- * rsvg_error_quark:
- *
- * The error domain for RSVG
- *
- * Returns: The error domain
- */
 #[no_mangle]
 pub extern "C" fn rsvg_error_quark() -> glib_sys::GQuark {
     RsvgError::domain().to_glib()
diff --git a/librsvg/dpi.rs b/librsvg/dpi.rs
index a4dc81e8..f8e07edc 100644
--- a/librsvg/dpi.rs
+++ b/librsvg/dpi.rs
@@ -51,21 +51,6 @@ impl From<Dpi> for rsvg_internals::Dpi {
     }
 }
 
-/**
- * rsvg_set_default_dpi_x_y:
- * @dpi_x: Dots Per Inch (aka Pixels Per Inch)
- * @dpi_y: Dots Per Inch (aka Pixels Per Inch)
- *
- * Do not use this function.  Create an #RsvgHandle and call
- * rsvg_handle_set_dpi_x_y() on it instead.
- *
- * Since: 2.8
- *
- * Deprecated: 2.42.3: This function used to set a global default DPI.  However,
- * it only worked if it was called before any #RsvgHandle objects had been
- * created; it would not work after that.  To avoid global mutable state, please
- * use rsvg_handle_set_dpi() instead.
- */
 #[no_mangle]
 pub unsafe extern "C" fn rsvg_set_default_dpi_x_y(dpi_x: libc::c_double, dpi_y: libc::c_double) {
     if dpi_x <= 0.0 {
@@ -81,20 +66,6 @@ pub unsafe extern "C" fn rsvg_set_default_dpi_x_y(dpi_x: libc::c_double, dpi_y:
     }
 }
 
-/**
- * rsvg_set_default_dpi:
- * @dpi: Dots Per Inch (aka Pixels Per Inch)
- *
- * Do not use this function.  Create an #RsvgHandle and call
- * rsvg_handle_set_dpi() on it instead.
- *
- * Since: 2.8
- *
- * Deprecated: 2.42.3: This function used to set a global default DPI.  However,
- * it only worked if it was called before any #RsvgHandle objects had been
- * created; it would not work after that.  To avoid global mutable state, please
- * use rsvg_handle_set_dpi() instead.
- */
 #[no_mangle]
 pub unsafe extern "C" fn rsvg_set_default_dpi(dpi: libc::c_double) {
     if dpi <= 0.0 {
diff --git a/librsvg/pixbuf_utils.rs b/librsvg/pixbuf_utils.rs
index 5d97bd96..a2e48939 100644
--- a/librsvg/pixbuf_utils.rs
+++ b/librsvg/pixbuf_utils.rs
@@ -1,11 +1,3 @@
-/**
- * SECTION: rsvg-pixbuf
- * @short_description: How to render SVGs into GdkPixbufs, for easy use in GTK+
- *  applications
- *
- * GdkPixbuf is a library for image loading and manipulation. It is part of the
- * cross-platform GTK+ widget toolkit.
- */
 use std::path::PathBuf;
 use std::ptr;
 
@@ -276,18 +268,6 @@ fn pixbuf_from_file_with_size_mode(
     }
 }
 
-/**
- * rsvg_pixbuf_from_file:
- * @filename: A file name
- * @error: return location for errors
- *
- * Loads a new #GdkPixbuf from @filename and returns it.  The caller must
- * assume the reference to the reurned pixbuf. If an error occurred, @error is
- * set and %NULL is returned.
- *
- * Return value: A newly allocated #GdkPixbuf, or %NULL
- * Deprecated: Set up a cairo matrix and use rsvg_handle_new_from_file() + rsvg_handle_render_cairo() 
instead.
- **/
 #[no_mangle]
 pub unsafe extern "C" fn rsvg_pixbuf_from_file(
     filename: *const libc::c_char,
@@ -313,22 +293,6 @@ pub unsafe extern "C" fn rsvg_pixbuf_from_file(
     )
 }
 
-/**
- * rsvg_pixbuf_from_file_at_size:
- * @filename: A file name
- * @width: The new width, or -1
- * @height: The new height, or -1
- * @error: return location for errors
- *
- * Loads a new #GdkPixbuf from @filename and returns it.  This pixbuf is scaled
- * from the size indicated to the new size indicated by @width and @height.  If
- * both of these are -1, then the default size of the image being loaded is
- * used.  The caller must assume the reference to the returned pixbuf. If an
- * error occurred, @error is set and %NULL is returned.
- *
- * Return value: A newly allocated #GdkPixbuf, or %NULL
- * Deprecated: Set up a cairo matrix and use rsvg_handle_new_from_file() + rsvg_handle_render_cairo() 
instead.
- **/
 #[no_mangle]
 pub unsafe extern "C" fn rsvg_pixbuf_from_file_at_size(
     filename: *const libc::c_char,
@@ -357,21 +321,6 @@ pub unsafe extern "C" fn rsvg_pixbuf_from_file_at_size(
     )
 }
 
-/**
- * rsvg_pixbuf_from_file_at_zoom:
- * @filename: A file name
- * @x_zoom: The horizontal zoom factor
- * @y_zoom: The vertical zoom factor
- * @error: return location for errors
- *
- * Loads a new #GdkPixbuf from @filename and returns it.  This pixbuf is scaled
- * from the size indicated by the file by a factor of @x_zoom and @y_zoom.  The
- * caller must assume the reference to the returned pixbuf. If an error
- * occurred, @error is set and %NULL is returned.
- *
- * Return value: A newly allocated #GdkPixbuf, or %NULL
- * Deprecated: Set up a cairo matrix and use rsvg_handle_new_from_file() + rsvg_handle_render_cairo() 
instead.
- **/
 #[no_mangle]
 pub unsafe extern "C" fn rsvg_pixbuf_from_file_at_zoom(
     filename: *const libc::c_char,
@@ -400,24 +349,6 @@ pub unsafe extern "C" fn rsvg_pixbuf_from_file_at_zoom(
     )
 }
 
-/**
- * rsvg_pixbuf_from_file_at_zoom_with_max:
- * @filename: A file name
- * @x_zoom: The horizontal zoom factor
- * @y_zoom: The vertical zoom factor
- * @max_width: The requested max width
- * @max_height: The requested max height
- * @error: return location for errors
- *
- * Loads a new #GdkPixbuf from @filename and returns it.  This pixbuf is scaled
- * from the size indicated by the file by a factor of @x_zoom and @y_zoom. If the
- * resulting pixbuf would be larger than max_width/max_heigh it is uniformly scaled
- * down to fit in that rectangle. The caller must assume the reference to the
- * returned pixbuf. If an error occurred, @error is set and %NULL is returned.
- *
- * Return value: A newly allocated #GdkPixbuf, or %NULL
- * Deprecated: Set up a cairo matrix and use rsvg_handle_new_from_file() + rsvg_handle_render_cairo() 
instead.
- **/
 #[no_mangle]
 pub unsafe extern "C" fn rsvg_pixbuf_from_file_at_zoom_with_max(
     filename: *const libc::c_char,
@@ -449,21 +380,6 @@ pub unsafe extern "C" fn rsvg_pixbuf_from_file_at_zoom_with_max(
     )
 }
 
-/**
- * rsvg_pixbuf_from_file_at_max_size:
- * @filename: A file name
- * @max_width: The requested max width
- * @max_height: The requested max height
- * @error: return location for errors
- *
- * Loads a new #GdkPixbuf from @filename and returns it.  This pixbuf is uniformly
- * scaled so that the it fits into a rectangle of size max_width * max_height. The
- * caller must assume the reference to the returned pixbuf. If an error occurred,
- * @error is set and %NULL is returned.
- *
- * Return value: A newly allocated #GdkPixbuf, or %NULL
- * Deprecated: Set up a cairo matrix and use rsvg_handle_new_from_file() + rsvg_handle_render_cairo() 
instead.
- **/
 #[no_mangle]
 pub unsafe extern "C" fn rsvg_pixbuf_from_file_at_max_size(
     filename: *const libc::c_char,
diff --git a/librsvg/rsvg-base.c b/librsvg/rsvg-base.c
new file mode 100644
index 00000000..7b1bc98b
--- /dev/null
+++ b/librsvg/rsvg-base.c
@@ -0,0 +1,89 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* vim: set sw=4 sts=4 expandtab: */
+/*
+   rsvg.c: SAX-based renderer for SVG files into a GdkPixbuf.
+
+   Copyright (C) 2000 Eazel, Inc.
+   Copyright (C) 2002 Dom Lachowicz <cinamod hotmail com>
+
+   This library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   This library 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with this library; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+
+   Author: Raph Levien <raph artofcode com>
+*/
+
+/**
+ * rsvg_error_quark:
+ *
+ * The error domain for RSVG
+ *
+ * Returns: The error domain
+ */
+
+/**
+ * rsvg_set_default_dpi:
+ * @dpi: Dots Per Inch (aka Pixels Per Inch)
+ *
+ * Do not use this function.  Create an #RsvgHandle and call
+ * rsvg_handle_set_dpi() on it instead.
+ *
+ * Since: 2.8
+ *
+ * Deprecated: 2.42.3: This function used to set a global default DPI.  However,
+ * it only worked if it was called before any #RsvgHandle objects had been
+ * created; it would not work after that.  To avoid global mutable state, please
+ * use rsvg_handle_set_dpi() instead.
+ */
+
+/**
+ * rsvg_set_default_dpi_x_y:
+ * @dpi_x: Dots Per Inch (aka Pixels Per Inch)
+ * @dpi_y: Dots Per Inch (aka Pixels Per Inch)
+ *
+ * Do not use this function.  Create an #RsvgHandle and call
+ * rsvg_handle_set_dpi_x_y() on it instead.
+ *
+ * Since: 2.8
+ *
+ * Deprecated: 2.42.3: This function used to set a global default DPI.  However,
+ * it only worked if it was called before any #RsvgHandle objects had been
+ * created; it would not work after that.  To avoid global mutable state, please
+ * use rsvg_handle_set_dpi() instead.
+ */
+
+/**
+ * rsvg_init:
+ *
+ * This function does nothing.
+ *
+ * Since: 2.9
+ * Deprecated: 2.36: There is no need to initialize librsvg.
+ **/
+
+/**
+ * rsvg_term:
+ *
+ * This function does nothing.
+ *
+ * Since: 2.9
+ * Deprecated: 2.36: There is no need to de-initialize librsvg.
+ **/
+
+/**
+ * rsvg_cleanup:
+ *
+ * Deprecated: 2.46: No-op. This function should not be called from normal programs.
+ *
+ * Since: 2.36
+ **/
diff --git a/librsvg/rsvg-handle.c b/librsvg/rsvg-handle.c
new file mode 100644
index 00000000..3f567443
--- /dev/null
+++ b/librsvg/rsvg-handle.c
@@ -0,0 +1,1102 @@
+/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* vim: set sw=4 sts=4 expandtab: */
+/*
+   rsvg-gobject.c: GObject support.
+
+   Copyright (C) 2006 Robert Staudinger <robert staudinger gmail com>
+
+   This library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   This library 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with this library; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+*/
+
+/**
+ * SECTION: rsvg-handle
+ * @short_description: Loads SVG data into memory.
+ *
+ * This is the main entry point into the librsvg library.  An RsvgHandle is an
+ * object that represents SVG data in memory.  Your program creates an
+ * RsvgHandle from an SVG file, or from a memory buffer that contains SVG data,
+ * or in the most general form, from a #GInputStream that will provide SVG data.
+ *
+ * Librsvg can load SVG images and render them to Cairo surfaces,
+ * using a mixture of SVG's [static mode] and [secure static mode].
+ * Librsvg does not do animation nor scripting, and can load
+ * references to external data only in some situations; see below.
+ *
+ * Librsvg supports reading <ulink
+ * url="https://www.w3.org/TR/SVG11/";>SVG 1.1</ulink> data, and is
+ * gradually adding support for features in <ulink
+ * url="https://www.w3.org/TR/SVG2/";>SVG 2</ulink>.  Librsvg also supports
+ * SVGZ files, which are just an SVG stream compressed with the GZIP algorithm.
+ *
+ * # The "base file" and resolving references to external files
+ *
+ * When you load an SVG, librsvg needs to know the location of the "base file"
+ * for it.  This is so that librsvg can determine the location of referenced
+ * entities.  For example, say you have an SVG in <filename>/foo/bar/foo.svg</filename>
+ * and that it has an image element like this:
+ *
+ * |[
+ * <image href="resources/foo.png" .../>
+ * ]|
+ *
+ * In this case, librsvg needs to know the location of the toplevel
+ * <filename>/foo/bar/foo.svg</filename> so that it can generate the appropriate
+ * reference to <filename>/foo/bar/resources/foo.png</filename>.
+ *
+ * ## Security and locations of referenced files
+ *
+ * When processing an SVG, librsvg will only load referenced files if they are
+ * in the same directory as the base file, or in a subdirectory of it.  That is,
+ * if the base file is <filename>/foo/bar/baz.svg</filename>, then librsvg will
+ * only try to load referenced files (from SVG's
+ * <literal>&lt;image&gt;</literal> element, for example, or from content
+ * included through XML entities) if those files are in <filename>/foo/bar/<!--
+ * -->*</filename> or in <filename>/foo/bar/<!-- -->*<!-- -->/.../<!--
+ * -->*</filename>.  This is so that malicious SVG files cannot include files
+ * that are in a directory above.
+ *
+ * The full set of rules for deciding which URLs may be loaded is as follows;
+ * they are applied in order.  A referenced URL will not be loaded as soon as
+ * one of these rules fails:
+ *
+ * <orderedlist>
+ *   <listitem>
+ *     All <literal>data:</literal> URLs may be loaded.  These are sometimes used
+ *     to include raster image data, encoded as base-64, directly in an SVG file.
+ *   </listitem>
+ *
+ *   <listitem>
+ *     All other URL schemes in references require a base URL.  For
+ *     example, this means that if you load an SVG with
+ *     rsvg_handle_new_from_data() without calling rsvg_handle_set_base_uri(),
+ *     then any referenced files will not be allowed (e.g. raster images to be
+ *     loaded from other files will not work).
+ *   </listitem>
+ *
+ *   <listitem>
+ *     If referenced URLs are absolute, rather than relative, then they must
+ *     have the same scheme as the base URL.  For example, if the base URL has a
+ *     "<literal>file</literal>" scheme, then all URL references inside the SVG must
+ *     also have the "<literal>file</literal>" scheme, or be relative references which
+ *     will be resolved against the base URL.
+ *   </listitem>
+ *
+ *   <listitem>
+ *     If referenced URLs have a "<literal>resource</literal>" scheme, that is,
+ *     if they are included into your binary program with GLib's resource
+ *     mechanism, they are allowed to be loaded (provided that the base URL is
+ *     also a "<literal>resource</literal>", per the previous rule).
+ *   </listitem>
+ *
+ *   <listitem>
+ *     Otherwise, non-<literal>file</literal> schemes are not allowed.  For
+ *     example, librsvg will not load <literal>http</literal> resources, to keep
+ *     malicious SVG data from "phoning home".
+ *   </listitem>
+ *
+ *   <listitem>
+ *     A relative URL must resolve to the same directory as the base URL, or to
+ *     one of its subdirectories.  Librsvg will canonicalize filenames, by
+ *     removing ".." path components and resolving symbolic links, to decide whether
+ *     files meet these conditions.
+ *   </listitem>
+ * </orderedlist>
+ *
+ * # Loading an SVG with GIO
+ *
+ * This is the easiest and most resource-efficient way of loading SVG data into
+ * an #RsvgHandle.
+ *
+ * If you have a #GFile that stands for an SVG file, you can simply call
+ * rsvg_handle_new_from_gfile_sync() to load an RsvgHandle from it.
+ *
+ * Alternatively, if you have a #GInputStream, you can use
+ * rsvg_handle_new_from_stream_sync().
+ *
+ * Both of those methods allow specifying a #GCancellable, so the loading
+ * process can be cancelled from another thread.
+ *
+ * ## Loading an SVG from memory
+ *
+ * If you already have SVG data in a byte buffer in memory, you can create a
+ * memory input stream with g_memory_input_stream_new_from_data() and feed that
+ * to rsvg_handle_new_from_stream_sync().
+ *
+ * Note that in this case, it is important that you specify the base_file for
+ * the in-memory SVG data.  Librsvg uses the base_file to resolve links to
+ * external content, like raster images.
+ *
+ * # Loading an SVG without GIO
+ *
+ * You can load an RsvgHandle from a simple filename or URI with
+ * rsvg_handle_new_from_file().  Note that this is a blocking operation; there
+ * is no way to cancel it if loading a remote URI takes a long time.  Also, note that
+ * this method does not let you specify #RsvgHandleFlags.
+ *
+ * Otherwise, loading an SVG without GIO is not recommended, since librsvg will
+ * need to buffer your entire data internally before actually being able to
+ * parse it.  The deprecated way of doing this is by creating a handle with
+ * rsvg_handle_new() or rsvg_handle_new_with_flags(), and then using
+ * rsvg_handle_write() and rsvg_handle_close() to feed the handle with SVG data.
+ * Still, please try to use the GIO stream functions instead.
+ *
+ * # Resolution of the rendered image (dots per inch, or DPI)
+ *
+ * SVG images can contain dimensions like "<literal>5 cm</literal>" or
+ * "<literal>2 pt</literal>" that must be converted from physical units into
+ * device units.  To do this, librsvg needs to know the actual dots per inch
+ * (DPI) of your target device.  You can call rsvg_handle_set_dpi() or
+ * rsvg_handle_set_dpi_x_y() on an RsvgHandle to set the DPI before rendering
+ * it.
+ *
+ * # Rendering
+ *
+ * The preferred way to render an already-loaded RsvgHandle is to use
+ * rsvg_handle_render_cairo().  Please see its documentation for details.
+ *
+ * Alternatively, you can use rsvg_handle_get_pixbuf() to directly obtain a
+ * #GdkPixbuf with the rendered image.  This is simple, but it does not let you
+ * control the size at which the SVG will be rendered.  It will just be rendered
+ * at the size which rsvg_handle_get_dimensions() would return, which depends on
+ * the dimensions that librsvg is able to compute from the SVG data.
+ *
+ * # API ordering
+ *
+ * Due to the way the librsvg API evolved over time, an #RsvgHandle object is available
+ * for use as soon as it is constructed.  However, not all of its methods can be
+ * called at any time.  For example, an #RsvgHandle just constructed with rsvg_handle_new()
+ * is not loaded yet, and it does not make sense to call rsvg_handle_get_dimensions() on it
+ * just at that point.
+ *
+ * The documentation for the available methods in #RsvgHandle may mention that a particular
+ * method is only callable on a "fully loaded handle".  This means either:
+ *
+ * <itemizedlist>
+ *   <listitem>
+ *     The handle was loaded with rsvg_handle_write() and rsvg_handle_close(), and
+ *     those functions returned no errors.
+ *   </listitem>
+ *   <listitem>
+ *     The handle was loaded with rsvg_handle_read_stream_sync() and that function
+ *     returned no errors.
+ *   </listitem>
+ * </itemizedlist>
+ *
+ * Before librsvg 2.46, the library did not fully verify that a handle was in a
+ * fully loaded state for the methods that require it.  To preserve
+ * compatibility with old code which inadvertently called the API without
+ * checking for errors, or which called some methods outside of the expected
+ * order, librsvg will just emit a g_critical() message in those cases.
+ *
+ * New methods introduced in librsvg 2.46 and later will check for the correct
+ * ordering, and panic if they are called out of order.  This will abort
+ * the program as if it had a failed assertion.
+ */
+
+/***** Begin documentation for RsvgHandle properties *****/
+
+/**
+ * RsvgHandle:flags:
+ *
+ * Flags from #RsvgHandleFlags.
+ *
+ * Since: 2.36
+ */
+
+/**
+ * RsvgHandle::dpi-x:
+ *
+ * Horizontal resolution in dots per inch.
+ */
+
+/**
+ * RsvgHandle::dpi-y:
+ *
+ * Horizontal resolution in dots per inch.
+ */
+
+/**
+ * RsvgHandle::base-uri:
+ *
+ * Base URI, to be used to resolve relative references for resources.  See the section
+ */
+
+/**
+ * RsvgHandle:width:
+ *
+ * Width, in pixels, of the rendered SVG after calling the size callback
+ * as specified by rsvg_handle_set_size_callback().
+ *
+ * Deprecated: 2.46.  For historical reasons, this property is of integer type,
+ * which cannot give the exact size of SVG images that are not pixel-aligned.
+ * Moreover, reading each of the size properties causes the size of the SVG to
+ * be recomputed, so reading both the <literal>width</literal> and
+ * <literal>height</literal> properties will cause two such computations.
+ * Please use rsvg_handle_get_intrinsic_dimensions() instead.
+ */
+
+/**
+ * RsvgHandle:height:
+ *
+ * Height, in pixels, of the rendered SVG after calling the size callback
+ * as specified by rsvg_handle_set_size_callback().
+ *
+ * Deprecated: 2.46.  For historical reasons, this property is of integer type,
+ * which cannot give the exact size of SVG images that are not pixel-aligned.
+ * Moreover, reading each of the size properties causes the size of the SVG to
+ * be recomputed, so reading both the <literal>width</literal> and
+ * <literal>height</literal> properties will cause two such computations.
+ * Please use rsvg_handle_get_intrinsic_dimensions() instead.
+ */
+
+/**
+ * RsvgHandle:em:
+ *
+ * Exact width, in pixels, of the rendered SVG before calling the size callback
+ * as specified by rsvg_handle_set_size_callback().
+ *
+ * Deprecated: 2.46.  Reading each of the size properties causes the size of the
+ * SVG to be recomputed, so reading both the <literal>em</literal> and
+ * <literal>ex</literal> properties will cause two such computations.  Please
+ * use rsvg_handle_get_intrinsic_dimensions() instead.
+ */
+
+/**
+ * RsvgHandle:ex:
+ *
+ * Exact height, in pixels, of the rendered SVG before calling the size callback
+ * as specified by rsvg_handle_set_size_callback().
+ *
+ * Deprecated: 2.46.  Reading each of the size properties causes the size of the
+ * SVG to be recomputed, so reading both the <literal>em</literal> and
+ * <literal>ex</literal> properties will cause two such computations.  Please
+ * use rsvg_handle_get_intrinsic_dimensions() instead.
+ */
+
+/**
+ * RsvgHandle:title:
+ *
+ * SVG's title.
+ *
+ * Deprecated: 2.36.  Reading this property always returns #NULL.
+ */
+
+/**
+ * RsvgHandle:desc:
+ *
+ * SVG's description.
+ *
+ * Deprecated: 2.36.  Reading this property always returns #NULL.
+ */
+
+/**
+ * RsvgHandle:metadata:
+ *
+ * SVG's metadata
+ *
+ * Deprecated: 2.36.  Reading this property always returns #NULL.
+ */
+
+/***** End documentation for RsvgHandle properties *****/
+
+/**
+ * rsvg_handle_free:
+ * @handle: An #RsvgHandle
+ *
+ * Frees @handle.
+ * Deprecated: Use g_object_unref() instead.
+ **/
+
+/**
+ * rsvg_handle_new:
+ *
+ * Returns a new rsvg handle.  Must be freed with @g_object_unref.  This
+ * handle can be used to load an image.
+ *
+ * The preferred way of loading SVG data into the returned #RsvgHandle is with
+ * rsvg_handle_read_stream_sync().
+ *
+ * The deprecated way of loading SVG data is with rsvg_handle_write() and
+ * rsvg_handle_close(); note that these require buffering the entire file
+ * internally, and for this reason it is better to use the stream functions:
+ * rsvg_handle_new_from_stream_sync(), rsvg_handle_read_stream_sync(), or
+ * rsvg_handle_new_from_gfile_sync().
+ *
+ * After loading the #RsvgHandle with data, you can render it using Cairo or get
+ * a GdkPixbuf from it. When finished, free the handle with g_object_unref(). No
+ * more than one image can be loaded with one handle.
+ *
+ * Note that this function creates an #RsvgHandle with no flags set.  If you
+ * require any of #RsvgHandleFlags to be set, use any of
+ * rsvg_handle_new_with_flags(), rsvg_handle_new_from_stream_sync(), or
+ * rsvg_handle_new_from_gfile_sync().
+ *
+ * Returns: A new #RsvgHandle with no flags set.
+ **/
+
+/**
+ * rsvg_handle_new_from_data:
+ * @data: (array length=data_len): The SVG data
+ * @data_len: The length of @data, in bytes
+ * @error: (optional): return location for errors
+ *
+ * Loads the SVG specified by @data.  Note that this function creates an
+ * #RsvgHandle without a base URL, and without any #RsvgHandleFlags.  If you
+ * need these, use rsvg_handle_new_from_stream_sync() instead by creating
+ * a #GMemoryInputStream from your data.
+ *
+ * Returns: A #RsvgHandle or %NULL if an error occurs.
+ * Since: 2.14
+ */
+
+/**
+ * rsvg_handle_new_from_file:
+ * @filename: The file name to load, or a URI.
+ * @error: (optional): return location for errors
+ *
+ * Loads the SVG specified by @file_name.  Note that this function, like
+ * rsvg_handle_new(), does not specify any loading flags for the resulting
+ * handle.  If you require the use of #RsvgHandleFlags, use
+ * rsvg_handle_new_from_gfile_sync().
+ *
+ * Returns: A #RsvgHandle or %NULL if an error occurs.
+ * Since: 2.14
+ */
+
+/**
+ * rsvg_handle_new_with_flags:
+ * @flags: flags from #RsvgHandleFlags
+ *
+ * Creates a new #RsvgHandle with flags @flags.  After calling this function,
+ * you can feed the resulting handle with SVG data by using
+ * rsvg_handle_read_stream_sync().
+ *
+ * Returns: (transfer full): a new #RsvgHandle
+ *
+ * Since: 2.36
+ **/
+
+/**
+ * rsvg_handle_new_from_gfile_sync:
+ * @file: a #GFile
+ * @flags: flags from #RsvgHandleFlags
+ * @cancellable: (nullable): a #GCancellable, or %NULL
+ * @error: (optional): a location to store a #GError, or %NULL
+ *
+ * Creates a new #RsvgHandle for @file.
+ *
+ * This function sets the "base file" of the handle to be @file itself, so SVG
+ * elements like <literal>&lt;image&gt;</literal> which reference external
+ * resources will be resolved relative to the location of @file.
+ *
+ * If @cancellable is not %NULL, then the operation can be cancelled by
+ * triggering the cancellable object from another thread. If the
+ * operation was cancelled, the error %G_IO_ERROR_CANCELLED will be
+ * returned in @error.
+ *
+ * Returns: a new #RsvgHandle on success, or %NULL with @error filled in
+ *
+ * Since: 2.32
+ */
+
+/**
+ * rsvg_handle_new_from_stream_sync:
+ * @input_stream: a #GInputStream
+ * @base_file: (nullable): a #GFile, or %NULL
+ * @flags: flags from #RsvgHandleFlags
+ * @cancellable: (nullable): a #GCancellable, or %NULL
+ * @error: (optional): a location to store a #GError, or %NULL
+ *
+ * Creates a new #RsvgHandle for @stream.
+ *
+ * This function sets the "base file" of the handle to be @base_file if
+ * provided.  SVG elements like <literal>&lt;image&gt;</literal> which reference
+ * external resources will be resolved relative to the location of @base_file.
+ *
+ * If @cancellable is not %NULL, then the operation can be cancelled by
+ * triggering the cancellable object from another thread. If the
+ * operation was cancelled, the error %G_IO_ERROR_CANCELLED will be
+ * returned in @error.
+ *
+ * Returns: a new #RsvgHandle on success, or %NULL with @error filled in
+ *
+ * Since: 2.32
+ */
+
+/**
+ * rsvg_handle_write:
+ * @handle: an #RsvgHandle
+ * @buf: (array length=count) (element-type guchar): pointer to svg data
+ * @count: length of the @buf buffer in bytes
+ * @error: (optional): a location to store a #GError, or %NULL
+ *
+ * Loads the next @count bytes of the image.
+ *
+ * Before calling this function for the first time, you may need to call
+ * rsvg_handle_set_base_uri() or rsvg_handle_set_base_gfile() to set the "base
+ * file" for resolving references to external resources.  SVG elements like
+ * <literal>&lt;image&gt;</literal> which reference external resources will be
+ * resolved relative to the location you specify with those functions.
+ *
+ * Returns: %TRUE on success, or %FALSE on error.
+ *
+ * Deprecated: 2.46.  Use rsvg_handle_read_stream_sync() or the constructor
+ * functions rsvg_handle_new_from_gfile_sync() or
+ * rsvg_handle_new_from_stream_sync().  This function is deprecated because it
+ * will accumulate data from the @buf in memory until rsvg_handle_close() gets
+ * called.  To avoid a big temporary buffer, use the suggested functions, which
+ * take a #GFile or a #GInputStream and do not require a temporary buffer.
+ **/
+
+/**
+ * rsvg_handle_close:
+ * @handle: a #RsvgHandle
+ * @error: (optional): a location to store a #GError, or %NULL
+ *
+ * Closes @handle, to indicate that loading the image is complete.  This will
+ * return %TRUE if the loader closed successfully and the SVG data was parsed
+ * correctly.  Note that @handle isn't freed until @g_object_unref is called.
+ *
+ * Returns: %TRUE on success, or %FALSE on error.
+ *
+ * Deprecated: 2.46.  Use rsvg_handle_read_stream_sync() or the constructor
+ * functions rsvg_handle_new_from_gfile_sync() or
+ * rsvg_handle_new_from_stream_sync().  See the deprecation notes for
+ * rsvg_handle_write() for more information.
+ **/
+
+/**
+ * rsvg_handle_read_stream_sync:
+ * @handle: a #RsvgHandle
+ * @stream: a #GInputStream
+ * @cancellable: (nullable): a #GCancellable, or %NULL
+ * @error: (optional): a location to store a #GError, or %NULL
+ *
+ * Reads @stream and writes the data from it to @handle.
+ *
+ * Before calling this function, you may need to call rsvg_handle_set_base_uri()
+ * or rsvg_handle_set_base_gfile() to set the "base file" for resolving
+ * references to external resources.  SVG elements like
+ * <literal>&lt;image&gt;</literal> which reference external resources will be
+ * resolved relative to the location you specify with those functions.
+ *
+ * If @cancellable is not %NULL, then the operation can be cancelled by
+ * triggering the cancellable object from another thread. If the
+ * operation was cancelled, the error %G_IO_ERROR_CANCELLED will be
+ * returned.
+ *
+ * Returns: %TRUE if reading @stream succeeded, or %FALSE otherwise
+ *   with @error filled in
+ *
+ * Since: 2.32
+ */
+
+/**
+ * rsvg_handle_set_base_uri:
+ * @handle: A #RsvgHandle
+ * @base_uri: The base uri
+ *
+ * Set the base URI for this SVG.
+ *
+ * Note: This function may only be called before rsvg_handle_write() or
+ * rsvg_handle_read_stream_sync() have been called.
+ *
+ * Since: 2.9
+ */
+
+/**
+ * rsvg_handle_set_base_gfile:
+ * @handle: a #RsvgHandle
+ * @base_file: a #GFile
+ *
+ * Set the base URI for @handle from @file.
+ *
+ * Note: This function may only be called before rsvg_handle_write() or
+ * rsvg_handle_read_stream_sync() have been called.
+ *
+ * Since: 2.32
+ */
+
+/**
+ * rsvg_handle_get_base_uri:
+ * @handle: A #RsvgHandle
+ *
+ * Gets the base uri for this #RsvgHandle.
+ *
+ * Returns: the base uri, possibly null
+ * Since: 2.8
+ */
+
+/**
+ * rsvg_handle_set_stylesheet:
+ * @handle: A #RsvgHandle.
+ * @css: (array length=css_len): String with CSS data; must be valid UTF-8.
+ * @css_len: Length of the @css data in bytes.
+ * @error: (optional): return location for errors.
+ *
+ * Sets a CSS stylesheet to use for an SVG document.
+ *
+ * The @css_len argument is mandatory; this function will not compute the length
+ * of the @css string.  This is because a provided stylesheet, which the calling
+ * program could read from a file, can have nul characters in it.
+ *
+ * During the CSS cascade, the specified stylesheet will be used with a "User"
+ * <ulink
+ * url="https://drafts.csswg.org/css-cascade-3/#cascading-origins";>origin</ulink>.
+ *
+ * Note that `@import` rules will not be resolved, except for `data:` URLs.
+ *
+ * Since: 2.48
+ */
+
+/**
+ * rsvg_handle_get_metadata:
+ * @handle: An #RsvgHandle
+ *
+ * Returns: (nullable): This function always returns #NULL.
+ *
+ * Since: 2.9
+ *
+ * Deprecated: 2.36.  Librsvg does not read the metadata/desc/title elements;
+ * this function always returns #NULL.
+ */
+
+/**
+ * rsvg_handle_get_title:
+ * @handle: An #RsvgHandle
+ *
+ * Returns: (nullable): This function always returns NULL.
+ *
+ * Since: 2.4
+ *
+ * Deprecated: 2.36.  Librsvg does not read the metadata/desc/title elements;
+ * this function always returns #NULL.
+ */
+
+/**
+ * rsvg_handle_get_desc:
+ * @handle: An #RsvgHandle
+ *
+ * Returns: (nullable): This function always returns NULL.
+ *
+ * Since: 2.4
+ *
+ * Deprecated: 2.36.  Librsvg does not read the metadata/desc/title elements;
+ * this function always returns #NULL.
+ */
+
+/**
+ * rsvg_handle_render_cairo_sub:
+ * @handle: A #RsvgHandle
+ * @cr: A Cairo context
+ * @id: (nullable): An element's id within the SVG, starting with "##" (a single
+ * hash character), for example, "##layer1".  This notation corresponds to a
+ * URL's fragment ID.  Alternatively, pass %NULL to render the whole SVG.
+ *
+ * Draws a subset of a loaded SVG handle to a Cairo context.  Drawing will occur with
+ * respect to the @cr's current transformation:  for example, if the @cr has a
+ * rotated current transformation matrix, the whole SVG will be rotated in the
+ * rendered version.
+ *
+ * This function depends on the #RsvgHandle's DPI to compute dimensions in
+ * pixels, so you should call rsvg_handle_set_dpi() beforehand.
+ *
+ * Note that @cr must be a Cairo context that is not in an error state, that is,
+ * cairo_status() must return #CAIRO_STATUS_SUCCESS for it.  Cairo can set a
+ * context to be in an error state in various situations, for example, if it was
+ * passed an invalid matrix or if it was created for an invalid surface.
+ *
+ * Element IDs should look like an URL fragment identifier; for example, pass
+ * "##foo" (hash <literal>foo</literal>) to get the geometry of the element that
+ * has an <literal>id="foo"</literal> attribute.
+ *
+ * Returns: %TRUE if drawing succeeded; %FALSE otherwise.
+ * Since: 2.14
+ */
+
+/**
+ * rsvg_handle_render_cairo:
+ * @handle: A #RsvgHandle
+ * @cr: A Cairo context
+ *
+ * Draws a loaded SVG handle to a Cairo context.  Drawing will occur with
+ * respect to the @cr's current transformation:  for example, if the @cr has a
+ * rotated current transformation matrix, the whole SVG will be rotated in the
+ * rendered version.
+ *
+ * This function depends on the #RsvgHandle's DPI to compute dimensions in
+ * pixels, so you should call rsvg_handle_set_dpi() beforehand.
+ *
+ * Note that @cr must be a Cairo context that is not in an error state, that is,
+ * cairo_status() must return #CAIRO_STATUS_SUCCESS for it.  Cairo can set a
+ * context to be in an error state in various situations, for example, if it was
+ * passed an invalid matrix or if it was created for an invalid surface.
+ *
+ * Returns: %TRUE if drawing succeeded; %FALSE otherwise.
+ * Since: 2.14
+ */
+
+/**
+ * rsvg_handle_get_dimensions:
+ * @handle: A #RsvgHandle
+ * @dimension_data: (out): A place to store the SVG's size
+ *
+ * Get the SVG's size. Do not call from within the size_func callback, because
+ * an infinite loop will occur.
+ *
+ * This function depends on the #RsvgHandle's DPI to compute dimensions in
+ * pixels, so you should call rsvg_handle_set_dpi() beforehand.
+ *
+ * Since: 2.14
+ */
+
+/**
+ * rsvg_handle_get_dimensions_sub:
+ * @handle: A #RsvgHandle
+ * @dimension_data: (out): A place to store the SVG's size
+ * @id: (nullable): An element's id within the SVG, starting with "##" (a single
+ * hash character), for example, "##layer1".  This notation corresponds to a
+ * URL's fragment ID.  Alternatively, pass %NULL to use the whole SVG.
+ *
+ * Get the size of a subelement of the SVG file. Do not call from within the
+ * size_func callback, because an infinite loop will occur.
+ *
+ * This function depends on the #RsvgHandle's DPI to compute dimensions in
+ * pixels, so you should call rsvg_handle_set_dpi() beforehand.
+ *
+ * Element IDs should look like an URL fragment identifier; for example, pass
+ * "##foo" (hash <literal>foo</literal>) to get the geometry of the element that
+ * has an <literal>id="foo"</literal> attribute.
+ *
+ * Deprecated: 2.46.  Use rsvg_handle_get_geometry_for_layer() instead.
+ *
+ * Since: 2.22
+ */
+
+/**
+ * rsvg_handle_get_position_sub:
+ * @handle: A #RsvgHandle
+ * @position_data: (out): A place to store the SVG fragment's position.
+ * @id: (nullable): An element's id within the SVG, starting with "##" (a single
+ * hash character), for example, "##layer1".  This notation corresponds to a
+ * URL's fragment ID.  Alternatively, pass %NULL to use the whole SVG.
+ *
+ * Get the position of a subelement of the SVG file. Do not call from within
+ * the size_func callback, because an infinite loop will occur.
+ *
+ * This function depends on the #RsvgHandle's DPI to compute dimensions in
+ * pixels, so you should call rsvg_handle_set_dpi() beforehand.
+ *
+ * Element IDs should look like an URL fragment identifier; for example, pass
+ * "##foo" (hash <literal>foo</literal>) to get the geometry of the element that
+ * has an <literal>id="foo"</literal> attribute.
+ *
+ * Deprecated: 2.46.  Use rsvg_handle_get_geometry_for_layer() instead.
+ *
+ * Since: 2.22
+ */
+
+/**
+ * rsvg_handle_has_sub:
+ * @handle: a #RsvgHandle
+ * @id: An element's id within the SVG, starting with "##" (a single hash
+ * character), for example, "##layer1".  This notation corresponds to a URL's
+ * fragment ID.
+ *
+ * Checks whether the element @id exists in the SVG document.
+ *
+ * Element IDs should look like an URL fragment identifier; for example, pass
+ * "##foo" (hash <literal>foo</literal>) to get the geometry of the element that
+ * has an <literal>id="foo"</literal> attribute.
+ *
+ * Returns: %TRUE if @id exists in the SVG document, %FALSE otherwise.
+ *
+ * Since: 2.22
+ */
+
+/**
+ * rsvg_handle_get_pixbuf_sub:
+ * @handle: An #RsvgHandle
+ * @id: (nullable): An element's id within the SVG, starting with "##" (a single
+ * hash character), for example, "##layer1".  This notation corresponds to a
+ * URL's fragment ID.  Alternatively, pass %NULL to use the whole SVG.
+ *
+ * Creates a #GdkPixbuf the same size as the entire SVG loaded into @handle, but
+ * only renders the sub-element that has the specified @id (and all its
+ * sub-sub-elements recursively).  If @id is #NULL, this function renders the
+ * whole SVG.
+ *
+ * This function depends on the #RsvgHandle's DPI to compute dimensions in
+ * pixels, so you should call rsvg_handle_set_dpi() beforehand.
+ *
+ * If you need to render an image which is only big enough to fit a particular
+ * sub-element of the SVG, consider using rsvg_handle_render_cairo_sub(), upon a
+ * surface that is just the size returned by rsvg_handle_get_dimensions_sub().
+ * You will need to offset the rendering by the amount returned in
+ * rsvg_handle_get_position_sub().
+ *
+ * Element IDs should look like an URL fragment identifier; for example, pass
+ * "##foo" (hash <literal>foo</literal>) to get the geometry of the element that
+ * has an <literal>id="foo"</literal> attribute.
+ *
+ * Returns: (transfer full) (nullable): a pixbuf, or %NULL if an error occurs
+ * during rendering.
+ *
+ * Since: 2.14
+ **/
+
+/**
+ * rsvg_handle_get_pixbuf:
+ * @handle: An #RsvgHandle
+ *
+ * Returns the pixbuf loaded by @handle.  The pixbuf returned will be reffed, so
+ * the caller of this function must assume that ref.  If insufficient data has
+ * been read to create the pixbuf, or an error occurred in loading, then %NULL
+ * will be returned.  Note that the pixbuf may not be complete until
+ * @rsvg_handle_close has been called.
+ *
+ * This function depends on the #RsvgHandle's DPI to compute dimensions in
+ * pixels, so you should call rsvg_handle_set_dpi() beforehand.
+ *
+ * Returns: (transfer full) (nullable): the pixbuf loaded by @handle, or %NULL.
+ **/
+
+/**
+ * rsvg_handle_set_dpi:
+ * @handle: An #RsvgHandle
+ * @dpi: Dots Per Inch (i.e. as Pixels Per Inch)
+ *
+ * Sets the DPI at which the @handle will be rendered. Common values are
+ * 75, 90, and 300 DPI.
+ *
+ * Passing a number <= 0 to @dpi will reset the DPI to whatever the default
+ * value happens to be, but since rsvg_set_default_dpi() is deprecated, please
+ * do not pass values <= 0 to this function.
+ *
+ * Since: 2.8
+ */
+
+/**
+ * rsvg_handle_set_dpi_x_y:
+ * @handle: An #RsvgHandle
+ * @dpi_x: Dots Per Inch (i.e. Pixels Per Inch)
+ * @dpi_y: Dots Per Inch (i.e. Pixels Per Inch)
+ *
+ * Sets the DPI at which the @handle will be rendered. Common values are
+ * 75, 90, and 300 DPI.
+ *
+ * Passing a number <= 0 to @dpi will reset the DPI to whatever the default
+ * value happens to be, but since rsvg_set_default_dpi_x_y() is deprecated,
+ * please do not pass values <= 0 to this function.
+ *
+ * Since: 2.8
+ */
+
+/**
+ * rsvg_handle_set_size_callback:
+ * @handle: An #RsvgHandle
+ * @size_func: (nullable): A sizing function, or %NULL
+ * @user_data: User data to pass to @size_func, or %NULL
+ * @user_data_destroy: Function to be called to destroy the data passed in @user_data,
+ *   or %NULL.
+ *
+ * Sets the sizing function for the @handle, which can be used to override the
+ * size that librsvg computes for SVG images.  The @size_func is called from the
+ * following functions:
+ *
+ * <itemizedlist>
+ *   <listitem>rsvg_handle_get_dimensions()</listitem>
+ *   <listitem>rsvg_handle_get_dimensions_sub()</listitem>
+ *   <listitem>rsvg_handle_get_position_sub()</listitem>
+ *   <listitem>rsvg_handle_render_cairo()</listitem>
+ *   <listitem>rsvg_handle_render_cairo_sub()</listitem>
+ * </itemizedlist>
+ *
+ * Librsvg computes the size of the SVG being rendered, and passes it to the
+ * @size_func, which may then modify these values to set the final size of the
+ * generated image.
+ *
+ * Deprecated: 2.14.  Set up a cairo matrix and use rsvg_handle_render_cairo() instead.
+ * You can call rsvg_handle_get_dimensions() to figure out the size of your SVG,
+ * and then scale it to the desired size via Cairo.  For example, the following
+ * code renders an SVG at a specified size, scaled proportionally from whatever
+ * original size it may have had:
+ *
+ * |[<!-- language="C" -->
+ * void
+ * render_scaled_proportionally (RsvgHandle *handle, cairo_t cr, int width, int height)
+ * {
+ *     RsvgDimensionData dimensions;
+ *     double x_factor, y_factor;
+ *     double scale_factor;
+ *
+ *     rsvg_handle_get_dimensions (handle, &dimensions);
+ *
+ *     x_factor = (double) width / dimensions.width;
+ *     y_factor = (double) height / dimensions.height;
+ *
+ *     scale_factor = MIN (x_factor, y_factor);
+ *
+ *     cairo_scale (cr, scale_factor, scale_factor);
+ *
+ *     rsvg_handle_render_cairo (handle, cr);
+ * }
+ * ]|
+ *
+ * This function was deprecated because when the @size_func is used, it makes it
+ * unclear when the librsvg functions which call the @size_func will use the
+ * size computed originally, or the callback-specified size, or whether it
+ * refers to the whole SVG or to just a sub-element of it.  It is easier, and
+ * unambiguous, to use code similar to the example above.
+ **/
+
+/**
+ * rsvg_handle_get_intrinsic_dimensions:
+ * @handle: An #RsvgHandle
+ * @out_has_width: (out)(optional): Will be set to #TRUE if the toplevel SVG has a <literal>width</literal> 
attribute
+ * @out_width: (out)(optional): Will be set to the value of the <literal>width</literal> attribute in the 
toplevel SVG
+ * @out_has_height: (out)(optional): Will be set to #TRUE if the toplevel SVG has a 
<literal>height</literal> attribute
+ * @out_height: (out)(optional): Will be set to the value of the <literal>height</literal> attribute in the 
toplevel SVG
+ * @out_has_viewbox: (out)(optional): Will be set to #TRUE if the toplevel SVG has a 
<literal>viewBox</literal> attribute
+ * @out_viewbox: (out)(optional): Will be set to the value of the <literal>viewBox</literal> attribute in 
the toplevel SVG
+ *
+ * Queries the <literal>width</literal>, <literal>height</literal>, and
+ * <literal>viewBox</literal> attributes in an SVG document.
+ *
+ * If you are calling this function to compute a scaling factor to render the SVG,
+ * consider simply using rsvg_handle_render_document() instead; it will do the
+ * scaling computations automatically.
+ *
+ * As an example, the following SVG element has a <literal>width</literal> of 100 pixels and a 
<literal>height</literal> of 400 pixels, but no <literal>viewBox</literal>:
+ *
+ * |[
+ * <svg xmlns="http://www.w3.org/2000/svg"; width="100" height="400">
+ * ]|
+ *
+ * Conversely, the following element has a <literal>viewBox</literal>, but no <literal>width</literal> or 
<literal>height</literal>:
+ *
+ * |[
+ * <svg xmlns="http://www.w3.org/2000/svg"; viewBox="0 0 100 400">
+ * ]|
+ *
+ * Note that the #RsvgLength return values have #RsvgUnits in them; you should
+ * not assume that they are always in pixels.  For example, the following SVG element
+ * will return a width value whose <literal>units</literal> field is RSVG_UNIT_MM.
+ *
+ * |[
+ * <svg xmlns="http://www.w3.org/2000/svg"; width="210mm" height="297mm">
+ * ]|
+ *
+ * API ordering: This function must be called on a fully-loaded @handle.  See
+ * the section <ulink url="#API-ordering">API ordering</ulink> for details.
+ *
+ * Panics: this function will panic if the @handle is not fully-loaded.
+ *
+ * Since: 2.46
+ */
+
+/**
+ * rsvg_handle_render_document:
+ * @handle: An #RsvgHandle
+ * @cr: A Cairo context
+ * @viewport: Viewport size at which the whole SVG would be fitted.
+ * @error: (optional): a location to store a #GError, or %NULL
+ *
+ * Renders the whole SVG document fitted to a viewport.
+ *
+ * The @viewport gives the position and size at which the whole SVG
+ * document will be rendered.
+ *
+ * The @cr must be in a #CAIRO_STATUS_SUCCESS state, or this function will not
+ * render anything, and instead will return an error.
+ *
+ * API ordering: This function must be called on a fully-loaded @handle.  See
+ * the section <ulink url="#API-ordering">API ordering</ulink> for details.
+ *
+ * Panics: this function will panic if the @handle is not fully-loaded.
+ *
+ * Since: 2.46
+ */
+
+/**
+ * rsvg_handle_get_geometry_for_layer:
+ * @handle: An #RsvgHandle
+ * @id: (nullable): An element's id within the SVG, starting with "##" (a single
+ * hash character), for example, "##layer1".  This notation corresponds to a
+ * URL's fragment ID.  Alternatively, pass %NULL to compute the geometry for the
+ * whole SVG.
+ * @viewport: Viewport size at which the whole SVG would be fitted.
+ * @out_ink_rect: (out)(optional): Place to store the ink rectangle of the element.
+ * @out_logical_rect: (out)(optional): Place to store the logical rectangle of the element.
+ * @error: (optional): a location to store a #GError, or %NULL
+ *
+ * Computes the ink rectangle and logical rectangle of an SVG element, or the
+ * whole SVG, as if the whole SVG were rendered to a specific viewport.
+ *
+ * Element IDs should look like an URL fragment identifier; for example, pass
+ * "##foo" (hash <literal>foo</literal>) to get the geometry of the element that
+ * has an <literal>id="foo"</literal> attribute.
+ *
+ * The "ink rectangle" is the bounding box that would be painted
+ * for fully- stroked and filled elements.
+ *
+ * The "logical rectangle" just takes into account the unstroked
+ * paths and text outlines.
+ *
+ * Note that these bounds are not minimum bounds; for example,
+ * clipping paths are not taken into account.
+ *
+ * You can pass #NULL for the @id if you want to measure all
+ * the elements in the SVG, i.e. to measure everything from the
+ * root element.
+ *
+ * This operation is not constant-time, as it involves going through all
+ * the child elements.
+ *
+ * API ordering: This function must be called on a fully-loaded @handle.  See
+ * the section <ulink url="#API-ordering">API ordering</ulink> for details.
+ *
+ * Panics: this function will panic if the @handle is not fully-loaded.
+ *
+ * Since: 2.46
+ */
+
+/**
+ * rsvg_handle_render_layer:
+ * @handle: An #RsvgHandle
+ * @cr: A Cairo context
+ * @id: (nullable): An element's id within the SVG, starting with "##" (a single
+ * hash character), for example, "##layer1".  This notation corresponds to a
+ * URL's fragment ID.  Alternatively, pass %NULL to render the whole SVG document tree.
+ * @viewport: Viewport size at which the whole SVG would be fitted.
+ * @error: (optional): a location to store a #GError, or %NULL
+ *
+ * Renders a single SVG element in the same place as for a whole SVG document.
+ *
+ * This is equivalent to rsvg_handle_render_document(), but it renders only a
+ * single element and its children, as if they composed an individual layer in
+ * the SVG.  The element is rendered with the same transformation matrix as it
+ * has within the whole SVG document.  Applications can use this to re-render a
+ * single element and repaint it on top of a previously-rendered document, for
+ * example.
+ *
+ * Element IDs should look like an URL fragment identifier; for example, pass
+ * "##foo" (hash <literal>foo</literal>) to get the geometry of the element that
+ * has an <literal>id="foo"</literal> attribute.
+ *
+ * You can pass #NULL for the @id if you want to render all
+ * the elements in the SVG, i.e. to render everything from the
+ * root element.
+ *
+ * API ordering: This function must be called on a fully-loaded @handle.  See
+ * the section <ulink url="#API-ordering">API ordering</ulink> for details.
+ *
+ * Panics: this function will panic if the @handle is not fully-loaded.
+ *
+ * Since: 2.46
+ */
+
+/**
+ * rsvg_handle_get_geometry_for_element:
+ * @handle: An #RsvgHandle
+ * @id: (nullable): An element's id within the SVG, starting with "##" (a single
+ * hash character), for example, "##layer1".  This notation corresponds to a
+ * URL's fragment ID.  Alternatively, pass %NULL to compute the geometry for the
+ * whole SVG.
+ * @out_ink_rect: (out)(optional): Place to store the ink rectangle of the element.
+ * @out_logical_rect: (out)(optional): Place to store the logical rectangle of the element.
+ * @error: (optional): a location to store a #GError, or %NULL
+ *
+ * Computes the ink rectangle and logical rectangle of a single SVG element.
+ *
+ * While `rsvg_handle_get_geometry_for_layer` computes the geometry of an SVG element subtree with
+ * its transformation matrix, this other function will compute the element's geometry
+ * as if it were being rendered under an identity transformation by itself.  That is,
+ * the resulting geometry is as if the element got extracted by itself from the SVG.
+ *
+ * This function is the counterpart to `rsvg_handle_render_element`.
+ *
+ * Element IDs should look like an URL fragment identifier; for example, pass
+ * "##foo" (hash <literal>foo</literal>) to get the geometry of the element that
+ * has an <literal>id="foo"</literal> attribute.
+ *
+ * The "ink rectangle" is the bounding box that would be painted
+ * for fully- stroked and filled elements.
+ *
+ * The "logical rectangle" just takes into account the unstroked
+ * paths and text outlines.
+ *
+ * Note that these bounds are not minimum bounds; for example,
+ * clipping paths are not taken into account.
+ *
+ * You can pass #NULL for the @id if you want to measure all
+ * the elements in the SVG, i.e. to measure everything from the
+ * root element.
+ *
+ * This operation is not constant-time, as it involves going through all
+ * the child elements.
+ *
+ * API ordering: This function must be called on a fully-loaded @handle.  See
+ * the section <ulink url="#API-ordering">API ordering</ulink> for details.
+ *
+ * Panics: this function will panic if the @handle is not fully-loaded.
+ *
+ * Since: 2.46
+ */
+
+/**
+ * rsvg_handle_render_element:
+ * @handle: An #RsvgHandle
+ * @cr: A Cairo context
+ * @id: (nullable): An element's id within the SVG, starting with "##" (a single
+ * hash character), for example, "##layer1".  This notation corresponds to a
+ * URL's fragment ID.  Alternatively, pass %NULL to render the whole SVG document tree.
+ * @element_viewport: Viewport size in which to fit the element
+ * @error: (optional): a location to store a #GError, or %NULL
+ *
+ * Renders a single SVG element to a given viewport
+ *
+ * This function can be used to extract individual element subtrees and render them,
+ * scaled to a given @element_viewport.  This is useful for applications which have
+ * reusable objects in an SVG and want to render them individually; for example, an
+ * SVG full of icons that are meant to be be rendered independently of each other.
+ *
+ * Element IDs should look like an URL fragment identifier; for example, pass
+ * "##foo" (hash <literal>foo</literal>) to get the geometry of the element that
+ * has an <literal>id="foo"</literal> attribute.
+ *
+ * You can pass #NULL for the @id if you want to render all
+ * the elements in the SVG, i.e. to render everything from the
+ * root element.
+ *
+ * The `element_viewport` gives the position and size at which the named element will
+ * be rendered.  FIXME: mention proportional scaling.
+ *
+ * API ordering: This function must be called on a fully-loaded @handle.  See
+ * the section <ulink url="#API-ordering">API ordering</ulink> for details.
+ *
+ * Panics: this function will panic if the @handle is not fully-loaded.
+ *
+ * Since: 2.46
+ */
+
+/**
+ * rsvg_handle_internal_set_testing:
+ * @handle: a #RsvgHandle
+ * @testing: Whether to enable testing mode
+ *
+ * Do not call this function.  This is intended for librsvg's internal
+ * test suite only.
+ **/
diff --git a/librsvg/rsvg-pixbuf.c b/librsvg/rsvg-pixbuf.c
new file mode 100644
index 00000000..8b8e4d0f
--- /dev/null
+++ b/librsvg/rsvg-pixbuf.c
@@ -0,0 +1,114 @@
+/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* vim: set sw=4 sts=4 expandtab: */
+/*
+   rsvg-file-util.c: SAX-based renderer for SVG files into a GdkPixbuf.
+
+   Copyright (C) 2000 Eazel, Inc.
+   Copyright (C) 2002 Dom Lachowicz <cinamod hotmail com>
+
+   This library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   This library 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with this library; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+
+   Author: Raph Levien <raph artofcode com>
+*/
+
+/**
+ * SECTION: rsvg-pixbuf
+ * @short_description: How to render SVGs into GdkPixbufs, for easy use in GTK+
+ *  applications
+ *
+ * GdkPixbuf is a library for image loading and manipulation. It is part of the
+ * cross-platform GTK+ widget toolkit.
+ */
+
+/**
+ * rsvg_pixbuf_from_file:
+ * @filename: A file name
+ * @error: return location for errors
+ * 
+ * Loads a new #GdkPixbuf from @filename and returns it.  The caller must
+ * assume the reference to the reurned pixbuf. If an error occurred, @error is
+ * set and %NULL is returned.
+ * 
+ * Return value: A newly allocated #GdkPixbuf, or %NULL
+ * Deprecated: Set up a cairo matrix and use rsvg_handle_new_from_file() + rsvg_handle_render_cairo() 
instead.
+ **/
+
+/**
+ * rsvg_pixbuf_from_file_at_zoom:
+ * @filename: A file name
+ * @x_zoom: The horizontal zoom factor
+ * @y_zoom: The vertical zoom factor
+ * @error: return location for errors
+ * 
+ * Loads a new #GdkPixbuf from @filename and returns it.  This pixbuf is scaled
+ * from the size indicated by the file by a factor of @x_zoom and @y_zoom.  The
+ * caller must assume the reference to the returned pixbuf. If an error
+ * occurred, @error is set and %NULL is returned.
+ * 
+ * Return value: A newly allocated #GdkPixbuf, or %NULL
+ * Deprecated: Set up a cairo matrix and use rsvg_handle_new_from_file() + rsvg_handle_render_cairo() 
instead.
+ **/
+
+/**
+ * rsvg_pixbuf_from_file_at_zoom_with_max:
+ * @filename: A file name
+ * @x_zoom: The horizontal zoom factor
+ * @y_zoom: The vertical zoom factor
+ * @max_width: The requested max width
+ * @max_height: The requested max height
+ * @error: return location for errors
+ * 
+ * Loads a new #GdkPixbuf from @filename and returns it.  This pixbuf is scaled
+ * from the size indicated by the file by a factor of @x_zoom and @y_zoom. If the
+ * resulting pixbuf would be larger than max_width/max_heigh it is uniformly scaled
+ * down to fit in that rectangle. The caller must assume the reference to the
+ * returned pixbuf. If an error occurred, @error is set and %NULL is returned.
+ * 
+ * Return value: A newly allocated #GdkPixbuf, or %NULL
+ * Deprecated: Set up a cairo matrix and use rsvg_handle_new_from_file() + rsvg_handle_render_cairo() 
instead.
+ **/
+
+/**
+ * rsvg_pixbuf_from_file_at_size:
+ * @filename: A file name
+ * @width: The new width, or -1
+ * @height: The new height, or -1
+ * @error: return location for errors
+ * 
+ * Loads a new #GdkPixbuf from @filename and returns it.  This pixbuf is scaled
+ * from the size indicated to the new size indicated by @width and @height.  If
+ * both of these are -1, then the default size of the image being loaded is
+ * used.  The caller must assume the reference to the returned pixbuf. If an
+ * error occurred, @error is set and %NULL is returned.
+ * 
+ * Return value: A newly allocated #GdkPixbuf, or %NULL
+ * Deprecated: Set up a cairo matrix and use rsvg_handle_new_from_file() + rsvg_handle_render_cairo() 
instead.
+ **/
+
+/**
+ * rsvg_pixbuf_from_file_at_max_size:
+ * @filename: A file name
+ * @max_width: The requested max width
+ * @max_height: The requested max height
+ * @error: return location for errors
+ * 
+ * Loads a new #GdkPixbuf from @filename and returns it.  This pixbuf is uniformly
+ * scaled so that the it fits into a rectangle of size max_width * max_height. The
+ * caller must assume the reference to the returned pixbuf. If an error occurred,
+ * @error is set and %NULL is returned.
+ * 
+ * Return value: A newly allocated #GdkPixbuf, or %NULL
+ * Deprecated: Set up a cairo matrix and use rsvg_handle_new_from_file() + rsvg_handle_render_cairo() 
instead.
+ **/


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]