-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Why is a CoreGraphics version of System.Drawing needed #24
Comments
We originally started with the Mono's System.Drawing implementation. There are fundamental problems with it:
Faced with these challenges we decided to go with the Cocoa implementation of System.Drawing instead. It is siginificantly faster for our purposes and makes interoperability with the native controls much easier. It also allowed us to add dark mode support recently by directly mapping That said, I spent almost a year fixing bugs in libgdiplus and Mono's System.Drawing. It now runs on 64-bit, can render internation fonts with Pango (which can use native Cocoa rendering) and most of the fundamental bugs are fixed. Last year I tried to port the XplatUICocoa back to run with Mono's System.Windows.Forms+System.Drawing. I had something up and running in a day and it mostly worked but it was nowhere near as polished as the implementation in this repository, and it lacks the native controls. |
Thanks very much for your answer. I think you did great work. I have some more questions.
|
It is upstreamed in Mono at this point. I believe it should be part of the stable Mono 6.0 release.
Correct
Both. It need the Cocoa API for creating windows, all drawing is done through System.Drawing. |
I think the current libgdiplus invokes Carbon API, am I right?, which only supports 32-bit. So in the coming Mono 6.0 release, will the libgdiplus shift from Carbon to Cocoa? |
It supports both Carbon and Cocoa. The Carbon code is 32-bit only. The Cocoa code is there to support integration with apps written in Xamarin.Mac and it has to be specifically enabled through some API call. |
Thanks. |
I downloaded the source code of Mono-6.4.0.181 and found no way to set GDIPlus.UseCocoaDrawable be true. Is there API available to use Cocoa in Mono-6.4.0? |
There is no public API except the one in Xamarin.Mac listed above which uses reflection to set |
In line 123 of mcs/class/System.Drawing/System.Drawing/gdipFunctions.cs, I set UseCocoaDrawable be true rather than UseCarbonDrawable and built the Mono-6.4.0.181 runtime in my mac and built / ran my application with the new runtime, there are same visibility and z-order issues. I did not see anything improved.
Does this work to use Cocoa? If not, can you give me some code to use reflection to set GDIPlus.UseCocoaDrawable? |
To use the Cocoa driver for System.Windows.Forms, isn't writing and using a XplatUICocoa in System.Windows.Forms enough? Why is a CoreGraphics version of System.Drawing introduced?
Thanks
The text was updated successfully, but these errors were encountered: