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 #include <libglademm/xml.h>
00035 
00036 using namespace firevision;
00037 
00038 class YuvViewerGtkWindow : public Gtk::Window
00039 {
00040 private:
00041 public:
00042   YuvViewerGtkWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml> ref_xml);
00043   virtual ~YuvViewerGtkWindow();
00044 
00045 private:
00046   bool on_mouse_over_yuv(GdkEventMotion *event);
00047   bool on_click_on_yuv(GdkEventButton *event);
00048   void on_y_value_changed();
00049   void on_y_res_changed();
00050   void on_uv_res_changed();
00051   void calc_seg();
00052   Glib::ustring convert_float2str(float f, unsigned int width);
00053 
00054 private:
00055   // widgets
00056   Gtk::EventBox   *__yuv_vp;
00057   Gtk::Viewport   *__cur_vp;
00058   Gtk::Viewport   *__seg_vp;
00059   Gtk::HScale     *__y_scale;
00060   Gtk::Label      *__u_value;
00061   Gtk::Label      *__v_value;
00062   Gtk::SpinButton *__y_res;
00063   Gtk::SpinButton *__u_res;
00064   Gtk::SpinButton *__v_res;
00065 
00066   ImageWidget     *__yuv_widget;
00067   ImageWidget     *__cur_widget;
00068   ImageWidget     *__seg_widget;
00069 
00070   unsigned char    __yuv_buffer[256 * 256 * 2];
00071   unsigned char    __cur_buffer[ 60 *  40 * 2];
00072   unsigned char    __seg_buffer[256 * 256 * 2];
00073 };
00074 
00075 #endif /* __FIREVISION_TOOLS_YUV_VIEWER_LOC_VIEWER_GUI_H_ */