Skip to main content

RasterizerOutline

Struct RasterizerOutline 

Source
pub struct RasterizerOutline<'a, Ren: RendererPrimitivesLike> { /* private fields */ }
Expand description

Outline rasterizer.

Reads vertices from a VertexSource and feeds them directly to a primitive renderer. No anti-aliasing or scanline conversion — just Bresenham lines.

Port of C++ rasterizer_outline<Renderer>.

Implementations§

Source§

impl<'a, Ren: RendererPrimitivesLike> RasterizerOutline<'a, Ren>

Source

pub fn new(ren: &'a mut Ren) -> Self

Source

pub fn move_to(&mut self, x: i32, y: i32)

Move to a new position (subpixel coordinates).

Source

pub fn line_to(&mut self, x: i32, y: i32)

Draw a line to (x, y) (subpixel coordinates).

Source

pub fn move_to_d(&mut self, x: f64, y: f64)

Move to a floating-point position (converts to subpixel).

Source

pub fn line_to_d(&mut self, x: f64, y: f64)

Draw a line to a floating-point position (converts to subpixel).

Source

pub fn close(&mut self)

Close the current polygon by drawing a line back to the start.

Source

pub fn add_vertex(&mut self, x: f64, y: f64, cmd: u32)

Add a single vertex with a path command.

Source

pub fn add_path<VS: VertexSource>(&mut self, vs: &mut VS, path_id: u32)

Add all vertices from a vertex source.

Source

pub fn render_all_paths<VS: VertexSource>( &mut self, vs: &mut VS, colors: &[Ren::Color], path_ids: &[u32], )

Render multiple paths with different colors.

Auto Trait Implementations§

§

impl<'a, Ren> Freeze for RasterizerOutline<'a, Ren>

§

impl<'a, Ren> RefUnwindSafe for RasterizerOutline<'a, Ren>
where Ren: RefUnwindSafe,

§

impl<'a, Ren> Send for RasterizerOutline<'a, Ren>
where Ren: Send,

§

impl<'a, Ren> Sync for RasterizerOutline<'a, Ren>
where Ren: Sync,

§

impl<'a, Ren> Unpin for RasterizerOutline<'a, Ren>

§

impl<'a, Ren> !UnwindSafe for RasterizerOutline<'a, Ren>

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.