pub struct RectShape { /* private fields */ }Expand description
Represents a simple rectangular shape with a fill color and stroke.
You typically do not need to use RectShape directly; instead, use the Shape::rect method.
§Fields
rect: An array containing two tuples representing the top-left and bottom-right coordinates of the rectangle.fill: The fill color of the rectangle.stroke: The stroke properties of the rectangle.
§Examples
use grafo::RectShape;
use grafo::Color;
use grafo::Stroke;
let rect_shape = RectShape::new(
[(0.0, 0.0), (100.0, 50.0)],
Color::rgb(255, 0, 0), // Red fill
Stroke::new(2.0, Color::BLACK), // Black stroke with width 2.0
);Implementations§
Source§impl RectShape
impl RectShape
Sourcepub fn new(rect: [(f32, f32); 2], fill: Color, stroke: Stroke) -> Self
pub fn new(rect: [(f32, f32); 2], fill: Color, stroke: Stroke) -> Self
Creates a new RectShape with the specified coordinates, fill color, and stroke.
§Parameters
rect: An array containing two tuples representing the top-left and bottom-right coordinates of the rectangle.fill: The fill color of the rectangle.stroke: The stroke properties of the rectangle.
§Examples
use grafo::RectShape;
use grafo::Color;
use grafo::Stroke;
let rect_shape = RectShape::new(
[(0.0, 0.0), (100.0, 50.0)],
Color::rgb(255, 0, 0), // Red fill
Stroke::new(2.0, Color::BLACK), // Black stroke with width 2.0
);Trait Implementations§
Auto Trait Implementations§
impl Freeze for RectShape
impl RefUnwindSafe for RectShape
impl Send for RectShape
impl Sync for RectShape
impl Unpin for RectShape
impl UnwindSafe for RectShape
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