Name
cairo.Context -- create Cairo context
Synopsis
handle = cairo.Context(target)
Function
Creates a new Cairo context with all graphics state parameters set to default values and with target as a target surface. The target surface should be constructed with a backend-specific function such as cairo.ImageSurface() (or any other Cairo surface backend constructor).

This function references target, so you can immediately call csurface:Free() on it if you don't need to maintain a separate reference to it.

This function returns a newly allocated Cairo context with a reference count of 1. The initial reference count should be released with ccontext:Free() when you are done using the Cairo context. This function never returns Nil. If memory cannot be allocated, a special Cairo context object will be returned on which ccontext:Status() returns #CAIRO_STATUS_NO_MEMORY. If you attempt to target a surface which does not support writing (such as a Cairo MIME surface) then a #CAIRO_STATUS_WRITE_ERROR will be raised. You can use this object normally, but no drawing will be done.

Inputs
target
target surface for the context
Results
handle
a newly allocated Cairo context

Show TOC