GDI bindings for software (CPU) presentation #1
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
cl-win32binds user32 and kernel32 only — it has nothing from gdi32. A new optional cl-windowing subsystem,cl-windowing/software, presents a CPU-drawn framebuffer to a window without any GPU API (OpenGL/Vulkan/DirectX), for text editors and other applications that are not graphically intensive. Its Win32 backend blits a top-down 32-bit DIB to the window with GDI, so it needs a small GDI surface added here.(The design uses GDI because, on modern Windows under WDDM, it is the supported, GPU-API-free way to get a CPU buffer onto a window. DirectDraw is deprecated DirectX emulated over D3D; "WDDM" is a driver model, not an app API. So GDI is the right backing.)
What to add
Idiomatic
cl-win32style: Lisp values, conditions on failure,with-macros for resources, no foreign pointers in the public API except documented escape hatches (the DIB pixel pointer is one).get-dc/release-dc(window DC),begin-paint/end-paint(forWM_PAINT),create-compatible-dc,delete-dc, andwith-macros for each.create-dib-section(32 bpp,BI_RGB, negative height = top-down), returning anHBITMAPand the pixel-memory pointer;select-object;delete-object.bit-bltandstretch-di-bits(and/orset-di-bits-to-device) withSRCCOPY; theBITMAPINFO/BITMAPINFOHEADERstructures and theBI_RGB,DIB_RGB_COLORSconstants.get-di-bits.These are general-purpose GDI, useful beyond this subsystem, and belong in
cl-win32alongside its user32 wrappers.Notes
BitBltto a window DC is reliable is to be confirmed by a test; if not, the consumer hands the blit to that thread.#xAARRGGBBpixel on little-endian (bytes B,G,R,X), so no conversion is needed.Tests
A Parachute test that creates a DIB section, blits a known pattern to a memory/window DC, reads it back with
get-di-bits, and checks the pixels.Spec
Full design in
gdi.orgin the engine workspace, section "cl-win32: GDI bindings". Consumer: thecl-windowing/softwaresubsystem (tracked indxtr/cl-windowing).