AGG渲染太极图

    //画左边白色大半圆

    ras.reset();

    agg::arc arc(400, 100, 100, 100, 1.57, -1.57,false);

    ras.add_path(arc);

    ras.move_to_d(400,0);

    ras.line_to_d(400,200);

    agg::render_scanlines_aa_solid(ras,sl,renb,agg::rgba8(255,255,255));

    ras.reset();

 


    agg::arc arc1(400, 100, 100, 100, 1.57, -1.57,true);

    ras.add_path(arc1);

    ras.edge_d(400,0,400,200);

    agg::render_scanlines_aa_solid(ras,sl,renb,agg::rgba8(0,0,0));


    //绘制上面的白色小半圆

    ras.reset();

    agg::arc arc2(400, 50, 50, 50, 1.57, -1.57,true);

    ras.add_path(arc2);

    ras.auto_close(true);


    agg::render_scanlines_aa_solid(ras,sl,renb,agg::rgba8(255,255,255));  


    //绘制下面的黑色小半圆 

    ras.reset();

    agg::arc arc3(400, 150, 50, 50, 1.57, -1.57,false);

    ras.add_path(arc3);

    ras.close_polygon();

    agg::render_scanlines_aa_solid(ras,sl,renb,agg::rgba8(0,0,0));  

   

    //绘制上面的黑色太极眼

    ras.reset();

    agg::ellipse ell(400,50,10,10);

    ras.add_path(ell);

    agg::render_scanlines_aa_solid(ras,sl,renb,agg::rgba8(0,0,0));  


    //绘制下面的白色太极眼

    ras.reset();

    agg::ellipse ell1(400,150,10,10);

    ras.add_path(ell1);

    agg::render_scanlines_aa_solid(ras,sl,renb,agg::rgba8(255,255,255));  


多说一句:    ras.close_polygon();   ras.auto_close(true);  ras.edge_d(400,0,400,200);都是用来封闭半弧的,然后才能够填充颜色!!

你可能感兴趣的:(agg,太极图)