[cairo] Drawing with XCB

Matthew Allen fret at memecode.com
Wed Dec 10 02:59:00 PST 2008


Hi,

I'm implementing a widget set that draws with pango and cairo over xcb. I have a few questions about cairo_xcb_surface_create.

Firstly, what should I pass as the x and y parameters? Currently I'm passing the size of the drawable (a window in my case). But at this point I'm drawing just a block of text which is usually much smaller than the whole window, so is there any point in passing say the layout extent of the text? If thats the case how to I map the text to a location within the view? There doesn't seem to be an offset to place the output of the surface anywhere other than 0,0 relative to the windows origin.

Secondly, when should I allocate a surface, and how long should I keep it around for? For instance, one option would be to allocate it along with the window and keep it around till I destroy the window, or I could allocate it per EXPOSE call... or I could allocate one for a single peice of text drawing. Which could be multiple times per EXPOSE event. Thoughts?
--
Matthew Allen



More information about the cairo mailing list