[Gambas-user] GB3, Paint.CurveTo

Benoît Minisini gambas at ...1...
Sun Dec 5 19:26:14 CET 2010


> Hello,
> i want to paint a graph from numerical data using CurveTo.
> CurveTo expects 3 points (p1,p2,p3) where p1 == (x1,y1)
> If i want to advance in curve plotting i have to add a p4,p5,...pn.
> Do i need always to provide the additional point by repeating the
> recently added 2 points or is there a smarter not redundant way ?
> Paint.CurveTo(p1,p2,p3)
> Paint.CurveTo(p2,p3,p4)
> PAit.CurveTo(p3,p4,p5)
> .....    a.s.o.
> Wjere can i find some cairo example code ?
> 
> Cheers wally
> 

The cairo doc says:

« Adds a cubic Bézier spline to the path from the current point to position 
(X3, Y3) in user-space coordinates, using (X1, Y1) and (X2, Y2) as the control 
points. After this call the current point will be (X3, Y3).

If there is no current point before the call to Cairo.CurveTo this function 
will behave as if preceded by a call to Cairo.MoveTo(X1, Y1). »

That means that you are drawing a curve between the current point and p3, and 
then p3 becomes the current point. p1 and p2 are used as control points for 
the bezier spline.

If there is no current point (i.e. it's your first drawing instruction), then 
the spline starts at p1.

Regards,

-- 
Benoît Minisini




More information about the User mailing list