pub struct FrameBuilder<'a> { /* private fields */ }Expand description
Writes the primitives of a drawing into the frame (main layer, clipped to the pane by the caller).
Implementations§
Source§impl<'a> FrameBuilder<'a>
impl<'a> FrameBuilder<'a>
Sourcepub fn new(frame: &'a mut Frame, layer: LayerId) -> Self
pub fn new(frame: &'a mut Frame, layer: LayerId) -> Self
A builder writing into layer of frame, for code that builds
frames outside a Chart (ferrochart-plot).
use ferrochart_core::drawing::FrameBuilder;
use ferrochart_core::frame::{Frame, LayerId, StrokeStyle};
use ferrochart_core::geom::{PointPx, Px, Rgba};
let mut frame = Frame::default();
let mut b = FrameBuilder::new(&mut frame, LayerId::Main);
let stroke = StrokeStyle { color: Rgba::hex(0xFFFF_FFFF), width: Px(1.0), dash: Default::default() };
b.line(PointPx { x: 0.0, y: 0.0 }, PointPx { x: 10.0, y: 0.0 }, stroke);
assert_eq!(frame.pools.lines.len(), 1);Sourcepub fn line(&mut self, from: PointPx, to: PointPx, stroke: StrokeStyle)
pub fn line(&mut self, from: PointPx, to: PointPx, stroke: StrokeStyle)
A line segment.
Sourcepub fn polyline(
&mut self,
pts: impl IntoIterator<Item = PointPx>,
style: StrokeStyle,
)
pub fn polyline( &mut self, pts: impl IntoIterator<Item = PointPx>, style: StrokeStyle, )
A polyline through pts.
Sourcepub fn polygon(&mut self, pts: impl IntoIterator<Item = PointPx>, fill: Rgba)
pub fn polygon(&mut self, pts: impl IntoIterator<Item = PointPx>, fill: Rgba)
A filled polygon with vertices pts.
Sourcepub fn text(&mut self, pos: PointPx, text: &str, label: Label)
pub fn text(&mut self, pos: PointPx, text: &str, label: Label)
A line of text; pos.y is its vertical center.
Auto Trait Implementations§
impl<'a> !UnwindSafe for FrameBuilder<'a>
impl<'a> Forget for FrameBuilder<'a>
impl<'a> Freeze for FrameBuilder<'a>
impl<'a> Move for FrameBuilder<'a>
impl<'a> RefUnwindSafe for FrameBuilder<'a>
impl<'a> Send for FrameBuilder<'a>
impl<'a> Sync for FrameBuilder<'a>
impl<'a> Unpin for FrameBuilder<'a>
impl<'a> UnsafeUnpin for FrameBuilder<'a>
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