diff options
Diffstat (limited to 'rust/crates/compositor/src/blend_mode.rs')
| -rw-r--r-- | rust/crates/compositor/src/blend_mode.rs | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/rust/crates/compositor/src/blend_mode.rs b/rust/crates/compositor/src/blend_mode.rs new file mode 100644 index 00000000..8c6edcc6 --- /dev/null +++ b/rust/crates/compositor/src/blend_mode.rs @@ -0,0 +1,47 @@ +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)] +#[serde(rename_all = "kebab-case")] +pub enum BlendMode { + Normal, + Darken, + Multiply, + ColorBurn, + Lighten, + Screen, + PlusLighter, + ColorDodge, + Overlay, + SoftLight, + HardLight, + Difference, + Exclusion, + Hue, + Saturation, + Color, + Luminosity, +} + +impl BlendMode { + pub fn shader_code(self) -> u32 { + match self { + Self::Normal => 0, + Self::Darken => 1, + Self::Multiply => 2, + Self::ColorBurn => 3, + Self::Lighten => 4, + Self::Screen => 5, + Self::PlusLighter => 6, + Self::ColorDodge => 7, + Self::Overlay => 8, + Self::SoftLight => 9, + Self::HardLight => 10, + Self::Difference => 11, + Self::Exclusion => 12, + Self::Hue => 13, + Self::Saturation => 14, + Self::Color => 15, + Self::Luminosity => 16, + } + } +} |
