如何填充路径呈现? [英] How are filled paths rendered?

查看:180
本文介绍了如何填充路径呈现?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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

解决方案
  1. 查找纲要(周长多边形)

    • 在此我想你已经有
  2. 三角(或切到凸多边形)

    • 有很多方法
    • 夹耳
    • 德劳
    • 在看到这里
  3. 填补凹凸的三角形/多边形

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

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

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

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

解决方案

  1. find outline (perimeter as polygon)

    • this I think you already have
  2. triangulate (or cut to convex polygons)

    • there are many approaches
    • clip ear
    • Delaunay
    • see here
  3. 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
  4. 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

这篇关于如何填充路径呈现?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆