[Qt-interest] in fact, QImage::ARGB32 is BGRA32 ?
James Yan
jyan972 at gmail.com
Wed Mar 18 08:28:13 CET 2009
hey all,
i need to access buff of QImage and modify them directly in ARGB32 format.
always, i found i just got error result, so i write a code to test like
following:
//play with buff of theTest
unsigned char* p = theTest.bits();
int w = theTest.width();
int h = theTest.height();
int s = theTest.bytesPerLine();
for(int i=0;i<h;i++)
{
for(int j=0;j<w;j++)
{
int t = i*s + j*4;
// it works in BGRA32
p[t + 0] = 0; // change B
p[t + 1] = 0; // change G
p[t + 2] = 0; // change R
/* my original version
p[t + 1] = 0; // change R
p[t + 2] = 0; // change G
p[t + 3] = 0; // change B
*/
}
}
so, it looks like QImage::ARGB32 is BGRA32 actually?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090318/2f433df2/attachment.html
More information about the Qt-interest-old
mailing list