[cairo-commit] src/cairo-svg-surface.c test/cairo-test.c

Emmanuel Pacaud emmanuel at kemper.freedesktop.org
Fri Apr 14 13:54:03 PDT 2006


 src/cairo-svg-surface.c |   47 +++++++++++++++++++++++++++++++++++++++++++++++
 test/cairo-test.c       |    6 +++++-
 2 files changed, 52 insertions(+), 1 deletion(-)

New commits:
diff-tree e952e0aff89412e67fb72ba2cf3a30c3ddd332b4 (from f919ba858f405aa5c1cc64e7c25c3de5ffbce88f)
Author: Emmanuel Pacaud <emmanuel.pacaud at free.fr>
Date:   Fri Apr 14 22:53:58 2006 +0200

    SVG: Add documentation for public API. Fix test filenames and add testing of CAIRO_CONTENT_COLOR

diff --git a/src/cairo-svg-surface.c b/src/cairo-svg-surface.c
index 5c1eeb6..accbe00 100644
--- a/src/cairo-svg-surface.c
+++ b/src/cairo-svg-surface.c
@@ -137,6 +137,24 @@ _cairo_svg_surface_create_for_stream_int
     return surface;
 }
 
+/**
+ * cairo_svg_surface_create_for_stream:
+ * @write: a #cairo_write_func_t to accept the output data
+ * @closure: the closure argument for @write
+ * @width_in_points: width of the surface, in points (1 point == 1/72.0 inch)
+ * @height_in_points: height of the surface, in points (1 point == 1/72.0 inch)
+ * 
+ * Creates a SVG surface of the specified size in points to be written
+ * incrementally to the stream represented by @write and @closure.
+ *
+ * Return value: a pointer to the newly created surface. The caller
+ * owns the surface and should call cairo_surface_destroy when done
+ * with it.
+ *
+ * This function always returns a valid pointer, but it will return a
+ * pointer to a "nil" surface if an error such as out of memory
+ * occurs. You can use cairo_surface_status() to check for this.
+ */
 cairo_surface_t *
 cairo_svg_surface_create_for_stream (cairo_write_func_t		write,
 				     void			*closure,
@@ -156,6 +174,23 @@ cairo_svg_surface_create_for_stream (cai
     return _cairo_svg_surface_create_for_stream_internal (stream, width, height);
 }
 
+/**
+ * cairo_svg_surface_create:
+ * @filename: a filename for the SVG output (must be writable)
+ * @width_in_points: width of the surface, in points (1 point == 1/72.0 inch)
+ * @height_in_points: height of the surface, in points (1 point == 1/72.0 inch)
+ * 
+ * Creates a SVG surface of the specified size in points to be written
+ * to @filename.
+ * 
+ * Return value: a pointer to the newly created surface. The caller
+ * owns the surface and should call cairo_surface_destroy when done
+ * with it.
+ *
+ * This function always returns a valid pointer, but it will return a
+ * pointer to a "nil" surface if an error such as out of memory
+ * occurs. You can use cairo_surface_status() to check for this.
+ **/
 cairo_surface_t *
 cairo_svg_surface_create (const char	*filename,
 			  double	width,
@@ -174,6 +209,18 @@ cairo_svg_surface_create (const char	*fi
     return _cairo_svg_surface_create_for_stream_internal (stream, width, height);
 }
 
+/**
+ * cairo_svg_surface_set_dpi:
+ * @surface: a svg cairo_surface_t
+ * @x_dpi: horizontal dpi
+ * @y_dpi: vertical dpi
+ * 
+ * Set the horizontal and vertical resolution for image fallbacks.
+ * When the svg backend needs to fall back to image overlays, it will
+ * use this resolution. These DPI values are not used for any other
+ * purpose, (in particular, they do not have any bearing on the size
+ * passed to cairo_svg_surface_create() nor on the CTM).
+ **/
 void
 cairo_svg_surface_set_dpi (cairo_surface_t	*surface,
 			   double		x_dpi,
diff --git a/test/cairo-test.c b/test/cairo-test.c
index c200bf7..59b55f7 100644
--- a/test/cairo-test.c
+++ b/test/cairo-test.c
@@ -1321,7 +1321,9 @@ create_svg_surface (cairo_test_t	 *test,
     ptc->width = width;
     ptc->height = height;
     
-    xasprintf (&ptc->filename, "%s-%s%s", test->name, "svg-argb32-out", ".svg");
+    xasprintf (&ptc->filename, "%s-svg-%s-out.svg",
+	       test->name, _cairo_test_content_name (content));
+    
     surface = cairo_svg_surface_create (ptc->filename, width, height);
     if (cairo_surface_status (surface)) {
 	free (ptc->filename);
@@ -1591,6 +1593,8 @@ cairo_test_expecting (cairo_test_t *test
 		create_pdf_surface, pdf_surface_write_to_png, cleanup_pdf },
 #endif
 #if CAIRO_HAS_SVG_SURFACE && CAIRO_CAN_TEST_SVG_SURFACE
+	    { "svg", CAIRO_SURFACE_TYPE_SVG, CAIRO_CONTENT_COLOR,
+		    create_svg_surface, svg_surface_write_to_png, cleanup_svg },
 	    { "svg", CAIRO_SURFACE_TYPE_SVG, CAIRO_CONTENT_COLOR_ALPHA,
 		    create_svg_surface, svg_surface_write_to_png, cleanup_svg },
 #endif


More information about the cairo-commit mailing list