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?

Thanks,
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