Logo Search packages:      
Sourcecode: libcaca version File versions  Download package

void caca_fill_ellipse ( int  xo,
int  yo,
int  a,
int  b,
char  c 
)

Fill an ellipse on the screen using the given character.

Parameters:
xo Center X coordinate.
yo Center Y coordinate.
a Ellipse X radius.
b Ellipse Y radius.
c Character to fill the ellipse with.
Returns:
void

Definition at line 79 of file conic.c.

References caca_draw_line().

{
    int d2;
    int x = 0;
    int y = b;
    int d1 = b*b - (a*a*b) + (a*a/4);

    while(a*a*y - a*a/2 > b*b*(x+1))
    {
        if(d1 < 0)
        {
            d1 += b*b*(2*x+1); /* XXX: "Computer Graphics" has + 3 here. */
        }
        else
        {
            d1 += b*b*(2*x*1) + a*a*(-2*y+2);
            caca_draw_line(xo - x, yo - y, xo + x, yo - y, c);
            caca_draw_line(xo - x, yo + y, xo + x, yo + y, c);
            y--;
        }
        x++;
    }

    caca_draw_line(xo - x, yo - y, xo + x, yo - y, c);
    caca_draw_line(xo - x, yo + y, xo + x, yo + y, c);

    d2 = b*b*(x+0.5)*(x+0.5) + a*a*(y-1)*(y-1) - a*a*b*b;
    while(y > 0)
    {
        if(d2 < 0)
        {
            d2 += b*b*(2*x+2) + a*a*(-2*y+3);
            x++;
        }
        else
        {
            d2 += a*a*(-2*y+3);
        }

        y--;
        caca_draw_line(xo - x, yo - y, xo + x, yo - y, c);
        caca_draw_line(xo - x, yo + y, xo + x, yo + y, c);
    }
}


Generated by  Doxygen 1.6.0   Back to index