[cairo] Cairo Win32 draws only some simple lines.

Roman Bednarek roman at mikronika.com.pl
Thu Feb 7 07:08:38 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


    I have used both functions with no effect, I think I do not use any 
native api drawing on the surface. I have compiled only WIN32_SURFACE 
with other features disabled, thinking it is the only one necessary to 
draw on windows, is it true? Is it possible that something necessary for 
those fallback functions is not compiled  in?

Roman Bednarek


More information about the cairo mailing list