field_drawer.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef __FVUTILS_DRAWER_FIELD_DRAWER_H__
00023 #define __FVUTILS_DRAWER_FIELD_DRAWER_H__
00024
00025 #include "field.h"
00026
00027 #include <utils/math/types.h>
00028 #include <fvutils/color/yuv.h>
00029
00030
00031 class SharedMemoryImageBuffer;
00032
00033 class FieldDrawer
00034 {
00035 public:
00036 FieldDrawer(const FieldLines &lines);
00037 virtual ~FieldDrawer();
00038
00039 void set_head_yaw(float head_yaw);
00040 void set_own_pos(fawkes::field_pos_t own_position);
00041 void set_own_pos_est(fawkes::field_pos_t own_position_estimate);
00042
00043 void set_line_points(const fld_line_points_t *points);
00044 void set_line_points_est(const fld_line_points_t *points_est);
00045
00046 void set_color_background(YUV_t color);
00047 void set_color_field(YUV_t color);
00048 void set_color_lines(YUV_t color);
00049 void set_color_line_points(YUV_t color);
00050 void set_color_line_points_est(YUV_t color);
00051 void set_color_own_pos(YUV_t color);
00052 void set_color_own_pos_est(YUV_t color);
00053
00054 virtual void draw_field(unsigned char *yuv422_planar, unsigned int img_width, unsigned int img_height,
00055 bool draw_background = true, bool draw_landscape = true);
00056
00057 protected:
00058 inline void clear_own_pos();
00059 inline float get_scale(unsigned int img_width, unsigned int img_height, bool draw_landscape = true) const;
00060 virtual void draw_line_points(bool draw_landscape = true, float scale = 0) const;
00061 virtual void draw_lines(YUV_t color, bool draw_landscape = true, float scale = 0) const;
00062
00063 unsigned char *_img_buffer;
00064 unsigned int _img_width;
00065 unsigned int _img_height;
00066
00067 private:
00068 const FieldLines &__lines;
00069 fawkes::field_pos_t __own_position, __own_pos_est;
00070 float __head_yaw;
00071
00072 const fld_line_points_t *__points;
00073 const fld_line_points_t *__points_est;
00074
00075 YUV_t __c_background;
00076 YUV_t __c_field;
00077 YUV_t __c_lines;
00078 YUV_t __c_line_points;
00079 YUV_t __c_line_points_est;
00080 YUV_t __c_own_pos;
00081 YUV_t __c_own_pos_est;
00082 };
00083
00084 #endif