[cairo] draw rectangle with lines, filling problem

ferraresi.carlo at tiscali.it ferraresi.carlo at tiscali.it
Thu Sep 22 08:36:59 PDT 2011


Hi to all! In my application I need to draw rectangles with not each 
border (maybe only top and bottom or something else) so I try to draw 
the single lines of the rectangle, but I have a problem if I want to 
fill the inside of the rectangles. Cairo fills only an half rectangle, 
it draws a triangle and not the full space. What's the problem??
This 
is my code:

    cairo_move_to(cr,x1,y1);
    cairo_set_line_width(cr,
2);
    if(!(lineSuppression & 0x0004))
            cairo_line_to(cr,x2,
y1);
    else
        cairo_move_to(cr,x1,y2);

    if(!
(lineSuppression & 0x0002))
        cairo_line_to(cr,x2,y2);
    else

        cairo_move_to(cr,x2,y2);

    if(!(lineSuppression & 0x0001))

        cairo_line_to(cr,x1,y2);
    else
        cairo_move_to(cr,x1,
y2);

    if(!(lineSuppression & 0x0008))
        cairo_line_to(cr, x1,
y1);
    else
        cairo_move_to(cr,x1,y1);

    cairo_fill_preserve
(cr);
    cairo_set_source_rgb(cr,0.0,0.8,0.0);
    cairo_stroke(cr);





E' nata indoona: chiama, videochiama e messaggia Gratis da smartphone e da PC: scaricalo da http://www.indoona.com/


More information about the cairo mailing list