Skip to main content

RendererBase

Struct RendererBase 

Source
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>

Source

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.

Source

pub fn width(&self) -> u32

Source

pub fn height(&self) -> u32

Source

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).

Source

pub fn reset_clipping(&mut self, visibility: bool)

Reset clipping to the full buffer or to nothing.

Source

pub fn clip_box(&self) -> &RectI

Source

pub fn xmin(&self) -> i32

Source

pub fn ymin(&self) -> i32

Source

pub fn xmax(&self) -> i32

Source

pub fn ymax(&self) -> i32

Source

pub fn inbox(&self, x: i32, y: i32) -> bool

Source

pub fn ren(&self) -> &PF

Get a reference to the underlying pixel format.

Source

pub fn ren_mut(&mut self) -> &mut PF

Get a mutable reference to the underlying pixel format.

Source

pub fn clear(&mut self, c: &PF::ColorType)

Clear the entire buffer to a solid color.

Source

pub fn copy_pixel(&mut self, x: i32, y: i32, c: &PF::ColorType)

Copy a single pixel (clipped).

Source

pub fn blend_pixel( &mut self, x: i32, y: i32, c: &PF::ColorType, cover: CoverType, )

Blend a single pixel (clipped).

Source

pub fn pixel(&self, x: i32, y: i32) -> PF::ColorType
where PF::ColorType: Default,

Get the pixel at (x, y), or default if outside clip.

Source

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.

Source

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.

Source

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.

Source

pub fn blend_bar( &mut self, x1: i32, y1: i32, x2: i32, y2: i32, c: &PF::ColorType, cover: CoverType, )

Blend a filled rectangle (clipped).

Source

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).

Source

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).

Source

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.

Source

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.

Auto Trait Implementations§

§

impl<PF> Freeze for RendererBase<PF>
where PF: Freeze,

§

impl<PF> RefUnwindSafe for RendererBase<PF>
where PF: RefUnwindSafe,

§

impl<PF> Send for RendererBase<PF>
where PF: Send,

§

impl<PF> Sync for RendererBase<PF>
where PF: Sync,

§

impl<PF> Unpin for RendererBase<PF>
where PF: Unpin,

§

impl<PF> UnwindSafe for RendererBase<PF>
where PF: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.