cairoSurfaceFinish is called on the surface. The initial
contents of buffer will be used as the initial image contents; you
must explicitly clear the buffer, using, for example,
cairoRectangle and cairoFill if you want it cleared.cairoImageSurfaceCreateForData(data, format, width, height, stride)cairoFormatStrideForWidth before allocating the data
cairoSurfaceDestroy when done
with it.This function always returns a valid pointer, but it will return a
pointer to a "nil" surface in the case of an error such as out of
memory or an invalid stride value. In case of invalid stride value
the error status of the returned surface will be
CAIRO_STATUS_INVALID_STRIDE. You can use
cairoSurfaceStatus to check for this.
See cairoSurfaceSetUserData for a means of attaching a
destroy-notification fallback to the surface if necessary.
cairoFormatStrideForWidth with the desired format and
maximum image width value, and the use the resulting stride value
to allocate the data and to create the image surface. See
cairoFormatStrideForWidth for example code.