qrcode::render

Trait Pixel

Source
pub trait Pixel: Copy + Sized {
    type Image: Sized + 'static;
    type Canvas: Canvas<Pixel = Self, Image = Self::Image>;

    // Required method
    fn default_color(color: Color) -> Self;

    // Provided method
    fn default_unit_size() -> (u32, u32) { ... }
}
Expand description

Abstraction of an image pixel.

Required Associated Types§

Source

type Image: Sized + 'static

Type of the finalized image.

Source

type Canvas: Canvas<Pixel = Self, Image = Self::Image>

The type that stores an intermediate buffer before finalizing to a concrete image

Required Methods§

Source

fn default_color(color: Color) -> Self

Obtains the default pixel color when a module is dark or light.

Provided Methods§

Source

fn default_unit_size() -> (u32, u32)

Obtains the default module size. The result must be at least 1×1.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<S: Primitive + 'static> Pixel for Luma<S>

Source§

type Image = ImageBuffer<Luma<S>, Vec<S>>

Source§

type Canvas = (Luma<S>, <Luma<S> as Pixel>::Image)

Source§

fn default_color(color: Color) -> Self

Source§

impl<S: Primitive + 'static> Pixel for LumaA<S>

Source§

type Image = ImageBuffer<LumaA<S>, Vec<S>>

Source§

type Canvas = (LumaA<S>, <LumaA<S> as Pixel>::Image)

Source§

fn default_color(color: Color) -> Self

Source§

impl<S: Primitive + 'static> Pixel for Rgb<S>

Source§

type Image = ImageBuffer<Rgb<S>, Vec<S>>

Source§

type Canvas = (Rgb<S>, <Rgb<S> as Pixel>::Image)

Source§

fn default_color(color: Color) -> Self

Source§

impl<S: Primitive + 'static> Pixel for Rgba<S>

Source§

type Image = ImageBuffer<Rgba<S>, Vec<S>>

Source§

type Canvas = (Rgba<S>, <Rgba<S> as Pixel>::Image)

Source§

fn default_color(color: Color) -> Self

Implementors§