温馨提示×

温馨提示×

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

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

AGG第二十七课 agg::conv_clip_polyline裁剪线区域

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

应用场景

路径点超出渲染范围N

头文件

#include"agg/include/agg_conv_clip_polyline.h"

简单例子

 void ClipPathByPolyline()

  {

   agg::rendering_buffer &rbuf = rbuf_window();

   agg::pixfmt_bgr24 pixf(rbuf);

 

   typedef agg::renderer_base<agg::pixfmt_bgr24> renderer_base_type;

   renderer_base_type renb(pixf);

 

   typedef agg::renderer_scanline_aa_solid<renderer_base_type>renderder_scanline_type;

   renderder_scanline_type rensl(renb);

 

   agg::rasterizer_scanline_aa<> ras;

   agg::scanline_u8 sl;

   ras.reset();

 

   agg::path_storage ps;

   ps.move_to(100,540);

   ps.line_to(168.889,471.429);

   ps.line_to(237.778,402.857);

   ps.line_to(306.667,334.286);

   ps.line_to(651.111,-8.57143);

   ps.line_to(720,-6.85714e+19);

   ps.line_to(200,400);

   ps.line_to(400,400);

   ps.line_to(200,500);

   ps.line_to(700,400);

 

   agg::conv_clip_polyline<agg::path_storage> polyline(ps);

   polyline.clip_box(0,0,600,800);

   agg::conv_dash<agg::conv_clip_polyline<agg::path_storage> >dash(polyline);

   dash.add_dash(10,10);

   agg::conv_stroke<agg::conv_dash<agg::conv_clip_polyline<agg::path_storage>> > stroke(dash);

   stroke.width(2);

 

   ras.add_path(stroke);

   agg::render_scanlines_aa_solid(ras,sl,renb,agg::rgba8(255,0,0));

  }


限制:

Here the lines will be clipped beforecalculating the rest. But if you have

very wide lines you will see some defects

 

To avoid it you may want to extend theclipping area to the maximal line width.


向AI问一下细节

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

AI