From a159562ea7724909f201491427d581e06ca0f60c Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Mon, 15 Apr 2024 11:29:32 +0200 Subject: [PATCH] Add a "image-default-formats" feature To enable the feature from the image crate. And enable it by default. Because users of older version of slint may have enabled feature from the image 0.24 crate. But since we upgrade to image 0.25, this these format would not be supported by Slint. So enable them by default to keep compatibility --- api/rs/slint/Cargo.toml | 8 +++++++- internal/core/Cargo.toml | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/api/rs/slint/Cargo.toml b/api/rs/slint/Cargo.toml index d1553ad4309..8049bff0a8f 100644 --- a/api/rs/slint/Cargo.toml +++ b/api/rs/slint/Cargo.toml @@ -25,6 +25,7 @@ default = [ "backend-default", "renderer-femtovg", "renderer-software", + "image-default-formats", "accessibility", "compat-1-2", ] @@ -34,7 +35,8 @@ default = [ ## Newer patch version may put current functionality behind a new feature ## that would be enabled by default only if this feature was added. ## [More info in this blog post](https://slint.dev/blog/rust-adding-default-cargo-feature.html) -"compat-1-2" = [] +"compat-1-6" = [] +"compat-1-2" = ["compat-1-6", "image-default-formats"] "compat-1-0" = ["compat-1-2", "renderer-software"] ## Enable use of the Rust standard library. @@ -84,6 +86,10 @@ accessibility = ["i-slint-backend-selector/accessibility"] ## [HasDisplayHandle](raw_window_handle_06::HasDisplayHandle) implementation. raw-window-handle-06 = ["dep:raw-window-handle-06", "i-slint-backend-selector/raw-window-handle-06"] +## Enable all formats from the `image` crate. To increase what is supported from [`Image::load_from_path`] +## or in `@image-url`. +image-default-formats = ["i-slint-core/image-default-formats"] + #! ### Backends #! Slint needs a backend that will act as liaison between Slint and the OS. diff --git a/internal/core/Cargo.toml b/internal/core/Cargo.toml index 3bd585a5810..37896bf128d 100644 --- a/internal/core/Cargo.toml +++ b/internal/core/Cargo.toml @@ -38,6 +38,7 @@ software-renderer = ["bytemuck"] software-renderer-rotation = [] image-decoders = ["dep:image", "dep:clru"] +image-default-formats = ["image?/default-formats"] svg = ["dep:resvg", "shared-fontdb"] box-shadow-cache = []