Cairo: A Vector Graphics Library | ||||
---|---|---|---|---|
#define CAIRO_HAS_SVG_SURFACE cairo_surface_t* cairo_svg_surface_create (const char *filename, double width_in_points, double height_in_points); cairo_surface_t* cairo_svg_surface_create_for_stream (cairo_write_func_t write_func, void *closure, double width_in_points, double height_in_points); void cairo_svg_surface_restrict_to_version (cairo_surface_t *surface, cairo_svg_version_t version); enum cairo_svg_version_t; void cairo_svg_get_versions (cairo_svg_version_t const **versions, int *num_versions); const char* cairo_svg_version_to_string (cairo_svg_version_t version);
The SVG surface is used to render cairo graphics to SVG files and is a multi-page vector surface backend.
#define CAIRO_HAS_SVG_SURFACE 1
Defined if the SVG surface backend is available. This macro can be used to conditionally compile backend-specific code.
cairo_surface_t* cairo_svg_surface_create (const char *filename, double width_in_points, double height_in_points);
Creates a SVG surface of the specified size in points to be written
to filename
.
|
a filename for the SVG output (must be writable) |
|
width of the surface, in points (1 point == 1/72.0 inch) |
|
height of the surface, in points (1 point == 1/72.0 inch) |
Returns : |
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.
|
Since 1.2
cairo_surface_t* cairo_svg_surface_create_for_stream (cairo_write_func_t write_func, void *closure, double width_in_points, double height_in_points);
Creates a SVG surface of the specified size in points to be written
incrementally to the stream represented by write_func
and closure
.
|
a cairo_write_func_t to accept the output data |
|
the closure argument for write_func
|
|
width of the surface, in points (1 point == 1/72.0 inch) |
|
height of the surface, in points (1 point == 1/72.0 inch) |
Returns : |
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.
|
Since 1.2
void cairo_svg_surface_restrict_to_version (cairo_surface_t *surface, cairo_svg_version_t version);
Restricts the generated SVG file to version
. See cairo_svg_get_versions()
for a list of available version values that can be used here.
This function should only be called before any drawing operations have been performed on the given surface. The simplest way to do this is to call this function immediately after creating the surface.
|
a SVG cairo_surface_t |
|
SVG version |
Since 1.2
typedef enum _cairo_svg_version { CAIRO_SVG_VERSION_1_1, CAIRO_SVG_VERSION_1_2 } cairo_svg_version_t;
cairo_svg_version_t is used to describe the version number of the SVG specification that a generated SVG file will conform to.
void cairo_svg_get_versions (cairo_svg_version_t const **versions, int *num_versions);
Used to retrieve the list of supported versions. See
cairo_svg_surface_restrict_to_version()
.
|
supported version list |
|
list length |
Since 1.2
const char* cairo_svg_version_to_string (cairo_svg_version_t version);
Get the string representation of the given version
id. This function
will return NULL
if version
isn't valid. See cairo_svg_get_versions()
for a way to get the list of valid version ids.
|
a version id |
Returns : |
the string associated to given version. |
Since 1.2