AGG lesson 36 gsv_text_outline rendering surrounding characters
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_bin_solid renderder_scanline_type
Renderder_scanline_type rensl (renb)
Agg::rasterizer_scanline_aa ras
Agg::scanline_u8 sl
Ras.reset ()
Renb.clear (agg::rgba8 (255255255))
Agg::ellipse ell (400,100,100,100)
Agg::conv_stroke stroke (ell)
Ras.add_path (stroke)
Agg::render_scanlines_aa_solid (ras,sl,renb,agg::rgba8 (255,0,0))
Ras.reset ()
Agg::gsv_text txt
Agg::trans_single_path transPath
TransPath.add_path (ell)
Agg::gsv_text_outline txtOutLine (txt, transPath)
Txt.flip (true)
Txt.size (10)
Txt.start_point (100,15)
Spacing between txt.space (5); / / characters
Txt.text ("http://fengyuzaitu.blog.51cto.com");"
Ras.add_path (txtOutLine)
Agg::render_scanlines_aa_solid (ras,sl,renb,agg::rgba8 (255,0,0))
Ras.reset ()
Note:
The direction specified by 1 start_point is no longer the real screen coordinates, but relative to the starting rendering coordinates of the vertex source. The current rendered ellipse starts rendering clockwise from the rightmost point of the ellipse. The first parameter can be understood as how far away from the starting point on the rendered arc, where trans_single_path provides total_length to calculate the length of the path. It is convenient to deploy the position of each character (relative to the starting point). The second parameter is to specify the width of the character to deviate from the path, whether the positive and negative values deviate from the internal test or the outside, respectively.