Get the App
SLTechnology News&Howtos  ›  Servers  › 

AGG lesson 29 the difference of agg::render_scanlines

Shulou Source: shulou.com Published: 2022-06-03 04:50:11 10月03日 Update

Attach the code:

Agg::rendering_buffer & rbuf = rbuf_window (); / / get the rendering cache

Agg::pixfmt_bgr24 pixf (rbuf); / / make up pixels

Typedef agg::renderer_base renderer_base_type

Renderer_base_type renb (pixf); / / provides a crop region, which is valid for rendering only within the crop region

Typedef agg::renderer_scanline_bin_solid renderder_scanline_type

Renderder_scanline_type rensl (renb); / / customize the underlying renderer

Agg::rasterizer_scanline_aa ras

Agg::scanline_u8 sl

Ras.reset ()

Renb.clear (agg::rgba8 (255255255))

Agg::ellipse ell (320230230)

Agg::conv_stroke stroke (ell)

Ras.add_path (stroke)

Rensl.color (agg::rgba8 (255j0pl 0))

Agg::render_scanlines (ras,sl,rensl)

This method does not provide anti-aliasing effect, using agg::renderer_scanline_bin_solid

Compare the following code:

Agg::rendering_buffer & rbuf = rbuf_window ()

Agg::pixfmt_bgr24 pixf (rbuf)

Typedef agg::renderer_base renderer_base_type

Renderer_base_type renb (pixf)

Renb.clear (agg::rgba8 (255255255))

Agg::rasterizer_scanline_aa ras

Agg::scanline_u8 sl

Ren_bas.clear (agg::rgba8 (255255255))

Agg::ellipse ell (320230230)

Agg::conv_stroke stroke (ell)

Ras.add_path (stroke)

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

The rendered circle is anti-aliased and the effect is very good. Aa actually means anti-aliasing.

Tags: Code region effect jagged valid pixel only actually is in fact the bottom layer meaning method cache face different. Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia vpn Apple Linux Docker