28 #include <IceUtil/Time.h>
55 if (numberImages == 0)
60 QPainter painter(
this);
61 std::scoped_lock lock(imageMutex);
62 painter.drawImage(0, 0, scaledImage);
82 std::scoped_lock lock(bufferMutex);
83 this->imageTimestamp = imageTimestamp;
84 this->receiveTimestamp = receiveTimestamp;
85 if (inputWidth != images[0]->width || inputHeight != images[0]->height || this->numberImages != numberImages)
87 inputWidth = images[0]->width;
88 inputHeight = images[0]->height;
89 this->numberImages = numberImages;
96 buffer =
new unsigned char[inputWidth * inputHeight * 4 * numberImages];
100 for (
int i = 0 ; i < numberImages ; i++)
102 if (images[i]->type == CByteImage::eRGB24)
104 unsigned char* pixels = images[i]->pixels;
105 int* output = (
int*) buffer;
108 for (
int y = 0 ; y < inputHeight ; y++)
110 int baseOffset = y * inputWidth * numberImages + i * inputWidth;
111 for (
int x = 0 ; x < inputWidth ; x++)
113 output[x + baseOffset] = 255 << 24 | pixels[inputOffset] << 16 | pixels[inputOffset + 1] << 8 | pixels[inputOffset + 2];
121 QImage image(buffer, inputWidth * this->numberImages, inputHeight, QImage::Format_RGB32);
123 std::scoped_lock lock2(imageMutex);
124 scaledImage = image.scaled(width(), height(), Qt::KeepAspectRatio, Qt::SmoothTransformation);
127 QMetaObject::invokeMethod(
this,
"updateImage", Q_ARG(
long, receiveTimestamp.toMicroSeconds()));
132 update(0, 0, width(), height());
134 displayDelay = timeDisplayed - IceUtil::Time::microSeconds(timeReceived);
139 return {(
float) scaledImage.width(), (
float) scaledImage.height()};