'Dgip' threw an exception #5608
Unanswered
RachelAlcraft
asked this question in
Q&A
Replies: 1 comment 1 reply
-
GDI+ is a windows only API, so it wont work on Linux. Avalonia has an inbuilt Bitmap class that you may use, you may use WritableBitmap class and call Lock on it to get an IntPtr to the raw data. If you need something more advanced you can use some cross platform image manipulation package like: Iv done similar types of image manipulation before, and Memory and Span apis are quite efficient for this, because you can create a struct for the PixelFormat i.e. struct BGRA { byte B, byte G, byte R, byte A }, and allocate a span over IntPtr returned from Lock.. then just manipulate each pixel. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, my main need for the Avaolnia linux build is for images, and I have tried to port my xaml image handling to avalonia. It wasn't immediately obvious what to do, but I eventually got it working when debugging on windows, however when I build and run on linux it crashes out with the error below. Is it an obvious error? Perhaps I have inadvertently linked to a library I shouldn't? I am mixing up the bitmap from avalonia and the bitmap from Systems.UI because I couldn;t work out how to set the RGB for each individual pixel in the avolonia bitmap, so I create it as a windows bitmap and them via the MemoryStream create an avalonia bitmap - perhaps that is a problem? Many thanks.
Unhandled exception. System.TypeInitializationException: The type initializer for 'Gdip' threw an exception.
---> System.DllNotFoundException: Unable to load DLL 'libgdiplus': The specified module could not be found.
at System.Runtime.InteropServices.FunctionWrapper`1.get_Delegate()
at System.Drawing.SafeNativeMethods.Gdip.GdiplusStartup(IntPtr& token, StartupInput& input, StartupOutput& output)
at System.Drawing.SafeNativeMethods.Gdip..cctor()
--- End of inner exception stack trace ---
at System.Drawing.SafeNativeMethods.Gdip.GdipCreateBitmapFromScan0(Int32 width, Int32 height, Int32 stride, Int32 format, HandleRef scan0, IntPtr& bitmap)
at System.Drawing.Bitmap..ctor(Int32 width, Int32 height, PixelFormat format)
Beta Was this translation helpful? Give feedback.
All reactions