A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.rs/embedded-graphics/latest/embedded_graphics/primitives/circle/struct.Circle.html below:

Circle in embedded_graphics::primitives::circle - Rust

pub struct Circle {
    pub top_left: Point,
    pub diameter: u32,
}
Expand description

Circle primitive

§Examples §Create some circles with different styles
use embedded_graphics::{
    pixelcolor::Rgb565,
    prelude::*,
    primitives::{Circle,  PrimitiveStyle, PrimitiveStyleBuilder},
};

Circle::new(Point::new(10, 20), 30)
    .into_styled(PrimitiveStyle::with_stroke(Rgb565::WHITE, 1))
    .draw(&mut display)?;

let style = PrimitiveStyleBuilder::new()
    .stroke_color(Rgb565::RED)
    .stroke_width(3)
    .fill_color(Rgb565::GREEN)
    .build();

Circle::new(Point::new(50, 20), 10)
    .into_styled(style)
    .draw(&mut display)?;

Circle::new(Point::new(10, 20), 30)
    .translate(Point::new(20, 10))
    .into_styled(PrimitiveStyle::with_fill(Rgb565::BLUE))
    .draw(&mut display)?;

Top-left point of circle’s bounding box

Diameter of the circle

Source§ Source

Create a new circle delimited with a top-left point with a specific diameter

Source

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

Source

Return the center point of the circle

Source§ Source§ Source§

Returns true if the given point is inside the shape.

Source§ Source§ Source§ Source§ Source§

Writes the defmt representation of self to fmt.

Source§ Source§ Source§ Source§ Source§

Tests for self and other values to be equal, and is used by ==.

1.0.0 · Source§

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

Source§ Source§

This method returns an ordering between

self

and

other

values if one exists.

Read more 1.0.0 · Source§

Tests less than (for

self

and

other

) and is used by the

<

operator.

Read more 1.0.0 · Source§

Tests less than or equal to (for

self

and

other

) and is used by the

<=

operator.

Read more 1.0.0 · Source§

Tests greater than (for

self

and

other

) and is used by the

>

operator.

Read more 1.0.0 · Source§

Tests greater than or equal to (for

self

and

other

) and is used by the

>=

operator.

Read more Source§ Source§

Iterator over all points inside the primitive.

Source§

Returns an iterator over all points inside the primitive.

Source§ Source§

Converts this primitive into a Styled.

Source§ Source§

Returns the bounding box using the given style.

Source§ Source§ Source§

Translate the circle 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(Point::new(5, 10), 10);
let moved = circle.translate(Point::new(10, 10));

assert_eq!(moved.top_left, Point::new(15, 20));
Source§

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

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

assert_eq!(circle.top_left, Point::new(15, 20));
Source§ Source§ Source§

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4