如何填充路径呈现?路径

2023-09-11 02:32:15 作者:你、vΙp专属

什么是矢量图形中使用的标准算法,渲染填充路径?

我不是只关心呈现招的过程中,我也想知道怎么形状填充 - 如何如果有一点是确定的内部或路径之外(我相信即使指定什么样的规则内外均不是一个简单的事情)。

解决方案

查找纲要(周长多边形)

在此我想你已经有

三角(或切到凸多边形)

有很多方法 夹耳 德劳 在看到这里

填补凹凸的三角形/多边形

这是很容易 在任一使用GFX的lib,比如OpenGL,DirectX的,... 或API类似GDI 或栅格化在自己喜欢的这

风格

这个东西是比较复杂的话听起来像是在第一次听到 轮廓宽度[笔,笔画(转换轮廓多边形由它移出或)看到这个 在外形风格[笔,行程](全,破折号,点,点点,...)看到这个

填充样式[刷子](状的阴影是所有最复杂的)

在涉及重多边形调整类似,但更难然后轮廓宽度 在一些风格比较简单一些复杂的极端 例如,用于等距线填充简单的循环+交集+多边形内部测试将做 要测试多边形内部可以使用点击测试

What are the standard algorithms used in vector graphics for rendering filled paths?

I'm not only interested in the process of rendering strokes, I also would like to know how the shapes are filled - how it is determined if given point is inside or outside the path (I believe even specifying the rules of what inside and outside mean is not a straightforward thing).

解决方案 填充路径是什么

find outline (perimeter as polygon)

this I think you already have

triangulate (or cut to convex polygons)

there are many approaches clip ear Delaunay see here

fill convex triangles/polygons

this is easy either use gfx lib like OpenGL,DirectX,... or api like GDI or rasterize on your own like this

style

this stuff is more complicated then it sound like at the first hear outline width [pen,stroke] (convert outline to polygon by shifting it out or in) see this outline style [pen,stroke] (full,dash dot,dot dot,...) see this

filling style [brush] (like hatching which is most complicated from all)

involves heavy polygon tweaking similar but much harder then outline width some styles are simpler some extremly complicated for example for equidistant line fill simple loop + intersection + inside polygon test will do to test polygon inside you can use hit test