On Tuesday 18 March 2008 02:30:29 pm Michael Droettboom wrote:
> Darren Dale wrote:
> > I discovered another blitting bug in backend_qt4agg.py. Qt expects a
> > pixmap stringBuffer formatted in ARGB, but mpl formats in RGBA. The qt4
> > backend usually uses the _renderer.tostring_bgra method to return a
> > properly formatted buffer:
> >
> > if QtCore.QSysInfo.ByteOrder == QtCore.QSysInfo.LittleEndian:
> >     stringBuffer = self.renderer._renderer.tostring_bgra()
> > else:
> >     stringBuffer = self.renderer._renderer.tostring_argb()
> >
> > The problem I am seeing is when we are blitting, and the tostring_bgra is
> > not available.
> >  The blitting code in backend_qt4agg.py, starting around line 112,
> > gets a buffer from a region copied from a bbox:
> >
> > reg = self.copy_from_bbox(bbox)
> > stringBuffer = reg.to_string()
> > qImage = QtGui.QImage(stringBuffer, w, h, QtGui.QImage.Format_ARGB32)
> >
> > reg does not have a method to swap the byte order, and Qt does not have a
> > Format_RGBA32. Could anyone suggest how to swap the byte order?
>
> There might be some numpy "trick" to massage the data.  However, it
> looks to me like BufferRegion (in _backend_agg.cpp) needs to grow a
> byte-swapped version of to_string()...  but maybe someone with more
> experience with the Qt backend has a better idea whether this used to
> work and why it may have stopped working.

Thanks for responding. I don't think it ever worked properly with the Qt 
backends. I just dropped back to the maintenance branch to check the 
following script:

from matplotlib import rcParams
rcParams['backend']='qt4agg'
from pylab import *
from matplotlib.widgets import Cursor
ax=axes()
ax.plot([1, 2, 3, 4, 5], 'ro', ms=10)
cursor = Cursor(ax, useblit=True)
show()

and it shows the same behavior.

Darren

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

Reply via email to