diff options
author | 2023-05-11 15:25:58 +0200 | |
---|---|---|
committer | 2023-05-11 15:25:58 +0200 | |
commit | 8622e998f2701e7f4ca8d2f71c85150f436a9945 (patch) | |
tree | de62eead3db44002997b83849711533b214aae31 /graphics/src/primitive.rs | |
parent | dd04c0b070b60b15293892e2a7c284787d3d63b1 (diff) | |
download | iced-8622e998f2701e7f4ca8d2f71c85150f436a9945.tar.gz iced-8622e998f2701e7f4ca8d2f71c85150f436a9945.tar.bz2 iced-8622e998f2701e7f4ca8d2f71c85150f436a9945.zip |
Write missing documentation in `iced_graphics`
Diffstat (limited to 'graphics/src/primitive.rs')
-rw-r--r-- | graphics/src/primitive.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/graphics/src/primitive.rs b/graphics/src/primitive.rs index d814c757..d4446c87 100644 --- a/graphics/src/primitive.rs +++ b/graphics/src/primitive.rs @@ -1,3 +1,4 @@ +//! Draw using different graphical primitives. use crate::core::alignment; use crate::core::image; use crate::core::svg; @@ -90,18 +91,28 @@ pub enum Primitive { /// The [`Gradient`] to apply to the mesh. gradient: Gradient, }, + /// A [`tiny_skia`] path filled with some paint. #[cfg(feature = "tiny-skia")] Fill { + /// The path to fill. path: tiny_skia::Path, + /// The paint to use. paint: tiny_skia::Paint<'static>, + /// The fill rule to follow. rule: tiny_skia::FillRule, + /// The transform to apply to the path. transform: tiny_skia::Transform, }, + /// A [`tiny_skia`] path stroked with some paint. #[cfg(feature = "tiny-skia")] Stroke { + /// The path to stroke. path: tiny_skia::Path, + /// The paint to use. paint: tiny_skia::Paint<'static>, + /// The stroke settings. stroke: tiny_skia::Stroke, + /// The transform to apply to the path. transform: tiny_skia::Transform, }, /// A group of primitives @@ -135,10 +146,12 @@ pub enum Primitive { } impl Primitive { + /// Creates a [`Primitive::Group`]. pub fn group(primitives: Vec<Self>) -> Self { Self::Group { primitives } } + /// Creates a [`Primitive::Clip`]. pub fn clip(self, bounds: Rectangle) -> Self { Self::Clip { bounds, @@ -146,6 +159,7 @@ impl Primitive { } } + /// Creates a [`Primitive::Translate`]. pub fn translate(self, translation: Vector) -> Self { Self::Translate { translation, @@ -153,6 +167,7 @@ impl Primitive { } } + /// Returns the bounds of the [`Primitive`]. pub fn bounds(&self) -> Rectangle { match self { Self::Text { |