[Xcb] Best way to load a png/jpeg file when using XCB?

Michael Stapelberg michael+xcb at stapelberg.de
Sun Jul 4 09:13:56 PDT 2010


Hi,

I recently wanted to convert i3lock (a simple screen locker forked from slock)
to use XCB. One of the features of i3lock is to display an image instead of
only a black screen (like slock). At the moment, we do this using libXpm for
simplicity.

Because libxpm requires xlib, I can’t use it with xcb. So I looked into
directly using libjpeg and/or libpng, but it seems very complicated (multiple
pages of code to load an image while i3lock has only ~ 250 SLOC). Also, I
looked into imlib2, but it also does not work with xcb (because you need the
xlib Display and Visual data structure for imlib_context_set_visual()).

My question is: What is the best way (not much code, no strange dependencies)
to load an image in a relatively convenient format (jpeg/png) when using XCB?

Best regards,
Michael


More information about the Xcb mailing list