-
-
Notifications
You must be signed in to change notification settings - Fork 29
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
Flatten or apply clip-path to svg path #204
Comments
First, let me say currently this is not done by the library. The clip-paths are not actually clips they are rendered clips. So effectively the geometry within the clip-path is actually not split and disposed of, it exists but it's not technically rastered/rendered. Which means they exist, but aren't drawn. Which is how I've tended to view this problem historically. I am however somewhat working on this same problem with regards to patterns within a closed shape. There's a lot of useful things with filling a shape with a bunch easily defined vectors that come up in lasers and embroidery. The actual required geometry functions here are find all the intersections between different segments in the clip polygon and different segments in the subject paths. #210 -- Here's a PR to make that possible. However, it gets a bit more difficult as you need to actually call a Assuming that's exists you finally need to be able to tell which segments are inside and which segments are outside the clip-path. We'd be able to find all the intersections. Split everything that intersected the path but then we'd need a reasonably fast method of determining whether a point is inside a polygon. Historically I've done this with setting up a scanbeam and finding the active segments within that scanbeam but there might be need to speed up the checks there. This is where we're somewhat stuck on the pattern problem. Point in polygon isn't a hard algorithm, but unlike a simple 30 line bit of code I'm proud of for the intersections of arbitrary segments it might be a bit outside the realm of this project, even though the goal is clearly well within that realm. I might need to finish the other bits first. But, I'll add the intersections thing and I'll look into adding splits. The API might be a bit weird since you're returning a second line segment from a first and clearly you'd want to call that on a Path() object and just have it take effect within the Path(). So there's some api work to think through. |
Hi,
Thanks for this fantastic library,
I am working on a problem where I want to flatten or add the clip-path to the SVG path itself or find a way to apply to the path how we can apply transformations to the SVG path.
Thank you.
The text was updated successfully, but these errors were encountered: