[Chart] chart-gtk flickering animation

Tim Docker tim at dockerz.net
Sun Sep 15 22:52:36 BST 2013


Hi,

runCRender has been replaced by runBackend.

I couldn't see any reason not to make your code below the default for 
gtk rendering. So I've pushed a patch to the library, which will be in 
the next release:

https://github.com/timbod7/haskell-chart/commit/ccc2958beda895adccde4653cf035c30f0043467

cheers,

Tim

On 15/09/13 08:29, Andreas Voellmy wrote:
> Hi Tim,
>
> I used this code with Chart 0.17 to reduce flickering in my GUI. It 
> uses runCRender from Chart. This was removed with 1.0. Would it be 
> possible to reinstate it? Or is there another way to do this now?
>
> -Andi
>
>
> On Jul 15, 2013, at 9:58 AM, Andreas Voellmy <andreas.voellmy at yale.edu 
> <mailto:andreas.voellmy at yale.edu>> wrote:
>
>> Thanks Tim,
>>
>> I found a very helpful stackoverflow question:
>>
>> http://stackoverflow.com/questions/5287622/haskell-gtk-double-buffering-with-primitives
>>
>> I tried it and it works beautifully - no more flickering. Here is my 
>> version of updateCanvas in case you want to include it in chart-gtk:
>>
>> updateCanvas :: Renderable a -> DrawingArea  -> IO Bool
>> updateCanvas chart canvas = do
>>     win <- widgetGetDrawWindow canvas
>>     (width, height) <- widgetGetSize canvas
>>     regio <- regionRectangle $ Rectangle 0 0 width height
>>     let sz = (fromIntegral width,fromIntegral height)
>>     drawWindowBeginPaintRegion win regio
>>     renderWithDrawable win $ runCRender (render chart sz) bitmapEnv
>>     drawWindowEndPaint win
>>     return True
>>
>> -Andi
>>
>> On Jul 15, 2013, at 5:21 AM, Tim Docker <tim at dockerz.net 
>> <mailto:tim at dockerz.net>> wrote:
>>
>>> Hi,
>>>
>>> I've not actually attempted to do any animation with cairo, so I"m 
>>> unsure of the problem. It does sound like writing to an off screen 
>>> buffer and then copying it into place is the right solution....
>>>
>>> Let me know how you get on - information on how to do this with the 
>>> chart library would be useful.
>>>
>>> Tim
>>>
>>>
>>> -------- Original Message --------
>>> Subject: 	chart-gtk flickering animation
>>> Date: 	Sun, 14 Jul 2013 21:18:22 -0400
>>> From: 	Andreas Voellmy <andreas.voellmy at yale.edu>
>>> To: 	tim at dockerz.net
>>>
>>>
>>>
>>> Hi Tim,
>>>
>>> Thanks so much for sharing your awesome chart and chart-gtk packages. I just started using then to display moving time series in a gtk-based GUI. I.e. I redraw the chart several times per second using "updateCanvas" function. I'm seeing that a lot of flickering. I wonder if you've come across this or have any ideas how to fix it.  I wonder if the chart is being rendered and sometimes shown halfway through the rendering process.   This link might be relatedhttp://islascruz.org/html/index.php/blog/show/Drawing-with-Cairo-without-flicker.html, but I haven't tried out his solution yet.
>>>
>>> Cheers,
>>> Andi
>>>
>>>
>>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://projects.haskell.org/pipermail/chart/attachments/20130916/5ce72023/attachment.htm>


More information about the Chart mailing list