About Skia graphics engine ! lazarus / 39-Graphics ---------------------------------------------------------------------- loaded · 2025-07-10 11:40 Hi All, I learned something today; Skia is an open-source 2D graphics engine developed by Google, used as the foundation for platforms like Android, Chrome, and Flutter. I've heard some rumors about its compatibility with Lazarus. Is this true? 🤔 Also, if anyone has any experience with this engine and would like to share it, I'd be very grateful. 😀 Regards. ---------------------------------------------------------------------- paweld · 2025-07-10 12:23 Skia4Delphi works with FPC 3.3.1 - more info: https://wiki.lazarus.freepascal.org/Skia ---------------------------------------------------------------------- DomingoGP · 2025-07-10 20:07 Some time ago I was playing with skia4delphi. Making some changes I got it to compile with FPC 3.2 and render on a BGRABITMAP. I attach the changed files and a project that works with lazarus in case someone wants to try it. NOTE: I do not include sk4d.dll which must be in the same directory as the application. The changes basically consist of changing the order of some type definitions and changing the references to functions by pointers to functions. ---------------------------------------------------------------------- loaded · 2025-07-11 06:25 paweld and DomingoGP, thank you very much for your answers.  👏 DomingoGP, I think you have experience on this subject. Thank you also for the example. By the way, what are your personal thoughts on the speed and ease of use? ---------------------------------------------------------------------- DomingoGP · 2025-07-11 07:12 I'm sorry but I have basically only used skia for this example, so I have very little experience. I guess it is faster than BGRABitmap but I think it is more difficult to use, but these are just my assumptions. The documentation for using it that I have found is rather sparse and I haven't gone any deeper. ---------------------------------------------------------------------- loaded · 2025-07-11 07:50 Brother DomingoGP, even this little bit of experience you've taken the trouble to share with me, taking your precious time, is invaluable to me. Thank you very much. 🙏 I'll handle the rest myself. Regards.🙋‍♂️ ---------------------------------------------------------------------- DomingoGP · 2025-07-11 07:58 You are welcome! ---------------------------------------------------------------------- gues1 · 2025-07-11 08:27 I don't know if this can help, but you can start from here (may be there is something usefull, sure some links): https://docwiki.embarcadero.com/RADStudio/Athens/en/Skia4Delphi Take care that all you read about it from Embarcadero was based on FMX (the multi platform framework of Delphi). Bye ---------------------------------------------------------------------- loaded · 2025-07-11 12:09 Thank you for your valuable answer, brother gues1. I think I will review this page soon. 👏 ---------------------------------------------------------------------- aydın · 2025-07-12 17:58 I've been researching this topic myself for a while. Skia internally uses OpenGL, but working with text rendering in it can be a real headache. My personal solution was to create an OpenGLControl on the Lazarus side and call Skia from a C++ library I built. Surprisingly, this worked flawlessly and is fully compatible. I don't have a minimal demo project ready for this setup, but I can provide one if anyone's interested. I should mention that it's a bit of a hassle to maintain. However, if you compile the C++ library with `-static-libstdc++`, integration with Pascal becomes much easier. If you're looking for a simpler yet faster alternative to LCLCanvas, Cairo might be the right choice for you. It doesn't use hardware acceleration, but I can say it's quite fast. I can also prepare a minimal example for Cairo if you'd like. ---------------------------------------------------------------------- ALLIGATOR · 2025-07-13 03:57 Examples? The more, the better! ---------------------------------------------------------------------- aydın · 2025-07-13 07:31 Of course! To be honest, I have a bit of a bias against Delphi components. I try to avoid them if possible. That's why I decided to go with a C++ integration approach. First, we'll fetch the Skia source code from Git and compile it ourselves. Create a folder and open a terminal in it. Code: Bash  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i git clone https://github.com/google/skia.git --depth=1Since I didn't want to clone the full history of the repository, I used `--depth=1`, but that's up to personal preference. Next, Code: Bash  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i cd skiapython3 tools/git-sync-deps bin/gn gen out/so --args='  is_official_build=true  is_component_build=true  skia_use_gl=true  skia_use_freetype=true  skia_use_fontconfig=true  target_os="linux"  cc="clang"  cxx="clang++"  extra_ldflags = ["-static-libstdc++", "-static-libgcc"]'ninja -C out/soTo catch any possible errors, run the commands one by one instead of using a script. If everything went well, there should be a `libskia.so` file in the `out/so` directory. You can extract the attached zip file and copy the `core` and `ui` folders next to the `skia` directory. Now, the project structure will look like this: Code: Text  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i LazSkiaTest  - core  // C++ side goes here  - skia  // Skia source and compiled files go here  - ui    // Pascal side that brings everything together In `core/Pkgs/lib.skia_test/Dev/Main.cpp`, specify the path to a font file at line 91. Then go into the core folder and run the following command. This is a Make setup I personally use in my own projects — feel free to modify or use it however you like. Code: Bash  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i make Build Now, go into the `ui` folder and open the project. It should be working at this point. I’ve also included a screenshot in the attachment. Good luck to everyone! ---------------------------------------------------------------------- cdbc · 2025-07-13 08:33 Hi Where can I find the libskia.so if I forgot to create an 'out' directory?!? On subsequent runs with out dir present, it just says 'Already up to date'... Regards Benny eta: BTW, both 'gn' and 'ninja' have prefixed 'fetch-' now... ---------------------------------------------------------------------- aydın · 2025-07-13 10:01 cdbc, I didn't fully understand your issue. The command I mentioned, `bin/gn gen`, already creates and prepares the out/so directory. One possible error you might encounter is during 'python3 tools/git- sync-deps`. If that happens, just try running it again. If you want to rebuild from scratch, simply delete the `out/so` directory, then run bin/gn followed by ninja. Could you share more details about exactly which step is failing for you? ---------------------------------------------------------------------- cdbc · 2025-07-13 11:34 Hi Hmmm.... Yes, deleted it all and started over -- ended up with a 1,08 Gb 'libskia.a' file and no libskia.so?!? I daren't think of the finished size of the so... Think I'll call it quits. Regards Benny ---------------------------------------------------------------------- aydın · 2025-07-13 12:09 For me, `libskia.a` is around 21.2 MB, while `libskia.so` is about 9.8 MB. It really shouldn't be that large. There might be an issue with the `--args=` parameter in your `bin/gn gen` command — it’s worth double-checking that. Also, I might be a bit late mentioning this, but the Qt widgetset in LCL doesn't fully support OpenGL. That's why I compile it using GTK2 instead.