Magick.NET icon indicating copy to clipboard operation
Magick.NET copied to clipboard

Possible bug with forced casting on IChannelPerceptualHash

Open Gounlaf opened this issue 1 year ago • 1 comments

Magick.NET version

13.6.0 (since 0fcf386b)

Environment (Operating system, version and so on)

All

Description

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

https://github.com/dlemstra/Magick.NET/blob/0fcf386b4a0ae831e6799e9b4b31e34c5ad72cb5/src/Magick.NET/Statistics/ChannelPerceptualHash.cs#L97-L104

It breaks interface contract.

I don't have a solution to suggest =/

Regards.

Steps to Reproduce

N/A

Gounlaf avatar May 11 '24 15:05 Gounlaf

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.

dlemstra avatar May 11 '24 17:05 dlemstra

I just pushed a commit that uses a different approach to avoid the typecast.

dlemstra avatar May 30 '24 18:05 dlemstra

Your solution is elegant :+1:

Gounlaf avatar May 31 '24 09:05 Gounlaf