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

Replace string-based flags with enums #5

Merged
merged 11 commits into from
Dec 23, 2016
Merged

Replace string-based flags with enums #5

merged 11 commits into from
Dec 23, 2016

Conversation

francesca64
Copy link
Collaborator

Closes #3

This changes all functions that previously accepted a &str flag to instead accept an appropriate enum. There are various changes to note:

  • For easy access, these enums are re-exported in the crate root, so anyone who wants to use BlurMode just has to use raster::BlurMode;.
  • The transform modes were previously "x" and "y", but I changed them to Horizontal and Vertical, as it's more explicit, expressive, and clear - and thus more rustic. For people with autocompletion, the loss of brevity is a non-issue, though I'd understand if you're not receptive to this change.
  • In various places where the possible string flags were enumerated in the documentation, I removed them. Anyone who wants to know all variants just has to click on the enum type in the function signature, and additionally, the example sections showcase the possibilities. In situations where the modes were accompanied by descriptions, those descriptions are now present in the enum's documention, i.e. with ResizeMode. Still, I feel this change may be slightly controversial, which is why I feel the need to mention it here.
  • I created a private BlendFunction enum that's just like the public BlendMode enum, except it doesn't have a Normal variant. BlendFunction was made specifically for consumption by ch_alpha_f, whereas BlendMode is part of the public API and used in all other places.

@kosinix kosinix merged commit d1214eb into kosinix:master Dec 23, 2016
@francesca64 francesca64 deleted the enum-modes branch December 24, 2016 00:09
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.

2 participants