2022-06-08 12:47:24 +00:00
|
|
|
// Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
|
2024-02-23 14:41:04 +00:00
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
|
2017-06-21 08:01:55 +00:00
|
|
|
|
|
|
|
#ifndef RENDERCAPTUREPROVIDER_H
|
|
|
|
#define RENDERCAPTUREPROVIDER_H
|
|
|
|
|
|
|
|
#include <QtQuick/QQuickImageProvider>
|
|
|
|
#include <Qt3DRender/QRenderCapture>
|
|
|
|
|
2020-09-03 10:01:47 +00:00
|
|
|
class RenderCaptureProvider : public QQuickImageProvider
|
2017-06-21 08:01:55 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
RenderCaptureProvider()
|
2020-09-03 10:01:47 +00:00
|
|
|
: QQuickImageProvider(Image)
|
2017-06-21 08:01:55 +00:00
|
|
|
{
|
|
|
|
m_image = QImage(10,10, QImage::Format_ARGB32);
|
|
|
|
m_image.fill(QColor("blue").rgba());
|
|
|
|
}
|
|
|
|
|
|
|
|
Q_INVOKABLE void updateImage(Qt3DRender::QRenderCaptureReply *reply)
|
|
|
|
{
|
|
|
|
m_image = reply->image();
|
|
|
|
}
|
|
|
|
|
2020-08-18 08:41:03 +00:00
|
|
|
virtual QImage requestImage(const QString &id, QSize *size, const QSize &requestedSize) override
|
2017-06-21 08:01:55 +00:00
|
|
|
{
|
2020-06-23 14:10:52 +00:00
|
|
|
Q_UNUSED(id);
|
|
|
|
Q_UNUSED(requestedSize);
|
2017-06-21 08:01:55 +00:00
|
|
|
*size = m_image.size();
|
|
|
|
return m_image;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
QImage m_image;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|