BGRABitmap for Android demo provides fast pixel access for jBitmap lazarus / 43-Android ---------------------------------------------------------------------- neuro · 2022-03-10 00:14 I have created BGRABitmap for Android demo which provides fast pixel access for jBitmap, and allows fast conversion “array of Byte” into jBitmap. jmpessoa, please download the attachment and include it in public distribution of LAMW demos. Currently LAMW does not provide fast pixel access for Android graphics. jCanvas has Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure DrawPoint(_x1: single; _y1: single);which is extremely slow and makes Android app almost unusable. Attached “AppBGRABitmapDemo1” has solved the problem of extremely slow graphics and now everybody will be able to create fast graphics apps using LAMW. Instructions how to test the AppBGRABitmapDemo1: 1) Install BGRABitmap package to Lazarus IDE. 2) Original BGRABitmap package does not compile in Android, thus you need to use patched source code files. From project subdirectory “!BGRABitmap_fixed_files” take 3 files bgrafreetype.pas bgranoguibitmap.pas bgraopengl.pas and replace these 3 files in TBGRABitmap package, which are located in directory: “C:\fpcupdeluxe\ccr\bgrabitmap\bgrabitmap” 3) Add “BGRABitmapPack4NoGUI” to the project “Required Packages”. Go to the menu: Project -> Project Inspector -> Required Packages -> Add -> BGRABitmapPack4NoGUI -> Ok 4) Run project and press button “Draw BGRABitmap”. P. S.:  patched BGRABitmap package files need more investigation by the author of BGRABitmap. Now I have disabled all fonts and OpenGL related code in order to enable compilation under Android. Official distribution of BGRABitmap package should be updated accordingly. ---------------------------------------------------------------------- jmpessoa · 2022-03-10 02:03 Quotejmpessoa, please download the attachment and include it in public distribution of LAMW demos. Done! Thank you! ---------------------------------------------------------------------- circular · 2022-03-10 07:46 Thank you very much  So to sum up, you've removed references to OpenGL and LazFreeType. Regarding LazFreeType, one problem that happened with fpGui/noGui was that with new version of Lazarus, the FreeType units were moved to a new "freetypelaz" package instead of LazUtils. Have you tried adding the reference to this new package? About OpenGL, I suppose that the OpenGL doesn't work at all? ---------------------------------------------------------------------- neuro · 2022-03-10 09:38 Yes, in BGRABitmapPack4NoGUI package I have removed references to OpenGL and LazFreeType, because they fail to compile under Android. My goal was to gain fast pixel access for jBitmap, so all unnecessary functionality of BGRABitmap (like LazFreeType and OpenGL) could be sacrificed for that purpose. Yesterday I had deleted and reinstalled the latest version of Lazarus (release v2.2.0h of fpcupdeluxe-x86_64-win64.exe), and only after fresh install of Lazarus I had created “AppBGRABitmapDemo1”. I have never used “FreeType” before, so I do not know if it could be forced to compile under Android. We should contact authors of BGRABitmap package and ask them to update the official distribution of BGRABitmap package to be compatible with Android (by disabling OpenGL and LazFreeType in Android version). Btw, please note that current latest version release v2.2.0h of fpcupdeluxe-x86_64-win64.exe by default installs incorrect version of gradle-7.3.1 and all Android apps fail to launch. The workaround solution is to manually install Gradle 6.8.3. Please read here: https://github.com/LongDirtyAnimAlf/fpcupdeluxe/issues/507 Release v2.2.0h of fpcupdeluxe-x86_64-win64.exe needs gradle-6.8.3 instead of gradle-7.3.1 ---------------------------------------------------------------------- AlexTP · 2022-03-10 11:35 @neuro, You can contact authors via GH: https://github.com/bgrabitmap/bgrabitmap/issues I posted the issue https://github.com/bgrabitmap/bgrabitmap/issues/169 ---------------------------------------------------------------------- circular · 2022-03-10 17:09 Well I am the author of the library. I am a bit lost when it comes to Android development. I can make a package for android where I just remove the references as you suggest, though I wonder exactly what the problems are with those, to get an idea whether there is a workaround. Can you give me more detailed information on the errors you encounter? About FreeType, you can try adding the package freetypelaz as a condition to the BGRABitmap package. This may compile. No need to know how to use it. I don't know either if it is useful in Android development to have text rendering capabilities. ---------------------------------------------------------------------- neuro · 2022-03-10 17:46 circular, as a quickest solution today, please just take 3 patched files from https://github.com/jmpessoa/lazandroidmodulewizard/tree/master/demos/G UI/AppBGRABitmapDemo1/!BGRABitmap_fixed_files bgrafreetype.pas bgranoguibitmap.pas bgraopengl.pas and replace these 3 files in your official TBGRABitmap package distribution: https://github.com/bgrabitmap/bgrabitmap/tree/master/bgrabitmap The only modification in these three *.pas files is disabling OpenGL and LazFreeType when compiling for Android platform. There are no changes in code when compiling for other platforms. The patch affects only compilation for Android platform. The patch was done in following way: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i  {$IF not Defined (ANDROID)} // Workaround fix for Android compilation//program code which fails to compile under Android {$ENDIF} // Workaround fix for Android compilationLet’s hope later somebody maybe will figure out what to do with FreeType and OpenGL in Android. As for today, let’s just disable this code when compiling for Android. ---------------------------------------------------------------------- circular · 2023-09-24 16:06 Thank you, neuro, for your dedicated efforts to improve BGRABitmap's compatibility with Android. I've incorporated your idea on the dev branch and introduced a new package named BGRABitmap4Android, which bypasses the FreeType dependency. I hope this will provide a smoother experience for Android development. I don't have the development environment so we may need to iterate to finalize it. My apologies for the delay in addressing this. Sometimes, in our pursuit for the perfect solution, we might overlook the practical and immediate fixes. Your proactive approach is really valuable to this community and the project.