Hello,

I'm looking to use QSharedMemory to grab an image from a widget into shared memory (using QWidget::grab() or QWidget::render()), so another process/program can process the images.

So I'm looking at the QSharedMemory example here:
http://doc.qt.io/qt-5/qtcore-ipc-sharedmemory-example.html

It looks to me like the process that loads the image from the file into shared memory has 3 deep copies. Maybe implicit sharing reduces that, I'm not sure. But on the surface, it looks like 1) the file is loaded into a QImage using image.load(fileName). Then 2) the QImage is streamed into a QBuffer using out << image; And finally, 3) the buffer is memcopied into shared memory.

So... isn't there an Qt way to do this with 1 copy? It would be trivial to load an image from a file straight into shared memory in straight C. And more importantly, is there a way to grab a widget image data (including alpha channel) straight into shared memory? I'd prefer a Qt way of doing this, but I'd also accept hacks as this doesn't need to be portable. I'm just trying to grab a widget 30 frames a second from my Qt app and convert it to video.

Josh
_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to