AGG lesson 27 agg::conv_clip_polyline clipping line area
Application scenario
The path point is far beyond the rendering range N
Header file
# include "agg/include/agg_conv_clip_polyline.h"
Simple example
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 (100540)
Ps.line_to (168.889471.429)
Ps.line_to (237.778402.857)
Ps.line_to (306.667334.286)
Ps.line_to (651.111 Jing Mi 8.57143)
Ps.line_to (720 mai muri 6.85714 eBay 19)
Ps.line_to (200400)
Ps.line_to (400400)
Ps.line_to (200500)
Ps.line_to (700400)
Agg::conv_clip_polyline polyline (ps)
Polyline.clip_box (0Pol 0600800)
Agg::conv_dashdash (polyline)
Dash.add_dash (10 and 10)
Agg::conv_stroke stroke (dash)
Stroke.width (2)
Ras.add_path (stroke)
Agg::render_scanlines_aa_solid (ras,sl,renb,agg::rgba8 (255j0pl 0))
}
Restrictions:
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.