From d4743183d40c6044ce6fa39e2a52919a32912cda Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Tue, 19 May 2020 14:23:28 +0200 Subject: Draft first working version of `iced_glow` :tada: --- glow/src/settings.rs | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 glow/src/settings.rs (limited to 'glow/src/settings.rs') diff --git a/glow/src/settings.rs b/glow/src/settings.rs new file mode 100644 index 00000000..bffc867e --- /dev/null +++ b/glow/src/settings.rs @@ -0,0 +1,50 @@ +//! Configure a [`Renderer`]. +//! +//! [`Renderer`]: struct.Renderer.html + +/// The settings of a [`Renderer`]. +/// +/// [`Renderer`]: ../struct.Renderer.html +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub struct Settings { + /// The bytes of the font that will be used by default. + /// + /// If `None` is provided, a default system font will be chosen. + pub default_font: Option<&'static [u8]>, + + /// The antialiasing strategy that will be used for triangle primitives. + pub antialiasing: Option, +} + +impl Default for Settings { + fn default() -> Settings { + Settings { + default_font: None, + antialiasing: None, + } + } +} + +/// An antialiasing strategy. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum Antialiasing { + /// Multisample AA with 2 samples + MSAAx2, + /// Multisample AA with 4 samples + MSAAx4, + /// Multisample AA with 8 samples + MSAAx8, + /// Multisample AA with 16 samples + MSAAx16, +} + +impl Antialiasing { + pub(crate) fn sample_count(self) -> u32 { + match self { + Antialiasing::MSAAx2 => 2, + Antialiasing::MSAAx4 => 4, + Antialiasing::MSAAx8 => 8, + Antialiasing::MSAAx16 => 16, + } + } +} -- cgit From c2e0c52ce031ffe1c300b3cfa362b0e445ac5afd Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Tue, 19 May 2020 20:34:17 +0200 Subject: Move `Antialiasing` to `iced_graphics` --- glow/src/settings.rs | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-) (limited to 'glow/src/settings.rs') diff --git a/glow/src/settings.rs b/glow/src/settings.rs index bffc867e..07b36938 100644 --- a/glow/src/settings.rs +++ b/glow/src/settings.rs @@ -1,6 +1,7 @@ //! Configure a [`Renderer`]. //! //! [`Renderer`]: struct.Renderer.html +pub use iced_graphics::Antialiasing; /// The settings of a [`Renderer`]. /// @@ -24,27 +25,3 @@ impl Default for Settings { } } } - -/// An antialiasing strategy. -#[derive(Debug, Clone, Copy, PartialEq, Eq)] -pub enum Antialiasing { - /// Multisample AA with 2 samples - MSAAx2, - /// Multisample AA with 4 samples - MSAAx4, - /// Multisample AA with 8 samples - MSAAx8, - /// Multisample AA with 16 samples - MSAAx16, -} - -impl Antialiasing { - pub(crate) fn sample_count(self) -> u32 { - match self { - Antialiasing::MSAAx2 => 2, - Antialiasing::MSAAx4 => 4, - Antialiasing::MSAAx8 => 8, - Antialiasing::MSAAx16 => 16, - } - } -} -- cgit From b9d42a45a8ce491e5fa21a86db0799bcd731d0dd Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Thu, 28 May 2020 01:46:17 +0200 Subject: Write documentation for `iced_glow` --- glow/src/settings.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'glow/src/settings.rs') diff --git a/glow/src/settings.rs b/glow/src/settings.rs index 07b36938..dce30029 100644 --- a/glow/src/settings.rs +++ b/glow/src/settings.rs @@ -1,6 +1,4 @@ -//! Configure a [`Renderer`]. -//! -//! [`Renderer`]: struct.Renderer.html +//! Configure a renderer. pub use iced_graphics::Antialiasing; /// The settings of a [`Renderer`]. -- cgit