Using XCB surfaces with xcffib¶
The cairocffi.xcb
module uses xcffib as the XCB library to create
graphics for X windows and pixmaps.
-
class
cairocffi.xcb.
XCBSurface
(conn, drawable, visual, width, height)¶ The XCB surface is used to render cairo graphics to X Window System windows and pixmaps using the XCB library.
Creates a cairo surface that targets the given drawable (pixmap or window).
Note
This class works using objects and libraries in
xcffib
Parameters: - conn – The
xcffib.Connection
for an open XCB connection - drawable – An XID corresponding to an XCB drawable (a pixmap or a window)
- visual – An
xcffib.xproto.VISUALTYPE
object. - width – integer
- height – integer
-
set_size
(width, height)¶ Informs cairo of the new size of the X Drawable underlying the surface. For a surface created for a Window (rather than a Pixmap), this function must be called each time the size of the window changes (for a subwindow, you are normally resizing the window yourself, but for a toplevel window, it is necessary to listen for
xcffib.xproto.ConfigureNotifyEvent
‘s).A Pixmap can never change size, so it is never necessary to call this function on a surface created for a Pixmap.
Parameters: - width – integer
- height – integer
- conn – The