CanvasCV: CanvasCV-doxygen/src/canvascv/widgets/matwidget.h Source File
CanvasCV  1.0.0
matwidget.h
1 #ifndef MATWIDGET_H
2 #define MATWIDGET_H
3 
4 #include <opencv2/opencv.hpp>
5 #include <list>
6 #include "canvascv/colors.h"
7 #include "widget.h"
8 
9 namespace canvascv
10 {
11 
17 class MatWidget : public Widget
18 {
19 public:
27  static std::shared_ptr<MatWidget> create(Layout &layout,
28  cv::Mat mat = cv::Mat(),
29  const cv::Point &pos = cv::Point(0,0));
30 
31 
33  const cv::Mat &getMat() const;
34 
41  void setMat(const cv::Mat &value);
42 
43  virtual const char *getType() const;
44  static const char *type;
45 protected:
46  friend class WidgetFactory;
47  template <class T> friend class WidgetFactoryT;
48 
49  virtual const cv::Rect &getRect();
50  virtual const cv::Rect &getMinimalRect();
51 
52  MatWidget(const cv::Point &pos);
53 
54  virtual void recalc();
55 
56  virtual void drawFG(cv::Mat &dst);
57 
58  /* TODO - write/read widgets to file for a designer app
59  virtual void writeInternals(cv::FileStorage &fs) const
60  {
61  }
62  virtual void readInternals(const cv::FileNode &node)
63  {
64  }
65  */
66 
67 private:
68  cv::Mat mat;
69  cv::Mat displayedMat;
70  cv::Rect rect;
71  cv::Rect minimalRect;
72 };
73 
74 }
75 
80 #endif // MATWIDGET_H
The WidgetFactory class.
Definition: widgetfactory.h:24
The MatWidget class.
Definition: matwidget.h:17
void setMat(const cv::Mat &value)
setMat
virtual const cv::Rect & getMinimalRect()
Minimal size the widget coould have occupy.
const cv::Mat & getMat() const
get the FG Mat which is displayed by the widget
virtual void recalc()
update self so next call to &#39;draw&#39; will display correctly
This namespace holds all the classes of the CanvasCV library.
Definition: canvas.h:20
virtual const char * getType() const
getType is always implemented by derived to return the same static pointer per widget.
virtual void drawFG(cv::Mat &dst)
dst is the roi of the widget size and not the full image
The Layout class.
Definition: layout.h:17
virtual const cv::Rect & getRect()
Actual size the widget is occupying due to Layout manager.
static std::shared_ptr< MatWidget > create(Layout &layout, cv::Mat mat=cv::Mat(), const cv::Point &pos=cv::Point(0, 0))
create a MatWidget widget
The WidgetFactoryT class.
Definition: widgetfactory.h:58
The Widget class.
Definition: widget.h:28