skia4delphi / skia4delphi

Skia4Delphi is a cross-platform 2D graphics API for Delphi platforms based on Google's Skia Graphics Library. It provides a comprehensive 2D API that can be used across mobile, server and desktop models to render images.
https://skia4delphi.org
MIT License
696 stars 141 forks source link

C++ Builder support #107

Closed sdzccs closed 1 year ago

sdzccs commented 2 years ago

Is the c + + builder platform supported?

checkdigits commented 2 years ago

Unfortunately at the moment only Delphi is supported - for both VCL and FMX. There is a plan to support C++ Builder at some point in the future, lots of people want it, but it's not straight-forward and requires considerable work.

The project is very happy to receive pull requests from anyone who is working on C++ Builder support too.

sdzccs commented 2 years ago
[bcc32c Error] Skia.Bindings.hpp(139): virtual function 'Release' has a different return type ('void') than the function it overrides (which has return type 'ULONG' (aka 'unsigned long'))
  unknwnbase.h(183): overridden virtual function is here
[bcc32c Error] Skia.hpp(3449): duplicate member 'ChildrenBlenders'
  Skia.hpp(3448): previous declaration is here
[bcc32c Error] Skia.hpp(3451): duplicate member 'ChildrenColorFilters'
  Skia.hpp(3450): previous declaration is here
[bcc32c Error] Skia.hpp(3454): duplicate member 'ChildrenShaders'
  Skia.hpp(3453): previous declaration is here
...
[bcc32c Error] Skia.FMX.hpp(1047): no member named 'TFontWeight' in namespace 'Skia::Fmx::Graphics'
[bcc32c Error] Skia.FMX.hpp(1047): no member named 'TFontSlant' in namespace 'Skia::Fmx::Graphics'
[bcc32c Error] Skia.FMX.hpp(1370): 'Types' is not a class, namespace, or enumeration
[bcc32c Error] Skia.FMX.hpp(1370): reference to 'Types' is ambiguous
antarey commented 2 years ago

Good day. Add C ++ builder support. Empty project #include "Skia.FMX.hpp" - 432 errors

viniciusfbb commented 2 years ago

Good day. Add C ++ builder support. Empty project #include "Skia.FMX.hpp" - 432 errors

It is not yet available. We are working in CBuilder support at this moment. It will be available in version 4, in few weeks.

sdzccs commented 2 years ago

Demand is the drive forward

vgromov commented 2 years ago

I've managed to compile simple C++ Builder project utilizing Skia, the main challenge was to deal with multiple namespaces disambiguation in hpp files. Still, these issues most likely to re-occur in forms which include third-party components, like TeeChart or TeeGrid, for instance. Auto generated hpps make their their namespaces implicit, that's the root of evil here. That way, if, say, Fmx::TGraphics, Skia::Fmx::TGraphics and Tee::Fmx::TGraphics are defined, and then Skia, Tee, Fmx, namespaces declared as implicit with 'using' in their respective hpps, the reference to TGraphics type may become super ambiguous. Should it be TGraphics from Fmx namespace, one have to address it as ::Fmx::TGraphics then. And that hell is all over the header files.

viniciusfbb commented 2 years ago

@vgromov Yes, the namespace is definitely an issue. But it doesn't come down to that. It is necessary to adapt from the Skia enable plugin within the IDE, adapt the setup, adapt the packages, solve the namespace problem, adapt the constructors with different names, adapt properties with duplicate names, adapt the helpers that do not work in C++, the creation of the demo and the creation of unit tests and all should work in all platforms.

It's not a small job, but we'll have news soon.

vgromov commented 2 years ago

It is necessary to adapt from the Skia enable plugin within the IDE

Yep, but it's barely an inconvenience, just add SKIA compiler define to c++ and Delphy settings, copy sk4d.dll, to project executable output directory, if needed, and proper pragma link to main project source file.

adapt the constructors with different names, adapt properties with duplicate names

That's rather tedious task, agee, took me some time to work-around names in hpps, as a temporary measure, just to complete compilation.

It's not a small job

Couldn't agree more, goal is achievable, but in a rather long run. So far, for a more-or-less complex C++ Builder project, I managed to utilize Skia renderer, and that's that. Anything more deep, and the namespace hell is overwhelming.

viniciusfbb commented 2 years ago

Anything more deep, and the namespace hell is overwhelming.

Yes, but I have a ready solution to all namespaces issues without rename the .pas and without made a macro to change the generated hpp, and without disable global or local "usings" and without third-party libraries incompatibility. But we don't want anything half done, and we need time. ;)

w0wbagger commented 1 year ago

I'm certainly interested. Let me know if there's anything I can do to help. What is the current timeline (as it seems as if it might have moved based on the previous messages).

jimmckeeth commented 1 year ago

We shared this at the Brazil conference a couple of months back. I'm a massive fan of Skia4Delphi, so I'm really looking forward to this personally. Unfortunately, there is no other information at this point. If you are interested in learning more, Premium Subscription customers are invited to our betas (Note: that link is for the Malawi beta, which is for the next minor update, likely to be 11.3, while Skia is planned for the next major update, which will be a future beta.)

BrazilWhatWorkingOn11 3AndNext

Safe Harbor Statement

viniciusfbb commented 1 year ago

Skia4Delphi support for C++Builder has been natively added to RAD Studio 12 Athens by Embarcadero. https://www.embarcadero.com/products/rad-studio/whats-new-in-12-athens