cairo-png-functions {RGtk2} | R Documentation

## PNG Support

### Description

Reading and writing PNG images

### Methods and Functions

`cairoImageSurfaceCreateFromPng(filename)`
`cairoImageSurfaceCreateFromPngStream(con)`
`cairoSurfaceWriteToPng(surface, filename)`
`cairoSurfaceWriteToPngStream(surface, con)`

### Detailed Description

The PNG functions allow reading PNG images into image surfaces, and writing any surface to a PNG file.

### User Functions

`cairo_read_func_t(closure, data, length)`

  `cairo_read_func_t` is the type of function which is called when a backend needs to read data from an input stream. It is passed the closure which was specified by the user at the time the read function was registered, the buffer to read the data into and the length of the data in bytes. The read function should return `CAIRO_STATUS_SUCCESS` if all the data was successfully read, `CAIRO_STATUS_READ_ERROR` otherwise.

  `closure`

    [R object] the input closure

  `data`

    [char] the buffer into which to read the data

  `length`

    [integer] the amount of data to read

  Returns: [`CairoStatus`] the status code of the read operation

`cairo_write_func_t(closure, data, length)`

  `CairoWriteFunc` is the type of function which is called when a backend needs to write data to an output stream. It is passed the closure which was specified by the user at the time the write function was registered, the data to write and the length of the data in bytes. The write function should return `CAIRO_STATUS_SUCCESS` if all the data was successfully written, `CAIRO_STATUS_WRITE_ERROR` otherwise.

  `closure`

    [R object] the output closure

  `data`

    [char] the buffer containing the data to write

  `length`

    [integer] the amount of data to write

  Returns: [`CairoStatus`] the status code of the write operation

### Author(s)

Derived by RGtkGen from GTK+ documentation

### References

https://www.cairographics.org/manual/cairo-PNG-Support.html

[Package RGtk2 version 2.20.40 Index]