1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-30 21:30:03 -04:00

Split out ecolor crate (#2399)

* split out ecolor crate

* split up ecolor crate in lots of modules

* add changelog notes

* add readme to ecolor

* put clippy::manual_range_contains on cranky allow list

* fix hex color issues

* doc fixes

* more hex_color fixes

* Document features

* Rename hex_color module to avoid warning

* Sort the feature names

* fix link in CHANGELOG.md

* better wording

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
This commit is contained in:
Andreas Reich
2022-12-06 20:42:25 +01:00
committed by GitHub
parent e30ac7f91a
commit 5effc68ba4
29 changed files with 1229 additions and 1101 deletions

View File

@@ -8,6 +8,7 @@ All notable changes to the epaint crate will be documented in this file.
* Improve mixed CJK/Latin line-breaking ([#1986](https://github.com/emilk/egui/pull/1986)).
* Added `Fonts::has_glyph(s)` for querying if a glyph is supported ([#2202](https://github.com/emilk/egui/pull/2202)).
* Added support for [thin space](https://en.wikipedia.org/wiki/Thin_space).
* Split out color into its own crate, `ecolor` ([#2399](https://github.com/emilk/egui/pull/2399)).
## 0.19.0 - 2022-08-20

View File

@@ -32,7 +32,13 @@ all-features = true
default = ["default_fonts"]
## [`bytemuck`](https://docs.rs/bytemuck) enables you to cast [`Vertex`] to `&[u8]`.
bytemuck = ["dep:bytemuck", "emath/bytemuck"]
bytemuck = ["dep:bytemuck", "emath/bytemuck", "ecolor/bytemuck"]
## [`cint`](https://docs.rs/cint) enables interopability with other color libraries.
cint = ["ecolor/cint"]
## Enable the [`hex_color`] macro.
color-hex = ["ecolor/color-hex"]
## This will automatically detect deadlocks due to double-locking on the same thread.
## If your app freezes, you may want to enable this!
@@ -44,18 +50,22 @@ deadlock_detection = ["dep:backtrace"]
default_fonts = []
## Enable additional checks if debug assertions are enabled (debug builds).
extra_debug_asserts = ["emath/extra_debug_asserts"]
extra_debug_asserts = [
"emath/extra_debug_asserts",
"ecolor/extra_debug_asserts",
]
## Always enable additional checks.
extra_asserts = ["emath/extra_asserts"]
extra_asserts = ["emath/extra_asserts", "ecolor/extra_asserts"]
## [`mint`](https://docs.rs/mint) enables interopability with other math libraries such as [`glam`](https://docs.rs/glam) and [`nalgebra`](https://docs.rs/nalgebra).
mint = ["emath/mint"]
## Allow serialization using [`serde`](https://docs.rs/serde).
serde = ["dep:serde", "ahash/serde", "emath/serde"]
serde = ["dep:serde", "ahash/serde", "emath/serde", "ecolor/serde"]
[dependencies]
emath = { version = "0.19.0", path = "../emath" }
ecolor = { version = "0.19.0", path = "../ecolor" }
ab_glyph = "0.2.11"
ahash = { version = "0.8.1", default-features = false, features = [
@@ -67,12 +77,6 @@ nohash-hasher = "0.2"
#! ### Optional dependencies
bytemuck = { version = "1.7.2", optional = true, features = ["derive"] }
## [`cint`](https://docs.rs/cint) enables interopability with other color libraries.
cint = { version = "0.3.1", optional = true }
## Enable the [`hex_color`] macro.
color-hex = { version = "0.2.0", optional = true }
## Enable this when generating docs.
document-features = { version = "0.2", optional = true }

File diff suppressed because it is too large Load Diff

View File

@@ -127,7 +127,7 @@ impl ColorImage {
let s = 1.0;
let v = 1.0;
let a = y as f32 / height as f32;
img[(x, y)] = crate::color::Hsva { h, s, v, a }.into();
img[(x, y)] = crate::Hsva { h, s, v, a }.into();
}
}
img

View File

@@ -13,7 +13,6 @@
#![allow(clippy::manual_range_contains)]
mod bezier;
pub mod color;
pub mod image;
mod mesh;
pub mod mutex;
@@ -31,7 +30,6 @@ pub mod util;
pub use {
bezier::{CubicBezierShape, QuadraticBezierShape},
color::{Color32, Rgba},
image::{ColorImage, FontImage, ImageData, ImageDelta},
mesh::{Mesh, Mesh16, Vertex},
shadow::Shadow,
@@ -48,13 +46,15 @@ pub use {
textures::TextureManager,
};
pub use ecolor::{Color32, Hsva, HsvaGamma, Rgba};
pub use emath::{pos2, vec2, Pos2, Rect, Vec2};
pub use ahash;
pub use ecolor;
pub use emath;
#[cfg(feature = "color-hex")]
pub use color_hex;
pub use ecolor::hex_color;
/// The UV coordinate of a white region of the texture mesh.
/// The default egui texture has the top-left corner pixel fully white.