Jump to content

vfbb

Members
  • Content Count

    281
  • Joined

  • Last visited

  • Days Won

    31

Posts posted by vfbb


  1. Ok. In the previous folder also does not have any files? "Skia4Delphi\Library\Delphi10Sydney\Win32\Release\"

    If you don't have any files either, check your rsvars.bat, "C:\Program Files (x86)\Embarcadero\Studio\22.0\bin\rsvars.bat", if it contains the same content:

     

    @SET BDS=C:\Program Files (x86)\Embarcadero\Studio\21.0
    @SET BDSINCLUDE=C:\Program Files (x86)\Embarcadero\Studio\21.0\include
    @SET BDSCOMMONDIR=C:\Users\Public\Documents\Embarcadero\Studio\21.0
    @SET FrameworkDir=C:\Windows\Microsoft.NET\Framework\v4.0.30319
    @SET FrameworkVersion=v4.5
    @SET FrameworkSDKDir=
    @SET PATH=%FrameworkDir%;%FrameworkSDKDir%;C:\Program Files (x86)\Embarcadero\Studio\21.0\bin;C:\Program Files (x86)\Embarcadero\Studio\21.0\bin64;C:\Program Files (x86)\Embarcadero\Studio\21.0\cmake;C:\Users\Public\Documents\Embarcadero\InterBase\redist\InterBaseXE7\IDE_spoof;%PATH%
    @SET LANGDIR=EN
    @SET PLATFORM=
    @SET PlatformSDK=

     


  2. @TimCruise You will have to remove these two registries and reinstall skia4delphi. But to be sure, follow the steps:

     

    1) Uninstall via GetIt (if you haven't already)

    2) With your RAD Studio closed, delete these two skia records in "HKEY_CURRENT_USER\SOFTWARE\Embarcadero\BDS\21.0\Disabled Packages"

    3) Go to Windows Configurations > Applications > search for Skia4Delphi (if found, uninstall it with your RAD Studio closed).

    4) Check if the file "C:\Users\Public\Documents\Embarcadero\Studio\Skia4Delphi\unins000.exe" exists, if so, run it to uninstall.

    5) Install the Skia4Delphi running the "Skia4Delphi_2.0.1_Setup.exe", because some uses have reported problems using out GetIt package in Sydney. In setup's platforms screen, select just the platforms that your IDE is already to compile.

    6) After installation, try to run our sample "skia4delphi\Samples\Basic\FMX\Skia4Delphi_Basic.dproj"


  3. 8 hours ago, TimCruise said:

    Are you the author?

    Yes, my brother and I are the authors.

     

    8 hours ago, TimCruise said:

     

    Right. I suspect that some unsuccessful install is hampering new installs, but I need more information:

    1) Did you install only using installer (Skia4Delphi_2.0.1_Setup.exe) or did you try another method (GetIt or manual)?

    2) Was there an error during an installation? If so, do you still have the Build.Logs.txt that is generated in the folder you installed skia4delphi in?

    3) Access RegEdit.exe, and take a screenshot of "HKEY_CURRENT_USER\SOFTWARE\Embarcadero\BDS\21.0\Known Packages" and "HKEY_CURRENT_USER\SOFTWARE\Embarcadero\BDS\21.0\Disabled Packages".


  4. 22 minutes ago, TimCruise said:

    And now, I am still facing these 2 errors after I have installed Skia from within RAD Studio.  How do I correct them?  :classic_huh:

     

    skiaerror2.png.4d52c860f278264d43d74d8a34d7bb11.pngskiaerror1.png.e0f864666dd63a4c770ccfa5ed389845.png

    Now that's a mistake. Probably the folder you are installing requires administrator permission and you have not run the installer as an administrator.

     

    The solution in this case is to uninstall and install in the default folder that the installer suggests (does not require admin permission).


  5. @TimCruise 

     

    There is but you need a macOS to install the SDK in your RAD Studio. It's even possible to run macOS on windows with VMWare, but that's probably illegal.

    Anyway, with the SDK installed you'll only be able to compile, the simulator doesn't work, you'll have to have an iPhone too.

     

    Without the SDK, you won't even be able to compile a blank project for the platform you want.

     

    About the Skia4Delphi installer, basically it checks if it is possible to compile for the platform, so if your delphi is really ready to compile for the platform, then yes it will appear available to be selected in its installation.


  6. Hello. I adapted your test with Skia4Delphi to directly access the pixels instead of painting the pixel. The result was 45 ms on win64.

     

    procedure TfrmMain.Button3Click(Sender: TObject);
    
      procedure DrawMandelbrotPixmap(APixmap: ISkPixmap; X, Y, au, bu: Double; X2, Y2: Integer);
      var
        c1, c2, z1, z2, tmp: Double;
        i, j, Count, rgb: Integer;
        hue, saturation, value: Double;
      begin
        c2 := bu;
        for i := 10 to X2 - 1 do
        begin
          c1 := au;
          for j := 0 to Y2 - 1 do
          begin
            z1 := 0;
            z2 := 0;
            Count := 0;
            // count is deep of iteration of the mandelbrot set
            // if |z| >=2 then z is not a member of a mandelset
            while (((z1 * z1 + z2 * z2 < 4) and (Count <= 50))) do
            begin
              tmp := z1;
              z1 := z1 * z1 - z2 * z2 + c1;
              z2 := 2 * tmp * z2 + c2;
              Inc(Count);
            end;
            // The color depends on the number of iterations
            hue := count / 50;
            saturation := 0.6;
            value := 0.5;
    
            PCardinal(APixmap.PixelAddr[i, j])^ := HSLtoRGB(hue, saturation, value);
            c1 := c1 + X;
          end;
          c2 := c2 + Y;
        end;
      end;
    
    var
      au, ao: Double;
      dX, dY, bo, bu: Double;
      LWidth: Integer;
      LHeight: Integer;
      LTimer: TStopwatch;
      LBitmap: TBitmap;
      LSurface: ISkSurface;
    begin
      LTimer := TStopwatch.StartNew;
      LWidth := Image1.Width;
      LHeight := Image1.Height;
      LSurface := TSkSurface.MakeRaster(LWidth, LHeight);
    
      LBitmap := TBitmap.Create(LWidth, LHeight);
      try
        ao := 1;
        au := -2;
        bo := 1.5;
        bu := -1.5;
        // direct scaling cause of speed
        dX := (ao - au) / (LWidth);
        dY := (bo - bu) / (LHeight);
        DrawMandelbrotPixmap(LSurface.PeekPixels, dX, dY, au, bu, LWidth, LHeight);
        LBitmap.SkiaDraw(
          procedure (const ACanvas: ISkCanvas)
          begin
            ACanvas.DrawImage(LSurface.MakeImageSnapshot, 0, 0);
          end);
        Image1.Picture.Assign(LBitmap);
      finally
        LBitmap.Free;
      end;
    
      Showmessage(LTimer.Elapsed.TotalMilliseconds.ToString+' ms');
    end;

     

    However, your benchmark isn't accurate, you're basically changing pixel by pixel, it's not a good way to measure drawing library performance.

     

    Also, tasks that change an image pixel by pixel almost always perform better by creating a shader to run on the GPU. This is another advantage of Skia4Delphi, as it allows you to create shaders at runtime through the Skia Shader Language (based on GLSL). Even now I'm preparing a VCL sample of an animated shader, see the performance:

     

     

     

    • Like 4

  7. Eric, what version of your PAServer? Is it 13.0.12.0? I couldn't confirm it, but someone reported in a whatsapp group that the PAServer patch 1 link on my.embarcadero.com is the link of the old version, 13.0.11.9...

     

    So if that's your case, install the patch via getit and use the new PAServer which will be in the RADStudio directory.


  8. @Hans♫ I couldn't simulate your problem. I set up the same scenario you described in a blank project and the scroll worked perfectly. I also mounted on a TVertScrollBox and it worked perfectly. I'm using RAD Studio 11, but it works the same as in previous versions. Try simulating on a blank project to see where the problem is. I don't know what's going on, but maybe some other control is capturing the gesture...


  9. You can use OnClick normally with this code:

    uses
      FMX.Objects, FMX.Math, FMX.Math.Vectors;
    
    type
      TipControl = class(TRectangle)
      private const
        DEFAULT_MOVEMENT_TOLERANCE = 4;
      private
        FAbsolutePressedPoint: TPointF;
        FIsMouseDown: Boolean;
        FIsValidClick: Boolean;
        FLastMouseActivePoint: TPointF;
        FMovementTolerance: Single;
        function IsMovementToleranceStored: Boolean;
      protected
        function CheckHasValidClick: Boolean; virtual;
        procedure Click; override;
        procedure DoClick; virtual;
        procedure MouseDown(AButton: TMouseButton; AShift: TShiftState; X, Y: Single); override;
        procedure MouseMove(AShift: TShiftState; X, Y: Single); override;
        procedure MouseUp(AButton: TMouseButton; AShift: TShiftState; X, Y: Single); override;
      public
        constructor Create(AOwner: TComponent); override;
        property IsValidClick: Boolean read FIsValidClick;
      published
        property MovementTolerance: Single read FMovementTolerance write FMovementTolerance stored IsMovementToleranceStored;
      end;
    
    function TipControl.CheckHasValidClick: Boolean;
    
      function CheckIsMouseOver: Boolean;
      begin
        Result := FIsMouseOver and TouchTargetExpansion.MarginRect(LocalRect).Contains(FLastMouseActivePoint);
      end;
    
    begin
      Result := FIsValidClick and FIsMouseDown and CheckIsMouseOver and
        ((FMovementTolerance = 0) or ((PressedPosition.Distance(FLastMouseActivePoint) <= FMovementTolerance) and
        (FAbsolutePressedPoint.Distance(LocalToAbsolute(FLastMouseActivePoint)) <= FMovementTolerance)));
    end;
    
    procedure TipControl.Click;
    begin
      if Pressed then
      begin
        if not CheckHasValidClick then
          FIsValidClick := False;
        if IsValidClick then
          DoClick;
      end
      else
        DoClick;
    end;
    
    constructor TipControl.Create(AOwner: TComponent);
    begin
      inherited;
      FMovementTolerance := DEFAULT_MOVEMENT_TOLERANCE;
      FLastMouseActivePoint := PointF(-10000,-10000);
    end;
    
    procedure TipControl.DoClick;
    begin
      inherited Click;
    end;
    
    function TipControl.IsMovementToleranceStored: Boolean;
    begin
      Result := not SameValue(FMovementTolerance, DEFAULT_MOVEMENT_TOLERANCE, TEpsilon.Position);
    end;
    
    procedure TipControl.MouseDown(AButton: TMouseButton; AShift: TShiftState; X,
      Y: Single);
    begin
      FAbsolutePressedPoint := LocalToAbsolute(PointF(X, Y));
      FIsValidClick := True;
      FIsMouseDown := True;
      FLastMouseActivePoint := PointF(X, Y);
      inherited;
    end;
    
    procedure TipControl.MouseMove(AShift: TShiftState; X, Y: Single);
    begin
      if CheckHasValidClick then
      begin
        FLastMouseActivePoint := PointF(X, Y);
        if not CheckHasValidClick then
          FIsValidClick := False;
      end
      else
        FLastMouseActivePoint := PointF(X, Y);
      inherited;
    end;
    
    procedure TipControl.MouseUp(AButton: TMouseButton; AShift: TShiftState; X,
      Y: Single);
    var
      LInvalidPressed: Boolean;
    begin
      FLastMouseActivePoint := PointF(X, Y);
      LInvalidPressed := not CheckHasValidClick;
      if LInvalidPressed then
        FIsValidClick := False;
      FIsMouseDown := False;
      inherited;
    end;

     

    • Like 1

  10. 13 hours ago, Antonello said:

    Hello, I would like to integrate freehand drawing into my firemonkey mobile application.

    I tried with the standard tools drawing on a Canvas using the onMouseDown and onMouseMove events ... but the result is always very jagged lines.

    Is it possible with Skia4Delphi to have a better result? I get the drawing like the picture attached here

    Thank you

    Antonello

    Schermata 2021-10-01 alle 18.55.18.png

     

    Made sample here: https://github.com/viniciusfbb/skia4delphi/issues/12#issuecomment-933528854

     

    Result:

    135866542-1ecbe2fe-d8c0-49ac-bad9-b2a3fe0745a1.thumb.png.8e1a5a89c477ff549e8d2035110572c3.png

     

     

    • Like 1

  11. Skia4Delphi-Black.png.94bc9658491fe9fbfdfc4795bb44c97d.png

     

     

    We are very pleased to announce the 2.0 release of the Skia4Delphi project. The library was almost completely rewritten, bringing many new features such as visual components (VCL/FMX), easy installation, easy configuration, miscellaneous error handling, and much more. Now it also has many more features as well as more examples. See main changes:

     

    v2.0.0

     

    • Added support for Delphi 11
    • Added support for OSX ARM 64-bit
    • Added Setup (friendly install)
    • Added IDE plugin to enable the skia in your project: replacing manual changes in project settings, deployment and dlls that were needed before. Now it's automatic, just right click on your project inside the IDE then "Enable Skia"
    • Built-in by default the "icudtl.dat" file in dll
    • Added the controls TSkLottieAnimation, TSkPaintBox and TSkSvg
    • Added SkParagraph (multiple styles in text)
    • Added support for Telegram stickers (using TSkLottieAnimation)
    • Added error handling in sensitive methods
    • Added the source of our website: https://skia4delphi.org
    • Library rewritted
    • Improved the integration with apple's MetalKit
    • Improved library usage, like replacing SkStream to TStream
    • Fixed AccessViolation using TStream
    • Fixed issue with transparent bitmap in Vcl sample
    • Fixed minor issues
    • Explained Svg limitations in documentation
    • We are now using the latest inactive milestone release of Skia (M88), because the others are updated frequently.
    • Deprecated non-windows platforms in Delphi 10.3 Rio or older

     

    Homepage: skia4delphi.org

    GitHub: https://github.com/viniciusfbb/skia4delphi

     

     

     

     

     

    A liittle preview

     

     

    Setup

    installation1.png.9390e469a1285c330adf0cccfbf0eda7.pnginstallation2.png.7f89039665d6b0ee61f099d21e793df8.png

    Just download the Skia4Delphi_2.0.0_Setup.exe attached in Releases page.

     

     

    Enabling your project

    enabling_project.png.d13c060749e8d6be67f55bbae9814729.png

     

     

    Telegram sticker (tgs files):

    telegram_sticker.gif.63664ff8398d45a0504fcc0501c9e302.gif

     

     

    SkParagraph:

    textparagraph.png.0f740e24c74d14c23f542e2316281a76.png

     

     

    WebP:

    kung_fu_panda.webp

    kung_fu_panda.thumb.png.2042f6ab8ba50506d0c20e21d608fcca.png

     

    Format Size
    Png (100% quality) 512 KB
    Jpeg (80% quality) 65.1 KB
    WebP (80% quality) 51.6 KB

     

     

    Controls

    controls.png.78c132e3b402d1a2241c49ff2e8d88ee.png

     

     

     

     

    And much more...

     

     

    • Like 8
    • Thanks 1

  12. 58 minutes ago, Rollo62 said:

    IWhat prerequisites do you need for that, does all modern browser have PDF viewer already integrated ?

    I think Firefox can do that without any AddOn, but I'm not so sure about all the others ( Chrome, Edge ).

    Edge, Firefox and Chrome open any pdf without addon.

    • Like 1

  13. Try this:

    uses
      System.SysUtils, System.IOUtils, Winapi.Windows, Winapi.ShellAPI;
    
    procedure OpenPdf(const AFileName: string);
    var
      LURL: string;
    begin
      LURL := TPath.GetFullPath(AFileName).Replace('\', '/', [rfReplaceAll]);
      LURL := 'file://' + LURL;
      ShellExecute(0, 'open', PChar(LURL), nil, nil, SW_SHOWNORMAL);
    end;

     

    • Sad 1

  14. 4 hours ago, Rollo62 said:

    Do You mean raster images, that have been "vectorized", or any Adobe SVG in general ?

     

    Have you figured out what exactly went wrong in those Adobe files ?

    Maybe there are easy ways to re-convert it ( like open/save with InkScape) to make them running, I will try to check that later.

    I didn't really investigate enough, I just noticed that more complex SVGs converted by Adobe programs weren't being read correctly. I reported this issue to skia and sent two examples of .eps files converted to SVG by adobe and another converter, where adobe's SVG is not rendered and other converters' SVG is rendered.

     

    Examples are attached.

    incompatible_svgs.zip

×