Skip to content

Conversation

@cyrgani
Copy link
Contributor

@cyrgani cyrgani commented Sep 23, 2024

This is an experimental idea for reducing the amount of dependencies in some projects.

image has around 15 more dependencies, but is only used in a few places in macroquad:

  • load a macroquad::Image from a image file of any format
  • load a macroquad::Texture from a image file of any format
  • save a macroquad::Image as a PNG file

For a user that does not need these features, those dependencies are unneeded. This PR adds a crate feature image-crate that in on by default. If it is disabled, image and the three functions above will not be compiled with macroquad.

For instance, it would be possible to convert an image buffer to a macroquad::Image once and then store the macroquad::Image's byte representation on the disk, to avoid having to use image again.

If a user had default-features = false in Cargo.toml for some strange reason (it has no effect right now, since there are no default features right now), this would break their code, but to fix it they would just have to remove default-features = false or add features = ["image-crate"], which seems easy enough.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant