[PyQt] Faster transparency from a QImage?
Jeiel Aranal
chemikhazi at gmail.com
Tue Jun 17 21:17:00 BST 2008
Is there a faster way to draw transparency on a QWidget from a QImage
other than converting the QImage to a pixmap and setting that as the
mask? I'm trying to have a 3d window draw into PyQt, the window output
is going in fast enough but getting the alpha of the 3d window into
the mask is being way too slow for my purpose. My paint event:
def paintEvent(self, event):
if self.pandaTexture.mightHaveRamImage():
self.pandaTexture.setFormat(Texture.FRgba32)
#print "Should draw yes?"
data = self.pandaTexture.getRamImage().getData()
img = QtGui.QImage(data, self.pandaTexture.getXSize(),
self.pandaTexture.getYSize(), QtGui.QImage.Format_ARGB32).mirrored()
self.paintSurface.begin(self)
self.paintSurface.drawPixmap(0, 0, self.desktopBg)
self.paintSurface.drawImage(0, 0, img)
self.paintSurface.end()
pixmap = QtGui.QPixmap.fromImage(img)
self.setMask(pixmap.mask())
More information about the PyQt
mailing list