Re: How to draw a simply dot in cairo?



int w=50;//line with, 2*radius
void draw_dot(int x, int y)
{
cairo_set_line_width (cr, w);
cairo_set_line_cap  (cr, CAIRO_LINE_CAP_ROUND); /* Round dot*/
cairo_move_to (cr, x, y); cairo_line_to (cr, x, y);/* a very short line is a dot */
cairo_stroke (cr);
}
I tried this, it works for me.
 it 'looks' simpler, but not sure what's happening underneath(the performance depends on how cario implements ), may this run faster ?
 
This is just my guess.
 
 Cheers
P
 
On Fri, May 8, 2009 at 12:43 PM, Dancefire <dancefire gmail com> wrote:
Hi,

I know how to draw line, arc(circle) in cairo. however, I cannot find the efficient way to draw a simple round dot. I tried arc(), it works, however, it is very slow. I need draw thousands of the small dot with different radius. arc() is a little bit slow to do that.

I also tried draw a rectangle with round cap, round join and 0 width and height. It works and seems faster than arc(). But I may in the wrong track.

Could anyone point me out, how to draw a lot of dot with different radius efficiently? Thanks.

--
Tao Wang
Microsoft Certified Technology Specialist
CCNA

_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
http://mail.gnome.org/mailman/listinfo/gtkmm-list




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]