[Vala] Cairo.SvgSurface.for_stream()



Hello,

I'm having trouble with the syntax of Cairo.SvgSurface.for_stream() which has the following signature in the vapi file:

[CCode (cheader_filename = "cairo.h")]
namespace Cairo {
   ⋮
    public enum Status {
       ⋮
    }
   ⋮
    public static delegate Status WriteFunc (void* closure, uchar[] data);
   ⋮
     [CCode (cname = "cairo_surface_t", cheader_filename = "cairo-svg.h")]
    public class SvgSurface : Surface {
       ⋮
        [CCode (cname = "cairo_svg_surface_create_for_stream")]
        public SvgSurface.for_stream (WriteFunc write_func, void* closure, double width_in_points, double height_in_points);
       ⋮
    }
   ⋮
}

(where ⋮ means stuff deleted that I consider unrelated).

How should I call Cairo.SvgSurface.for_stream(). The following attempt failed...

Cairo.Status my_write_func (void* closure, uchar[] data)
{
    stderr.printf("%s", data);

    return (Cairo.Status)0;
}

int main(string[] args)
{
  ⋮
    var surface = new Cairo.SvgSurface.for_stream(my_write_func, null, 100, 100);
}

Thanks!
Dov



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]