![]() |
GDI+ Zeichenfehler bei ARC
Liste der Anhänge anzeigen (Anzahl: 1)
Hallo,
ich habe mal versucht ein Testprogramm auf GDI+ umzustellen, aber ich scheiter natürlich wieder an den Bögen :-( Ich bin für jeden Tipp dankbar... |
AW: GDI+ Zeichenfehler bei ARC
Sollte ich eventuell doch mit Direct3D oder OpenGL machen, da ich später dann auch besser Skalieren und um XYZ rotieren könnte.
Was meint Ihr ? OpenGL oder Direct3D ? |
AW: GDI+ Zeichenfehler bei ARC
Zitat:
|
AW: GDI+ Zeichenfehler bei ARC
Hi,
@DacCoda why not using TGPGraphicsPath ? TGPGraphicsPath should simplify your code, like a lot, as it is literally what you need and what you are simulating. Is there something i am missing with it ? |
AW: GDI+ Zeichenfehler bei ARC
@Kas Ob,
Hi Kas, in this moment i have a full project with drawing on a TPaintBox. Everything is ok, but i want to have AntiAliasing for the Lines. So i tried to make a changeover to GDI+ The Normal Lines (procedure DrawLine) is easy to chnage over. but i'am struggeling on procedure DrawArc. The changeover is not working. You can see it in the attached Source in the first Post. For this moment i'am not ready to make it in 3D. I have to study first the Tutorials and so on... But i need the Program now with functional GDI+ and i have no idea whats going wrong in the attached Test-App. If the GDI+ Version works well, i will start to make 3D Stuff :-) |
AW: GDI+ Zeichenfehler bei ARC
Zitat:
Here some thoughts: 1) You can use TGPGraphicsPath then add it to your mixed (what ever) it is called, adding it is simple as
Delphi-Quellcode:
The above is wrong and missing a lot it is just to show the ability to mixing directional arc into Graphics.
Pen := TGPPen.Create(ColorRefToARGB(Color), 1.0);
try Path := TGPGraphicsPath.Create; try Path.AddArc(StartX, StartY, FScale * Cos(EndAngle), FScale * Sin(EndAngle), StartAngle, EndAngle); /// THIS IS WRONG CALCULATION !!! JUST AN EXAMPLE Graphics.DrawPath(Pen, Path); finally Path.Free; end; finally Pen.Free; end; 2) You don't need 3D to switch to GDI(+) in full, i might be missing or misunderstand your point here, but drawing in 2d is fine, and on top of that Path drawing is more consistent with what you are simulating, see.. DrawArc doesn't have a direction vector !, while AddArc from GraphicsPath::AddArc ![]() This what i meant by switching or using GraphicsPath, you remove the need for Counter/ClockWise handling. 3) AddArc and your DrawArc both need the Bounding Box, aka the rectangle for the the arc (width and height or rect), this a little bit complicated, as it need more calculation, explaining it is way easier by showing some formulas, so i tried to search and found a nice answer for this on StackOverflow, and it is well written and easy to understand, so read the answer here and adjust as you don't have the third point, but you will find these if..then..esle are crucial for your rect finding, of course after calculating the center of the circle of the arc : ![]() And good luck ! |
AW: GDI+ Zeichenfehler bei ARC
Liste der Anhänge anzeigen (Anzahl: 1)
@Kas,
thank you for the info's. But at the end it will not the right solution with GDI+ Because i have a 2D Solution now, but i can't rotate it to see the steps (Deep) in the Z-Axis now. So i have to Draw with all 3-Parameters (X, Y, and Z) with Scaling and rotation. I think Spending time in 2Dis wasting of time... But there is no way to make this in a Easy-Way for Dummies (Me) :lol: |
AW: GDI+ Zeichenfehler bei ARC
Liste der Anhänge anzeigen (Anzahl: 1)
I am sorry, i think i am completely in loss and misunderstood the question, as thought the problem in drawing arcs in GDI
I ran you test and this is screenshot of the result Anhang 57162 So i was talking about fixing this arcs and their directional drawing :oops: Sorry again ! |
AW: GDI+ Zeichenfehler bei ARC
Dear Kas,
Zitat:
But in the meantime i have realisized that i have to change over to Real-3D to have the functionality in future Steps. However, your answers were completely correct and I am very grateful for your help. But I think my own requirements, or my new thoughts for the future display with Z-coordinates, require real 3D. |
AW: GDI+ Zeichenfehler bei ARC
Somit ist dann dieser Thread erst einmal abgeschlossen und ich muss schauen wie ich das Projekt aus dem ersten Posting umändere zu echten 3D inklusive Z-Koordinaten.
Vielen Dank an Euch Alle, es hat mir sehr geholfen und ich habe dabei eben festgestellt, das ich mit 2D auf dem Holzweg bin... :-) |
Alle Zeitangaben in WEZ +1. Es ist jetzt 09:28 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 by Thomas Breitkreuz