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

Correct channel detection in MagickImage.blur #151

Merged
merged 1 commit into from
Feb 6, 2024

Conversation

Peeterush
Copy link
Contributor

The Channels enum is converted to numerical values on compilation, meaning e.g. MagickImage.blur(Channels.Blue) will currently be interpreted as MagickImage.blur(4, 1).

I found this problem during the implementation of MagickImage.gaussianBlur(radius: number, channels: Channels). Unlike there, we don't need to omit it here as we can identify the usage of MagickImage.blur by the presence of other arguments. Namely, if a sigma value is given then the first argument is a radius, otherwise it is a Channels value.

Copy link
Owner

@dlemstra dlemstra left a comment

Choose a reason for hiding this comment

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

Just a minor comment. And should we not add extra tests for this issue?

else if (radiusOrChannel !== undefined)
channels = radiusOrChannel;
if (radiusOrChannels !== undefined) {
if (sigmaOrUndefined === undefined) {
Copy link
Owner

Choose a reason for hiding this comment

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

Can you remove the { here and in the else to have this in the same style as the rest of the project? The first one should stay because it is multiline.

@Peeterush
Copy link
Contributor Author

Fair point! I've added a test and updated that if statement for you.

@dlemstra dlemstra merged commit 26769e5 into dlemstra:main Feb 6, 2024
7 checks passed
@Peeterush Peeterush deleted the fix-blur branch February 7, 2024 12:29
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