Hello John,
On 26.05.06, John Owens wrote:
> Actually, might I follow up to this and instead ask:
>
> Can I get an example of a palette that's not a built-in palette? It's the
> palette.select call that I think I really need to support here.
Yes. I had not yet received this mail when answering the previous one.
Here is a self-contained example:
import math
from pyx import *
def red(x):
return math.sin(x / math.pi)
def green(x):
return x
def blue(x):
return x**2
pal = color.functionpalette(functions={"r":red, "g":green, "b":blue},
type="rgb")
c = canvas.canvas()
c.fill(path.rect(0, 0, 1, 1), [pal.getcolor(0.3)])
c.fill(path.rect(1, 0, 1, 1), [pal.getcolor(0.6)])
c.fill(path.rect(2, 0, 1, 1), [pal.getcolor(0.0)])
c.fill(path.rect(3, 0, 1, 1), [pal.getcolor(1.0)])
c.writeEPSfile("mini", paperformat=document.paperformat.A4)
You can ask 'pal' for a color with the 'getcolor' method.
Michael.
--
"A mathematician is a device for turning coffee into theorems"
Paul Erdös.
-------------------------------------------------------
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642
_______________________________________________
PyX-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pyx-user