AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Sprachen und Entwicklungsumgebungen Object-Pascal / Delphi-Language Delphi Performanceproblem: Anzeige von Positionen mehrerer Clients
Thema durchsuchen
Ansicht
Themen-Optionen

Performanceproblem: Anzeige von Positionen mehrerer Clients

Ein Thema von alphaflight83 · begonnen am 20. Dez 2010 · letzter Beitrag vom 14. Feb 2011
 
Benutzerbild von alphaflight83
alphaflight83

Registriert seit: 5. Jun 2008
Ort: Würzburg
148 Beiträge
 
Delphi 12 Athens
 
#9

AW: Performanceproblem: Anzeige von Positionen mehrerer Clients

  Alt 11. Feb 2011, 09:52
So, ich glaube ich habe nun das Ergebnis, das ich haben wollte.

Zunächst mal hab ich einen Zwischenschritt beim Zeichnen weggelassen der keinen Sinn machte
und zeichne nun alles auf EIN Offscreenbitmap.

Mit GDIPlus hab ich nun auch bei den rotierten Images ein zufriedenstellendes Ergebnis erzielt.

Anmerkungen:
Der Beispiel-Code verwendet kein Offscreenbitmap.
Die Bilsen GDIPlus Implementation verwendet Objekt-Interfaces.

Delphi-Quellcode:
uses GDIPlus;

procedure TFormDrawThis.DrawImages;
var
  Graphics: IGPGraphics;
  Image: IGPImage;
  Matrix: IGPMatrix;
  imgWidth, imgHeight : Integer;
  Angle : Single;
begin
  (* Lock the canvas *)
  Canvas.Lock;

  (* Get the dimensions of the bitmap *)
  imgWidth := Image.GetWidth;
  imgHeight := Image.GetHeight;
   
  (* Create the GDIPlus components *)
  Graphics := TGPGraphics.Create(Canvas.Handle);
  Image := TGPImage.Create(sImage_Path + 'AwesomeImage.png', TRUE);
  (* Create the transformation matrix *)
  Matrix := TGPMatrix.Create;

  (* Set the transformation *)
  Angle := 30.0;
  Matrix.Translate(150, 100);
  Matrix.RotateAt(Angle, TGPPointF.Create(150, 100), MatrixOrderAppend);
  Graphics.SetTransform(Matrix);

  (* Draw the image according to the transformation translated to it's center *)
  Graphics.DrawImage(Image,-imgWidth*0.5,-imgHeight*0.5, imgWidth, imgHeight);

  (* Reset the transformation in the matrix and the graphics *)
  Graphics.ResetTransform;
  Matrix.Reset;

  (* Set the new transformation *)
  Angle := 120.0;
  Matrix.Translate(100, 150);
  Matrix.RotateAt(Angle, TGPPointF.Create(100, 150), MatrixOrderAppend);
  Graphics.SetTransform(Matrix);

  (* Draw the next image according to the transformation translated to it's center *)
  Graphics.DrawImage(Image,-imgWidth*0.5,-imgHeight*0.5, imgWidth, imgHeight);

  (* Reset the transformation in the matrix and the graphics *)
  Graphics.ResetTransform;
  Matrix.Reset;
   
  (* aso *)

  (* Flush all the stuff to the canvas *)
  Graphics.Flush();
end;
Falls jemand eine einfachere Möglichkeit kennt, immer her damit

Gruß, alphaflight83
Make me a sandwich! - What? Make it yourself. - Sudo make me a sandwich! - Okay

Geändert von alphaflight83 (11. Feb 2011 um 10:09 Uhr) Grund: Anmerkungen
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 23:00 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz