I have tried to use gizeh.rectangle() in combination with gizeh.ImagePattern() using the old surface to achieve the same effect, but passing a gizeh.Surface to gizeh.ImagePattern() does not seem to work. I saw that it should be possible to use surface.get_npimage() instead, but I rather avoid the overhead of converting it to a numpy array and back to a Cairo surface.
Is there another way to achieve the same effect?
edit: I also tried using surface.get_npimage() and passing that to gizeh.ImagePattern() instead, but that also fails with:
"TypeError: Cannot cast ufunc add output from dtype('float64') to dtype('uint8') with casting rule 'same_kind'"
Hi,
Using cairocffi, one can copy part of the surface to another by doing something along the lines of:
I have tried to use
gizeh.rectangle()
in combination withgizeh.ImagePattern()
using the old surface to achieve the same effect, but passing agizeh.Surface
togizeh.ImagePattern()
does not seem to work. I saw that it should be possible to usesurface.get_npimage()
instead, but I rather avoid the overhead of converting it to a numpy array and back to a Cairo surface.Is there another way to achieve the same effect?
edit: I also tried using
surface.get_npimage()
and passing that togizeh.ImagePattern()
instead, but that also fails with: "TypeError: Cannot cast ufunc add output from dtype('float64') to dtype('uint8') with casting rule 'same_kind'"Yours sincerely, Stephan.