Skip to main content

Module blend_kernel

Module blend_kernel 

Source
Expand description

GPU blend kernels (CPU simulation via Rayon).

Provides parallel image compositing and blending operations that simulate GPU compute-shader dispatch semantics.

§Supported blend modes

ModeDescription
BlendMode::AlphaCompositePorter-Duff “over” compositing
BlendMode::Additivesrc + dst, clamped to 255
BlendMode::Multiplysrc * dst / 255
BlendMode::Screen1 - (1-src)*(1-dst)
BlendMode::OverlayPhotoshop-style overlay
BlendMode::SoftLightPegtop soft light formula
BlendMode::Differenceabs(src - dst)
BlendMode::DissolveRandom per-pixel src/dst selection by opacity

§Example

use oximedia_gpu::blend_kernel::{BlendKernel, BlendMode};

let src = vec![200u8, 100, 50, 255];   // opaque orange
let mut dst = vec![0u8, 128, 255, 255]; // opaque blue
BlendKernel::blend(&src, &mut dst, 1, 1, BlendMode::AlphaComposite, 255)
    .expect("blend failed");

Structs§

BlendKernel
GPU-style image blending kernel (CPU simulation via Rayon).
BlendStats
Statistics from a blend operation.

Enums§

BlendError
Errors returned by blend kernel operations.
BlendMode
Compositing / blend mode.