58 QList<QColor> colors = { Qt::red, Qt::green, Qt::blue, Qt::yellow };
59 const int width = image.width();
60 const int height = image.height();
62 for (
int j = 0; j < height; ++j) {
63 for (
int i = 0; i < width; ++i) {
64 const int colorX = i < width / 2 ? 0 : 1;
65 const int colorY = j < height / 2 ? 0 : 1;
66 const int colorIndex = colorX + 2 * colorY;
67 image.setPixel(i, j, colors[colorIndex].rgb());
74 using namespace std::chrono;
76 QImage image(m_size, QImage::Format_ARGB32);
78 case ImagePattern::SingleColor:
79 image.fill(colors[m_frameIndex % colors.size()]);
81 case ImagePattern::ColoredSquares:
82 fillColoredSquares(image);
86 QVideoFrame rgbFrame(image);
87 QVideoFrameFormat outputFormat { m_size, m_pixelFormat };
89 QPlatformMediaIntegration::instance()->convertVideoFrame(rgbFrame, outputFormat);
92 frame.setStreamFrameRate(*m_frameRate);
95 frame.setStartTime(duration_cast<microseconds>(*m_period).count() * m_frameIndex);
96 frame.setEndTime(duration_cast<microseconds>(*m_period).count() * (m_frameIndex + 1));
99 if (m_presentationRotation)
100 frame.setRotation(*m_presentationRotation);
102 if (m_presentationMirrored)
103 frame.setMirrored(*m_presentationMirrored);