[cairo] Cairo Win32 draws only some simple lines.
Roman Bednarek
roman at mikronika.com.pl
Tue Feb 12 01:03:36 PST 2013
On Thu, 7 Feb 2013, Chris Wilson wrote:
> On Thu, Feb 07, 2013 at 10:33:34AM +0100, Roman Bednarek wrote:
>>
>> Hello
>> I am a new cairo user, and want to use it at the beginning on Windows
>> platform.
>> Binaries which I found on GTK site version 1.10.2 are over a year old,
>> and use old msvcrt runtime, so I decided to compile current new version.
>> The build was succesfull without problems, but my version does not work.
>>
>> that code draws a line:
>> cairo_set_source_rgb (cr, 0.0, 0.0, 1.0);
>> cairo_set_line_width (cr, 10.0);
>> cairo_move_to(cr, 100.0, 100.0);
>> cairo_rel_line_to(cr, 0.0, 600.0);
>> cairo_stroke (cr);
>>
>> and this one does not:
>> cairo_set_source_rgb (cr, 0.0, 0.0, 1.0);
>> cairo_set_line_width (cr, 10.0);
>> cairo_move_to(cr, 100.0, 100.0);
>> cairo_rel_line_to(cr, 10.0, 600.0);
>> cairo_stroke (cr);
>>
>> it also does not draw a rectangle with alpha channel, cairo_status does
>> not return any error.
>
> One thing to be aware, is that before you can expect results to be
> externally visible you must flush the surface with
> cairo_surface_flush(). The difference is that in the second case, you
> are performing an operation that is not natively handled by the win32
> gdi code, and so trigger fallbacks. Those fallbacks are buffered and
> only presented back to the original surface when the surface is flushed,
> either implicitly as it is used as source or explicitly by the
> application.
>
> See cairo_surface_mark_dirty() and cairo_surface_flush().
> -Chris
>
After some more tries I found out that both functions work ok on
surfaces created with cairo_win32_surface_create_with_dib and
cairo_win32_surface_create_with_ddb, they do not work only on surfaces
created with cairo_win32_surface_create. Therefore I think that cairo is
compiled anf build correctly, just some function (requiring fallbacks?) do
not work on surfaces drawing directly on a window.
I am using buffer anyway, so it is not a problem for me anymore, but it
may be some bug in newer cairo versions.
I am working on Windows 7.
Roman Bednarek
More information about the cairo
mailing list