[Vala] Cairo.ImageSurface.get_data().length returns -1



Hi there!

Am I doing something wrong here? The following code (compiled with valac
0.26.2 & cairo 1.14.2) creates a red test.png file but prints

-1

to the standard output. Therefore I'm unable to access the pixel data of
the surface. Can anybody explain what's going on here?

var surface = new Cairo.ImageSurface (Cairo.Format.ARGB32, 32, 32);
var ctx = new Cairo.Context (surface);
ctx.set_source_rgba (1, 0, 0, 1);
ctx.rectangle (0, 0, 32, 32);
ctx.fill ();
surface.write_to_png ("test.png");
message (surface.get_data().length.to_string());

Thank you very  much!
Simon


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