There is a bug in gtkagg that is exposed by creating the figure with
figure(frameon=False) and then resizing it. "screen noise" appears,
as in the attached figure, which indicates the pixel buffer is not
being initialized This totally mystified me, because the agg backend
does clear the image background with (1,1,1,0) (all white,
transparent),
rendererBase->clear(agg::rgba(1, 1, 1, 0));
In gtkagg, we do
pixbuf = gtk.gdk.pixbuf_new_from_data(
buf, gtk.gdk.COLORSPACE_RGB, True, 8, w, h, w*4)
where buf is the agg rgba buffer including the image. Apparently
there is an "optimization" that skips data when alpha=0. If in
_backend_agg we clear the background with (1,1,1,1) the screen noise
problem goes away, which is why I suspect the copy method in gtk is
ignoring the alpha =0 case. But this isn't really an option since
people like to have transparent figures (well, I suppose it is an
option for gtkagg only).
I have a fairly old gtk (2.6). Do others see a similar problem with
more recent gtk?
If recent pygtk versions have fixed this bug, I'm ok to ignore it.
But if it is present in others, we probably need to rethink how we
create and initialize the gtk pixel buffer in gtkagg.
JDH