-
Content Count
281 -
Joined
-
Last visited
-
Days Won
31
Posts posted by vfbb
-
-
23 minutes ago, domus said:Tested with over 3000 rotating rectangles, with assigned bitmaps. FMX still runs very smoothly, but Skia was jerky (even with GlobalUseSkiaRasterWhenAvailable = False).
With 200 rotating rectangles, I have the impression Skia is smoother.
All very subjective observations, of course. Not certain if any of this information is useful.
There are 2 questions in your test:
1) On the Windows platform, both the FMX and Skia canvas present very similar results, both in terms of quality and performance. Although on my machine there was a 10% gain, some reported the opposite, but overall both were satisfactory in all tests. On non-Windows platforms, the performance differences are greater and a second problem arises, which is the quality of the drawings (there is only antialiasing on FMX Windows, while on Skia there is maximum quality on all platforms);
2) In our canvas implementation, bitmaps are not as optimized as they could be. We split our canvas into 2 parts, the window canvas (form) and the bitmap canvas. In the implementation of the canvas bitmap we always decided to use the raster mode because we wanted the TBitmap to be used in background threads without locking the UI (embarcadero put a lock on the canvas that blocks drawings in parallel, even if you use bitmaps in threads, the drawings are not actually done in parallel, one blocks the other during BeginScene and EndScene). In our tests this raster implementation of bitmaps didn't affect the performance of projects that don't abuse bitmaps as much (but it's not your case, you're drawing 300 bitmaps at once);
-
39 minutes ago, domus said:Now it's flying again!
However, is Skia still being used for bitmaps when this is set to False?
Yes. When you set "GlobalUseSkia := True;", the lib replaces the app's default canvas to the skia-based canvas. However, we made more than 1 canvas based on skia: a raster canvas (CPU), an opengl canvas (GPU) and a metal canvas (GPU).
When creating the first form or drawing with bitmaps (which is when the FMX canvas system is started), we check if GlobalUseSkia is true, and if it is, we will choose one of our implementations based on the booleans GlobalUseSkiaRasterWhenAvailable and GlobalUseMetal, and on the target platform.
But why use by default on Windows a raster canvas (which runs on the CPU), since the canvases that run on the GPU are faster? This was done because it is the most compatible mode of all, as some specific VMs do not implement full openGL support and often this is not possible to verify via code.
In the future we intend to add new canvas implementations based on skia, such as the Vulkan implementation. Perhaps Vulkan was better implemented on Windows VMs.
-
7 minutes ago, domus said:That was it! Many thanks!
Odd that this wasn't necessary in the first test project.
Without this step it will work when you run your app on Windows through the IDE run (because the IDE shares the same env PATH with the exe it is running).
But the rule is: whenever you are going to use any skia code in an application (vcl, console or fmx), do this step. This should only not be done in libraries that use skia.
9 minutes ago, domus said:However, while the test (just rotation bitmaps) runs very smoothly in standard FMX, it comes to an absolute crawl when I set GlobalUseSkia := True.
This is not expected. Can you add a new line above your GlobalUseSkia declaration:
GlobalUseSkiaRasterWhenAvailable := False;
-
35 minutes ago, domus said:Installed fine (Windows 10) and worked fine in first project test. When I try a second project, I keep getting "skia library could not be loaded". These are tiny one-unit test projects.
Anyone have any idea what I'm overlooking? Thx.
Have you enabled skia in your project? Inside of IDE, right click in your project > Enable Skia. Maybe after that you have to rebuild your project (Clean and Compile). This step is made to configure skia binaries in your project...
Maybe this is also @Serge_G problem too.
6 hours ago, Serge_G said:installing Ubuntu 20.04
My Ubuntu is 20.04 too (although it should work on 18.04 too)
-
42 minutes ago, everybyte2 said:Webinar demo creates a PDF from a bitmap of the control, as a result PDF does not scale well.
With a fix in Skia I do create scalable PDFs on Windows (where Printer canvas is available),
but this solution is not portable, at least for Android.
You are sure! I hadn't realized it.
I have an idea how to solve this, maybe I can put it in a next version.
-
1
-
-
17 minutes ago, everybyte2 said:Can anybody suggest a component or library to print an FMX control to a PDF?
You didn't get it with Skia? On github there is a demo just printing a control in PDF.
Source: Webinar Demo - SourceVideo: Webinar Demo - YouTube
-
On 5/2/2022 at 5:33 AM, Serge_G said:Hi,
It worked as expected on Android, but I can't test on Ubuntu
I first have a problem of a lacking package I think it was zlib1g-dev, I install this one. But, if now I can deploy my project or the demo the program don't run. What did I miss ? Is there any doc/help for a "good" deployment ?
What is your Ubuntu version? The packages needed to run on Ubuntu are the same for FMXLinux, if you can run a blank fmx app on your Ubuntu, you will be able to run our demo.
@Edit
Note: The Linux version of skia4delphi works only in RAD Studio 11.
-
11 minutes ago, everybyte2 said:A second question about printing:
Skia has an example of rendering to a PDF canvas, but this canvas is of a TskCanvas class
and thus not compatible with FMX adapter class TSkCanvasCustom (which uses TskCanvas internally).
Is there an easy way to create TSkCanvasCustom from a given TskCanvas instance?
You cannot convert SkCustomCanvas <> SkCanvas. However, you can transform bitmaps into ISkImage (via TBitmap.ToSkImage) and paint it in ISkCanvas of the PDF. That way you can do anything, for example, paint controls on a TBitmap, convert that TBitmap to ISkImage, and then paint that ISkImage onto the PDF's ISkCanvas.
20 minutes ago, everybyte2 said:Has anybody tried to do printing of an control ?
The TextLayout is bound to TSkCanvasCustom for display but the printing goes to GDI+ canvas,
which custom TextLayout knows nothing about. As a result all text is missing in the printout.
Printing is an untested area in our project, so it's possibly an issue. It would really help if you opened an issue on the GitHub page with a project that simulates the problem.
-
@Rollo62 Eugene's idea (creator of FMX) is great. He creates regions with cached drawings, through his control, then it is the programmer who has to define where he will cache the drawings, and have moderation about it. Unfortunately I had some issues mainly with updating the drawings of some controls inside it, so I never used it in production.
I'm very conservative when I think about third-party libraries. Some libs also partially solve the FMX performance problem, but they leave you hostage, since you have to change all your codes, use their controls, etc. This is the main difference, you implement Skia in your app changing only 1 line in dpr. The day you want to remove the library, just remove the line...
About updates and development stage, we still don't have the best code design and there's still a lot to optimize, a lot, such as: using Vulkan on Android and Windows 10+, and using hardware acceleration in drawings inside bitmaps, etc. But one thing I can say, it's very stable, it's no wonder that today we have 0 issues.
-
1
-
2
-
-
19 hours ago, Rollo62 said:FMX has the drawback that it repaints the whole screen, even when only a small fraction of the screen has changed.
How is the screen painting handled in Skia controls ?
Is the control handled by Skia external library, or does it still behave like the original FMX ?
Yes, we repaint the entire screen with every render.
Unfortunately FMX is right. To repaint only modified controls, we would have to have a layering system, basically a bitmap for each control containing the control draw cached. It would be a very high speed drawing system, because drawing bitmaps on the screen (without strech), is an almost instantaneous operation. However, there is an insurmountable problem with this solution: memory consumption. Bitmaps consume a lot of memory, if each control has its own, you will quickly have a memory overflow. In addition you will have other problems, such as controls that are larger than the MaxSize of the bitmap accepted on the device (such as scrollbox). On a device with infinite memory this would be the best option, but it is not the case.
There is another option, which FMX even implemented, which is to "filter" all controls that were changed through the region that was changed, repainting only them and with ClipRect on the changed region (it does this for Canvas that have the flag TCanvasStyle.SupportClipRects). Intuitively, this seemed like a great solution, but in practice it surprisingly turned out to be slightly worse. This is probably why FMX also disabled this option on non-Windows platforms.
-
@Rollo62 The replacement of the FMX graphic engine by Ski4Delphi graphic engine (which is done just by adding the line "GlobalUseSkia := True;" in the dpr), affects all the drawings in your app, whether the screen controls or drawings in TBitmaps. So even delphi controls like TRectangle, TCircle, and all others (even third-party controls) are now rendered on screen by the Skia-based Canvas. Everything is done automatically internally. With this, your entire application will automatically gain:
- Performance (up to 50%)
- Quality in drawings (everything is rendered with antialiasing, and maximum quality, producing smooth curves, no jagged edges)
- Fidelity (there are dozens of bugs in the FMX render that do not occur with Canvas based on Skia, mainly involving Metal)
- And other advantages-
3
-
4
-
-
- Added StrokeColor property to TSkLabel;
- Added LetterSpacing property to TSkLabel;
- Added automatically Skia to uses when use controls in form;
- Added EncodedImageFormat property and MakeFromStream to SkCodec;
- Added MakeRawShader to SkImage;
- Added MakeImage to SkRuntimeEffects;
- Exposed DirectContext in TGrCanvasCustom class to run code on the GPU more easily;
- Fixed BackgroundColor property of TSkLabel;
- Fixed issue loading bitmaps from stream when using Skia in Vcl project;
- Fixed build script with python3 as default;
- Minor improvements and fixes.
New StrokeColor property of TSkLabel
Github: github.com/skia4delphi/skia4delphi
Website: skia4delphi.org
-
7
-
1
-
-
Hi @enesgeven!
I didn't find this issue in the quality portal so I reported it: https://quality.embarcadero.com/browse/RSP-37935
Just a tip: This issue is fixed in the latest version of Skia4Delphi (3.3.2). Not only this problem but a dozen others. Our Metal is as stable as OpenGL. Just enable Skia4Delphi as your app's renderer, and all issues will be resolved.
-
On 4/5/2022 at 10:20 AM, John van de Waeter said:Hi VFBB,
What is the minimal Android version supported?
On Android 6 I get an OpenGLES error (3009)...Cheers,
John
The problem was fixed in new version 3.3.2.
Fix: We support Android 5+
-
- Changed Skia4Delphi's default Canvas on Windows to raster based to avoid some issue in specific scenarios; (1)
- Fixed support to Android 5.0, 5.1 and 6.0 when using Skia4Delphi Canvas;
- Fixed form draw in Metal when "Zoomed setting" is enabled in iOS/macOS settings when using Skia4Delphi Canvas; (RSP-37935)
- On Windows, Skia4Delphi has 2 types of Canvas to render the forms: GPU based and raster based (CPU). Before this release, the default was GPU based, however, support for GPU operations is not well implemented by the OS in some scenarios, especially in some VMs. It is not possible to detect these scenarios at runtime, so we changed our default Canvas to raster based (CPU) on Windows. However, you can still force the use of our GPU-based Canvas by adding to the dpr: GlobalUseSkiaRasterWhenAvailable := False;. Both have excellent and higher performance than the FMX but there are specific operations where the GPU-based Canvas is much faster, such as running shaders, mainly created by SkRuntimeEffects.
-
@John van de Waeter I confirmed the problem. I reported it on GitHub, you can follow it there: https://github.com/skia4delphi/skia4delphi/issues/94
-
1
-
-
11 hours ago, John van de Waeter said:What is the minimal Android version supported?
On Android 6 I get an OpenGLES error (3009)...It supports Android 4.1 JellyBean+. I will test it ASAP.
-
1
-
-
- Fixed TSkLabel click in Vcl;
- Fixed bitmaps starting with garbage when using Skia4Delphi Canvas;
- Fixed AV in TSkLabel and TSkTextLayout in specific cases involving $13 char;
- Fixed AV drawing uninitialized bitmaps when using Skia4Delphi Canvas;
-
2
-
-
- Added HeightMultiplier property to TSkLabel to change the default line height;
- Added tag properties to TCustomWordsItem of TSkLabel;
- Added TItemClickedMessage to intercept the OnClick of all TCustomWordsItem of TSkLabel controls;
- Improvements in the OnClick triggering of TSkLabel items;
- Fixed many issues in Windows when using Skia4Delphi Canvas (including combobox dropdown);
- Fixed wrong colors in iOS with services when using Skia4Delphi Canvas: IFMXTakenImageService, IFMXCameraService, IFMXPhotoLibrary and IFMXShareSheetActionsService;
- Fixed effects and filters issue in Metal when using Skia4Delphi Canvas;
- Fixed wrong text size when using Skia4Delphi Canvas (fixing problems with TMemo and TTMSFMXHTMLText);
- Fixed AV in TSkLabel when the text of a TWordsItem starts with a sLineBreak;
- Fixed case-insensitive of image formats when saving images;
- Fixed wrong draws with stroke thickness zero when using Skia4Delphi Canvas;
- Fixed black screen startup on iOS in simple forms with only shapes when using Skia4Delphi Canvas;
- Fixed specific cases of performance issues in Windows when using Skia4Delphi Canvas;
- Fixed projects of RAD Studio 11;
- Fixed popup menu exception in rasterization mode when using Skia4Delphi Canvas;
- Fixed modulate color problem before RAD Studio 11.1 (which involves TintColor and TintIconColor properties on mobile);
- Minor improvements and fixes.
Github: github.com/skia4delphi/skia4delphi
Website: skia4delphi.org
-
12
-
@eg1 This problem will be automatically fixed if you use the last version of skia4delphi. I reported the problem and solution to embarcadero too.
-
@ginnix Confirmed the issue! I reported the problem on Github, you can follow it there: https://github.com/skia4delphi/skia4delphi/issues/81
-
Hi @b1ol, the default HitTest of TSkSvg and TSkAnimatedImage is False. So, you need to set the property HitTest to True to use the mouse operations.
-
1
-
ANN: Skia4Delphi v3.4.0
in Delphi Third-Party
Posted
Skia does not support animated SVG. There are very few libs that support SVG animations and even then I believe there are no versions for delphi.
However, there is something similar, and much better: lottie. Lottie are also vectorized animations in json format. As with SVG, you can also find lottie of everything on the internet. You can also create your own animation using Adobe After Effects (although it's hard for programmers lol). However it is not possible to edit it at runtime.
Note: Replacing your app's canvas (GlobalUseSkia := True) is optional. You'll be able to use svg, lottie, skia controls, even without skia being your app's renderer. However, skia controls perform better when your app's canvas is based on skia (GlobalUseSkia := True)