tuigui 0.23.0

An easy-to-use, highly extensible, and speedy TUI library.
Documentation
use crate::preludes::shader_creation::*;

/// Shader configuration
pub struct ShaderConfig {
    /// Whether or not the shader should be given a position relative to the canvas,
    /// or the position relative to the world (world position is true position)
    pub real_position: bool,
    /// Whether or not the shader should apply to all the content in the area
    /// instead of only the content set by the canvas
    pub whole_area: bool,
}

impl Default for ShaderConfig {
    fn default() -> Self {
        Self {
            real_position: true,
            whole_area: true,
        }
    }
}

/// Shaders are a way to take in what a widget has drawn and to change it in one way or another
pub trait Shader {
    /// Apply to canvas
    fn apply(&mut self, canvas: &Canvas, position: Position, content: Option<&Content>) -> Option<Content>;

    /// Configuration
    fn config(&self) -> ShaderConfig;
}