On Tue, Dec 1, 2009 at 10:37 PM, Pietro Battiston <too...@email.it> wrote:

> Il giorno mar, 01/12/2009 alle 22.11 +0530, nipun batra ha scritto:
> > There seems to be an easy way to draw polygons using Graphics Context
> > as described in chap 12 of manual.How can the same thing be done using
> > cairo
>
> What (easy) way?
> What manual?
> Some particular kind of polygon?
>
> For a generic polygon, I don't think anythink sensibly "easier" than a
> sequence of "line_to" followed by "close" and "strike" (or "fill") is
> conceivable.
>
> But I think that, both to increase the probability of a satisfying
> answer and as a mere matter of respect for people to whom you're asking
> to help you, you should be more clear in your questions.
>
> Pietro
>
>
This is what i have thought as of now.wanted to use faster implementations.

def draw_polygon(x0, y0,x1,y1,x2,y2,x3,y3):
cr.move_to(x0,y0)
cr.line_to(x1,y1)
cr.move_to(x1,y1)
cr.line_to(x2,y2)
cr.move_to(x2,y2)
cr.line_to(x3,y3)
cr.move_to(x3,y3)
cr.line_to(x0,y0)
 #cr.arc(x, y, 2, 0, 2 * pi)
cr.set_source_rgba(0, 0, 0, 1)
cr.stroke()

Thanks to all
_______________________________________________
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

Reply via email to