From 26cd6c0f2b21b4fb555e8773e3217710f9ce0f3f Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Wed, 1 Apr 2020 02:32:01 +0200 Subject: Update `iced_wgpu` information in repository docs --- wgpu/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'wgpu') diff --git a/wgpu/README.md b/wgpu/README.md index 38c6ddb6..cd3db788 100644 --- a/wgpu/README.md +++ b/wgpu/README.md @@ -11,8 +11,9 @@ Currently, `iced_wgpu` supports the following primitives: - Text, which is rendered using [`wgpu_glyph`]. No shaping at all. - Quads or rectangles, with rounded borders and a solid background color. -- Images, lazily loaded from the filesystem. - Clip areas, useful to implement scrollables or hide overflowing content. +- Images and SVG, loaded from memory or the file system. +- Meshes of triangles, for rendering geometry freely. ![iced_wgpu](../docs/graphs/wgpu.png) -- cgit From f4f8f62f55bcaf5b92b7af96544f153f88bab287 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Wed, 1 Apr 2020 03:14:49 +0200 Subject: Add example for `Canvas` widget --- wgpu/src/widget/canvas.rs | 41 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) (limited to 'wgpu') diff --git a/wgpu/src/widget/canvas.rs b/wgpu/src/widget/canvas.rs index 3a9605c9..5d531a0a 100644 --- a/wgpu/src/widget/canvas.rs +++ b/wgpu/src/widget/canvas.rs @@ -33,11 +33,48 @@ pub use text::Text; /// A widget capable of drawing 2D graphics. /// /// A [`Canvas`] may contain multiple layers. A [`Layer`] is drawn using the -/// painter's algorithm. In other words, layers will be drawn on top of each in -/// the same order they are pushed into the [`Canvas`]. +/// painter's algorithm. In other words, layers will be drawn on top of each +/// other in the same order they are pushed into the [`Canvas`]. /// /// [`Canvas`]: struct.Canvas.html /// [`Layer`]: layer/trait.Layer.html +/// +/// # Example +/// Let's see how we can draw a circle: +/// +/// ``` +/// # mod iced { +/// # pub use iced_wgpu::canvas; +/// # pub use iced_native::Color; +/// # } +/// use iced::canvas::{self, layer, Canvas, Drawable, Fill, Frame, Path}; +/// use iced::Color; +/// +/// // First, we define the data we need for drawing +/// #[derive(Debug)] +/// struct Circle { +/// radius: f32, +/// } +/// +/// // Then, we implement the `Drawable` trait +/// impl Drawable for Circle { +/// fn draw(&self, frame: &mut Frame) { +/// // We create a `Path` representing a simple circle +/// let circle = Path::new(|p| p.circle(frame.center(), self.radius)); +/// +/// // And fill it with some color +/// frame.fill(&circle, Fill::Color(Color::BLACK)); +/// } +/// } +/// +/// // We can use a `Cache` to avoid unnecessary re-tessellation +/// let cache: layer::Cache = layer::Cache::new(); +/// +/// // Finally, we simply provide the data to our `Cache` and push the resulting +/// // layer into a `Canvas` +/// let canvas = Canvas::new() +/// .push(cache.with(&Circle { radius: 50.0 })); +/// ``` #[derive(Debug)] pub struct Canvas<'a> { width: Length, -- cgit From 4c44517556976454c0598c876addb10b88515cda Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Wed, 1 Apr 2020 04:34:14 +0200 Subject: Fix minor documentation issues --- wgpu/src/widget/canvas.rs | 2 +- wgpu/src/widget/canvas/layer/cache.rs | 2 +- wgpu/src/widget/canvas/path.rs | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) (limited to 'wgpu') diff --git a/wgpu/src/widget/canvas.rs b/wgpu/src/widget/canvas.rs index 5d531a0a..6c9a9e19 100644 --- a/wgpu/src/widget/canvas.rs +++ b/wgpu/src/widget/canvas.rs @@ -42,7 +42,7 @@ pub use text::Text; /// # Example /// Let's see how we can draw a circle: /// -/// ``` +/// ```no_run /// # mod iced { /// # pub use iced_wgpu::canvas; /// # pub use iced_native::Color; diff --git a/wgpu/src/widget/canvas/layer/cache.rs b/wgpu/src/widget/canvas/layer/cache.rs index f7002459..20a095bd 100644 --- a/wgpu/src/widget/canvas/layer/cache.rs +++ b/wgpu/src/widget/canvas/layer/cache.rs @@ -12,7 +12,7 @@ use std::{cell::RefCell, marker::PhantomData, sync::Arc}; /// change or it is explicitly cleared. /// /// [`Layer`]: ../trait.Layer.html -/// [`Cached`]: struct.Cached.html +/// [`Cache`]: struct.Cache.html #[derive(Debug)] pub struct Cache { input: PhantomData, diff --git a/wgpu/src/widget/canvas/path.rs b/wgpu/src/widget/canvas/path.rs index 15c2e853..e7ff47f3 100644 --- a/wgpu/src/widget/canvas/path.rs +++ b/wgpu/src/widget/canvas/path.rs @@ -3,6 +3,7 @@ pub mod arc; mod builder; +#[doc(no_inline)] pub use arc::Arc; pub use builder::Builder; -- cgit From 48b90a752915557f216bcbc808f4163a4d110dac Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Thu, 2 Apr 2020 02:51:33 +0200 Subject: Add examples to `Canvas` documentation --- wgpu/src/widget/canvas.rs | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'wgpu') diff --git a/wgpu/src/widget/canvas.rs b/wgpu/src/widget/canvas.rs index 6c9a9e19..325f90ce 100644 --- a/wgpu/src/widget/canvas.rs +++ b/wgpu/src/widget/canvas.rs @@ -39,8 +39,21 @@ pub use text::Text; /// [`Canvas`]: struct.Canvas.html /// [`Layer`]: layer/trait.Layer.html /// -/// # Example -/// Let's see how we can draw a circle: +/// # Examples +/// The repository has a couple of [examples] showcasing how to use a +/// [`Canvas`]: +/// +/// - [`clock`], an application that uses the [`Canvas`] widget to draw a clock +/// and its hands to display the current time. +/// - [`solar_system`], an animated solar system drawn using the [`Canvas`] widget +/// and showcasing how to compose different transforms. +/// +/// [examples]: https://github.com/hecrj/iced/tree/0.1/examples +/// [`clock`]: https://github.com/hecrj/iced/tree/0.1/examples/clock +/// [`solar_system`]: https://github.com/hecrj/iced/tree/0.1/examples/solar_system +/// +/// ## Drawing a simple circle +/// If you want to get a quick overview, here's how we can draw a simple circle: /// /// ```no_run /// # mod iced { -- cgit From 7d40b76b0231414e1a00341e1076816adf0df502 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Thu, 2 Apr 2020 03:11:16 +0200 Subject: Update `iced_wgpu` root documentation --- wgpu/README.md | 2 +- wgpu/src/lib.rs | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'wgpu') diff --git a/wgpu/README.md b/wgpu/README.md index cd3db788..cd80379e 100644 --- a/wgpu/README.md +++ b/wgpu/README.md @@ -13,7 +13,7 @@ Currently, `iced_wgpu` supports the following primitives: - Quads or rectangles, with rounded borders and a solid background color. - Clip areas, useful to implement scrollables or hide overflowing content. - Images and SVG, loaded from memory or the file system. -- Meshes of triangles, for rendering geometry freely. +- Meshes of triangles, useful to draw geometry freely. ![iced_wgpu](../docs/graphs/wgpu.png) diff --git a/wgpu/src/lib.rs b/wgpu/src/lib.rs index 4e0cbc60..f00c7d2c 100644 --- a/wgpu/src/lib.rs +++ b/wgpu/src/lib.rs @@ -11,8 +11,9 @@ //! Currently, `iced_wgpu` supports the following primitives: //! - Text, which is rendered using [`wgpu_glyph`]. No shaping at all. //! - Quads or rectangles, with rounded borders and a solid background color. -//! - Images, lazily loaded from the filesystem. //! - Clip areas, useful to implement scrollables or hide overflowing content. +//! - Images and SVG, loaded from memory or the file system. +//! - Meshes of triangles, useful to draw geometry freely. //! //! [Iced]: https://github.com/hecrj/iced //! [`iced_native`]: https://github.com/hecrj/iced/tree/master/native -- cgit From 703f7657e15234554afb5c62fafed6fd4f8d1d03 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Thu, 2 Apr 2020 03:29:46 +0200 Subject: Add example to `pane_grid` module documentation --- wgpu/src/widget/pane_grid.rs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'wgpu') diff --git a/wgpu/src/widget/pane_grid.rs b/wgpu/src/widget/pane_grid.rs index 7bc2f7c5..578e8960 100644 --- a/wgpu/src/widget/pane_grid.rs +++ b/wgpu/src/widget/pane_grid.rs @@ -1,6 +1,13 @@ //! Let your users split regions of your application and organize layout dynamically. //! //! [![Pane grid - Iced](https://thumbs.gfycat.com/MixedFlatJellyfish-small.gif)](https://gfycat.com/mixedflatjellyfish) +//! +//! # Example +//! The [`pane_grid` example] showcases how to use a [`PaneGrid`] with resizing, +//! drag and drop, and hotkey support. +//! +//! [`pane_grid` example]: https://github.com/hecrj/iced/tree/0.1/examples/pane_grid +//! [`PaneGrid`]: type.PaneGrid.html use crate::Renderer; pub use iced_native::pane_grid::{ -- cgit From 2ef1b4317a6d8a99cb9d9653597e09666bd9ea81 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Thu, 2 Apr 2020 03:37:56 +0200 Subject: Remove subcrates `CHANGELOG` At this stage, it is important to allow the library to change rapidly. Because of this, keeping a log of changes can be counter-productive. We do not want pin down design decisions by writing detailed changelogs (sunk cost fallacy). Once the library and its different parts start becoming more stable and mature, we will reintroduce changelogs accordingly. For now, we will keep a main `CHANGELOG` file just for the `iced` crate. --- wgpu/CHANGELOG.md | 14 -------------- 1 file changed, 14 deletions(-) delete mode 100644 wgpu/CHANGELOG.md (limited to 'wgpu') diff --git a/wgpu/CHANGELOG.md b/wgpu/CHANGELOG.md deleted file mode 100644 index f9708308..00000000 --- a/wgpu/CHANGELOG.md +++ /dev/null @@ -1,14 +0,0 @@ -# Changelog -All notable changes to this project will be documented in this file. - -The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), -and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - -## [Unreleased] - -## [0.1.0] - 2019-11-25 -### Added -- First release! :tada: - -[Unreleased]: https://github.com/hecrj/iced/compare/wgpu-0.1.0...HEAD -[0.1.0]: https://github.com/hecrj/iced/releases/tag/wgpu-0.1.0 -- cgit