Fawkes API  Fawkes Development Version
yuv_viewer_gui.h
00001 
00002 /***************************************************************************
00003  *  yuv_viewer.h - YUV viewer gui
00004  *
00005  *  Created:  Sat Mar 22 16:34:02 2009
00006  *  Copyright 2009 Christof Rath <c.rath@student.tugraz.at>
00007  *
00008  ****************************************************************************/
00009 
00010 /*  This program is free software; you can redistribute it and/or modify
00011  *  it under the terms of the GNU General Public License as published by
00012  *  the Free Software Foundation; either version 2 of the License, or
00013  *  (at your option) any later version.
00014  *
00015  *  This program is distributed in the hope that it will be useful,
00016  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  *  GNU Library General Public License for more details.
00019  *
00020  *  Read the full text in the LICENSE.GPL file in the doc directory.
00021  */
00022 
00023 #ifndef __FIREVISION_TOOLS_YUV_VIEWER_LOC_VIEWER_GUI_H_
00024 #define __FIREVISION_TOOLS_YUV_VIEWER_LOC_VIEWER_GUI_H_
00025 
00026 #define LOC_PLUGIN_NAME       "fvnao_loc"
00027 #define FUSE_PLUGIN_NAME      "fvfountain"
00028 #define FOUNTAIN_PORT_PATH    "/firevision/fountain/tcp_port"
00029 
00030 #include <fvwidgets/image_widget.h>
00031 #include <fvutils/color/yuv.h>
00032 
00033 #include <gtkmm.h>
00034 
00035 using namespace firevision;
00036 
00037 class YuvViewerGtkWindow : public Gtk::Window
00038 {
00039 private:
00040 public:
00041   YuvViewerGtkWindow(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder> builder);
00042   virtual ~YuvViewerGtkWindow();
00043 
00044 private:
00045   bool on_mouse_over_yuv(GdkEventMotion *event);
00046   bool on_click_on_yuv(GdkEventButton *event);
00047   void on_y_value_changed();
00048   void on_y_res_changed();
00049   void on_uv_res_changed();
00050   void calc_seg();
00051   Glib::ustring convert_float2str(float f, unsigned int width);
00052 
00053 private:
00054   // widgets
00055   Gtk::EventBox   *__yuv_vp;
00056   Gtk::Viewport   *__cur_vp;
00057   Gtk::Viewport   *__seg_vp;
00058   Gtk::HScale     *__y_scale;
00059   Gtk::Label      *__u_value;
00060   Gtk::Label      *__v_value;
00061   Gtk::SpinButton *__y_res;
00062   Gtk::SpinButton *__u_res;
00063   Gtk::SpinButton *__v_res;
00064 
00065   ImageWidget     *__yuv_widget;
00066   ImageWidget     *__cur_widget;
00067   ImageWidget     *__seg_widget;
00068 
00069   unsigned char    __yuv_buffer[256 * 256 * 2];
00070   unsigned char    __cur_buffer[ 60 *  40 * 2];
00071   unsigned char    __seg_buffer[256 * 256 * 2];
00072 };
00073 
00074 #endif /* __FIREVISION_TOOLS_YUV_VIEWER_LOC_VIEWER_GUI_H_ */