![]() |
Quadrat 90° gedreht
Hallo,
dass ich jetzt ein um 90° gedrehtes Quadrat bekomme habe ich jetzt das hier gemacht:
Delphi-Quellcode:
geht das auch einfacher z.b. wie der rectangle code?
image1.Canvas.MoveTo(120,40);
image1.Canvas.lineTo(200,120); image1.Canvas.MoveTo(200,120); image1.Canvas.lineTo(120,200); image1.Canvas.MoveTo(120,200); image1.Canvas.lineTo(40,120) ; image1.Canvas.MoveTo(40,120); image1.Canvas.lineTo(120,40) ; wenn möglich antworten mit code besispielen - danke ^^ |
Re: Quadrat 90° gedreht
dreh mal bitte ein Quadrat um 90°... lol ich denke mal du meinst 45° *g*
ich denke das ist bereits die einfachste Lösung. Du könntest nur noch das Quadrat per Rectangle erzeugen und dann einen Algorithmus verwenden der das Bild um 45° dreht, aber ob das schneller geht... |
Re: Quadrat 90° gedreht
ja gut 45° sorry ^^
ich hab mal was von polygon oder so gehört - weiß jemand, wie das in diesem fall gehen soll? |
Re: Quadrat 90° gedreht
willst du wirklich nur die Linie um 45° drehen oder doch das ganze bild?
wenn es nur um linie geht sollte die Funktion "PolyPolyline" eventuell das können was du willst. [Edit] Ich hab mich vertan, für deine Zwecke ist "Polyline" die richtige Funktion
Delphi-Quellcode:
[/Edit]
var LPoints: Array of TPoint;
begin SetLength(LPoints, 5); LPoints[0] := Point(50, 0); LPoints[1] := Point(100, 50); LPoints[2] := Point(50, 100); LPoints[3] := Point(0, 50); LPoints[4] := Point(50, 0); Polyline(Image1.Picture.Bitmap.Canvas.Handle, Pointer(LPoints)^, Length(LPoints)); |
Re: Quadrat 90° gedreht
die hab ich jetzt auch benutzt - danke an alle helfer
IHR seid SUPER - das muss man auch mal sagen ;) |
Re: Quadrat 90° gedreht
Da ich in meiner Übereifrigkeit vorhin "PolyPolyline" angesprochen hab welches eigentlich zum zeichnen mehrere Polygone gedacht ist hier mal ein Beispiel für die Verwendung um 10 Polygone zu malen. (jeweils immer mit den 5 Punkten von Oben um 10 Pixel nach rechts verschoben)
Delphi-Quellcode:
var LPoints: Array of TPoint;
LPolyCnts: Array of Integer; LCount, LPolyCnt: Integer; begin LPolyCnt := 10; SetLength(LPoints, 5 * LPolyCnt); SetLength(LPolyCnts, LPolyCnt); for LCount := 0 to LPolyCnt - 1 do begin LPoints[0 + 5 * LCount] := Point(50 + LCount * 8, 0); LPoints[1 + 5 * LCount] := Point(100 + LCount * 8, 50); LPoints[2 + 5 * LCount] := Point(50 + LCount * 8, 100); LPoints[3 + 5 * LCount] := Point(0 + LCount * 8, 50); LPoints[4 + 5 * LCount] := Point(50 + LCount * 8, 0); LPolyCnts[LCount] := 5; end; PolyPolyline(Image1.Picture.Bitmap.Canvas.Handle, Pointer(LPoints)^, Pointer(LPolyCnts)^, LPolyCnt); |
Alle Zeitangaben in WEZ +1. Es ist jetzt 16:20 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