I have a C++ QT application that is sending a ByteArray of ARGB values via a TCP socket. The image is 100 x 100. The problem is that when I read off the ByteArray I can't seem to get the image to display right. I've tried lots of different ways and here is AS3 code that's got me the closest.
bitmapData.lock();
for(var x = 0;x<100; x++){
for(var y = 0;y<100; y++){
alphaValue = byteArray.readUnsignedByte();
redValue = byteArray.readUnsignedByte();
greenValue = byteArray.readUnsignedByte();
blueValue = byteArray.readUnsignedByte();
color = redValue << 16 | greenValue << 8 | blueValue;
bitmapData.setPixel(y,x,color);
}
}
bitmapData.unlock();
I'm just not using the alpha value at the moment because I'm not sure what to do with it. Qt says "The image is stored using a 32-bit RGB format (0xffRRGGBB)." I tried using readUnsignedInt()
too, but that didn't work either.
Here is what I'm trying to send and what I see on screen.
Sent : Received in Flash
It's close, but not just right. Does anyone have any idea what I may be doing wrong?