Zulko / gizeh

Simple Vector Graphics for Python
Other
709 stars 69 forks source link

Input to 'radial' ColorGradient #9

Open jmlorenzi opened 9 years ago

jmlorenzi commented 9 years ago

I am trying to use the ColorGradient(type='radial', ... ) and getting confused with the meaning of xy1, xy2 and xy3. Going through cairocffi's docstrings, I see that cairocffi.RadialGradient takes (cx0, cy0, radius0, cx1, cy1, radius1) as arguments, instead of the coordinates of three points. Maybe the optional xy3 should be replaced by (r1,r2)? Or am I missing something?

In any case, thanks for this great module!

Zulko commented 9 years ago

I must admit I am not sure either. If you feel confident, I'd gladly accept a commit. I think I'll have to update all the examples then.

laurentperrinet commented 9 years ago

from this documentation @ http://docs.go-mono.com/index.aspx?link=T%3aCairo.RadialGradient the RadialGradient class:

Extends Cairo.Gradient to create a new radial gradient between the two circles defined by (cx0, cxy0, radius0) and (cx1, cy1, radius1).

such that we should have this equivalence

xy1, xy2, xy3 = (cx0, cy0), (cx1, cy1), (radius0, radius1)

a MWE should be more helpful :-)

Zulko commented 9 years ago

what"s an MWE ? Edit: Minimal working example ?

laurentperrinet commented 9 years ago

I made a notebook showing some fiddling with these parameters:

https://laurentperrinet.github.io/sciblog/posts/2015-02-17-creating-an-animation-using-gizeh-+-moviepy.html

ldo commented 3 years ago

Did you ever figure out how to get this to work? Here is some sample code (using a different Python binding for Cairo) if it will help; corresponding output can be seen here.