-
Notifications
You must be signed in to change notification settings - Fork 120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TCanvas32.DrawPath doesn't handle overlaps #185
Comments
I've thought long and hard about this problem and it seems to me that it's caused by a combination of a design flaw in One possible solution could be to move the handling of mixed open/closed polylines/polygons from |
…l unrelated polygons. Refs #185
I've committed a solution to the bugfix/TCanvas32_DrawPath branch. I used your example as a test case. Anyway, give it a try. |
Thanks for help and code I simplified the solution by removing portion modified in
New virual method added
simple helper
|
I don't think I understand. Can you please post two code snippets which demonstrate the problem:
|
Same code posted in the first post with some tests with TDashedBrush as it has the same problem - this issue is fixed now.. The figure above was my intention to implement ArcLineJoin in the past I abandoned due to the design of TCanvas32 and TStrokeBrush. |
As far as I can tell this issue is resolved as your problems with arc line joins are beyond the issue scope. I'll create a new issue about arc line joins. |
Please delete the last commit even if it solves the problem but it shouldn't be part of the library, the code adds unnecessary complexity for marginal benefit and propagates the design error :) |
I disagree. It may very well be that the solution complicates things for your effort to implement arc line joins and that the whole thing will have to be redesigned but we'll cross that bridge when and if we come to it. |
By default path generated by TextToPath is rendered with oddeven winding rule, so any intersection area becomes visible, mainly in case of cursive font or strikethrough text. |
Where? FWIW, I believe the normal way to render a text poly-polygon would be to use a |
No, it's not possible with the text path at least in the same run, the curent structure used to hold path text is very poor just ArrayOfArrayOfPoint which doesn't help to distinguish it |
I'm not sure understand the last case I haven’t done any test later , thanks |
Problem not fixed for TDashedBrush currently it produces the same anomaly,, there are three almost identical methods that make it hard to guess which one to implement :
I suggest creating a single method having both overloaded paramaters in this version if
|
Is this the "anomaly" you mean? I think that case is well beyond what TCanvas32 is meant to handle. I suspect that what you wanted was for all the dashes to be merged into non-overlapping polygons so they could be drawn in one go without semi-transparency issues, right? If this is what you want then you should merge the polygons before passing them to TCanvas32 (you can use Clipper or something like it for that). Graphics32 itself does not contain functionality to calculate the union of a set of polygons. It does contain a copy of Clipper but Clipper's functionality isn't integrated as that would kill performance.
Yes, the |
Yes it's about that , |
Fixed; I have now completely redesigned |
Thanks for your great efforts the second fix works as expected 👍 the second design in graphics32/Source/GR32_Brushes.pas Lines 667 to 671 in a517ef0
as you can see in the figure I propose this change :
My last remark is the current code is supposed to work with the last thing I want to know how to enable Clipper & Angus utilites , I 've juste enable the symbol when comparing with Firefox broser I get this Svg file of test
|
Yes, that's as-expected with that branch. The TCustomBrush-redesign branch should fix that.
Please explain.
I have tried various solutions to the fill-and-stroke problem but I have unfortunately not been able to come up with any good solutions.
Enabling procedure TCustomBrush.RenderPolyPolygon(Renderer: TCustomPolygonRenderer; const Points: TArrayOfArrayOfFloatPoint;
const ClipRect: TFloatRect; Transformation: TTransformation; Closed: Boolean);
begin
UpdateRenderer(Renderer);
Renderer.PolyPolygonFS(Points, ClipRect, Transformation);
PolyPolylineFS(TPolygonRenderer32(Renderer).Bitmap, Points, clBlue32, Closed);
end;
Investigating... |
I don't think this is a problem; It's a corner case with no exact solution. Like the problems in #106. We can keep tweaking the algorithm forever without ever solving all the small quirks. |
Eliminated Closed parameter from RenderPolyPolygon and EndPolygon; The final polygons are always closed. Added debug output. Will be disabled before merge. Refs #185
Eliminated Closed parameter from RenderPolyPolygon and EndPolygon; The final polygons are always closed. Added debug output. Will be disabled before merge. Refs #185
I just applied one of the changes you suggested in #106 and now the output matches that of GR32_VectorUtils.Angus exactly... How about that. |
I am nor sure but as you can see the three mentioned brushs TDashedBrush , TStrokeBrush and TSolidBrushbut are based on vectors are easy to draw in any order but i guess this is not possible for other situations you can take a look at
When I enable the derective and debug BuildPolyPolyLine called in
I am not worried about that I know that the basic Grow doesn't generate perfect offsets, for performance reasons the operation is shortened, I just want to see how the production of Clipper looks like.
The problem in 106 cannot appear with Clipper it's perfectly handled, if it's present is for other reason as you showed in the last photos, these irregularities look more like a wraped dash rather offsetting bug.
not yet tested I will try again |
Thanks now it works without problem. |
and the name |
DrawPath draws complex figures containing mixed closed and not closed paths in separate passes, so these vectors are treated as separate figures and their overlaps are visible .
The first figure is when the three paths are not closed the second one is given when the path of circle is closed .
The text was updated successfully, but these errors were encountered: