Einzelnen Beitrag anzeigen

Benutzerbild von Matze
Matze
(Co-Admin)

Registriert seit: 7. Jul 2003
Ort: Schwabenländle
14.929 Beiträge
 
Turbo Delphi für Win32
 
#1

Inhalt von TGraphic in ein Bitmap konvertieren

  Alt 29. Sep 2006, 21:17
DGL-luke zeigt hier, wie man den Inhalt von TGraphic als Bitmap erhält.

Delphi-Quellcode:
procedure GetBitmap(const Graphic: TGraphic; out Bitmap: TBitmap);
begin
  if Bitmap = nil then
    Bitmap := TBitmap.Create;
  Bitmap.SetSize(Graphic.Width,Graphic.Height);
  Bitmap.Canvas.Draw(0,0,Graphic);
end;
In manchen Fällen funktioniert die folgende Lösung nämlich nicht immer:

Delphi-Quellcode:
procedure GraphicToBitmap(const g: TGraphic; out bmp: TBitmap);
begin
  bmp.Assign(g);
end;
  Mit Zitat antworten Zitat