pub struct RendererPrimitives<'a, PF: PixelFormat> { /* private fields */ }Expand description
Basic shape primitives renderer.
Draws rectangles, ellipses, and Bresenham lines directly into a
RendererBase without anti-aliasing. Maintains separate fill and line
colors and a current position for line_to operations.
Port of C++ renderer_primitives<BaseRenderer>.
Implementations§
Source§impl<'a, PF: PixelFormat> RendererPrimitives<'a, PF>
impl<'a, PF: PixelFormat> RendererPrimitives<'a, PF>
pub fn new(ren: &'a mut RendererBase<PF>) -> Self
Sourcepub fn coord(c: f64) -> i32
pub fn coord(c: f64) -> i32
Convert a floating-point coordinate to subpixel Bresenham coordinate.
pub fn set_fill_color(&mut self, c: PF::ColorType)
pub fn set_line_color(&mut self, c: PF::ColorType)
pub fn fill_color(&self) -> &PF::ColorType
pub fn line_color(&self) -> &PF::ColorType
Sourcepub fn rectangle(&mut self, x1: i32, y1: i32, x2: i32, y2: i32)
pub fn rectangle(&mut self, x1: i32, y1: i32, x2: i32, y2: i32)
Draw an outlined rectangle (line color only).
Sourcepub fn solid_rectangle(&mut self, x1: i32, y1: i32, x2: i32, y2: i32)
pub fn solid_rectangle(&mut self, x1: i32, y1: i32, x2: i32, y2: i32)
Draw a solid filled rectangle (fill color only).
Sourcepub fn outlined_rectangle(&mut self, x1: i32, y1: i32, x2: i32, y2: i32)
pub fn outlined_rectangle(&mut self, x1: i32, y1: i32, x2: i32, y2: i32)
Draw an outlined and filled rectangle.
Sourcepub fn ellipse(&mut self, x: i32, y: i32, rx: i32, ry: i32)
pub fn ellipse(&mut self, x: i32, y: i32, rx: i32, ry: i32)
Draw an outlined ellipse (line color only).
Sourcepub fn solid_ellipse(&mut self, x: i32, y: i32, rx: i32, ry: i32)
pub fn solid_ellipse(&mut self, x: i32, y: i32, rx: i32, ry: i32)
Draw a solid filled ellipse (fill color only).
Sourcepub fn outlined_ellipse(&mut self, x: i32, y: i32, rx: i32, ry: i32)
pub fn outlined_ellipse(&mut self, x: i32, y: i32, rx: i32, ry: i32)
Draw an outlined and filled ellipse.
Sourcepub fn line(&mut self, x1: i32, y1: i32, x2: i32, y2: i32, last: bool)
pub fn line(&mut self, x1: i32, y1: i32, x2: i32, y2: i32, last: bool)
Draw a Bresenham line from (x1,y1) to (x2,y2).
Coordinates are in subpixel units (use coord() to convert).
Sourcepub fn line_to(&mut self, x: i32, y: i32, last: bool)
pub fn line_to(&mut self, x: i32, y: i32, last: bool)
Draw a line from the current position to (x, y).
pub fn ren(&self) -> &RendererBase<PF>
pub fn ren_mut(&mut self) -> &mut RendererBase<PF>
Trait Implementations§
Source§impl<'a, PF: PixelFormat> RendererPrimitivesLike for RendererPrimitives<'a, PF>
impl<'a, PF: PixelFormat> RendererPrimitivesLike for RendererPrimitives<'a, PF>
Auto Trait Implementations§
impl<'a, PF> Freeze for RendererPrimitives<'a, PF>
impl<'a, PF> RefUnwindSafe for RendererPrimitives<'a, PF>
impl<'a, PF> Send for RendererPrimitives<'a, PF>
impl<'a, PF> Sync for RendererPrimitives<'a, PF>
impl<'a, PF> Unpin for RendererPrimitives<'a, PF>
impl<'a, PF> !UnwindSafe for RendererPrimitives<'a, PF>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more