GraphicApplication: canvas facade with a contract and backends, modifier keys, window types #14
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "GraphicApplicationCanvas"
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?
GraphicApplication: canvas facade with a contract and backends, modifier keys, window types
Split out of the Widgets core refactor (#12). These are the GraphicApplication changes the new Widgets core needs. They touch only
GraphicApplication/.Canvas: facade, contract, backends
The canvas now follows the same structure the platform windows use (
backends/contract+ implementations beside it, facade on top):src/canvas—Canvas, the drawing facade: origin, clip scopes, composite operation. Portable, links Math and Containers only, no Vulkan.src/canvas/backends/contract—CanvasBackend, the interface every backend implements, plus the drawing vocabulary (Axis,TextAlign,FontFace,TextStyle,ImageHandle,TextMetrics).src/canvas/backends/nanovg—NanoVgCanvasBackend, drawing on a window surface. The canvas's window-surface constructor andbeginFrame(frame, windowFrame)/endFrame()are defined here, next to the backend, so the portable facade never names a GPU frame. The application usesCanvasdirectly.src/canvas/backends/recording—RecordingCanvasBackend, records each command with its surface rect, clip and composite operation, and measures text with a fixed advance, so layout and painting are testable headless.Also:
Canvas::Clipis a public clip scope; clips intersect and restore with the scope.SavedStatealso restores the composite operation.gradientRecttakes anAxis;polyline/polygontake vectors;texttakes a string;frame()anddebugCross()had no users and are gone.setCliptakesstd::optional<RectF>instead of a null pointer.Modifier keys
KeyModifiers(shift, control, alt, super; either side of the keyboard counts) andModifierTracker, which follows modifier presses in event order.InputState::modifiers()gives the modifiers held at the end of the frame. Losing keyboard focus releases them.Window vocabulary library
WindowTypes(cursor shapes, clipboard image, window identity and edges) andPlatformInfomove from the backend contract intoGraphicApplicationWindowTypes, which needs only Math. Code that names a cursor no longer links the GPU device.Verification
master(f855ec9): 88 → 103 → 108 → 108.masteralready fails on 5 files of the oldWidgetslibrary, which still uses the removedGraphicsAPI. This PR adds one more file there,ColorPickerWidget.cpp, because of thepolygonsignature change. That library is replaced by #12; nothing that builds onmasterstops building.#12 is stacked on this branch and depends on it.
fe26787119to1052e3346dGraphicApplication: portable canvas with recording backend, modifier keys, window typesto GraphicApplication: canvas facade with a contract and backends, modifier keys, window types1052e3346dtoce1bd316c9