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:
27.11.2021_01.05.45_REC.mp4
27.11.2021_01.05.45_REC.mp4