温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

AGG第四十课 SVG 使用的三种管道

发布时间:2020-07-25 01:05:11 来源:网络 阅读:743 作者:fengyuzaitu 栏目:系统运维

The current version of SVG contains 3 pipelines:


Simple polygons:

path_storage ->

 conv_curve -> 

  conv_transform ->

   conv_clip


Strokes:

path_storage ->

 conv_curve -> 

  conv_stroke ->

   conv_transform ->

    conv_clip


Contoured polygons:

path_storage ->

 conv_curve -> 

  conv_contour ->

   conv_transform ->

    conv_clip

> And is it doubly calculated for

> filling, then stroking (in

> case both apply)?


It is. Otherwise you would have to store the

intermediate result somewhere. But the good news is

that conv_curve works pretty fast, at least stroking

and clipping are much more time consuming tasks. 


The only obvious case when we can approximate the

curves in the last step is drawing text. But again,

when it's without stroking/outlining/contouring.


>  Also what exactly does conv_contour do?


Exactly half of the work conv_stroke does. :-) It

dilates or erodes polygons depending on the sign of

the width. I used it to eliminate the defects when

joining anti-aliased polygons:https://cache.yisu.com/upload/information/20200311/29/188328.jpg> I hope you dont mind all these questions :)


Of course I don't. Afterall I myself started cooking

this porridge :-)


> If so, doesnt this give the same result each time,

> as its done before the

> conv_transform? 


Yes, it does, at least seems to do :-)

But the reality is more complex. Here's a

contadiction. Yes, we could transform paths before

approximating them with line segments. But conv_stroke

and conv_contour require already decomposed path. So,

the only case we can use this order (conv_transform ->

conv_curve) is a simple filled polygon without a

"border". But the situation is even worse. I use

conv_clip that performs polygonal clipping. Such kind

of a "vectorial" clipping can work with line segments

only, so, the curves must be decomposed before

clipping. Ideally it would be fine to decompose curves

as late as possible, but if the order of the

conversions is different solid and stroked paths will

be inconsistent:https://cache.yisu.com/upload/information/20200311/29/188345.jpgEventually I decided to set my jaw and to convert the

curves in the first pipeline step. Well, this is the

whole idea of the custom pipelines - in certain cases

you can use different conversion order for the sake of

performance.


向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI