Problem with Vcl.Skia.BitmapToSkImage()

Hi All,
There is a problem with the Skia helper function Vcl.Skia.BitmapToSkImage as used below.

procedure TForm15.SkSvg1Draw(ASender: TObject; const ACanvas: ISkCanvas; const ADest: TRectF; const AOpacity: Single);
var
  LPaint: ISkPaint;
  LImage: ISkImage;
  LBm: TBitmap;
begin
  if not FBitmap.Empty then
  begin
    LPaint := TSkPaint.Create;
    LBm := TBitmap.Create;
    try
      LImage := Vcl.Skia.BitmapToSkImage(FBitmap);
      LBm := Vcl.Skia.SkImageToBitmap(LImage); <<
      Image1.Picture.Assign(LBm); <<
      ACanvas.DrawImage(LImage, 0, 0, LPaint);
    finally
      LBm.Free;
    end;
  end;
end;

What happens is that FBitmap is converted to the ISkImage correctly the 1st time and displays properly. After this the displayed image is xored or something weird. It’s as though the BitmapToSkImage routine requires resetting or something. Strangely, the 2 lines marked << cause slightly different behavior. The bitmap returned by SkImageToBitmap is also faulty at this point as displayed in Image1. NOTE: Delphi 12 Patch 1

Thanks Gerard Hook

1 Like

The best place to get an answer to this question is in the dedicated Skia4Delphi forum which can be found here: Telegram: View @skia4delphi

The maintainers of the project hang out there and are very active in answering questions; I am pretty sure they can help.

Thanks Ian,

I’ll give that a go.

Gerard