FileOnQ / Imaging.Heif

A C#/.NET wrapper around libheif for decoding and processing high efficiency image formats (heif, heic).
GNU Lesser General Public License v3.0
15 stars 4 forks source link

Clean Up Native Interop #35

Closed SkyeHoefling closed 2 years ago

SkyeHoefling commented 2 years ago

Description

We added the Interop API which updates the dll search directory for .NET Framework to match behaviors in .NET5+. This means we no longer need to have explicit x86 vs x64 interop classes. They all reference the exact same assembly name. Let's remove the duplicate file but keep the native interop wrapper. See code snippet example below.

internal static IntPtr InitJpegEncoder(int quality)
{
    switch (RuntimeInformation.ProcessArchitecture)
    {
        case Architecture.X64:
        case Architecture.X86:
            return native.encoder_jpeg_init(quality);
        default:
            throw new NotSupportedException($"Current platform ({RuntimeInformation.ProcessArchitecture}) is not supported");
    }
}