How emadgh/windows-shade-editor works
Purpose and Runtime
Shade Editor is a native Windows Rust/egui desktop application for non-destructive editing and production conversion of multi-channel TIFF artwork used in ceramic printing. It preserves source TIFF pixels; .shade projects persist recipes, metadata, previews, and recovery state. Primary executable entry is src/main.rs; shared module wiring is in src/lib.rs.
Application and Project Lifecycle
Application orchestration connects UI actions to project state, persistence, autosave, history, and recovery. The project schema represents Faces, recipes, preview settings, source/production roles, snapshots, and conversion provenance. TIFF paths are generally project-relative.
• src/main.rs
• src/model.rs
• src/project_lifecycle.rs
• src/project_autosave.rs
• src/recovery.rs
Face Ingestion and TIFF Boundary
TIFF inspection/decoding discovers dynamic RGB, CMYK, extra, and Spot channels plus ICC and Photoshop metadata. This is the boundary between immutable source files and in-memory project/preview state. Filesystem safety and path validation support atomic operations and relinking.
• src/tiff_io.rs
• src/tiff_inspect.rs
• src/png_source.rs
• src/safe_fs.rs
• src/path_safety.rs
Non-Destructive Adjustment and Preview Rendering
Each Face carries an adjustment recipe applied in production order: Levels → dynamic N×N channel mixer → Curve. Rendering creates viewport/thumbnail previews without modifying sources. Preview color management selects embedded or assigned ICC profiles, transforms to sRGB, and can soft-proof through an output profile.
• src/adjustment_tools.rs
• src/render.rs
• src/color_management.rs
• src/thumbnail.rs
• src/snapshot_preview_cache.rs
UI Control Layer
egui views and input routing expose face navigation, adjustment editors, color conversion, export/conversion queues, settings, and status. Controllers/features form the application-facing command boundary rather than embedding workflow behavior directly in UI panels.
• src/ui/mod.rs
• src/ui/actions.rs
• src/ui/input_router.rs
• src/app_controllers.rs
• src/app_features.rs
Production Color Conversion
Production setup separately assigns hash-verified source ICCs and validates target Output ICC or DeviceLink recipes, channel topology, precision, and destination safety. The worker renders the saved immutable adjustment state into a disk-backed mmap spool, invokes ICC/device-link conversion, and writes bounded strips to a staged TIFF. N-channel output uses separated ink semantics and authoritative ink names.
• src/conversion_preflight.rs
• src/conversion_recipe.rs
• src/icc_conversion_worker.rs
• src/devicelink_conversion.rs
• src/conversion_tiff.rs
Durable Queues, Transactions, and Output
Conversion captures are immutable and serialized before background work. Persistent queue state supports restart recovery, pause/resume, retry, progress, and cancellation before commit. Transaction handling makes TIFF commit atomic; post-commit project/link failures retain recovery payloads. A parallel export queue handles normal full-resolution TIFF exports and batches.
• src/conversion_queue.rs
• src/conversion_transaction.rs
• src/conversion_workflow.rs
• src/export_queue.rs
• src/export.rs
Validation and Windows Integration
Production acceptance validates output profiles, TIFF transport properties, metadata retention, and round-trip expectations. Windows-specific infrastructure includes installed ICC catalog access, native file/process support, and an optional Explorer Shell extension built from shell/.
• src/validation.rs
• src/production_acceptance.rs
• src/production_project.rs
• shell/ShadeEditorShell.cpp
• .github/workflows/build-windows.yml
Main entry points: project_lifecycle.rs Project lifecycle · model.rs Project model · app_controllers.rs Controllers and features · tiff_io.rs TIFF ingest and inspection
Components 21
Desktop application
- Application entry
src/main.rs - egui UI and input
src/ui/mod.rs - Controllers and features · Maps UI intent to application workflows.
src/app_controllers.rs - Project model · Faces, recipes, roles, snapshots, and provenance in .shade projects.
src/model.rs - Project lifecycle
src/project_lifecycle.rs - Autosave and recovery
src/project_autosave.rs
Image pipeline
- TIFF ingest and inspection · Decodes dynamic channels and extracts ICC and Photoshop metadata.
src/tiff_io.rs - Safe filesystem paths · Validates paths and supports atomic file operations and relinking.
src/safe_fs.rs - Adjustment recipes · Applies Levels, N×N mixer, then Curve.
src/adjustment_tools.rs - Preview rendering · Renders previews without modifying source pixels.
src/render.rs - Preview color management · Uses embedded or assigned profiles, sRGB transforms, and soft proofing.
src/color_management.rs
Production output
- Conversion preflight · Validates profiles, topology, precision, and destination safety.
src/conversion_preflight.rs - Conversion recipe · Captures hash-verified source and target ICC or DeviceLink setup.
src/conversion_recipe.rs - Persistent conversion queue · Supports restart, pause, retry, progress, and pre-commit cancellation.
src/conversion_queue.rs - Conversion workflow · Serializes immutable captures and coordinates conversion, commit, and recovery.
src/conversion_workflow.rs - ICC conversion worker · Renders saved state to mmap spool and performs ICC conversion.
src/icc_conversion_worker.rs - Staged TIFF writer · Writes bounded strips with separated inks and authoritative names.
src/conversion_tiff.rs - Atomic output commit · Retains recovery payloads when post-commit linking fails.
src/conversion_transaction.rs - Production acceptance · Checks TIFF transport, metadata retention, profiles, and round trips.
src/production_acceptance.rs - Export queue · Runs normal full-resolution TIFF exports and batches.
src/export_queue.rs
Windows integration
- Windows ICC and shell support · Provides ICC catalog and optional Explorer Shell extension.
shell/ShadeEditorShell.cpp
Connections 27
- Application entry → egui UI and input: starts
- Application entry → Project lifecycle: initializes
- egui UI and input → Controllers and features: user actions
- Controllers and features → Project lifecycle: project commands
- Project lifecycle → Project model: loads and updates
- Project lifecycle → Autosave and recovery: persists recovery state
- Project lifecycle → TIFF ingest and inspection: ingests faces
- TIFF ingest and inspection → Project model: source metadata and channels
- Safe filesystem paths → Project lifecycle: safe paths and relinking
- Project model → Adjustment recipes: stores recipes
- Adjustment recipes → Preview rendering: applies recipe
- TIFF ingest and inspection → Preview rendering: immutable source pixels
- Preview color management → Preview rendering: display transform
- Controllers and features → Conversion preflight: requests production setup
- Project model → Conversion recipe: saved conversion state
- Conversion preflight → Conversion recipe: validates
- Conversion recipe → Persistent conversion queue: immutable capture
- Persistent conversion queue → Conversion workflow: scheduled job
- Conversion workflow → ICC conversion worker: renders and converts
- Adjustment recipes → ICC conversion worker: production-order state
- ICC conversion worker → Staged TIFF writer: converted strips
- Staged TIFF writer → Production acceptance: staged output
- Production acceptance → Atomic output commit: accepted TIFF
- Atomic output commit → Project model: committed output link
- Conversion workflow → Autosave and recovery: failure recovery payload
- Controllers and features → Export queue: export requests
- Windows ICC and shell support → Conversion preflight: installed ICC catalog