From c0657c13e526b9e66bf52e183f0f7e739d84b599 Mon Sep 17 00:00:00 2001 From: kevin Date: Mon, 24 Jun 2019 11:22:22 -0400 Subject: [PATCH] I misunderstood the description of QImage::Format_RGBA8888, I figured it converted the color order to RGB regardless of if the arch is little or big endian. I've not tested on a big endian machine but using ARGB32 produces the right order of colors. --- hgx11grab.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hgx11grab.cpp b/hgx11grab.cpp index 4e6f7a8..ba4d8cf 100644 --- a/hgx11grab.cpp +++ b/hgx11grab.cpp @@ -136,7 +136,7 @@ void hgx11grab::_grabFrame() return; } - QImage qimg = *new QImage(reinterpret_cast(_xImage_p->data), _destWidth_m, _destHeight_m, _xImage_p->bytes_per_line, QImage::Format_RGBA8888); + QImage qimg = *new QImage(reinterpret_cast(_xImage_p->data), _destWidth_m, _destHeight_m, _xImage_p->bytes_per_line, QImage::Format_ARGB32); qimg = qimg.convertToFormat(QImage::Format_RGB888); imgdata_m.clear(); imgdata_m = QByteArray::fromRawData(reinterpret_cast(qimg.bits()), qimg.byteCount());