skia-pathops icon indicating copy to clipboard operation
skia-pathops copied to clipboard

Feature request: an "overlapRemoved" state or "wouldRemoveOverlap" check

Open skef opened this issue 4 years ago • 3 comments

pathops seems to be both much faster and more accurate than booleanOperations and seems far preferable for instancing a glyph. However, there are other cases where one wants to remove overlap from a glyph for purposes of analysis rather than final product, and one may only want to do so when there is overlap to be removed. For that, one would either want a state passed back with the output or -- given how fast the library is -- a method that can be called first to ask whether overlap will be removed.

(Simple analysis of the result doesn't answer the question because of the other changes -- combined lines, added inflection points, and so on.)

I haven't entirely convinced myself but I suspect this question is close enough to the question "Are there any inter-segment intersections?" that the latter could serve for the former. If that's accurate then maybe one could replicate the non-debugging portions of SkPathOpsSimplify.cpp:SimplifyDebug() up to before HandleCoincidence() and query the coincidence object.

I don't really expect the maintainers to do this work themselves -- I'm filing to track a desirable thing that I may try to implement in the future.

skef avatar Apr 06 '22 07:04 skef

thanks, that would be desirable indeed. I'm thinking this could be useful for https://github.com/google/fonts/issues/4405

anthrotype avatar Apr 06 '22 08:04 anthrotype

Thinking about this, I suppose what just testing for intersections would miss is a contour with the same direction entirely within another contour. There might be corner cases in VF instances where such a thing could happen in a production font. However, maybe its a small enough concern to be ignored.

skef avatar Apr 07 '22 00:04 skef

Thinking about this, I suppose what just testing for intersections would miss is a contour with the same direction entirely within another contour. There might be corner cases in VF instances where such a thing could happen in a production font. However, maybe its a small enough concern to be ignored.

Yeah but I don't think those cases are problematic. So, fine with me.

behdad avatar Apr 29 '24 21:04 behdad