Get the App
SLTechnology News&Howtos  ›  Servers  › 

Limitations of lesson 4 of AGG

Shulou Source: shulou.com Published: 2022-06-02 19:52:19 09月11日 Update

1 preface

The boundary of anti-aliasing image rendered by AGG always seems to be blurred. After research, it is due to the use of sub-pixel precision anti-aliasing, the boundary will be blurred by half a pixel. Causes the same color problem on the boundaries where multiple images overlap. As the author said, do not think that the use of AGG can solve all problems, the so-called virtue rises ten, as vice rises one foot. Any design is a compromise, and the problem can only be solved in an evasive way. Continued attention will be paid to the limitations of AGG in the future.

2 the boundary coloring problem of overlapping areas 1 code display

Void TestBlackBorden ()

{

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 ()

Ras.add_path (agg::ellipse (100150100100))

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

Ras.add_path (agg::ellipse (200100100100))

Agg::render_scanlines_aa_solid (ras,sl,renb,agg::rgba8 (0555))

Ras.add_path (agg::ellipse (200200100100))

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

}

2 problem description

Three solid circles form three rings, and each circle has overlapping parts, and you can see that there is a black arc on the overlapping boundary.

According to normal logic, the boundary is either red, blue, or green. There is actually a mixed color, and the anti-aliasing effect uses a mixed color to alpha-blending the underlying color with the overlaid color, which will actually show the mixed color.

The following is the author's description:

I only flipped your p_w_picpath horizontally. Itshows how the colortriplets are

Placed and explains this effect. But youare right, these "black borders"

Will be seen on any device. To get rid ofthem you need to use gamma

Correction. Seeexamples/gamma_correction.cpp.

According to the author's idea to set up gamma, of course, do not rule out setting errors, do not understand the example of gamma_correction.

The developer responded:

For my display a gamma of 2.5 looks good. Ithink I will add someuser

Defined gamma option to my application. Bytime i will have to delve

Into this topic more deeply.

Tags: Boundary color problem blending author three pixel image actual actually way sawtooth limitation virtue rises ten as vice rises one foot code example preface region multiple Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Docker Redmi Huawei Xiaomi Shulou Technology