Cannot instantiate Cairo.Context
I'm trying to draw on a surface using cairo, but this code (inside a configure-event
handler):
const Cairo = imports.gi.cairo;
// ...
let surface = widget.get_window().create_similar_surface(Cairo.Content.COLOR,
widget.get_allocated_width(), widget.get_allocated_height());
let cr = new Cairo.Context(surface);
// ...
is failing with this error message:
(org.gnome.Youstream:3): Gjs-WARNING **: 15:52:48.099: JS ERROR: Error: Unable to construct struct type Context since it has no default constructor and cannot be allocated directly
I'm using GNOME Builder flatpak support and my target runtime is org.gnome.Platform/x86_64/master.
Am I missing something?
Thanks for your all your efforts!