详细代码:
void TestBlackBorden()
{
agg::rendering_buffer &rbuf = rbuf_window();
agg::pixfmt_bgr24 pixf(rbuf);
typedef agg::renderer_base<agg::pixfmt_bgr24> renderer_base_type;
renderer_base_type renb(pixf);
typedef agg::renderer_scanline_aa_solid<renderer_base_type> renderder_scanline_type;
renderder_scanline_type rensl(renb);
agg::rasterizer_scanline_aa<> ras;
agg::scanline_u8 sl;
ras.reset();
/*
尝试设置gamma的值,但是无效,反而翻转y轴看到黑色边消失了!!
*/
ras.gamma(agg::gamma_power(2.5));
ras.add_path(agg::ellipse(100,150,100,100));
agg::render_scanlines_aa_solid(ras,sl,renb,agg::rgba8(255,0,0));
ras.add_path(agg::ellipse(200,100,100,100));
agg::render_scanlines_aa_solid(ras,sl,renb,agg::rgba8(0,255,0));
ras.add_path(agg::ellipse(200,200,100,100));
agg::render_scanlines_aa_solid(ras,sl,renb,agg::rgba8(0,0,255));
}
如下是作者的描述:
I only flipped your image horizontally. It shows how the colortriplets are
placed and explains this effect. But you are right, these"black borders"
will be seen on any device. To get rid of them you need to use gamma
correction. See examples/gamma_correction.cpp.
按照作者的思路进行了gamma的设置,当然不排除设置的错误,没有理解gamma_correction这个例子。
开发者回应:
For my display a gamma of 2.5 looks good. I think I will add someuser
defined gamma option to my application. By time i will have to delve
into this topic more deeply.