pub struct RendererBase<PF: PixelFormat> { /* private fields */ }Expand description
Base renderer that clips all operations to a rectangle before delegating to the underlying pixel format.
Port of C++ renderer_base<PixelFormat>.
Implementations§
Source§impl<PF: PixelFormat> RendererBase<PF>
impl<PF: PixelFormat> RendererBase<PF>
Sourcepub fn new(ren: PF) -> Self
pub fn new(ren: PF) -> Self
Create a new renderer wrapping the given pixel format. The clip box is initialized to the full buffer extent.
pub fn width(&self) -> u32
pub fn height(&self) -> u32
Sourcepub fn clip_box_i(&mut self, x1: i32, y1: i32, x2: i32, y2: i32) -> bool
pub fn clip_box_i(&mut self, x1: i32, y1: i32, x2: i32, y2: i32) -> bool
Set the clip rectangle (will be intersected with the buffer bounds).
Sourcepub fn reset_clipping(&mut self, visibility: bool)
pub fn reset_clipping(&mut self, visibility: bool)
Reset clipping to the full buffer or to nothing.
pub fn clip_box(&self) -> &RectI
pub fn xmin(&self) -> i32
pub fn ymin(&self) -> i32
pub fn xmax(&self) -> i32
pub fn ymax(&self) -> i32
pub fn inbox(&self, x: i32, y: i32) -> bool
Sourcepub fn copy_pixel(&mut self, x: i32, y: i32, c: &PF::ColorType)
pub fn copy_pixel(&mut self, x: i32, y: i32, c: &PF::ColorType)
Copy a single pixel (clipped).
Sourcepub fn blend_pixel(
&mut self,
x: i32,
y: i32,
c: &PF::ColorType,
cover: CoverType,
)
pub fn blend_pixel( &mut self, x: i32, y: i32, c: &PF::ColorType, cover: CoverType, )
Blend a single pixel (clipped).
Sourcepub fn pixel(&self, x: i32, y: i32) -> PF::ColorType
pub fn pixel(&self, x: i32, y: i32) -> PF::ColorType
Get the pixel at (x, y), or default if outside clip.
Sourcepub fn copy_hline(&mut self, x1: i32, y: i32, x2: i32, c: &PF::ColorType)
pub fn copy_hline(&mut self, x1: i32, y: i32, x2: i32, c: &PF::ColorType)
Copy a horizontal line (clipped). x1, x2 are inclusive endpoints.
Sourcepub fn blend_hline(
&mut self,
x1: i32,
y: i32,
x2: i32,
c: &PF::ColorType,
cover: CoverType,
)
pub fn blend_hline( &mut self, x1: i32, y: i32, x2: i32, c: &PF::ColorType, cover: CoverType, )
Blend a horizontal line (clipped). x1, x2 are inclusive endpoints.
Sourcepub fn blend_vline(
&mut self,
x: i32,
y1: i32,
y2: i32,
c: &PF::ColorType,
cover: CoverType,
)
pub fn blend_vline( &mut self, x: i32, y1: i32, y2: i32, c: &PF::ColorType, cover: CoverType, )
Blend a vertical line (clipped). y1, y2 are inclusive endpoints.
Sourcepub fn blend_bar(
&mut self,
x1: i32,
y1: i32,
x2: i32,
y2: i32,
c: &PF::ColorType,
cover: CoverType,
)
pub fn blend_bar( &mut self, x1: i32, y1: i32, x2: i32, y2: i32, c: &PF::ColorType, cover: CoverType, )
Blend a filled rectangle (clipped).
Sourcepub fn blend_solid_hspan(
&mut self,
x: i32,
y: i32,
len: i32,
c: &PF::ColorType,
covers: &[CoverType],
)
pub fn blend_solid_hspan( &mut self, x: i32, y: i32, len: i32, c: &PF::ColorType, covers: &[CoverType], )
Blend a solid horizontal span with per-pixel coverage (clipped).
Sourcepub fn blend_solid_vspan(
&mut self,
x: i32,
y: i32,
len: i32,
c: &PF::ColorType,
covers: &[CoverType],
)
pub fn blend_solid_vspan( &mut self, x: i32, y: i32, len: i32, c: &PF::ColorType, covers: &[CoverType], )
Blend a solid vertical span with per-pixel coverage (clipped).
Sourcepub fn blend_color_hspan(
&mut self,
x: i32,
y: i32,
len: i32,
colors: &[PF::ColorType],
covers: &[CoverType],
cover: CoverType,
)
pub fn blend_color_hspan( &mut self, x: i32, y: i32, len: i32, colors: &[PF::ColorType], covers: &[CoverType], cover: CoverType, )
Blend a horizontal span with per-pixel colors (clipped).
If covers is non-empty, each pixel uses its corresponding coverage.
If covers is empty, all pixels use the uniform cover value.
Sourcepub fn blend_color_vspan(
&mut self,
x: i32,
y: i32,
len: i32,
colors: &[PF::ColorType],
covers: &[CoverType],
cover: CoverType,
)
pub fn blend_color_vspan( &mut self, x: i32, y: i32, len: i32, colors: &[PF::ColorType], covers: &[CoverType], cover: CoverType, )
Blend a vertical span with per-pixel colors (clipped).
If covers is non-empty, each pixel uses its corresponding coverage.
If covers is empty, all pixels use the uniform cover value.
Port of C++ renderer_base::blend_color_vspan.