The other thing is that there are many aspects of GDI drawing, you have to take into account region clipping, pens, brushes, line thickness, line style, fill style, and other wonders, and make them work in 1, 4, 8, 16, 24 and 32 bit colour depth pixel-for-pixel exact with the way Windows does them.
I see. Effectively the number of parameters to take in account will be a difficulty and the GDI API is huge. Moreover implementing it in a fluent way won't be easy as said Stefan and Rolf.
But I asked Alexandre about this, and he said the whole point of the DIB engine is that you shouldn't need the locking. How that would work is beyond me, after all, if you only draw on the client-side, you still have to upload the image to the X server when you want it to become visible, but what about images that aren't double-buffered, and what about mixed drawing with OpenGL?
Perhaps should we draw everything asked in memory and just send it to X when the application calls EndPaint, this way we limit the interaction with the X server (and locks).