Skip to main content

Compositor

Trait Compositor 

Source
pub trait Compositor<D: DrawTarget<Color = Rgb565>> {
    // Required method
    fn plot(
        target: &mut D,
        x: i32,
        y: i32,
        color: Rgb565,
        opacity: u8,
        blend: BlendMode,
        backdrop: Rgb565,
    ) -> Result<(), D::Error>;
}
Expand description

Pixel-plotting policy for a RenderCtx. Selected by the ctx’s C type parameter so the same drawing calls composite differently depending on the target’s capabilities — with no runtime branch and no specialization.

  • Dither (the default) approximates translucency with ordered dithering and works on any write-only DrawTarget.
  • Blend performs true per-pixel alpha compositing and requires a readback-capable target (PixelRead), e.g. a Framebuffer.

plot receives screen-space coords already transformed and clipped, the layer-combined opacity, and the active layer blend mode + backdrop.

Required Methods§

Source

fn plot( target: &mut D, x: i32, y: i32, color: Rgb565, opacity: u8, blend: BlendMode, backdrop: Rgb565, ) -> Result<(), D::Error>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<D: DrawTarget<Color = Rgb565> + PixelRead> Compositor<D> for Blend

Source§

impl<D: DrawTarget<Color = Rgb565>> Compositor<D> for Dither