Method

StDrawingAreaget_context

Declaration [src]

cairo_t*
st_drawing_area_get_context (
  StDrawingArea* area
)

Description [src]

Gets the Cairo context to paint to. This function must only be called from a signal handler or virtual function for the StDrawingArea::repaint signal.

JavaScript code must call the special dispose function before returning from the signal handler or virtual function to avoid leaking memory:

function onRepaint(area) {
    let cr = area.get_context();

    // Draw to the context

    cr.$dispose();
}

let area = new St.DrawingArea();
area.connect('repaint', onRepaint);

Return value

Type: cairo_t

The Cairo context for the paint operation.

The data is owned by the instance.