Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Separate image widget support from image codecs. #2244

Merged

Conversation

dtzxporter
Copy link
Contributor

This optimization with feature flags allows a couple of cases:

  • You can now use the Image widget without having any codecs configured (Raw pixel buffers).
  • A release + lto binary shaves off 1.7mb on average removing codecs and still supporting the image widget.

Now, the from_path and from_memory methods are gated and will only be present when one or more codec features are enabled.

@dtzxporter

This comment was marked as outdated.

@dtzxporter
Copy link
Contributor Author

Thinking about this it may make more sense to enable the image widget by default, and turn the "image" feature into actual codec support in general. That way it would be a non-breaking change and still a win-win size wise.

dtzxporter added a commit to dtzxporter/iced that referenced this pull request Feb 12, 2024
This is a non-breaking change that allows using images loaded with a different library in your program, or raw pixel buffers without including all of the bloat that image-rs is.

It's another attempt at iced-rs#2244 that is backwards compatible with existing applications because they will already use the image feature if they want the widget.
Co-authored-by: dtzxporter <dtzxporter@users.noreply.github.com>
@hecrj hecrj force-pushed the separate-image-widget-from-image-codecs branch from d93b040 to fa66610 Compare September 2, 2024 09:49
Copy link
Member

@hecrj hecrj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just introduced an image-without-codecs feature that disables the default features of the image crate.

Users can enable any codecs directly by depending on image in their projects.

@hecrj hecrj enabled auto-merge September 2, 2024 09:50
@hecrj hecrj merged commit cb94e40 into iced-rs:master Sep 2, 2024
12 checks passed
@hecrj hecrj added this to the 0.13 milestone Sep 5, 2024
@hecrj hecrj added feature New feature or request widget image addition labels Sep 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants