static Gdip() { Debug.Assert(s_initToken == IntPtr.Zero, "GdiplusInitialization: Initialize should not be called more than once in the same domain!"); PlatformInitialize(); // GDI+ ref counts multiple calls to Startup in the same process, so calls from multiple // domains are ok, just make sure to pair each w/GdiplusShutdown int status = GdiplusStartup(out s_initToken, StartupInputEx.GetDefault(), out _); CheckStatus(status); }
static Gdip() { if (!OperatingSystem.IsWindows()) { NativeLibrary.SetDllImportResolver(Assembly.GetExecutingAssembly(), static (_, _, _) => throw new PlatformNotSupportedException(SR.PlatformNotSupported_Unix)); } Debug.Assert(s_initToken == IntPtr.Zero, "GdiplusInitialization: Initialize should not be called more than once in the same domain!"); // GDI+ ref counts multiple calls to Startup in the same process, so calls from multiple // domains are ok, just make sure to pair each w/GdiplusShutdown int status = GdiplusStartup(out s_initToken, StartupInputEx.GetDefault(), out _); CheckStatus(status); }