> Thanks for clarifying. I understand what you're saying now. I think > what we want to do is store the unmultiplied alpha as a "canonical" > version of the image, and premultiply a copy (or use some C++ iterator > magic to avoid the copy) right before sending it off to Agg. Then the > alpha can be fully "tweakable" at runtime.
Just for my understanding of the design approach of matplotlib in general, is it implicitly assumed that once pixels have been passed to agg, they are destined for the renderer? No other possible use? And the life span is short? I'm just not very familiar with where _image is used throughout the rest of the code, if at all. As far as the iterator magic, the kicker is that it would have to take place inside of agg; it cannot be on the mpl side; So if I'm understanding correctly, 1) create a copy of the image within resize() 2) premultiply the alpha on the copy 3) let agg do its work, returning its result in a new pixmap (resized) that is premultiplied. 4) toss the extra copy made in (1) 5) in each individual backend's renderer, right before the pixels are rendered, unmultiply the alpha if necessary (as is the case with wxagg). I also remember you making mention of saving pngs above, I suppose there would have to be an unmultiply there as well. i've done some grepping through the code, and don't see that these filter routines are used anywhere except specifically in this resize() function. I can fully understand the desire to comply with agg's spec, but I'm still not convinced that a small patch to agg isn't appropriate here. It's a little odiferous, but won't be hard to maintain given that agg is a very slowly changing library (last release 2006?). Or maybe treat patching agg as short term solution. Looking through the filter algorithms too, it looks like exactly the same ops are done to each channel (RGBA) separately. So (it appears as if, to my untrained eye) that the algorithms are applicable regardless of whether or not the alphas are premultiplied. Further, removing the clip will have very minimal impact on "proper" usage of agg (i.e. sending in premultiplied alpha). > I'll try to tackle this problem, as well as the problem that set_alpha > simply doesn't work, at the same time when I get a chance (or patches > are always welcome, of course :). I have a patch, but you don't like it :D But seriously, I'll take a more careful look at what it would take to implement items 1-5 above; it might not be so bad, but I'm uncomfortable dealing with the "underbelly" of matplotlib, as I'm not familiar with either mpl's design nor the general subject of graphics. ------------------------------------------------------------------------------ The demand for IT networking professionals continues to grow, and the demand for specialized networking skills is growing even more rapidly. Take a complimentary Learning@Cisco Self-Assessment and learn about Cisco certifications, training, and career opportunities. http://p.sf.net/sfu/cisco-dev2dev _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users