Re: draw rectangle with lines, filling problem

Bill Spitzak <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <[email protected]>
Only the line-to calls produce an edge to the filled shape. The moveto 
calls start new filled shapes (or produce nothing if they are just a 
point or 1 line).

You probably want to draw the rectangle with 4 sides to fill it, then 
add your line segments afterwards.

[email protected] wrote:
> 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/
> --
> cairo mailing list
> [email protected]
> http://lists.cairographics.org/mailman/listinfo/cairo
--
cairo mailing list
[email protected]
http://lists.cairographics.org/mailman/listinfo/cairo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.