Trait qrcode::render::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.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<S> Pixel for Luma<S>
where S: Primitive + 'static, Luma<S>: Pixel<Subpixel = S>,

§

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

§

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

source§

fn default_color(color: Color) -> Self

source§

impl<S> Pixel for LumaA<S>
where S: Primitive + 'static, LumaA<S>: Pixel<Subpixel = S>,

§

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

§

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

source§

fn default_color(color: Color) -> Self

source§

impl<S> Pixel for Rgb<S>
where S: Primitive + 'static, Rgb<S>: Pixel<Subpixel = S>,

§

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

§

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

source§

fn default_color(color: Color) -> Self

source§

impl<S> Pixel for Rgba<S>
where S: Primitive + 'static, Rgba<S>: Pixel<Subpixel = S>,

§

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

§

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

source§

fn default_color(color: Color) -> Self

Implementors§

source§

impl Pixel for Dense1x2

source§

impl<'a> Pixel for Color<'a>

§

type Canvas = Canvas<'a>

§

type Image = String

source§

impl<P: Element> Pixel for P

§

type Canvas = Canvas<P>

§

type Image = String