darkly 0.5.0

A GPU-native paint engine on wgpu: brushes, layers, blend modes, masks, selections, and undo.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
//! WGSL canvas-window helper library.
//!
//! WGSL has no `#include`, so the shared canvas-coordinate helpers in
//! `shaders/lib/canvas.wgsl` are concatenated ahead of every shader that
//! needs them at module-creation time. One definition, many call sites —
//! see the module doc in `shaders/lib/canvas.wgsl`.

/// Source of the shared canvas-window helper functions.
pub const CANVAS_LIB: &str = include_str!("../../shaders/lib/canvas.wgsl");

/// Prepend the canvas helper library to a shader source so its functions
/// (`plane_to_selection_uv`, `window_uv_to_plane`) are in scope.
pub fn with_canvas_lib(src: &str) -> String {
    format!("{CANVAS_LIB}\n{src}")
}