ImageProvider.h 1.3 KB

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