Gdip
using System.Collections.Generic;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using Windows.Win32.Graphics.GdiPlus;
namespace System.Drawing
{
[NullableContext(1)]
[Nullable(0)]
internal static class Gdip
{
private static readonly bool s_initialized = Init();
[Nullable(new byte[] {
2,
1,
1
})]
[ThreadStatic]
private static IDictionary<object, object> t_threadData;
internal static bool Initialized => s_initialized;
internal static IDictionary<object, object> ThreadData => t_threadData ?? (t_threadData = new Dictionary<object, object>());
private static bool Init()
{
if (!OperatingSystem.IsWindows())
NativeLibrary.SetDllImportResolver(Assembly.GetExecutingAssembly(), delegate {
throw new PlatformNotSupportedException(System.SR.PlatformNotSupported_Unix);
});
return GdiPlusInitialization.EnsureInitialized();
}
internal static void CheckStatus(Status status)
{
status.ThrowIfFailed();
}
internal static Exception StatusException(Status status)
{
return status.GetException();
}
}
}