jpayne@68: jpayne@68: jpayne@68:
jpayne@68: jpayne@68:jpayne@68: Top jpayne@68: | jpayne@68:![]() |
jpayne@68: ![]() |
jpayne@68: ![]() |
jpayne@68: ![]() |
jpayne@68:
jpayne@68: SVG Surfacesjpayne@68:SVG Surfaces — Rendering SVG documents jpayne@68: |
jpayne@68: jpayne@68: |
jpayne@68: cairo_surface_t * jpayne@68: | jpayne@68:jpayne@68: cairo_svg_surface_create () jpayne@68: | jpayne@68:
jpayne@68: cairo_surface_t * jpayne@68: | jpayne@68:jpayne@68: cairo_svg_surface_create_for_stream () jpayne@68: | jpayne@68:
jpayne@68: cairo_svg_unit_t jpayne@68: | jpayne@68:jpayne@68: cairo_svg_surface_get_document_unit () jpayne@68: | jpayne@68:
jpayne@68: void jpayne@68: | jpayne@68:jpayne@68: cairo_svg_surface_set_document_unit () jpayne@68: | jpayne@68:
jpayne@68: void jpayne@68: | jpayne@68:jpayne@68: cairo_svg_surface_restrict_to_version () jpayne@68: | jpayne@68:
jpayne@68: void jpayne@68: | jpayne@68:jpayne@68: cairo_svg_get_versions () jpayne@68: | jpayne@68:
const char * jpayne@68: | jpayne@68:jpayne@68: cairo_svg_version_to_string () jpayne@68: | jpayne@68:
#define | jpayne@68:CAIRO_HAS_SVG_SURFACE | jpayne@68:
enum | jpayne@68:cairo_svg_version_t | jpayne@68:
enum | jpayne@68:cairo_svg_unit_t | jpayne@68:
The SVG surface is used to render cairo graphics to jpayne@68: SVG files and is a multi-page vector surface backend.
jpayne@68:cairo_surface_t * jpayne@68: cairo_svg_surface_create (jpayne@68:const char *filename
, jpayne@68:double width_in_points
, jpayne@68:double height_in_points
);
Creates a SVG surface of the specified size in points to be written
jpayne@68: to filename
jpayne@68: .
The SVG surface backend recognizes the following MIME types for the
jpayne@68: data attached to a surface (see cairo_surface_set_mime_data()
) when
jpayne@68: it is used as a source pattern for drawing on this surface:
jpayne@68: CAIRO_MIME_TYPE_JPEG
, CAIRO_MIME_TYPE_PNG
,
jpayne@68: CAIRO_MIME_TYPE_URI
. If any of them is specified, the SVG backend
jpayne@68: emits a href with the content of MIME data instead of a surface
jpayne@68: snapshot (PNG, Base64-encoded) in the corresponding image tag.
The unofficial MIME type CAIRO_MIME_TYPE_URI
is examined
jpayne@68: first. If present, the URI is emitted as is: assuring the
jpayne@68: correctness of URI is left to the client code.
If CAIRO_MIME_TYPE_URI
is not present, but CAIRO_MIME_TYPE_JPEG
jpayne@68: or CAIRO_MIME_TYPE_PNG
is specified, the corresponding data is
jpayne@68: Base64-encoded and emitted.
If CAIRO_MIME_TYPE_UNIQUE_ID
is present, all surfaces with the same
jpayne@68: unique identifier will only be embedded once.
filename |
jpayne@68: a filename for the SVG output (must be writable), |
jpayne@68: jpayne@68: |
width_in_points |
jpayne@68: width of the surface, in points (1 point == 1/72.0 inch) |
jpayne@68: jpayne@68: |
height_in_points |
jpayne@68: height of the surface, in points (1 point == 1/72.0 inch) |
jpayne@68: jpayne@68: |
a pointer to the newly created surface. The caller
jpayne@68: owns the surface and should call cairo_surface_destroy()
when done
jpayne@68: with it.
This function always returns a valid pointer, but it will return a
jpayne@68: pointer to a "nil" surface if an error such as out of memory
jpayne@68: occurs. You can use cairo_surface_status()
to check for this.
Since: 1.2
jpayne@68:cairo_surface_t * jpayne@68: cairo_svg_surface_create_for_stream (jpayne@68:cairo_write_func_t write_func
, jpayne@68:void *closure
, jpayne@68:double width_in_points
, jpayne@68:double height_in_points
);
Creates a SVG surface of the specified size in points to be written
jpayne@68: incrementally to the stream represented by write_func
jpayne@68: and closure
jpayne@68: .
write_func |
jpayne@68: a cairo_write_func_t to accept the output data, may be |
jpayne@68: jpayne@68: |
closure |
jpayne@68: the closure argument for |
jpayne@68: jpayne@68: |
width_in_points |
jpayne@68: width of the surface, in points (1 point == 1/72.0 inch) |
jpayne@68: jpayne@68: |
height_in_points |
jpayne@68: height of the surface, in points (1 point == 1/72.0 inch) |
jpayne@68: jpayne@68: |
a pointer to the newly created surface. The caller
jpayne@68: owns the surface and should call cairo_surface_destroy()
when done
jpayne@68: with it.
This function always returns a valid pointer, but it will return a
jpayne@68: pointer to a "nil" surface if an error such as out of memory
jpayne@68: occurs. You can use cairo_surface_status()
to check for this.
Since: 1.2
jpayne@68:cairo_svg_unit_t
jpayne@68: cairo_svg_surface_get_document_unit (cairo_surface_t *surface
);
jpayne@68: Get the unit of the SVG surface.
jpayne@68:If the surface passed as an argument is not a SVG surface, the function jpayne@68: sets the error status to CAIRO_STATUS_SURFACE_TYPE_MISMATCH and returns jpayne@68: CAIRO_SVG_UNIT_USER.
jpayne@68:surface |
jpayne@68: a SVG cairo_surface_t |
jpayne@68: jpayne@68: |
Since: 1.16
jpayne@68:void jpayne@68: cairo_svg_surface_set_document_unit (jpayne@68:cairo_surface_t *surface
, jpayne@68:cairo_svg_unit_t unit
);
Use the specified unit for the width and height of the generated SVG file. jpayne@68: See cairo_svg_unit_t for a list of available unit values that can be used jpayne@68: here.
jpayne@68:This function can be called at any time before generating the SVG file.
jpayne@68:However to minimize the risk of ambiguities it's recommended to call it jpayne@68: before any drawing operations have been performed on the given surface, to jpayne@68: make it clearer what the unit used in the drawing operations is.
jpayne@68:The simplest way to do this is to call this function immediately after jpayne@68: creating the SVG surface.
jpayne@68:Note if this function is never called, the default unit for SVG documents jpayne@68: generated by cairo will be "pt". This is for historical reasons.
jpayne@68:surface |
jpayne@68: a SVG cairo_surface_t |
jpayne@68: jpayne@68: |
unit |
jpayne@68: SVG unit |
jpayne@68: jpayne@68: |
Since: 1.16
jpayne@68:void jpayne@68: cairo_svg_surface_restrict_to_version (jpayne@68:cairo_surface_t *surface
, jpayne@68:cairo_svg_version_t version
);
Restricts the generated SVG file to version
jpayne@68: . See cairo_svg_get_versions()
jpayne@68: for a list of available version values that can be used here.
This function should only be called before any drawing operations jpayne@68: have been performed on the given surface. The simplest way to do jpayne@68: this is to call this function immediately after creating the jpayne@68: surface.
jpayne@68:surface |
jpayne@68: a SVG cairo_surface_t |
jpayne@68: jpayne@68: |
version |
jpayne@68: SVG version |
jpayne@68: jpayne@68: |
Since: 1.2
jpayne@68:void jpayne@68: cairo_svg_get_versions (jpayne@68:cairo_svg_version_t const **versions
, jpayne@68:int *num_versions
);
Used to retrieve the list of supported versions. See
jpayne@68: cairo_svg_surface_restrict_to_version()
.
versions |
jpayne@68: supported version list |
jpayne@68: jpayne@68: |
num_versions |
jpayne@68: list length |
jpayne@68: jpayne@68: |
Since: 1.2
jpayne@68:const char *
jpayne@68: cairo_svg_version_to_string (cairo_svg_version_t version
);
jpayne@68: Get the string representation of the given version
jpayne@68: id. This function
jpayne@68: will return NULL
if version
jpayne@68: isn't valid. See cairo_svg_get_versions()
jpayne@68: for a way to get the list of valid version ids.
version |
jpayne@68: a version id |
jpayne@68: jpayne@68: |
Since: 1.2
jpayne@68:#define CAIRO_HAS_SVG_SURFACE 1 jpayne@68:jpayne@68:
Defined if the SVG surface backend is available. jpayne@68: This macro can be used to conditionally compile backend-specific code.
jpayne@68:Since: 1.2
jpayne@68:cairo_svg_version_t is used to describe the version number of the SVG jpayne@68: specification that a generated SVG file will conform to.
jpayne@68:jpayne@68: |
jpayne@68: The version 1.1 of the SVG specification. (Since 1.2) jpayne@68: |
jpayne@68: jpayne@68: |
jpayne@68: |
jpayne@68: The version 1.2 of the SVG specification. (Since 1.2) jpayne@68: |
jpayne@68: jpayne@68: |
Since: 1.2
jpayne@68:CAIRO_SVG_UNIT_USER
jpayne@68: : User unit, a value in the current coordinate system.
jpayne@68: If used in the root element for the initial coordinate systems it
jpayne@68: corresponds to pixels. (Since 1.16)
jpayne@68: CAIRO_SVG_UNIT_EM
jpayne@68: : The size of the element's font. (Since 1.16)
jpayne@68: CAIRO_SVG_UNIT_EX
jpayne@68: : The x-height of the element’s font. (Since 1.16)
jpayne@68: CAIRO_SVG_UNIT_PX
jpayne@68: : Pixels (1px = 1/96th of 1in). (Since 1.16)
jpayne@68: CAIRO_SVG_UNIT_IN
jpayne@68: : Inches (1in = 2.54cm = 96px). (Since 1.16)
jpayne@68: CAIRO_SVG_UNIT_CM
jpayne@68: : Centimeters (1cm = 96px/2.54). (Since 1.16)
jpayne@68: CAIRO_SVG_UNIT_MM
jpayne@68: : Millimeters (1mm = 1/10th of 1cm). (Since 1.16)
jpayne@68: CAIRO_SVG_UNIT_PT
jpayne@68: : Points (1pt = 1/72th of 1in). (Since 1.16)
jpayne@68: CAIRO_SVG_UNIT_PC
jpayne@68: : Picas (1pc = 1/6th of 1in). (Since 1.16)
jpayne@68: CAIRO_SVG_UNIT_PERCENT
jpayne@68: : Percent, a value that is some fraction of another
jpayne@68: reference value. (Since 1.16)
cairo_svg_unit_t is used to describe the units valid for coordinates and jpayne@68: lengths in the SVG specification.
jpayne@68:See also: jpayne@68: https://www.w3.org/TR/SVG/coords.htmlUnits jpayne@68: https://www.w3.org/TR/SVG/types.htmlDataTypeLength jpayne@68: https://www.w3.org/TR/css-values-3/lengths
jpayne@68:jpayne@68: | jpayne@68: | jpayne@68: |
jpayne@68: | jpayne@68: | jpayne@68: |
jpayne@68: | jpayne@68: | jpayne@68: |
jpayne@68: | jpayne@68: | jpayne@68: |
jpayne@68: | jpayne@68: | jpayne@68: |
jpayne@68: | jpayne@68: | jpayne@68: |
jpayne@68: | jpayne@68: | jpayne@68: |
jpayne@68: | jpayne@68: | jpayne@68: |
jpayne@68: | jpayne@68: | jpayne@68: |
jpayne@68: | jpayne@68: | jpayne@68: |
Since: 1.16
jpayne@68: