File indexing completed on 2023-03-17 11:01:12
0001 #ifndef Subsystem_Package_FWTEveViewer_h
0002 #define Subsystem_Package_FWTEveViewer_h
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023 #include <thread>
0024 #include <future>
0025 #include <mutex>
0026 #include <condition_variable>
0027
0028
0029
0030 #include "TEveViewer.h"
0031
0032
0033
0034 class FWTGLViewer;
0035
0036 class FWTEveViewer : public TEveViewer {
0037 public:
0038 FWTEveViewer(const char* n = "FWTEveViewer", const char* t = "");
0039 ~FWTEveViewer() override;
0040
0041
0042
0043
0044
0045 static bool SavePng(const TString& file, UChar_t* xx, int ww, int hh);
0046 static bool SaveJpg(const TString& file, UChar_t* xx, int ww, int hh);
0047
0048
0049
0050 FWTGLViewer* fwGlViewer() { return m_fwGlViewer; }
0051
0052 FWTGLViewer* SpawnFWTGLViewer();
0053
0054 std::future<int> CaptureAndSaveImage(const TString& file, int height = -1);
0055
0056 FWTEveViewer(const FWTEveViewer&) = delete;
0057
0058 const FWTEveViewer& operator=(const FWTEveViewer&) = delete;
0059
0060 private:
0061 void spawn_image_thread();
0062
0063
0064
0065 FWTGLViewer* m_fwGlViewer;
0066
0067 std::vector<unsigned char> m_imgBuffer;
0068
0069 TString m_name;
0070 int m_ww, m_hh;
0071 bool m_thr_exit = false;
0072 std::thread* m_thr = nullptr;
0073 std::promise<int> m_prom;
0074 std::mutex m_moo;
0075 std::condition_variable m_cnd;
0076 };
0077
0078 #endif