Make conflicting chroma key strategies an error + remove inert options - #224
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Image.Options.ChromaKeyhas two mutually exclusive strategies, but nothing enforced it.select_strategy/1matched on the merged options map, and the color range clause is defined before the threshold clause, so the color range options always won when both were present.default_options/0merged[color: :auto, threshold: 20], supplying only one of:greater_thanand:less_thanfell through to the threshold clause instead, leaving the final clause unreachable.Changes
:strategykey, whichdo_chroma_mask/2dispatches on (instead of map key presence):sigmaand:min_amplitude. They were never read by anything, and were leftovers from copyingImage.Options.Blur(in 1326801)%Image.Error{reason: :invalid_option}. The unreachable clause originally returned a bare binary:greater_thanand:less_thandocs (which were inverted). The mask covers the range between the bounds, so:greater_thanis the lower oneBreaking changes
Affects
Image.chroma_mask/2,Image.chroma_key/2,Image.replace_color/2and their bang variants.:colorand:thresholdwere silently dropped:greater_than/:less_thanreturns an error. Previously the supplied option was silently discarded and auto chroma detection ran instead:sigmaand:min_amplitudeare rejected. They had no effect, but were accepted