diff options
| author | Maze Winther <mazewinther@gmail.com> | 2026-04-13 04:40:29 +0200 |
|---|---|---|
| committer | Maze Winther <mazewinther@gmail.com> | 2026-04-13 05:01:51 +0200 |
| commit | 8230faf082c405c9fd0fa640f4ce2284315782ae (patch) | |
| tree | e00bf694a83b4d14d6d56942ba89ba92402d854e /rust/crates/compositor/src/blend_mode.rs | |
| parent | dbd68ff1396bf498eb97f095810b78d2bddd0011 (diff) | |
| download | opencut-8230faf082c405c9fd0fa640f4ce2284315782ae.tar.gz | |
feat: wasm compositor
Made-with: Cursor
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, + } + } +} |
