Merge branch 'master' into explicit-text-caching
This commit is contained in:
commit
b8e5693a30
178 changed files with 1768 additions and 1388 deletions
|
|
@ -1,14 +1,18 @@
|
|||
[package]
|
||||
name = "iced_graphics"
|
||||
version = "0.9.0"
|
||||
authors = ["Héctor Ramón Jiménez <hector0193@gmail.com>"]
|
||||
edition = "2021"
|
||||
description = "A bunch of backend-agnostic types that can be leveraged to build a renderer for Iced"
|
||||
license = "MIT"
|
||||
repository = "https://github.com/iced-rs/iced"
|
||||
documentation = "https://docs.rs/iced_graphics"
|
||||
keywords = ["gui", "ui", "graphics", "interface", "widgets"]
|
||||
categories = ["gui"]
|
||||
description = "A bunch of backend-agnostic types that can be leveraged to build a renderer for iced"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
authors.workspace = true
|
||||
license.workspace = true
|
||||
repository.workspace = true
|
||||
homepage.workspace = true
|
||||
categories.workspace = true
|
||||
keywords.workspace = true
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
rustdoc-args = ["--cfg", "docsrs"]
|
||||
all-features = true
|
||||
|
||||
[features]
|
||||
geometry = ["lyon_path"]
|
||||
|
|
@ -17,43 +21,29 @@ image = ["dep:image", "kamadak-exif"]
|
|||
web-colors = []
|
||||
|
||||
[dependencies]
|
||||
glam = "0.24"
|
||||
half = "2.2.1"
|
||||
log = "0.4"
|
||||
raw-window-handle = "0.5"
|
||||
thiserror = "1.0"
|
||||
bitflags = "1.2"
|
||||
cosmic-text = "0.9"
|
||||
rustc-hash = "1.1"
|
||||
iced_core.workspace = true
|
||||
|
||||
[dependencies.bytemuck]
|
||||
version = "1.4"
|
||||
features = ["derive"]
|
||||
bitflags.workspace = true
|
||||
bytemuck.workspace = true
|
||||
glam.workspace = true
|
||||
half.workspace = true
|
||||
log.workspace = true
|
||||
raw-window-handle.workspace = true
|
||||
thiserror.workspace = true
|
||||
cosmic-text.workspace = true
|
||||
rustc-hash.workspace = true
|
||||
|
||||
[dependencies.iced_core]
|
||||
version = "0.10"
|
||||
path = "../core"
|
||||
lyon_path.workspace = true
|
||||
lyon_path.optional = true
|
||||
|
||||
[dependencies.twox-hash]
|
||||
version = "1.6"
|
||||
default-features = false
|
||||
image.workspace = true
|
||||
image.optional = true
|
||||
|
||||
[target.'cfg(not(target_arch = "wasm32"))'.dependencies.twox-hash]
|
||||
version = "1.6.1"
|
||||
features = ["std"]
|
||||
kamadak-exif.workspace = true
|
||||
kamadak-exif.optional = true
|
||||
|
||||
[dependencies.image]
|
||||
version = "0.24"
|
||||
optional = true
|
||||
twox-hash.workspace = true
|
||||
|
||||
[dependencies.kamadak-exif]
|
||||
version = "0.5"
|
||||
optional = true
|
||||
|
||||
[dependencies.lyon_path]
|
||||
version = "1"
|
||||
optional = true
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
rustdoc-args = ["--cfg", "docsrs"]
|
||||
all-features = true
|
||||
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
||||
twox-hash.workspace = true
|
||||
twox-hash.features = ["std"]
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ pub trait Compositor: Sized {
|
|||
/// Screenshots the current [`Renderer`] primitives to an offscreen texture, and returns the bytes of
|
||||
/// the texture ordered as `RGBA` in the sRGB color space.
|
||||
///
|
||||
/// [`Renderer`]: Self::Renderer;
|
||||
/// [`Renderer`]: Self::Renderer
|
||||
fn screenshot<T: AsRef<str>>(
|
||||
&mut self,
|
||||
renderer: &mut Self::Renderer,
|
||||
|
|
|
|||
|
|
@ -14,11 +14,11 @@ pub use text::Text;
|
|||
|
||||
pub use crate::gradient::{self, Gradient};
|
||||
|
||||
/// A renderer capable of drawing some [`Geometry`].
|
||||
/// A renderer capable of drawing some [`Self::Geometry`].
|
||||
pub trait Renderer: crate::core::Renderer {
|
||||
/// The kind of geometry this renderer can draw.
|
||||
type Geometry;
|
||||
|
||||
/// Draws the given layers of [`Geometry`].
|
||||
/// Draws the given layers of [`Self::Geometry`].
|
||||
fn draw(&mut self, layers: Vec<Self::Geometry>);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
//! Fill [crate::widget::canvas::Geometry] with a certain style.
|
||||
//! Fill [`Geometry`] with a certain style.
|
||||
//!
|
||||
//! [`Geometry`]: super::Renderer::Geometry
|
||||
pub use crate::geometry::Style;
|
||||
|
||||
use crate::core::Color;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
//! Create lines from a [crate::widget::canvas::Path] and assigns them various attributes/styles.
|
||||
//! Create lines from a [`Path`] and assigns them various attributes/styles.
|
||||
//!
|
||||
//! [`Path`]: super::Path
|
||||
pub use crate::geometry::Style;
|
||||
|
||||
use iced_core::Color;
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
//! A gradient that can be used as a [`Fill`] for some geometry.
|
||||
//! A gradient that can be used as a fill for some geometry.
|
||||
//!
|
||||
//! For a gradient that you can use as a background variant for a widget, see [`Gradient`].
|
||||
//!
|
||||
//! [`Gradient`]: crate::core::Gradient;
|
||||
use crate::color;
|
||||
use crate::core::gradient::ColorStop;
|
||||
use crate::core::{self, Color, Point, Rectangle};
|
||||
|
|
@ -36,10 +34,7 @@ impl Gradient {
|
|||
}
|
||||
}
|
||||
|
||||
/// A linear gradient that can be used in the style of [`Fill`] or [`Stroke`].
|
||||
///
|
||||
/// [`Fill`]: crate::geometry::Fill;
|
||||
/// [`Stroke`]: crate::geometry::Stroke;
|
||||
/// A linear gradient.
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
pub struct Linear {
|
||||
/// The absolute starting position of the gradient.
|
||||
|
|
@ -53,7 +48,7 @@ pub struct Linear {
|
|||
}
|
||||
|
||||
impl Linear {
|
||||
/// Creates a new [`Builder`].
|
||||
/// Creates a new [`Linear`] builder.
|
||||
pub fn new(start: Point, end: Point) -> Self {
|
||||
Self {
|
||||
start,
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
#![doc(
|
||||
html_logo_url = "https://raw.githubusercontent.com/iced-rs/iced/9ab6923e943f784985e9ef9ca28b10278297225d/docs/logo.svg"
|
||||
)]
|
||||
#![forbid(rust_2018_idioms)]
|
||||
#![deny(
|
||||
missing_debug_implementations,
|
||||
//missing_docs,
|
||||
|
|
@ -16,9 +17,9 @@
|
|||
clippy::from_over_into,
|
||||
clippy::needless_borrow,
|
||||
clippy::new_without_default,
|
||||
clippy::useless_conversion
|
||||
clippy::useless_conversion,
|
||||
rustdoc::broken_intra_doc_links
|
||||
)]
|
||||
#![forbid(rust_2018_idioms)]
|
||||
#![allow(clippy::inherent_to_string, clippy::type_complexity)]
|
||||
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
|
||||
mod antialiasing;
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ impl Damage for Mesh {
|
|||
}
|
||||
}
|
||||
|
||||
/// A set of [`Vertex2D`] and indices representing a list of triangles.
|
||||
/// A set of vertices and indices representing a list of triangles.
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub struct Indexed<T> {
|
||||
/// The vertices of the mesh
|
||||
|
|
|
|||
|
|
@ -43,7 +43,10 @@ impl Cache {
|
|||
}
|
||||
|
||||
if let hash_map::Entry::Vacant(entry) = self.entries.entry(hash) {
|
||||
let metrics = cosmic_text::Metrics::new(key.size, key.line_height);
|
||||
let metrics = cosmic_text::Metrics::new(
|
||||
key.size,
|
||||
key.line_height.max(f32::MIN_POSITIVE),
|
||||
);
|
||||
let mut buffer = cosmic_text::Buffer::new(font_system, metrics);
|
||||
|
||||
buffer.set_size(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue