Merge pull request #193 from hecrj/feature/canvas

Canvas widget for 2D graphics
This commit is contained in:
Héctor Ramón 2020-02-20 05:51:18 +01:00 committed by GitHub
commit 17271eae67
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
42 changed files with 2096 additions and 211 deletions

View file

@ -178,6 +178,11 @@ pub trait Application: Sized {
_settings.into(),
iced_wgpu::Settings {
default_font: _settings.default_font,
antialiasing: if _settings.antialiasing {
Some(iced_wgpu::settings::Antialiasing::MSAAx4)
} else {
None
},
},
);

View file

@ -204,5 +204,5 @@ use iced_web as common;
pub use common::{
futures, Align, Background, Color, Command, Font, HorizontalAlignment,
Length, Space, Subscription, Vector, VerticalAlignment,
Length, Point, Size, Space, Subscription, Vector, VerticalAlignment,
};

View file

@ -16,6 +16,15 @@ pub struct Settings {
/// If `None` is provided, a default system font will be chosen.
// TODO: Add `name` for web compatibility
pub default_font: Option<&'static [u8]>,
/// If set to true, the renderer will try to perform antialiasing for some
/// primitives.
///
/// Enabling it can produce a smoother result in some widgets, like the
/// `Canvas`, at a performance cost.
///
/// By default, it is disabled.
pub antialiasing: bool,
}
#[cfg(not(target_arch = "wasm32"))]