Created
August 18, 2024 18:39
-
-
Save smourier/ec63b4a74f1e125ec5ac5d22676b0cd2 to your computer and use it in GitHub Desktop.
Use WIC component with GDI+ (version 3)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var hr = GdiplusStartup(out var token, StartupInputEx.GetDefault(), out var output); | |
using var img = new Bitmap(Environment.GetCommandLineArgs()[1]); | |
[DllImport("gdiplus")] | |
private static extern int GdiplusStartup(out nint token, in StartupInputEx input, out StartupOutput output); | |
private struct StartupInputEx | |
{ | |
public int GdiplusVersion; | |
public nint DebugEventCallback; | |
public bool SuppressBackgroundThread; | |
public bool SuppressExternalCodecs; | |
public int StartupParameters; | |
public static StartupInputEx GetDefault() | |
{ | |
var result = new StartupInputEx | |
{ | |
GdiplusVersion = 3 | |
}; | |
return result; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment