pub struct DrawingContext<'a>(/* private fields */);Available on crate feature
winio only.Expand description
Canvas drawing context.
Implementations§
Source§impl<'a> DrawingContext<'a>
impl<'a> DrawingContext<'a>
Sourcepub fn set_transform(
&mut self,
transform: Transform2D<f64, LogicalSpace, LogicalSpace>,
) -> Result<(), Error>
pub fn set_transform( &mut self, transform: Transform2D<f64, LogicalSpace, LogicalSpace>, ) -> Result<(), Error>
Set the transform matrix.
Sourcepub fn transform(
&self,
) -> Result<Transform2D<f64, LogicalSpace, LogicalSpace>, Error>
pub fn transform( &self, ) -> Result<Transform2D<f64, LogicalSpace, LogicalSpace>, Error>
Get the transform matrix.
Sourcepub fn draw_path(
&mut self,
pen: impl Pen,
path: &DrawingPath,
) -> Result<(), Error>
pub fn draw_path( &mut self, pen: impl Pen, path: &DrawingPath, ) -> Result<(), Error>
Draw a path.
Sourcepub fn fill_path(
&mut self,
brush: impl Brush,
path: &DrawingPath,
) -> Result<(), Error>
pub fn fill_path( &mut self, brush: impl Brush, path: &DrawingPath, ) -> Result<(), Error>
Fill a path.
Sourcepub fn draw_arc(
&mut self,
pen: impl Pen,
rect: Rect<f64, LogicalSpace>,
start: f64,
end: f64,
) -> Result<(), Error>
pub fn draw_arc( &mut self, pen: impl Pen, rect: Rect<f64, LogicalSpace>, start: f64, end: f64, ) -> Result<(), Error>
Draw an arc.
Sourcepub fn draw_pie(
&mut self,
pen: impl Pen,
rect: Rect<f64, LogicalSpace>,
start: f64,
end: f64,
) -> Result<(), Error>
pub fn draw_pie( &mut self, pen: impl Pen, rect: Rect<f64, LogicalSpace>, start: f64, end: f64, ) -> Result<(), Error>
Draw an arc.
Sourcepub fn fill_pie(
&mut self,
brush: impl Brush,
rect: Rect<f64, LogicalSpace>,
start: f64,
end: f64,
) -> Result<(), Error>
pub fn fill_pie( &mut self, brush: impl Brush, rect: Rect<f64, LogicalSpace>, start: f64, end: f64, ) -> Result<(), Error>
Fill a pie.
Sourcepub fn draw_ellipse(
&mut self,
pen: impl Pen,
rect: Rect<f64, LogicalSpace>,
) -> Result<(), Error>
pub fn draw_ellipse( &mut self, pen: impl Pen, rect: Rect<f64, LogicalSpace>, ) -> Result<(), Error>
Draw an ellipse.
Sourcepub fn fill_ellipse(
&mut self,
brush: impl Brush,
rect: Rect<f64, LogicalSpace>,
) -> Result<(), Error>
pub fn fill_ellipse( &mut self, brush: impl Brush, rect: Rect<f64, LogicalSpace>, ) -> Result<(), Error>
Fill an ellipse.
Sourcepub fn draw_line(
&mut self,
pen: impl Pen,
start: Point2D<f64, LogicalSpace>,
end: Point2D<f64, LogicalSpace>,
) -> Result<(), Error>
pub fn draw_line( &mut self, pen: impl Pen, start: Point2D<f64, LogicalSpace>, end: Point2D<f64, LogicalSpace>, ) -> Result<(), Error>
Draw a line.
Sourcepub fn draw_rect(
&mut self,
pen: impl Pen,
rect: Rect<f64, LogicalSpace>,
) -> Result<(), Error>
pub fn draw_rect( &mut self, pen: impl Pen, rect: Rect<f64, LogicalSpace>, ) -> Result<(), Error>
Draw a rectangle.
Sourcepub fn fill_rect(
&mut self,
brush: impl Brush,
rect: Rect<f64, LogicalSpace>,
) -> Result<(), Error>
pub fn fill_rect( &mut self, brush: impl Brush, rect: Rect<f64, LogicalSpace>, ) -> Result<(), Error>
Fill a rectangle.
Sourcepub fn draw_round_rect(
&mut self,
pen: impl Pen,
rect: Rect<f64, LogicalSpace>,
round: Size2D<f64, LogicalSpace>,
) -> Result<(), Error>
pub fn draw_round_rect( &mut self, pen: impl Pen, rect: Rect<f64, LogicalSpace>, round: Size2D<f64, LogicalSpace>, ) -> Result<(), Error>
Draw a rounded rectangle.
Sourcepub fn fill_round_rect(
&mut self,
brush: impl Brush,
rect: Rect<f64, LogicalSpace>,
round: Size2D<f64, LogicalSpace>,
) -> Result<(), Error>
pub fn fill_round_rect( &mut self, brush: impl Brush, rect: Rect<f64, LogicalSpace>, round: Size2D<f64, LogicalSpace>, ) -> Result<(), Error>
Fill a rounded rectangle.
Sourcepub fn draw_str(
&mut self,
brush: impl Brush,
font: DrawingFont,
pos: Point2D<f64, LogicalSpace>,
text: impl AsRef<str>,
) -> Result<(), Error>
pub fn draw_str( &mut self, brush: impl Brush, font: DrawingFont, pos: Point2D<f64, LogicalSpace>, text: impl AsRef<str>, ) -> Result<(), Error>
Draw a string.
Sourcepub fn measure_str(
&self,
font: DrawingFont,
text: &str,
) -> Result<Size2D<f64, LogicalSpace>, Error>
pub fn measure_str( &self, font: DrawingFont, text: &str, ) -> Result<Size2D<f64, LogicalSpace>, Error>
Measure string size.
Sourcepub fn create_image(&self, image: DynamicImage) -> Result<DrawingImage, Error>
pub fn create_image(&self, image: DynamicImage) -> Result<DrawingImage, Error>
Create a DrawingContext-compatible image from DynamicImage.
Sourcepub fn draw_image(
&mut self,
image: &DrawingImage,
rect: Rect<f64, LogicalSpace>,
clip: Option<Rect<f64, LogicalSpace>>,
) -> Result<(), Error>
pub fn draw_image( &mut self, image: &DrawingImage, rect: Rect<f64, LogicalSpace>, clip: Option<Rect<f64, LogicalSpace>>, ) -> Result<(), Error>
Draw a image with RGBA format.
Sourcepub fn create_path_builder(
&self,
start: Point2D<f64, LogicalSpace>,
) -> Result<DrawingPathBuilder, Error>
pub fn create_path_builder( &self, start: Point2D<f64, LogicalSpace>, ) -> Result<DrawingPathBuilder, Error>
Create DrawingPathBuilder.
Auto Trait Implementations§
impl<'a> Freeze for DrawingContext<'a>
impl<'a> RefUnwindSafe for DrawingContext<'a>
impl<'a> !Send for DrawingContext<'a>
impl<'a> !Sync for DrawingContext<'a>
impl<'a> Unpin for DrawingContext<'a>
impl<'a> UnsafeUnpin for DrawingContext<'a>
impl<'a> !UnwindSafe for DrawingContext<'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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more