[librsvg] RsvgHandle: Document the preferred way to load SVGs from memory



commit 515ec77a6866645e86a5223e15e8f84773878b01
Author: Federico Mena Quintero <federico gnome org>
Date:   Tue Mar 20 19:21:32 2018 -0600

    RsvgHandle: Document the preferred way to load SVGs from memory
    
    https://gitlab.gnome.org/GNOME/librsvg/issues/98

 librsvg/rsvg-handle.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
---
diff --git a/librsvg/rsvg-handle.c b/librsvg/rsvg-handle.c
index 7459b3ff..860d011e 100644
--- a/librsvg/rsvg-handle.c
+++ b/librsvg/rsvg-handle.c
@@ -72,6 +72,18 @@
  * 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 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().  This lets you specify the appropriate
+ * flags, for example #RSVG_HANDLE_FLAG_UNLIMITED if your input data is very
+ * large.
+ *
+ * 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


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