$ show GraphiteEditor/Graphite
Graphite is a free, open-source vector and raster graphics editor with a fully nondestructive editing workflow. It combines layer-based compositing with node-based generative design, enabling procedural content creation. The system is architected as a multi-crate Rust workspace with a desktop application (using Chromium Embedded Framework for UI and wgpu for GPU rendering) and a web frontend (Svelte + Vite compiled to WebAssembly). The core document model is a node graph executed by an interpreted runtime with GPU shader support via rust-gpu. Storage uses a CRDT-based format (`.gdd`) with content-addressed deltas, history, and session state, supporting collaborative editing and undo/redo. The editor features a comprehensive tool system (select, pen, brush, shape, text, etc.), a node graph editor, color management, raw image decoding, and vector path operations. The frontend communicates with the Rust backend through a message-passing architecture with hierarchical message types and a dispatcher pattern. The project also includes a CLI tool for export, a build system (cargo-run), and extensive developer tooling (bisect tool, crate hierarchy visualizer, node documentation generator).
The LLM identified 5 files worth highlighting for reuse:
Implements a generic context propagation framework for the node-graph execution engine. Defines traits like `ExtractFootprint`, `InjectFootprint`, `ModifyFootprint` for runtime features (footprint, time, position, index, varargs). Uses `ContextFeatures` bitflags for efficient compile-time analysis of context dependencies. The `OwnedContextImpl` builder pattern allows ergonomic construction. This is a reusable pattern for any graph-based computation system that needs to pass runtime data through nodes without coupling to specific types.
Defines the core CRDT delta types for collaborative document storage. Includes `RegistryDelta` enum covering all operations (node creation, deletion, attribute changes, etc.) with content-addressed hashing (Blake3), LWW semantics, and merge deltas. The `Delta` struct carries id, parent, author, timestamp, kind, reverse, and attributes. This is a clean, reusable implementation of a CRDT-based storage layer that can be adapted for other collaborative applications requiring conflict-free merging.
Provides `PipelineCache` for lazy initialization and caching of wgpu compute and render pipelines. Handles shader module compilation, pipeline layout creation, and binding group layout management. The cache avoids redundant GPU resource creation and supports dynamic shader variants. This is a reusable component for any wgpu-based application that needs efficient pipeline management.
A dynamic typing library that extends `Any`-like behavior to types with non-'static lifetimes, a niche requirement for graph node polymorphism. Provides `DynAny` trait and derive macro, enabling type-erased storage and retrieval with lifetime reborrowing. This is a reusable solution for systems that need to store heterogeneous types with borrowed data, such as node graph runtimes.
Implements O(n) hierarchical dart throwing algorithm for maximal Poisson disk sampling. Generates a set of points with minimum distance constraint, used for stippling or point cloud generation. The algorithm is efficient and well-structured, with clear separation of concerns. This is a reusable geometric algorithm that can be extracted for any application requiring blue noise sampling.