pub trait PixelFormat {
type ColorType;
// Required methods
fn width(&self) -> u32;
fn height(&self) -> u32;
fn blend_pixel(
&mut self,
x: i32,
y: i32,
c: &Self::ColorType,
cover: CoverType,
);
fn blend_hline(
&mut self,
x: i32,
y: i32,
len: u32,
c: &Self::ColorType,
cover: CoverType,
);
fn blend_solid_hspan(
&mut self,
x: i32,
y: i32,
len: u32,
c: &Self::ColorType,
covers: &[CoverType],
);
fn copy_hline(&mut self, x: i32, y: i32, len: u32, c: &Self::ColorType);
fn copy_pixel(&mut self, x: i32, y: i32, c: &Self::ColorType);
fn blend_color_hspan(
&mut self,
x: i32,
y: i32,
len: u32,
colors: &[Self::ColorType],
covers: &[CoverType],
cover: CoverType,
);
fn pixel(&self, x: i32, y: i32) -> Self::ColorType;
}Expand description
Trait for pixel format renderers that can blend colors into a rendering buffer.
This is the abstraction layer between the renderer and the raw pixel data. Different implementations handle different pixel layouts (RGBA, RGB, gray) and blending modes (premultiplied, non-premultiplied).
Required Associated Types§
Required Methods§
fn width(&self) -> u32
fn height(&self) -> u32
Sourcefn blend_pixel(&mut self, x: i32, y: i32, c: &Self::ColorType, cover: CoverType)
fn blend_pixel(&mut self, x: i32, y: i32, c: &Self::ColorType, cover: CoverType)
Blend a single pixel at (x, y) with color c and coverage cover.
Sourcefn blend_hline(
&mut self,
x: i32,
y: i32,
len: u32,
c: &Self::ColorType,
cover: CoverType,
)
fn blend_hline( &mut self, x: i32, y: i32, len: u32, c: &Self::ColorType, cover: CoverType, )
Blend a horizontal line of len pixels at (x, y) with uniform color and coverage.
Sourcefn blend_solid_hspan(
&mut self,
x: i32,
y: i32,
len: u32,
c: &Self::ColorType,
covers: &[CoverType],
)
fn blend_solid_hspan( &mut self, x: i32, y: i32, len: u32, c: &Self::ColorType, covers: &[CoverType], )
Blend a horizontal span of len pixels with per-pixel coverage values.
Sourcefn copy_hline(&mut self, x: i32, y: i32, len: u32, c: &Self::ColorType)
fn copy_hline(&mut self, x: i32, y: i32, len: u32, c: &Self::ColorType)
Copy (overwrite) a horizontal line of len pixels with color c.
Sourcefn copy_pixel(&mut self, x: i32, y: i32, c: &Self::ColorType)
fn copy_pixel(&mut self, x: i32, y: i32, c: &Self::ColorType)
Copy (overwrite) a single pixel at (x, y) with color c.
Sourcefn blend_color_hspan(
&mut self,
x: i32,
y: i32,
len: u32,
colors: &[Self::ColorType],
covers: &[CoverType],
cover: CoverType,
)
fn blend_color_hspan( &mut self, x: i32, y: i32, len: u32, colors: &[Self::ColorType], covers: &[CoverType], cover: CoverType, )
Blend a horizontal span with per-pixel colors and optional per-pixel coverage.
If covers is non-empty, each pixel uses its corresponding coverage.
If covers is empty, all pixels use the uniform cover value.