![]() |
[Firemonkey] TBitmap.Rotate Center?
Hi,
in Firemonkey gibts ja sone tolle Prozedur in TBitmap ( ![]() ![]() Ich bin mir nicht sicher ob ich den Source Code der Prozedur posten darf also mache ich es mal nicht. Freundliche Grüsse |
AW: [Firemonkey] TBitmap.Rotate Center?
Habs hinbekommen, war einfacher als gedacht. ^^
Falls es jemand mal brauchen sollte hier ein Beispiel, funktioniert wie ich das brauche und ohne Matrizen :D
Delphi-Quellcode:
Nun hat man die alten Koordinaten des Null-Punktes (in diesem Fall: X0 Y0) und kann das gedrehte Bitmap einfach auf die richtige Stelle rendern.
function RotatePoint(const APoint, ACenter : TPointF; const AAngle : single) : TPointF;
begin Result := (APoint - ACenter).Rotate(DegToRad(AAngle)) + ACenter; end; var LNullPoint, LNullPointRotated : TPointF; begin FRotatedBitmap.Assign(FBitmap); FRotatedBitmap.Rotate(45); LNullPoint := PointF((FRotatedBitmap.Bitmap.Width-FBitmap.Bitmap.Width)/2, (FRotatedBitmap.Bitmap.Height-FBitmap.Bitmap.Height)/2); LNullPointRotated := RotatePoint(LNullPoint, PointF(FRotatedBitmap.Bitmap.Width/2, FRotatedBitmap.Bitmap.Height/2), 45); end; Freundliche Grüsse |
Alle Zeitangaben in WEZ +1. Es ist jetzt 14:34 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