| 1 |
|
| 2 |
@c %start of fragment |
| 3 |
|
| 4 |
@deffn Function cairo-svg-surface-create (@var{width-in-points}@tie{}@code{<double>}) (@var{height-in-points}@tie{}@code{<double>}) [(@var{filename}@tie{}@code{<char>})] @result{}@tie{} (@var{ret}@tie{}@code{<cairo-surface-t >}) |
| 5 |
Creates a SVG surface of the specified size in points to be written to |
| 6 |
@var{filename}. If @var{filename} is not given, the output is sent to |
| 7 |
the current output port. |
| 8 |
|
| 9 |
The SVG surface backend recognizes the following MIME types for the data |
| 10 |
attached to a surface (see @code{cairo-surface-set-mime-data}) when it |
| 11 |
is used as a source pattern for drawing on this surface: |
| 12 |
@samp{CAIRO_MIME_TYPE_JPEG}, @samp{CAIRO_MIME_TYPE_PNG}, |
| 13 |
@samp{CAIRO_MIME_TYPE_URI}. If any of them is specified, the SVG backend |
| 14 |
emits a href with the content of MIME data instead of a surface snapshot |
| 15 |
(PNG, Base64-encoded) in the corresponding image tag. |
| 16 |
|
| 17 |
The unofficial MIME type @samp{CAIRO_MIME_TYPE_URI} is examined first. |
| 18 |
If present, the URI is emitted as is: assuring the correctness of URI is |
| 19 |
left to the client code. |
| 20 |
|
| 21 |
If @samp{CAIRO_MIME_TYPE_URI} is not present, but |
| 22 |
@samp{CAIRO_MIME_TYPE_JPEG} or @samp{CAIRO_MIME_TYPE_PNG} is specified, |
| 23 |
the corresponding data is Base64-encoded and emitted. |
| 24 |
|
| 25 |
@table @var |
| 26 |
@item filename |
| 27 |
a filename for the SVG output (must be writable), @samp{@code{#f}} may |
| 28 |
be used to specify no output. This will generate a SVG surface that may |
| 29 |
be queried and used as a source, without generating a temporary file. |
| 30 |
|
| 31 |
@item width-in-points |
| 32 |
width of the surface, in points (1 point == 1/72.0 inch) |
| 33 |
|
| 34 |
@item height-in-points |
| 35 |
height of the surface, in points (1 point == 1/72.0 inch) |
| 36 |
|
| 37 |
@item ret |
| 38 |
a pointer to the newly created surface. The caller owns the surface and |
| 39 |
should call @code{cairo-surface-destroy} when done with it. This |
| 40 |
function always returns a valid pointer, but it will return a pointer to |
| 41 |
a "nil" surface if an error such as out of memory occurs. You can use |
| 42 |
@code{cairo-surface-status} to check for this. |
| 43 |
|
| 44 |
@end table |
| 45 |
|
| 46 |
Since 1.2 |
| 47 |
|
| 48 |
@end deffn |
| 49 |
|
| 50 |
|
| 51 |
@c %end of fragment |