Implement flair-ui: complete Vulkan-backed 2D vector graphics library in Zig#1
Draft
Implement flair-ui: complete Vulkan-backed 2D vector graphics library in Zig#1
Conversation
Agent-Logs-Url: https://github.com/YesserLab/flair-ui/sessions/71b406ca-a075-4223-a055-51b24b574e1e Co-authored-by: YesserLab <2708404+YesserLab@users.noreply.github.com>
Agent-Logs-Url: https://github.com/YesserLab/flair-ui/sessions/71b406ca-a075-4223-a055-51b24b574e1e Co-authored-by: YesserLab <2708404+YesserLab@users.noreply.github.com>
…iling whitespace Agent-Logs-Url: https://github.com/YesserLab/flair-ui/sessions/71b406ca-a075-4223-a055-51b24b574e1e Co-authored-by: YesserLab <2708404+YesserLab@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add 2D vector graphics library using Vulkan
Implement flair-ui: complete Vulkan-backed 2D vector graphics library in Zig
Apr 15, 2026
…air-ui Agent-Logs-Url: https://github.com/YesserLab/flair-ui/sessions/58a930a3-a723-4c32-8526-71e8c5053493 Co-authored-by: YesserLab <2708404+YesserLab@users.noreply.github.com>
- Replace @cImport (deprecated in 0.16) with b.addTranslateC() for both the Vulkan and Wayland C headers. Two wrapper headers are added under src/c_headers/ and two named modules (vulkan_c, wayland_c) are wired into lib.root_module in build.zig. - Replace removed std.compress.zlib.compressor in image.zig with a hand-rolled zlibStoreCompress() that writes a valid RFC 1950 zlib stream using RFC 1951 DEFLATE stored blocks. - Bump minimum_zig_version in build.zig.zon to "0.16.0". Agent-Logs-Url: https://github.com/YesserLab/flair-ui/sessions/e03440a2-8ed1-44e3-8fc0-f260407bd3b2 Co-authored-by: YesserLab <2708404+YesserLab@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
src/c_headers/vulkan.hwrapper headersrc/c_headers/wayland.hwrapper headerbuild.zig— addb.addTranslateC()steps for both headers and wire modules into the librarysrc/vulkan.zig— replace@cImportwith@import("vulkan_c")src/platform/wayland.zig— replace@cImportwith@import("wayland_c")src/image.zig— replace removedstd.compress.zlibwith a manual DEFLATE-stored / zlib encoderbuild.zig.zon— bumpminimum_zig_versionto"0.16.0"Original prompt
Overview
Implement a complete 2D vector graphics library in Zig that depends exclusively on Vulkan for rendering. The library is called
flair-uiand should provide a clean, ergonomic public API.Core Concepts
1. Surface — The Central Drawing Primitive
A
Surfaceis the primary thing users draw onto. It is backed by a Vulkan image/framebuffer.2. Drawing Primitives / Shapes
The library must support drawing the following shapes. Every shape can be drawn as either filled or as stroked (outline) with a configurable stroke width:
3. Color & Paint System
Painttype represents how a shape is filled/stroked:4. Draw Style
Every shape draw function accepts a
DrawStyle:.fill— fill the interior.strokewith a configurableline_width5. Window — Platform-Agnostic Abstraction
A
Windowpresents a surface to the screen and handles input.libwayland-clientvia Zig's@cImport/ C interop.xdg-shellfor window decoration/toplevel.VK_KHR_wayland_surface.pollEvents()or similar).6. Input Handling
The window must handle user input and expose it through an event system:
window.pollEvents()which returns an iterator/slice of events, or the user registers callback functions.wl_keyboardand mouse fromwl_pointervia thewl_seatinterface.Architecture & File Structure