[][src]Struct embedded_graphics::primitives::circle::Circle

pub struct Circle<C: PixelColor> {
    pub center: Coord,
    pub radius: u32,
    pub style: Style<C>,
}

Circle primitive

Examples

The macro examples make for more concise code.

Create some circles with different styles

use embedded_graphics::prelude::*;
use embedded_graphics::primitives::Circle;

// Default circle with only a stroke centered around (10, 20) with a radius of 30
let c1 = Circle::new(Coord::new(10, 20), 30);

// Circle with styled stroke and fill centered around (50, 20) with a radius of 30
let c2 = Circle::new(Coord::new(50, 20), 30)
    .stroke(Some(5u8))
    .stroke_width(3)
    .fill(Some(10u8));

// Circle with no stroke and a translation applied
let c3 = Circle::new(Coord::new(10, 20), 30)
    .stroke(None)
    .fill(Some(10u8))
    .translate(Coord::new(65, 35));

display.draw(c1);
display.draw(c2);
display.draw(c3);

Fields

center: Coord

Center point of circle

radius: u32

Radius of the circle

style: Style<C>

Style of the circle

Methods

impl<C> Circle<C> where
    C: PixelColor
[src]

pub fn new(center: Coord, radius: u32) -> Self[src]

Create a new circle centered around a given point with a specific radius

Trait Implementations

impl<C> Drawable for Circle<C> where
    C: PixelColor
[src]

impl<C> Dimensions for Circle<C> where
    C: PixelColor
[src]

impl<C> Primitive for Circle<C> where
    C: PixelColor
[src]

impl<C> WithStyle<C> for Circle<C> where
    C: PixelColor
[src]

impl<C> Transform for Circle<C> where
    C: PixelColor
[src]

fn translate(&self, by: Coord) -> Self[src]

Translate the circle center from its current position to a new position by (x, y) pixels, returning a new Circle. For a mutating transform, see translate_mut.

let circle = Circle::new(Coord::new(5, 10), 10)
let moved = circle.translate(Coord::new(10, 10));

assert_eq!(moved.center, Coord::new(15, 20));

fn translate_mut(&mut self, by: Coord) -> &mut Self[src]

Translate the circle center from its current position to a new position by (x, y) pixels.

let mut circle = Circle::new(Coord::new(5, 10), 10)
circle.translate_mut(Coord::new(10, 10));

assert_eq!(circle.center, Coord::new(15, 20));

impl<C: Debug + PixelColor> Debug for Circle<C>[src]

impl<C: Copy + PixelColor> Copy for Circle<C>[src]

impl<C> IntoIterator for Circle<C> where
    C: PixelColor
[src]

type Item = Pixel<C>

The type of the elements being iterated over.

type IntoIter = CircleIterator<C>

Which kind of iterator are we turning this into?

impl<'a, C> IntoIterator for &'a Circle<C> where
    C: PixelColor
[src]

type Item = Pixel<C>

The type of the elements being iterated over.

type IntoIter = CircleIterator<C>

Which kind of iterator are we turning this into?

impl<C: Clone + PixelColor> Clone for Circle<C>[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

Auto Trait Implementations

impl<C> Unpin for Circle<C> where
    C: Unpin

impl<C> Send for Circle<C> where
    C: Send

impl<C> Sync for Circle<C> where
    C: Sync

Blanket Implementations

impl<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = I

Which kind of iterator are we turning this into?

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<SS, SP> SupersetOf<SS> for SP where
    SS: SubsetOf<SP>,