Add canvas feature to iced_wgpu

And prepare `canvas` module
This commit is contained in:
Héctor Ramón Jiménez 2020-02-11 23:14:25 +01:00
parent 3a00f3398c
commit 8daf798e57
4 changed files with 27 additions and 3 deletions

View file

@ -9,6 +9,7 @@ repository = "https://github.com/hecrj/iced"
[features] [features]
svg = ["resvg"] svg = ["resvg"]
canvas = ["lyon"]
[dependencies] [dependencies]
iced_native = { version = "0.1.0", path = "../native" } iced_native = { version = "0.1.0", path = "../native" }
@ -20,5 +21,16 @@ raw-window-handle = "0.3"
glam = "0.8" glam = "0.8"
font-kit = "0.4" font-kit = "0.4"
log = "0.4" log = "0.4"
resvg = { version = "0.8", features = ["raqote-backend"], optional = true }
image = { version = "0.22", optional = true } [dependencies.image]
version = "0.22"
optional = true
[dependencies.resvg]
version = "0.8"
features = ["raqote-backend"]
optional = true
[dependencies.lyon]
version = "0.15"
optional = true

View file

@ -19,7 +19,7 @@
//! [`wgpu`]: https://github.com/gfx-rs/wgpu-rs //! [`wgpu`]: https://github.com/gfx-rs/wgpu-rs
//! [WebGPU API]: https://gpuweb.github.io/gpuweb/ //! [WebGPU API]: https://gpuweb.github.io/gpuweb/
//! [`wgpu_glyph`]: https://github.com/hecrj/wgpu_glyph //! [`wgpu_glyph`]: https://github.com/hecrj/wgpu_glyph
#![deny(missing_docs)] //#![deny(missing_docs)]
#![deny(missing_debug_implementations)] #![deny(missing_debug_implementations)]
#![deny(unused_results)] #![deny(unused_results)]
#![forbid(unsafe_code)] #![forbid(unsafe_code)]

View file

@ -32,3 +32,10 @@ pub use scrollable::Scrollable;
pub use slider::Slider; pub use slider::Slider;
#[doc(no_inline)] #[doc(no_inline)]
pub use text_input::TextInput; pub use text_input::TextInput;
#[cfg(feature = "canvas")]
pub mod canvas;
#[cfg(feature = "canvas")]
#[doc(no_inline)]
pub use canvas::Canvas;

View file

@ -0,0 +1,5 @@
//! Draw freely in 2D.
/// A 2D drawable region.
#[derive(Debug)]
pub struct Canvas;