[cairo] Drawing a sequence of line segments

ax487 ax487 at gmx.de
Tue Jun 3 04:45:16 PDT 2014


*bump*

I actually put quite some work into the pastebin example. Doesn't anyone
have an idea how to interpolate between the full redraw and the lazy
variant?

On 29.05.2014 13:16, ax487 wrote:
> Hello all,
> 
> I am using cairo to draw a stroke, that is a sequence of line segments,
> onto a canvas, which is represented as a cairo_surface_t* internally.
> The canvas is used in a Gtk+ application, the stroke is extended
> whenever the mouse moves. Obviously, the redraw needs to be fast enough
> such that there is no visible lag. A minimal example is here:
> http://pastebin.com/RtaPajcU
> I have tried the following approaches:
> 
> 1: Redraw the entire stroke whenever the mouse moves. This works
> correctly apart from the fact that there is a lag which increases as
> more points are drawn.
> 
> 2: Only draw the stroke between the last two points whenever the mouse
> moves. This is noticeably faster but the drawing is incorrect: Pixels
> are repeatedly overdrawn so the alpha value increases along certain
> paths of the stroke.
> 
> I would like to go for fast and correct. Any ideas?
> 
> ax487
> 


More information about the cairo mailing list