[cairo] Cairo Win32 draws only some simple lines.

Chris Wilson chris at chris-wilson.co.uk
Thu Feb 7 03:44:55 PST 2013


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

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the cairo mailing list