| 1 |
|
| 2 |
@c %start of fragment |
| 3 |
|
| 4 |
@deffn Function cairo-image-surface-create-from-png (@var{filename}@tie{}@code{<char>}) @result{}@tie{} (@var{ret}@tie{}@code{<cairo-surface-t >}) |
| 5 |
Creates a new image surface and initializes the contents to the given |
| 6 |
PNG file. |
| 7 |
|
| 8 |
@table @var |
| 9 |
@item filename |
| 10 |
name of PNG file to load |
| 11 |
|
| 12 |
@item ret |
| 13 |
a new @code{<cairo-surface-t>} initialized with the contents of the PNG |
| 14 |
file, or a "nil" surface if any error occurred. A nil surface can be |
| 15 |
checked for with cairo_surface_status(surface) which may return one of |
| 16 |
the following values: |
| 17 |
@samp{CAIRO_STATUS_NO_MEMORY}@samp{CAIRO_STATUS_FILE_NOT_FOUND}@samp{CAI |
| 18 |
RO_STATUS_READ_ERROR} Alternatively, you can allow errors to propagate |
| 19 |
through the drawing operations and check the status on the context upon |
| 20 |
completion using @code{cairo-status}. |
| 21 |
|
| 22 |
@end table |
| 23 |
|
| 24 |
@end deffn |
| 25 |
|
| 26 |
@deffn Function cairo-surface-write-to-png (@var{surface}@tie{}@code{<cairo-surface-t>}) (@var{filename}@tie{}@code{<char>}) @result{}@tie{} (@var{ret}@tie{}@code{<cairo-status-t>}) |
| 27 |
Writes the contents of @var{surface} to a new file @var{filename} as a |
| 28 |
PNG image. |
| 29 |
|
| 30 |
@table @var |
| 31 |
@item surface |
| 32 |
a @code{<cairo-surface-t>} with pixel contents |
| 33 |
|
| 34 |
@item filename |
| 35 |
the name of a file to write to |
| 36 |
|
| 37 |
@item ret |
| 38 |
@samp{CAIRO_STATUS_SUCCESS} if the PNG file was written successfully. |
| 39 |
Otherwise, @samp{CAIRO_STATUS_NO_MEMORY} if memory could not be |
| 40 |
allocated for the operation or @samp{CAIRO_STATUS_SURFACE_TYPE_MISMATCH} |
| 41 |
if the surface does not have pixel contents, or |
| 42 |
@samp{CAIRO_STATUS_WRITE_ERROR} if an I/O error occurs while attempting |
| 43 |
to write the file. |
| 44 |
|
| 45 |
@end table |
| 46 |
|
| 47 |
@end deffn |
| 48 |
|
| 49 |
|
| 50 |
@c %end of fragment |