Jump to content

TfgArch with SweepAngle 360 not drawing properly


Recommended Posts

Posted

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

Posted (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 by Michal
  • Administrators
Posted

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.

Posted (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. 

Screenshot_20210110-065739.jpg

Edited by Michal
Posted

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?

Screenshot_20210110-090335.jpg

Przechwytywanie.PNG

Project1.zip

Posted (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 by Michal
  • Administrators
Posted

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.

WhatsApp Image 2021-01-10 at 13.52.49.jpeg

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):

WhatsApp Image 2021-01-10 at 13.52.50.jpeg

 

Thank you.

  • Like 2
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...