@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
I was talking about DrawArc and its problem !
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:
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;
The above is wrong and missing a lot it is just to show the ability to mixing directional arc into Graphics.
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
https://learn.microsoft.com/en-us/wi...real_real_real)
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 :
https://stackoverflow.com/questions/...-box-of-an-arc
And good luck !