[cairo] virtual surfaces and composition

LRN lrn1986 at gmail.com
Wed Dec 9 10:18:30 PST 2015


On 09.12.2015 18:47, Henry (Yu) Song wrote:
> Enrico Weigelt, metux IT consult wrote:
>> I'm currently designing a new widget toolkit (focused on embedded /
>> full screen targets) and exploring whether cairo is suitable for that.
>> 
>> One important thing I didnt find out yet is how to create virtual
>> surfaces / canvas'es which later can be composited onto the screen.
>> 
>> The idea goes like this:
>> 
>> For each widget, there will be an virtual surface / canvas, where the
>> the widget renders itself on. In most cases, it will only be temporarily
>> accessible - when the engine calls the individual widget's paint handler
>> (unless the widget explicitly asks for a permanent surface). Optimally
>> widgets will only be repainted, when it actually changes (eg. not on
>> moving / scrolling, etc) - it's entirely up to the engine, whether
>> to buffer pixmaps or paint operations, etc.
> 
> Does cairo recording surface work for you? Unfortunately cairo
> recording surface does not have "TRUE" playback though. But as long as
> all of your operators are CAIRO_OPERATOR_OVER, you should be fine.

CMIIW, but IME the recording surface draws roughly as fast as your own code
does. I.e. you will get no speedup by caching drawing of a widget on a
recording surface.

Image surfaces should work fine and you can create image surfaces that are
similar to the actual output surface of the display system you are using,
so they can be composited efficiently (AFAIU).

You might want to ask GTK+ developers about their experience in using cairo
as a backend for a widget toolkit, because that is exactly what they are
doing (and if your licensing situation allows, you can even borrow somre of
their code; it's LGPLv2+).



-- 
O< ascii ribbon - stop html email! - www.asciiribbon.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: OpenPGP digital signature
URL: <http://lists.cairographics.org/archives/cairo/attachments/20151209/25632ac1/attachment-0001.sig>


More information about the cairo mailing list