diff --git a/Cargo.toml b/Cargo.toml index 251b1b3b..ef642244 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,12 +12,18 @@ homepage = "https://github.com/image-rs/imageproc" exclude = [".github/*", "examples/*", "tests/*"] [features] -default = ["rayon", "image/default"] +default = ["rayon", "image/default", "text", "image_hash"] display-window = ["sdl2"] rayon = ["dep:rayon", "image/rayon"] +# Option: enable image_hash +image_hash = ["dep:rustdct"] + +# Option: enable drawing::text +text = ["dep:ab_glyph"] + [dependencies] -ab_glyph = { version = "0.2.23", default-features = false, features = ["std"] } +ab_glyph = { version = "0.2.23", default-features = false, features = ["std"], optional = true} approx = { version = "0.5", default-features = false } image = { version = "0.25.0", default-features = false } itertools = { version = "0.14.0", default-features = false, features = [ @@ -36,7 +42,7 @@ sdl2 = { version = "0.38.0", optional = true, default-features = false, features "bundled", ] } katexit = { version = "0.1.4", optional = true, default-features = false } -rustdct = "0.7.1" +rustdct = { version = "0.7.1", optional = true } [target.'cfg(target_arch = "wasm32")'.dependencies] getrandom = { version = "0.3.0", default-features = false, features = ["wasm_js"] } diff --git a/src/drawing/mod.rs b/src/drawing/mod.rs index a56aa0fa..0e771c7e 100644 --- a/src/drawing/mod.rs +++ b/src/drawing/mod.rs @@ -32,7 +32,10 @@ pub use self::rect::{ draw_filled_rect, draw_filled_rect_mut, draw_hollow_rect, draw_hollow_rect_mut, }; +#[cfg(feature = "text")] mod text; + +#[cfg(feature = "text")] pub use self::text::{draw_text, draw_text_mut, text_size}; mod fill; diff --git a/src/lib.rs b/src/lib.rs index a67c44db..b37c4258 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -37,6 +37,7 @@ pub mod gradients; pub mod haar; pub mod hog; pub mod hough; +#[cfg(feature = "image_hash")] pub mod image_hash; pub mod integral_image; pub mod kernel; diff --git a/tests/regression.rs b/tests/regression.rs index 9abed820..7fe14b58 100644 --- a/tests/regression.rs +++ b/tests/regression.rs @@ -952,6 +952,7 @@ fn test_bilateral_filter() { } #[test] +#[cfg(feature = "text")] fn test_draw_text() { let font_bytes = include_bytes!("data/fonts/DejaVuSans.ttf"); let font = ab_glyph::FontRef::try_from_slice(font_bytes).unwrap();