57 QList<QColor> colors = { Qt::red, Qt::green, Qt::blue, Qt::yellow };
58 const int width = image.width();
59 const int height = image.height();
61 for (
int j = 0; j < height; ++j) {
62 for (
int i = 0; i < width; ++i) {
63 const int colorX = i < width / 2 ? 0 : 1;
64 const int colorY = j < height / 2 ? 0 : 1;
65 const int colorIndex = colorX + 2 * colorY;
66 image.setPixel(i, j, colors[colorIndex].rgb());
73 using namespace std::chrono;
75 QImage image(m_size, QImage::Format_ARGB32);
77 case ImagePattern::SingleColor:
78 image.fill(colors[m_frameIndex % colors.size()]);
80 case ImagePattern::ColoredSquares:
81 fillColoredSquares(image);
85 QVideoFrame rgbFrame(image);
86 QVideoFrameFormat outputFormat { m_size, m_pixelFormat };
88 QPlatformMediaIntegration::instance()->convertVideoFrame(rgbFrame, outputFormat);
91 frame.setStreamFrameRate(*m_frameRate);
94 frame.setStartTime(duration_cast<microseconds>(*m_period).count() * m_frameIndex);
95 frame.setEndTime(duration_cast<microseconds>(*m_period).count() * (m_frameIndex + 1));
98 if (m_presentationRotation)
99 frame.setRotation(*m_presentationRotation);
101 if (m_presentationMirrored)
102 frame.setMirrored(*m_presentationMirrored);