[cairo] cairo issues, empty output
stoneMcClane
stonemcclane at gmail.com
Sat Oct 10 17:16:58 PDT 2009
Hi all,
Today I digged out one of my old projects which makes use of cairo. It
used to work fine all the time, but now that I tried to compile it
again, cairo doesn't behave the way that I was expecting.
I got the binary+dev files from
http://www.gtk.org/download-windows.html , I also tried older versions
of cairo, but the behaviour was the same.
My application reads vector graphic specifications from files and
renders them automatically using cairo, therefore I placed appropriate
"printf"s to reconstruct the code that isn't working.
mSurface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, 256, 128);
cairo_create(mSurface);
cairo_set_fill_rule(CAIRO_FILL_RULE_EVEN_ODD);
cairo_set_source_rgba(1, 0, 0, 1);
cairo_move_to(0.00, 0.00);
cairo_line_to(256.00, 0.00);
cairo_line_to(256.00, 128.00);
cairo_line_to(0.00, 128.00);
cairo_line_to(0.00, 0.00);
cairo_new_sub_path();
cairo_move_to(53.82, 27.43);
cairo_line_to(217.03, 27.43);
cairo_line_to(217.03, 97.96);
cairo_line_to(53.82, 97.96);
cairo_line_to(53.82, 27.43);
cairo_close_path();
cairo_fill();
cairo_set_source_rgba(0, 0, 1, 1);
cairo_move_to(53.82, 27.43);
cairo_line_to(217.03, 27.43);
cairo_line_to(217.03, 97.96);
cairo_line_to(53.82, 97.96);
cairo_line_to(53.82, 27.43);
cairo_close_path();
cairo_fill();
(I left out the mCairo variable, since it doesn't add to clarity of the code)
after these operations have finished I call
"cairo_image_surface_get_data" and write the buffer to an image file.
With the above code, the image is empty, meaning rgba(0,0,0,0) over
the full image.
However, if I add...
cairo_set_source_rgba(1, 0, 0, 1);
cairo_paint();
right before writing the buffer to the image file, I get a fully red
image, just like what you would expect, so I'm really puzzled what
could be wrong here.
Like said, this code used to work some months ago when I wrote it, but
now it doesn't draw anything at all.
I've changed from WinXP to Win7 since I last worked with this code,
could there be any issues with this ?
(yeah I've got the correct cairo binary version for my system, namely 32-bit)
As said, I'm really on a dead end here, and I've debugged this already
quite some time, without any solution.
I'd really appreciate it, if someone had an idea what could be wrong.
Thanks in advance,
sincerly, Wolfgang Steiner
More information about the cairo
mailing list