Hello everybody.

Great news!

Finally I find a way to save the canvas of a form, with all his 
child-components into a png file (or bitmap).
Only the canvas is saved, even if the form is covered by other external forms.

Here the trick (thanks to the wonderful BGRABitmap gem):

----------------------------

procedure tmainfo.saveform2png(const Sender: TObject);
var
  btmp: tbgrabitmap;
  r: rectty;
  p: pointty;
begin

 btmp := tbgrabitmap.Create(Width, Height);

  r.x  := 0;
  r.y  := 0;
  r.cx := Width;
  r.cy := Height;

  p.x := 0;
  p.y := 0;

  btmp.Canvas.copyarea(getcanvas, r, p);  // The Trick!

  btmp.savetofile('aBitmap.png');

  btmp.Free;

end;

--------------------------------

That opens lot of new possibilities ( Wayland, etc...)

A zip file with a project demonstrating it is there:
https://github.com/mse-org/mseide-msegui/discussions/62


Fre;D
_______________________________________________
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk

Reply via email to