Skip to main content

TargetPixel

Trait TargetPixel 

Source
pub trait TargetPixel: Sized + Copy {
    // Required methods
    fn blend(&mut self, color: PremultipliedRgbaColor);
    fn from_rgb(red: u8, green: u8, blue: u8) -> Self;

    // Provided methods
    fn blend_slice(slice: &mut [Self], color: PremultipliedRgbaColor) { ... }
    fn from_rgb565(value: u16) -> Self { ... }
    fn background() -> Self { ... }
}
Available on crate feature renderer-software only.
Expand description

Trait for the pixels in the buffer

Required Methods§

Source

fn blend(&mut self, color: PremultipliedRgbaColor)

Blend a single pixel with a color

Source

fn from_rgb(red: u8, green: u8, blue: u8) -> Self

Create a pixel from the red, gree, blue component in the range 0..=255

Provided Methods§

Source

fn blend_slice(slice: &mut [Self], color: PremultipliedRgbaColor)

Blend a color to all the pixel in the slice.

Source

fn from_rgb565(value: u16) -> Self

Create a pixel from a 16-bit RGB565 value in native byte order (5 red bits, 6 green bits, 5 blue bits).

The default implementation expands the components. RGB565 pixel types override this and use the value as-is.

Source

fn background() -> Self

Pixel which will be filled as the background in case the slint view has transparency

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementations on Foreign Types§

Source§

impl TargetPixel for Rgb<u8>

Source§

fn blend(&mut self, color: PremultipliedRgbaColor)

Source§

fn from_rgb(r: u8, g: u8, b: u8) -> Rgb<u8>

Implementors§