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

应用场景

路径点超出渲染范围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 renderer_base_type;

   renderer_base_type renb(pixf);

 

   typedef agg::renderer_scanline_aa_solidrenderder_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 polyline(ps);

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

   agg::conv_dash >dash(polyline);

   dash.add_dash(10,10);

   agg::conv_stroke> > 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.


分享名称:AGG第二十七课agg::conv_clip_polyline裁剪线区域
当前路径:http://scyanting.com/article/pdojij.html