00001 #ifndef bgui_roi_tableau_make_roi_h_
00002 #define bgui_roi_tableau_make_roi_h_
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #include <bgui/bgui_image_tableau.h>
00015 #include <vgui/vgui_rubberband_tableau.h>
00016
00017 class bgui_roi_tableau_make_roi : public vgui_rubberband_client
00018 {
00019 bool done_;
00020 bgui_image_tableau_sptr image_tableau_;
00021 public:
00022 bool is_done() const { return done_; }
00023
00024 bgui_roi_tableau_make_roi(bgui_image_tableau_sptr const& imt)
00025 : done_(false), image_tableau_(imt) {}
00026
00027 void add_box(float x0,float y0,float x1,float y1)
00028 {
00029 inline void swap(float& a, float& b) { float t=a; a=b; b=t; }
00030 if (x0<x1) swap(x0,x1);
00031 if (y0<y1) swap(y0,y1);
00032 image_tableau_->set_roi(x1,y1,x0-x1,y0-y1);
00033 done_ = true;
00034 }
00035 };
00036
00037 #endif // bgui_roi_tableau_make_roi_h_