Repository navigation
Overview
Blinc is a high-performance UI framework built from the ground up for GPU-accelerated rendering without virtual DOM overhead. This chapter explains how the major systems work together.
Blinc follows several key principles:
- Fine-grained Reactivity - Signal-based state management with automatic dependency tracking eliminates the need for virtual DOM diffing
- Layout as Separate Concern - Tree structure is independent from visual properties, enabling visual-only updates without layout recomputation
- GPU-First Rendering - SDF shaders provide resolution-independent, smooth rendering with glass/blur effects
- Incremental Updates - Hash-based diffing with change categories minimizes recomputation
- Background Thread Animations - Animation scheduler runs independently from the UI thread
Each frame runs through five named phases. The phase numbering is load-bearing: code, traces, and runbooks all reference it.
┌─────────────────────────────────────────────────────────────┐
│ WindowedApp Event Loop (Platform abstraction) │
├─────────────────────────────────────────────────────────────┤
│ • Receives pointer, keyboard, lifecycle events │
│ • Routes through EventRouter -> StateMachines │
│ • Triggers reactive signal updates │
└─────────────────────────────────────────────────────────────┘
↓
┌─────────────────────────────────────────────────────────────┐
│ Phase 1: Diff │
├─────────────────────────────────────────────────────────────┤
│ • incremental_update() compares hashes │
│ • VisualOnly: apply prop updates │
│ • ChildrenChanged: rebuild subtree, invalidate cache │
│ • Most signal updates skip rebuild; they land as │
│ dynamic bindings the compositor patches in Phase 4 │
└─────────────────────────────────────────────────────────────┘
↓
┌─────────────────────────────────────────────────────────────┐
│ Phase 2: Layout (Taffy Flexbox) │
├─────────────────────────────────────────────────────────────┤
│ • compute_layout() on dirty nodes only │
│ • Stylesheet overrides applied before compute_layout │
└─────────────────────────────────────────────────────────────┘
↓
┌─────────────────────────────────────────────────────────────┐
│ Phase 3: Tick │
├─────────────────────────────────────────────────────────────┤
│ • Spring physics, CSS keyframes, CSS transitions │
│ • Scroll physics, motion bindings │
│ • Layout-prop animations re-run compute_layout │
└─────────────────────────────────────────────────────────────┘
↓
┌─────────────────────────────────────────────────────────────┐
│ Phase 4: Paint │
├─────────────────────────────────────────────────────────────┤
│ • try_fast_paint? (cache + no rebuild / layout / scroll) │
│ yes → apply_binding_deltas + apply_css_deltas │
│ render_static_layer_damaged (scissor + redraw) │
│ no → full walker → repopulate cache │
└─────────────────────────────────────────────────────────────┘
↓
┌─────────────────────────────────────────────────────────────┐
│ Phase 5: Composite & Present │
├─────────────────────────────────────────────────────────────┤
│ • Blit static cache → swapchain │
│ • Overlay pass: dynamic batch + motion subtree blits │
│ • Submit, present │
│ • request_redraw() if any visible animation mid-flight │
└─────────────────────────────────────────────────────────────┘
After the first paint of a tree state, the static layer lives in a GPU-side texture cache. Most subsequent frames (hover, focus, CSS animation tick, spring tick) never re-walk the tree. The compositor patches a small set of primitive fields in place (translate, scale, opacity, colour, corner radius) and the GPU pass scissors a damage rect, re-dispatching only the SDF primitives that intersect.
Signal-bound props (bg(my_signal), w(my_signal)) go through the same
in-place patch path. A signal update doesn't necessarily rebuild any
subtree; it can simply patch the GPU primitive's relevant field.
A signal read inside a branched expression is the case that rebuilds the reading component's subtree (not the whole UI). And off-screen content opted into viewport culling emits zero primitives, so it costs nothing.
The full re-walk only fires when the cache invalidates: structural rebuilds, layout-affecting changes, scroll, overlay transitions. See GPU Rendering for the cache, damage, and culling details.
The static layer is a window-sized texture. A desktop window that has drawn
nothing for two seconds frees it, with the offscreen targets, pooled layer
textures, flow scene copy and mesh targets, and the next frame paints in full
and makes them again. The window-sized intermediates also go once no frame has
used them for 60 frames, while the app keeps drawing. An app
that drives its own loop can do the same with BlincApp::release_idle_memory.
| Crate | Purpose |
|---|---|
blinc_core |
Reactive signals, FSM, core types, event system |
blinc_layout |
Element builders, Taffy integration, diff system, stateful elements |
blinc_animation |
Spring physics, keyframe timelines, animation scheduler |
blinc_gpu |
wgpu renderer, SDF shaders, glass effects, text rendering |
blinc_text |
Font loading, glyph shaping, text atlas |
blinc_app |
WindowedApp, render context, platform integration |
Traditional frameworks (React, Vue) use a virtual DOM to diff the entire component tree on every state change. This has overhead:
- Creating VDOM objects for every render
- Diffing the full tree to find changes
- Patching the real DOM with changes
Blinc avoids this with:
- Fine-grained signals - Only dependent code re-runs when state changes
- Stateful elements - UI state managed at the element level, not rebuilt from scratch
- Hash-based diffing - Quick equality checks without deep comparison
- Change categories - Visual vs layout vs structural changes handled differently
The result: updates proportional to what changed, not to tree size.
- GPU Rendering - SDF primitives, glass effects, text rendering
- Reactive State - Signal system, dependency tracking, effects
- Layout & Diff - Taffy integration, incremental updates
- Animation - Spring physics, timelines, scheduler
- Stateful Elements - FSM-driven interactive widgets
Getting Started
Migrating
Mobile Development
Example Gallery
- Example Gallery
- Canvas Element
- Canvas Kit Interactive
- Carousel Demo - Selector API Showcase
- Chrome-Style Tabs
- blinc_cn Components
- Run with
cargo run -p blinc_app_examples --features cn --example cn_pickers_demo. - Code Element
- Complex SVG
- CSS Debug
- CSS Visual Features
- Layer Effects
- Emoji and HTML Entities
- @flow Shader
- Fluid Surface
- Skeleton animation with glTF +
blinc_canvas_kit. - Gpu Pass Demo
- Image CSS Styling
- Image Layer Test
- Keyframe Animation Canvas
- Markdown Editor
- 3D Mesh Demo — renders the Khronos glTF
DamagedHelmetsample model - Motion Demo
- Music Player Glass Card
- Node-editor demo — pre-wired graph with three node types, typed
- Notch Menu Bar
- Overflow Fade
- Overlay System
- Pointer Query
- Rich Text Element
- Rich Text Editor
- Scroll Container
- Semantic @flow
- Sortable
- Stateful API + Signal-bound modifiers demo.
- End-to-end 3D demo wiring Blinc's SceneKit3D renderer up to
- Unified Styling API
- SVG Animation
- Table Builder
- Tabler Icons
- Minimal text positioning test
- Text Input Widgets
- KHR_texture_transform
- Theme System
- Timeline Animation
- Typography
- Wet Glass
- Windowed Application
Web Development
Core Concepts
- Elements & Layout
- Styling & Materials
- CSS Styling
- Theming
- Event Handling
- Accessibility
- State Management
- Lists & Conditional Content
- Element Refs
Animation
Components
Component Library (blinc_cn)
- Overview
- Button
- Card
- Icons
- Typography
- Dialog
- Form Components
- Date, Time and Colour Pickers
- Rich Text Editor
- Code Editor
- Navigation
- Feedback
- Layout
- Data Display
Widgets
- Buttons & Inputs
- Text & Rich Text
- Code Editor
- Scroll Containers
- Virtualized List
- Canvas Drawing
- Gestures
- Notched Surfaces
- Images & SVG
- Audio & Video
- Markdown Rendering
Canvas Kit
Advanced
- Routing & Navigation
- Multi-Window
- System Integration
- Element Query API
- Overlay System
- Custom State Machines
- Pointer Query
- Performance Tips
- Flow Shaders
- 3D Rendering
- Custom GPU Passes
- Hot reloading
Architecture
Contributing