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

Possible bug with forced casting on IChannelPerceptualHash #1629

Open
Gounlaf opened this issue May 11, 2024 · 1 comment
Open

Possible bug with forced casting on IChannelPerceptualHash #1629

Gounlaf opened this issue May 11, 2024 · 1 comment

Comments

@Gounlaf
Copy link
Sponsor Contributor

Gounlaf commented May 11, 2024

Magick.NET version

13.6.0 (since 0fcf386)

Environment (Operating system, version and so on)

All

Description

Since commit 0fcf386, ChannelPerceptualHash.SumSquaredDistance force casting of parameter IChannelPerceptualHash to implementation ChannelPerceptualHash :

public double SumSquaredDistance(IChannelPerceptualHash other)
{
Throw.IfNull(nameof(other), other);
var otherChannelPerceptualHash = other as ChannelPerceptualHash;
var ssd = 0.0;
foreach (var huPhashList in _huPhashes)

It breaks interface contract.

I don't have a solution to suggest =/

Regards.

Steps to Reproduce

N/A

@dlemstra
Copy link
Owner

Not doing the cast would force me to expose the HuPhashList that nobody will want to use. So I took this shortcut. Creating an interface for the HuPhashList is probably a better solution. I will take a look at this next week.

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

No branches or pull requests

2 participants