xvWidgets
Image.hpp
1 #pragma once
2 
19 #include "Widget.hpp"
20 #include "ImageTranslator.hpp"
21 
22 namespace xv
23 {
24 
29 class Image : public Widget
30 {
31  friend ImagePanel;
32 public:
35  static const cv::Scalar PADDING_COLOR;
36 
37  Image();
38  virtual ~Image();
39 
41  inline void setImage(gui_image_t data){ m_guiImage = data; };
42 
44  inline gui_image_t getImage(){ return m_guiImage; };
45  inline gui_bitmap_t& getBitmap(){ return m_bitmap; };
46 
48  void setBestSizeFit(int w, int h);
49 
52  gui_point_t Image::getPixelInterpolation(gui_point_t point);
53 
55  void createBitmap(int w, int h);
56 
58  cv::Mat
59  m_cvMat, //the original image
60  m_renderMat; //the image transformed for display*/
61 private:
63  std::mutex m_mutex;
64 
66  gui_image_t m_guiImage;
67 
69  gui_bitmap_t m_bitmap;
70 
71  virtual void render(const cv::Mat&);
72 
74  virtual void paint(const cv::Mat&);
75 
77  virtual bool contains(const gui_point_t&);
78 
80  int m_hBorder = 0;
81 
83  int m_vBorder = 0;
84 
86  double m_scale = 1;
87 
88 };
89 
90 }
void createBitmap(int w, int h)
Makes the stored image ready for display.
gui_image_t getImage()
returns stored image data
Definition: Image.hpp:44
void setImage(gui_image_t data)
load data into the image container
Definition: Image.hpp:41
static const cv::Scalar PADDING_COLOR
Definition: Image.hpp:35
Class used to display images and as container of widgets.
Definition: ImagePanel.hpp:32
An off-screen image representation native to the selected GUI.
Definition: Image.hpp:29
cv::Mat m_cvMat
to-do: refactor
Definition: Image.hpp:59
Definition: Angle.hpp:8
void setBestSizeFit(int w, int h)
Fits the image to a new size using black borders to mantain aspect ratio.
Base class for all Widgets.
Definition: Widget.hpp:40