nlfiedler / magick-rust

Rust bindings for ImageMagick
https://crates.io/crates/magick_rust
Apache License 2.0
246 stars 63 forks source link

Create "types" module #119

Closed 5ohue closed 1 month ago

5ohue commented 1 month ago

This pull request refactors the current CompositeOperator and ResourceType into a separate module and adds a bunch of new enum wrappers around imagemagick types. This is a VERY breaking change!!!

Now the user has less need to directly touch bindings module to pass arguments to funcions (like magick_rust::bindings::FilterType_GaussianFilter which gets replaced with magick_rust::FilterType::Gaussian).

Also the "types" module is one separate place to add more wrappers around various magick types in the future.

5ohue commented 1 month ago

Some types use unsafe code to convert from the libc::c_uint to the enum. It looks alright but you should probably double check the code (CompositeOperator file has that for example).

nlfiedler commented 1 month ago

This looks fantastic. It may be time to finally call the next release 1.0, that way when there are minor and major API changes, the (semantic) version moving up will actually mean something. Going from 0.2 to 0.3 seems a poor fit given both the amount of working going into magick-rust, and the fact that this crate has been available for several years now.

Thank you very much, look forward to a release soon.

5ohue commented 1 month ago

I'll open a new PR soon. I will add some more types to the module and remove size_t from a lot of functions (replaced with more rustic usize)

nlfiedler commented 1 month ago

Excellent, I look forward to it.