ImageProvider.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #ifndef IMAGEPROVIDER_H
  2. #define IMAGEPROVIDER_H
  3. #include "EgoInterface.h"
  4. #include <QImage>
  5. #include <QQuickImageProvider>
  6. #include <mutex>
  7. class ImageProvider : public QQuickImageProvider {
  8. public:
  9. ImageProvider();
  10. QImage requestImage(const QString &id, QSize *size,
  11. const QSize &requestedSize);
  12. QPixmap requestPixmap(const QString &id, QSize *size,
  13. const QSize &requestedSize);
  14. QImage img;
  15. };
  16. class ShowImage : public QObject, public IRender {
  17. Q_OBJECT
  18. public:
  19. explicit ShowImage(QObject *parent,RenderPosition _pos);
  20. ImageProvider *m_pImgProvider;
  21. virtual void OnRender(std::unique_ptr<uint8_t> &pBuffer, int32_t width,
  22. int32_t height) override;
  23. virtual void Empty() override;
  24. public slots:
  25. void sendFrontImage();
  26. void sendBackImage();
  27. void sendLeftImage();
  28. void sendRightImage();
  29. void sendLeftAnchor();
  30. void sendRightAnchor();
  31. // void sendPanelImage(QImage);
  32. signals:
  33. void callQmlRefeshFrontImg();
  34. void callQmlRefeshBackImg();
  35. void callQmlRefeshRightImg();
  36. void callQmlRefeshLeftImg();
  37. void callQmlRefeshLeftAnchor();
  38. void callQmlRefeshRightAnchor();
  39. void callQmlRefeshPanelImg();
  40. // void sendPic(QImage image);
  41. private:
  42. QImage m_image;
  43. RenderPosition campos;
  44. std::mutex buffer_lock_;
  45. };
  46. #endif // IMAGEPROVIDER_H