Transparency in Index8 QImage
I've got grayscale image data coming from a streaming firewire camera for a scientific application. I'm trying to overlay images with one another in a widget. I've created a 256 gray level colormap for the indexed image, etc. I can draw them just fine in the paintEvent method of the widget.
Is there an easy way to easily set the alpha blending for the whole image so that I can see through the image to whatever is behind?
I'm trying to allow the user to stitch images from side-by-side cameras visually.
for (int i = 0; i < 256; i++)
colorTable.push_back(QColor(i, i, i,128).rgba());@
That seems to create a 50% transparent grayscale index for the colormap of the image. Pretty easy, it seems. Does that track?
I have a follow on question about data sharing and a QImage.
If I create the QImage from a pointer to a unsigned char in memory (and a width and height argument), is it possible to change the pointer withing deleting and re-creating the QImage? Data sharing seems to say that it doesn't copy the data until you try to write to it (which I won't do).
I have a circular frame buffer of images that are being filled by the camera. In my paintevent method, i'm currently creating and destroying qimages.. Would it be faster to re-assign the memory location to the image data? Is that possible once the qimage has been created?
I'm new to the use of this data structure and want to make sure I'm using it as intended.