[prev in list] [next in list] [prev in thread] [next in thread] 

List:       cairo
Subject:    Re: [cairo] Cairo, GtkDrawingArea, and buffer
From:       Stefan Salewski <mail () ssalewski ! de>
Date:       2011-02-27 13:32:00
Message-ID: 1298813520.2293.10.camel () AMD64X2 ! fritz ! box
[Download RAW message or body]

On Sun, 2011-02-27 at 13:50 +0800, Xi Yang wrote:
> Hi, everyone!
> I want to have a customized widget, and I decided to use
> GtkDrawingArea and Cairo together. 
> 
> 
> However, each time the GtkDrawingArea is resized or uncovered, it
> needs to be redrawed. I don't want to perform the Cairo drawing at
> each exposure_event, as my drawing procedure is pretty complicated.
> 
> 
> I need a buffer which the cairo_t would build on. At each
> exposure_event, I just need to copy the buffer to the GtkDrawingArea.
> So how can I achieve that? Which classes should I use?
> 
> Thanks!
> 

I had a similar task and wrote a small demo in Ruby, followed by some
discussions on this list:

http://www.ssalewski.de/PetEd-Demo.html.en

http://comments.gmane.org/gmane.comp.lib.cairo/20967

Works not too bad, if we define a bounding box for each or at least the
complicated objects, and draw only these objects which overlap with the
visible area. Maybe that is a starting point for you -- I do use a
buffer. Based on this thread:

http://lists.cairographics.org/archives/cairo/2009-March/016756.html


--
cairo mailing list
cairo@cairographics.org
http://lists.cairographics.org/mailman/listinfo/cairo
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic