agg::conv_contour无法应用于自交的图形

测试代码:

    

  void DrawIntersectContour()

  {

    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(200,400);

    ps.line_to(500,500);

    ps.line_to(200,500);

    ps.line_to(500,400);

    ps.line_to(200,400);


    agg::conv_contour<agg::path_storage> contour(ps);

    agg::conv_stroke<agg::conv_contour<agg::path_storage> > stroke(contour);

    ras.add_path(stroke);

//     agg::conv_stroke<agg::path_storage> stroke1(ps);

//     ras.add_path(stroke1);

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

  }

结果分析:尝试绘制一个三角形漏斗,但是通过扩展轮廓线模块,发现没有进行封闭,可通过取消注释,查看具体的情况。

如下是作者的描述:

You can use conv_contour in your vector pipeline. See

examples/conv_contour.cpp for details. The only problem is it won'twork for

self-intersecting contours, because the direction of the polygons is

essential, but we can't talk about the polygon direction if itintersects

itself.


你可能感兴趣的:(agg)