Lazarus

Programming => Graphics and Multimedia => Graphics => Topic started by: heberallred on October 14, 2019, 08:41:32 am

Title: Graphics32 for Cocoa Interface
Post by: heberallred on October 14, 2019, 08:41:32 am
Since Apple is soon to disallow 32 bit applications on the latest MacOS Catalina, then Carbon as a UI is not an option.  It appears Cocoa is the primary path forward for UI for MacOS.  I was able to use FPCUpDeluxe to build and install the 64 bit version with Cocoa UI (it was very helpful).  Now I can at least compile 64 bit applications on Mac.

I've been trying to get Graphics32 it to work the last few days with no luck.  I got it to compile, but it errors with "test_project quit unexpectedly" when it tries to Draw.

I think the core change needed is a new GR32 "Backend" for Cocoa.  I copied GR32_Backends_LCL_CustomDrawn.pas to GR32_Backends_LCL_Cocoa.pas as a start point, but I think it may need some changes to the "InitializeSurface" procedure.

Is anyone familiar enough with Graphics32 to know how to make it work with Cocoa?  I'm not sure if it's just a small tweak needed, or if it needs some more in depth adjustments.  Any help is appreciated.  I'm sure many users using Graphics32 will be hitting the same issue when they begin switching to 64 bit on MacOS.

Another option would be to use CustomDrawn interface for Lazarus components (and Graphics32 has a "backend" for that), but they don't compile for 64 bit because there are lingering references to Carbon UI in the code.