Get the App
SLTechnology News&Howtos  ›  Servers  › 

AGG lesson 35 gsv_text rendering ASCII characters

Shulou Source: shulou.com Published: 2022-06-02 23:37:26 09月19日 Update

Code

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::gsv_text txt

Agg::conv_stroke txtStroke (txt)

TxtStroke.width (3)

TxtStroke.line_cap (agg::square_cap)

Txt.flip (true); / / the lower axis of Windows is inverted.

Txt.size (20); / / text size

Txt.line_space (10); / / gsv_text can handle\ nline wrapping, setting the spacing between each line

Spacing between txt.space (10); / / characters

Txt.start_point (100,300); / / the starting position of the text is actually biased and needs to be fine-tuned

Txt.text ("http://fengyuzaitu.blog.51cto.com\nhttp://fengyuzaitu.blog.51cto.com");"

Ras.add_path (txtStroke)

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

Ras.reset ()

Note:

1 only supports rendering of ASCII characters

2 can only render horizontal characters

Tags: Characters between text spacing one line code position deviation coordinates axis actual actually size horizontal processing support start Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS Microsoft NVidia MySQL MariaDB