Jump to content

vfbb

Members
  • Content Count

    266
  • Joined

  • Last visited

  • Days Won

    30

Posts 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. 3 hours ago, martincg said:

    if I copy the image to a bitmap then use SKiaDraw on the bitmap the original image information is wiped.

    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);


  3. 1 hour ago, Ralf7 said:

    It would be interesting to create a Canvas -> PDF output under Win32. The question arises as to whether the necessary VCL Canvas APIs are all supported.

    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.


  4. 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.


  5. 10 hours ago, TurboMagic said:

    I tried to follow your idea with the deployment but I didn't fully understand this yet.

    Is this only relevant if I'm building an .aab later on?

    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


  6. 25 minutes ago, AlanScottAgain said:

    I think I was confused because the default notification icon is colored!

    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.

    • Like 1
    • Thanks 1

  7. 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+.


  8. On 3/22/2023 at 1:30 PM, softtouch said:

    Is there a way to convert a svg (its in a tmemorystream) to png (to another tmemorystream)?

    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;

     

    • Like 1

  9. On 4/4/2023 at 2:45 PM, Kyle Miller said:

    Basic question: Skia4Delphi is more than GPU integration. It requires the GPU. Correct?

     

    I ask because I tried running some apps with Skia enabled on Terminal server, and they crashed hard. They run fine on local desktop.

    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
     


  10. github-social-preview.thumb.png.06fa9b6d00c8816b8daf0bf167ba7080.png

     

     

     

    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

     

    • Like 3
    • Thanks 4

  11. 18 minutes ago, softtouch said:

    Why cant it encode bmp format and gif?

    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.


  12. 17 minutes ago, softtouch said:

    How can I get the image forma (jpg, png etc.) of an image stored in a memorystream with skia4delphi?

    Just to discover the image format? You can use the TSkCodec.MakeFromStream(LStream).EncodedImageFormat

    • Like 1

  13. 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:

    1. 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.
    2. Delete old Skia4Delphi folders that you detect on your computer.
    3. Check in your "RAD Studio > Options > Language > Delphi > Library > Library Path >" if there is any other skia directory besides these:
      215127012-f0a5ddb2-f695-4647-bfe4-6b4fe1486f06.png.643b7b6f2bf2249fe7486b1534fb373e.png
    4. Check in your "RAD Studio > Component > Install Package" if there is any other skia package besides these:
      215127048-cf53705d-09c2-41d7-869f-6366fd1cb2db.thumb.png.c23f3bf879eef0d1d8ba5b4a102f6189.png
    5. 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:

    1. 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.
    2. 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


  14. v4.1.0

    • Added new parameters to SkCanvas.SaveLayer; API
    • Added functions ComputeFastBounds and CanComputeFastBounds to SkImageFilter; API
    • Added the properties ApproximateOpCount and ApproximateBytesUsed to SkPicture; API
    • Added ShaderButton demo in VCL & FMX (presented at the Embarcadero Brazil Conference 2022); Samples
    • Added virtual methods to TSkLabel; #182 Controls
    • Added support for beta versions of RAD Studio; Setup
    • Improved codecs load; Render
    • Fixed support for iOS Simulator ARM64; #186 Library
    • Fixed invalid float point operation in texts; Render
    • Fixed trimming issue in TTextLayout; #192 Render
    • Fixed Skia's codecs color type on mobile with Skia's render disabled; #197 Render
    • Fixed ISkPath.IsRect results; API
    • Fixed read of Metal view; Render
    • Fixed cursor in TSkLabel of VCL; Controls
    • Fixed text attributes; Render
    • Fixed controls inside TSkCustomAnimatedControl in VCL; Controls
    • Fixed TextLayout before 10.2 Tokyo; Render
    • Fixed iOS certificate issues in main demo; Samples
    • Fixed NavigationBar color on Android12+ in main demo; Samples
    • Fixed and improved unit tests; Tests
    • Minor improvements.

    Skia version: 107.1.0

     

    New ShaderButton demo (VCL & FMX)

     

     

    • Like 5
×