summaryrefslogtreecommitdiffstats
path: root/wgpu/src/widget/canvas/path/arc.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2020-02-18 08:48:54 +0100
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2020-02-18 08:48:54 +0100
commit9c067562fa765cfc49d09cd9b12fbba96d5619fa (patch)
tree7e0a37c5f2a867ec62260b934af91a7473f7b7bb /wgpu/src/widget/canvas/path/arc.rs
parent570f769744aabce2d9d9618feadb47e4b92f50ca (diff)
downloadiced-9c067562fa765cfc49d09cd9b12fbba96d5619fa.tar.gz
iced-9c067562fa765cfc49d09cd9b12fbba96d5619fa.tar.bz2
iced-9c067562fa765cfc49d09cd9b12fbba96d5619fa.zip
Write documentation for new `canvas` module
Diffstat (limited to 'wgpu/src/widget/canvas/path/arc.rs')
-rw-r--r--wgpu/src/widget/canvas/path/arc.rs44
1 files changed, 44 insertions, 0 deletions
diff --git a/wgpu/src/widget/canvas/path/arc.rs b/wgpu/src/widget/canvas/path/arc.rs
new file mode 100644
index 00000000..343191f1
--- /dev/null
+++ b/wgpu/src/widget/canvas/path/arc.rs
@@ -0,0 +1,44 @@
+//! Build and draw curves.
+use iced_native::{Point, Vector};
+
+/// A segment of a differentiable curve.
+#[derive(Debug, Clone, Copy)]
+pub struct Arc {
+ /// The center of the arc.
+ pub center: Point,
+ /// The radius of the arc.
+ pub radius: f32,
+ /// The start of the segment's angle, clockwise rotation.
+ pub start_angle: f32,
+ /// The end of the segment's angle, clockwise rotation.
+ pub end_angle: f32,
+}
+
+/// An elliptical [`Arc`].
+///
+/// [`Arc`]: struct.Arc.html
+#[derive(Debug, Clone, Copy)]
+pub struct Elliptical {
+ /// The center of the arc.
+ pub center: Point,
+ /// The radii of the arc's ellipse, defining its axes.
+ pub radii: Vector,
+ /// The rotation of the arc's ellipse.
+ pub rotation: f32,
+ /// The start of the segment's angle, clockwise rotation.
+ pub start_angle: f32,
+ /// The end of the segment's angle, clockwise rotation.
+ pub end_angle: f32,
+}
+
+impl From<Arc> for Elliptical {
+ fn from(arc: Arc) -> Elliptical {
+ Elliptical {
+ center: arc.center,
+ radii: Vector::new(arc.radius, arc.radius),
+ rotation: 0.0,
+ start_angle: arc.start_angle,
+ end_angle: arc.end_angle,
+ }
+ }
+}