C++ class: PaintQueue¶
Description¶
Drawing command queue that resumes after backpressure.
Qualified name : gaspardos::desktop::PaintQueue.
Header : bindings/cpp/desktop_gui.hpp. C++98.
When to use it¶
Split rendering into short loop iterations.
Simple program example¶
#include "desktop_gui.hpp"
#include <cstdio>
#include <cstring>
int main()
{
gaspardos::desktop::PaintQueue queue;
queue.fill(0, 0, 100, 30, 0xFFFFFF);
queue.text(4, 4, "hello");
return queue.finished() ? 1 : 0;
}
Building from Windows¶
Save the program above as build/api-examples/PaintQueue.cpp from the repository root. Create the directory if necessary.
PowerShell — from the repository root:
New-Item -ItemType Directory -Force build/api-examples | Out-Null
& .\build-x64-install\bin\x86_64-gaspardos-gcc.exe -std=gnu1x -O2 -mno-red-zone -c bindings/native/gaspardos_x64_syscall.c -o build/api-examples/syscall.o
if ($LASTEXITCODE -ne 0) { throw "C compilation failed" }
& .\build-x64-install\bin\x86_64-gaspardos-g++.exe -std=c++98 -O2 -Ibindings/cpp build/api-examples/PaintQueue.cpp build/api-examples/syscall.o bindings/cpp/file_explorer.cpp bindings/cpp/desktop_native.cpp bindings/cpp/desktop_gui.cpp -o build/api-examples/PaintQueue-x64.elf
if ($LASTEXITCODE -ne 0) { throw "C++ compilation/link failed" }
Run the ELF on GaspardOS, not Windows. The driver supplies CRT and libraries. Prepare the required volumes/services; examples bound their waits and may exit on backpressure rather than retry. Successful compilation does not validate kernel execution.
The headers, implementation files, native wrappers and complete examples are available under Source files.
Class methods¶
PaintQueue()¶
Initial position zero.
void clear()¶
Clear commands and position.
void fill(int x, int y, int width, int height, uint32_t color)¶
Queue a rectangle when dimensions are positive.
void text(int x, int y, const std::string& value, uint32_t color = 0x202020, unsigned columns = 110)¶
Queue text truncated to min(columns,120) bytes without splitting UTF-8.
void button(int x, int y, int width, const std::string& text, bool selected = false)¶
Queue border, background and label for a 26-pixel-high button.
void input(int x, int y, int width, const TextInput& input, bool focused)¶
Queue TextInput rendering; require positive usable width.
bool finished() const¶
True once all commands have been processed.
int64_t paint(gui::Painter& painter)¶
At most 12 commands per call; zero does not mean finished; errors retain the current command.
Native contract¶
LP64 ABI, 32-bit wchar_t, no packing. Native negative results are not errno. Handle -11 with yield and an application limit. Referenced objects must outlive their users; do not copy handle owners. File uses stdio/errno and invalidates its stream on close, even on error.