Michal Posted January 4, 2021 Posted January 4, 2021 Hi There is a problem with TfgArch. When SweepAngle is 360 (full circle) it is not drawn. With value greater than 360 only value-360 is drawn. I know I could use TfgCircle but I plan to use TfgArch as part of data chart so I need to use component with customized angle. Michal
Administrators Yaroslav Brovin Posted January 4, 2021 Administrators Posted January 4, 2021 Hello Michal, It's bug. We will fix it. Thank you
Michal Posted January 7, 2021 Author Posted January 7, 2021 (edited) I found something else. I don't know is it a bug or am I doing something wrong. I have a TfgPaintBox where I wanted to draw path. When I call Canvas.DrawPath path is drawn perfectly. When I call Canvas FillPath only part is drawn and it is a part created with AddSmoothCurve. I tried to fill path of simple rectangle but it is not filled . I am attaching project Michal Project1.zip Edited January 7, 2021 by Michal
Administrators Viktor Akselrod Posted January 9, 2021 Administrators Posted January 9, 2021 Hello, Michal. The fill is applied to closed subpaths. The command MoveTo interrupts the current subpath and the next command starts a new subpath. Please, try to remove all MoveTo commands and check the result. In most cases, it makes no sense to use the MoveTo command explicitly, since the pen will be at the end point of the last command. Thank you.
Michal Posted January 10, 2021 Author Posted January 10, 2021 (edited) Well I tried to draw path without moveto but it was worse. What I am trying to do is to draw curvy line like the orange one you can see in picture. I'm using smoothcurveto with destination point at blue point and control point at the right of blue point at the same y in the middle of them. Without moveto lines look really strange. I know I can combine curves with rectangles and film them separately but in that case i cannot use gradient fill for whole figure. I also don't see that pen is at the last point. If you do moveto(0 0), lineto (100 100) and then lineto (200 200) second line will be drawn from 0 0 to 200 200 not from 100 100 to 200 200. Edited January 10, 2021 by Michal
Michal Posted January 10, 2021 Author Posted January 10, 2021 I tried to make a path with and without Moveto. In upper paintbox i do MoveTo after first SmoothCurve. in lower after first curve is next SmoothCurve. You can see difference. What I want to get is on the next picture. I know that MoveTo breaks path but as you can see there is some difference. Maybe it is a control point? Project1.zip
Michal Posted January 10, 2021 Author Posted January 10, 2021 (edited) I think I found a solution. I used AddSmoothCurve (this is the function I used in FMX as on picture above) but in FGX i should have used AddQuadraticCurve Edited January 10, 2021 by Michal
Administrators Viktor Akselrod Posted January 10, 2021 Administrators Posted January 10, 2021 Hello, Michal. 5 hours ago, Michal said: If you do moveto(0 0), lineto (100 100) and then lineto (200 200) second line will be drawn from 0 0 to 200 200 not from 100 100 to 200 200. M0,0 L100,100 200,200 is one diagonal line, nothing is visually clear.M0.0 L100.0 200,200 will be much clearer - here you will see a triangle. 3 hours ago, Michal said: Maybe it is a control point? This happens because when two bezier curves go in a row, the first control point is taken not from the "pen position", but Quote The first control point is assumed to be the reflection of the second control point on the previous command relative to the current point. (If there is no previous command or if the previous command was not an C, c, S or s, assume the first control point is coincident with the current point.) (x2,y2) is the second control point (i.e., the control point at the end of the curve). more details (command "S") In order not to break the path and start drawing a second bezier curve from the "pen position" you can replace MoveTo with LineTo. path:=TfgPath.Create; path.MoveTo(10,10); path.AddSmoothCurve(PointF(40,10),PointF(40,20)); path.LineTo(40,20); // !!! path.AddSmoothCurve(PointF(80,10),PointF(120,50)); Result (bottom image): Thank you. 2
Michal Posted January 10, 2021 Author Posted January 10, 2021 (edited) Thanks. Very clear . I changed to AddQuadraticCurve and everything is ok now Edited January 10, 2021 by Michal
Administrators Viktor Akselrod Posted January 13, 2021 Administrators Posted January 13, 2021 On 1/4/2021 at 4:19 PM, Michal said: When SweepAngle is 360 (full circle) it is not drawn Fixed in 1.9.0.0. 2
Recommended Posts