Jump to content

vfbb

Members
  • Content Count

    266
  • Joined

  • Last visited

  • Days Won

    30

Everything posted by vfbb

  1. @Stefan Glienke Could you add a version constant to Spring.pas? Something like: const Spring4DVersion = 2.0; to help us maintain code compatible with 1.x and 2.0 at the same time, as it would allow: {$IFNDEF DELPHI_12_UP} constructor THashSet<T>.Create(ACapacity: NativeInt); begin {$IF defined(Spring4DVersion) and (Spring4DVersion >= 2)} inherited Create(ACapacity, nil); {$ELSE} inherited Create; {$ENDIF} end; {$ENDIF} This is especially important for large teams/projects that share common code, where some projects and people use version 1.x while others use version 2.x, and the common code should support both.
  2. vfbb

    Skia4Delphi

    Website: github.com/viniciusfbb/skia4delphi Skia4Delphi is a cross-platform 2D graphics API for Delphi based on Google's Skia Graphics Library (skia.org). Google's Skia Graphics Library serves as the graphics engine for Google Chrome and Chrome OS, Android, Flutter, Xamarin, Mozilla Firefox and Firefox OS, and many other products. Skia provides a more robust Canvas, being very fast and very stable, with hundreds of features for drawing 2D graphics, in addition to a text shaping engine designed to render texts in the most diverse languages with right-to-left support (such as the Persian language), full support for loading SVG files, support for creating PDF files, support for rendering Lottie files (verotized animations created in Adobe After Effects), integration with the GPU, among countless other cool features. Skia's idea is similar to Firemonkey's, the same codebase used in an OS will work the same on other platforms. It is also possible to design using the CPU in independent background threads. Skia also has native codecs, of course if you don't use the SKCodec class, when loading an encoded image it will give priority to using the platform's native codec, but it is possible to use its codec, for example for jpeg files it uses libjpeg-turbo and for png files libpng which maybe in certain environments may perform better than native. See some examples: Advanced shapes Advanced text rendering / shaping Svg Lottie files And much more...
  3. vfbb

    Copy from a LSKSurface to a TSKPaintBox

    Hi @martincg! I answered you on another topic with the same issue. To preserve the old content of the bitmap when starts draw with skia, you should call Bitmap.SkiaDraw(..., False);
  4. vfbb

    Skia4Delphi

    @martincg Bitmap.SkiaDraw have a second optional argument, AStartClean: Boolean, and when False you will not lost its content.
  5. vfbb

    delphi12 skia vulkan

    1) Enable Skia on your project (right click on project > Enable Skia; 2) GlobalUseVulkan on FMX.Types is default True on Android, so it will use Skia Vulkan on Android by default;
  6. The current design of Vcl's TCanvas makes it unfeasible to create a wrapper that uses different libraries / different outputs. There is already a request to try to improve this and you can vote: [RSP-43149] Remodel TCanvas to allow injection of a different drawing backend - Embarcadero Technologies So currently, what can be done is to draw using the APIs directly from Skia, that is, using the document's SkCanvas, or you can draw in a TBitmap in the conventional Vcl way and in the end use: SkCanvas.DrawImage(Bitmap.ToSkImage, 0, 0); but I don't recommend this because you wouldn't have a vectorized PDF, and the texts couldn't even be selected/copied, as the PDF would be an image in fact.
  7. From what I saw here, the bad quality seems to be only in the preview control. The output images are in good quality.
  8. @PeterPanettone Please, report that on Quality Portal, it is an issue and should be fixed. As a "workaround", I strongly recommend using SVG: Radioactive SVGs which is working perfectly.
  9. When you Run the app by the IDE, it will share the PATHs of the IDE with your program. IOW, in a project without Skia enabled, using skia controls, if you click on Run on the IDE, it will work fine (because the IDE have on it own PATHs the path to the sk4d.dll), but if you run the Project1.exe on the Windows Explorer, it will crash on startup due the lack of the sk4d.dll.
  10. Additional info: On RAD 12 it is possible to encode animated WebP (better format than GIF). See DocWiki.
  11. vfbb

    Loading .webp images into tbitmap?

    Maybe you have the "Webp Image Extensions" installed: https://apps.microsoft.com/detail/9PG2DK419DRG
  12. Yes, this is relevant only for the .aab generation. Note: you can’t change the ‘condition’ on IDE side, you should open the dproj and add it manually. See one dproj with that: https://github.com/skia4delphi/skia4delphi/blob/eed4afbf8a34137a9bfa308bcb5ef87cee84abcb/Samples/Demo/FMX/Projects/RAD%20Studio%2011%20Alexandria/Skia4Delphi.dproj#L1182
  13. vfbb

    No Android Platform in Delphi 11.3

    Did you configure the paths in Tools > Options > Deployment > SDK Manager?
  14. vfbb

    Colored Notification Icon

    Older versions supported multi-color icons (up to Android 6 or 7 if I'm not mistaken). From then on they are treated as mono color. Even if you have your multi-color icon, Android applies a color filter, with the AccentColor color (if the Use Accent Color is selected). When "Use Accent Color" is not selected, your icon will have the default color of the device's theme. Also, in the Android documentation it is stated that the icon should be white, but in practice there is no difference because Android will apply the color filter anyway. Just don't forget to delete your icon's background.
  15. vfbb

    Colored Notification Icon

    Note: notification icons are always monocolor.
  16. vfbb

    Colored Notification Icon

    Did you try Project Options > Icons > Android > Accent Color?
  17. vfbb

    TMapview Android 12

    The FMX still doesn't support the new splash of Android12+ and the issue of the topic is probably generated by the way of the current FMX splash for Android is configured (WindowsBackground=splash in the center). An issue has already been opened on the quality portal to add support for the new splash format on Android12+.
  18. vfbb

    Skia4Delphi

    Yes! See an example: uses Skia, Skia.FMX {or Skia.Vcl}; procedure SvgStreamToImageStream(const AInputSvgStream, AOutputImageStream: TStream; const AImageWidth, AImageHeight: Integer; const AFormat: TSkEncodedImageFormat = TSkEncodedImageFormat.PNG); var LSurface: ISkSurface; LSvgBrush: TSkSvgBrush; LSvgBytes: TBytes; begin SetLength(LSvgBytes, AInputSvgStream.Size - AInputSvgStream.Position); AInputSvgStream.ReadBuffer(LSvgBytes, Length(LSvgBytes)); LSurface := TSkSurface.MakeRaster(AImageWidth, AImageHeight); LSurface.Canvas.Clear(TAlphaColors.Null); LSvgBrush := TSkSvgBrush.Create; try LSvgBrush.Source := TEncoding.UTF8.GetString(LSvgBytes); LSvgBrush.Render(LSurface.Canvas, RectF(0, 0, AImageWidth, AImageHeight), 1); finally LSvgBrush.Free; end; LSurface.MakeImageSnapshot.EncodeToStream(AOutputImageStream, AFormat); end;
  19. vfbb

    Skia4Delphi

    The library itself does not require a GPU. There is a raster backend that uses only CPU. It should work normally, I even ran it on Windows Server normally. On the other hand, I saw that SkiaSharp already had problems with the Nano Server, so the more information you can give, the better it will be. I suggest opening an issue on the project's github with all the information you have. Skia4Delphi GitHub - Issues
  20. v5.0.0 Added GPU backend render to TSkAnimatedPaintBox in Vcl; #108 Controls Rewritten Canvas, addressing all pending issues and further enhancing performance; #201 #40 FMX Render Improved performance of TSkAnimatedImage in Vcl; Controls Improved anti-aliasing through multi-sampling; FMX Render Improved library reliability through more unit tests; Tests Fixed numerous minor issues and improved the wrapper as well as the C++ code; API Fixed compilation to Android on RAD Studio Rio; #206 API Fixed issues related to transparency and addressed problems with OpenGL in fullscreen mode on Windows #127; FMX Render Fixed deployment for custom build config; #208 Library Fixed custom font in TSkAnimatedImage; #203 Controls Fixed support for Android 5 and Android 6 broken in last version; Library Deprecated SkParticles since Skia stopped maintaining it at Milestone 112; API Minor improvements. Skia version: 107.2.0 Compatibility break We changed very specific APIs, which are unlikely to generate incompatibilities for developers, but a new major was necessary because we faithfully follow the semantic version. Github: github.com/skia4delphi/skia4delphi Website: skia4delphi.org
  21. vfbb

    Skia4Delphi

    Google Skia decision. Just as FMX decided to only encode PNG or JPEG, Skia decided to only encode PNG, JPEG and WEBP (the same goes for other languages). Maybe it's because they only adopted the formats that are widely used on all platforms. Decoding a variety of formats, which already occurs, is really the most important thing. In addition, the accepted formats already meet the needs of the vast majority.
  22. vfbb

    Skia4Delphi

    Just to discover the image format? You can use the TSkCodec.MakeFromStream(LStream).EncodedImageFormat
  23. Let's do it by steps. Few users had problems when updating to version 4, but all who had problems were due to conflicts with older versions of Skia4Delphi installed on the machine. So, for a secure installation, follow these steps: Install running the setup (the manual installation is not recommended) with the IDE closed. You can choose always the same destination folder (prefer the default folder to avoid administrator permission), even if there is an old installation there. Delete old Skia4Delphi folders that you detect on your computer. Check in your "RAD Studio > Options > Language > Delphi > Library > Library Path >" if there is any other skia directory besides these: Check in your "RAD Studio > Component > Install Package" if there is any other skia package besides these: Never drop library files into the RAD Studio folder. The bpls in the bds folder are automatically loaded by the IDE, even though they are not in the Search Path / Registry. If you've ever done that, you should delete them. You should also understand that there are 2 enablements in the library: To add or remove the App library, right-click on the project and choose "Enable Skia" or "Disable Skia". You will only be able to use controls or any unit from the library after this enablement. You can enable replacing the FMX render with the Skia render by adding the line "GlobalUseSkia := True;" and "Skia.FMX" in dpr uses. This is a completely optional feature, as the library controls work fine without this feature. I also emphasize that some libraries are not compatible with Skia's rendering, such as Alcinoe. But we always recommend this feature as it improves the quality of the application's graphics, and fixes several issues that exist in the default FMX render. If you removed the library via step 1 ("Disable Skia" menu) and removed the library units / controls from your form, your application will not have any code from the library running and therefore the exception that remains has nothing to do with the library. About the lack of borders in the TMS controls, does this happen with the Skia render ("GlobalUseSkia := True;"), or without the Skia render? You can check at runtime which render is enabled by giving a simple ShowMessage: procedure TForm1.FormCreate(ASender: TObject); begin ShowMessage(TCanvasManager.DefaultCanvas.ClassName); end; There are 4 implementations of Skia rendering, so it will be Skia rendering if the ShowMessage returns one of the following classes: TSkRasterWindowsCanvas, TGlCanvas, TMtlCanvas, TSkRasterMacOSCanvas
  24. vfbb

    Skia component and IDE

    The BPL’s of some specific paths are loaded automatically when the IDE opens, even if it isn’t in registry.
×