Is there some way to convert a BufferedImage to X11 Pixmap? It looks like JNA has com.sun.jna.platform.unix.X11.Pixmap
but I can't find a way to convert anything to that format.
Turns out the answer is to create a BufferedImage
with the correct type,
create a com.sun.jna.Memory
buffer, create an XImage
based on that buffer, and then write the BufferedImage's data into the buffer.
The correct type is based on the target visual of the XImage.
I wrote up a demo in Clojure and might still be playing with it. It should be easily conveted back to Java code for anyone interested.
https://github.com/robbieh/clj-xscreensaver-basic-demo/tree/dev