Fawkes API  Fawkes Development Version
firevision::Drawer Class Reference

Draw to an image. More...

#include <>>

Public Member Functions

 Drawer ()
 Constructor. More...
 
 ~Drawer ()
 Destructor. More...
 
void draw_circle (int center_x, int center_y, unsigned int radius)
 Draw circle. More...
 
void draw_rectangle (unsigned int x, unsigned int y, unsigned int w, unsigned int h)
 Draw rectangle. More...
 
void draw_rectangle_inverted (unsigned int x, unsigned int y, unsigned int w, unsigned int h)
 Draw inverted rectangle. More...
 
void draw_point (unsigned int x, unsigned int y)
 Draw point. More...
 
void color_point (unsigned int x, unsigned int y)
 Color the given point. More...
 
void color_point (unsigned int x, unsigned int y, YUV_t color)
 Color the given point. More...
 
void draw_line (unsigned int x_start, unsigned int y_start, unsigned int x_end, unsigned int y_end)
 Draw line. More...
 
void draw_cross (unsigned int x_center, unsigned int y_center, unsigned int width)
 Draws a cross. More...
 
void set_buffer (unsigned char *buffer, unsigned int width, unsigned int height)
 Set the buffer to draw to. More...
 
void set_color (unsigned char y, unsigned char u, unsigned char v)
 Set drawing color. More...
 
void set_color (YUV_t color)
 Set drawing color. More...
 

Detailed Description

Draw to an image.

Author
Tim Niemueller

Definition at line 34 of file drawer.h.

Constructor & Destructor Documentation

◆ Drawer()

firevision::Drawer::Drawer ( )

Constructor.

Default paint color is white.

Definition at line 44 of file drawer.cpp.

References firevision::YUV_t_struct::white().

◆ ~Drawer()

firevision::Drawer::~Drawer ( )

Destructor.

Definition at line 51 of file drawer.cpp.

Member Function Documentation

◆ color_point() [1/2]

void firevision::Drawer::color_point ( unsigned int  x,
unsigned int  y 
)

Color the given point.

This will leave the Y-component of the given pixel unchanged and will just set the U and V components. This can be used to keep a little bit of original image information but marking special regions.

Parameters
xx coordinate of point
yy coordinate of point

Definition at line 336 of file drawer.cpp.

References firevision::YUV_t_struct::U, firevision::YUV_t_struct::V, and firevision::YUV_t_struct::Y.

Referenced by ColorTrainWidget::draw_segmentation_result(), and firevision::FilterROIDraw::~FilterROIDraw().

◆ color_point() [2/2]

void firevision::Drawer::color_point ( unsigned int  x,
unsigned int  y,
YUV_t  color 
)

Color the given point.

This will color a single point (to save excessive function calls the color is also a parameter)

Parameters
xx coordinate of point
yy coordinate of point
colorColor to set

Definition at line 358 of file drawer.cpp.

References firevision::YUV_t_struct::U, firevision::YUV_t_struct::V, and firevision::YUV_t_struct::Y.

◆ draw_circle()

void firevision::Drawer::draw_circle ( int  center_x,
int  center_y,
unsigned int  radius 
)

Draw circle.

Draws a circle at the given center point and with the given radius.

Parameters
center_xx coordinate of circle center
center_yy coordinate of circle center
radiusradius of circle

Definition at line 102 of file drawer.cpp.

References firevision::YUV_t_struct::U, firevision::YUV_t_struct::V, and firevision::YUV_t_struct::Y.

Referenced by firevision::FieldDrawer::draw_field(), and firevision::FieldDrawer::draw_lines().

◆ draw_cross()

void firevision::Drawer::draw_cross ( unsigned int  x_center,
unsigned int  y_center,
unsigned int  width 
)

Draws a cross.

Parameters
x_centerCenter of the cross
y_centerCenter of the cross
widthof the bars

Definition at line 467 of file drawer.cpp.

References draw_line().

Referenced by firevision::FieldDrawer::draw_line_points().

◆ draw_line()

void firevision::Drawer::draw_line ( unsigned int  x_start,
unsigned int  y_start,
unsigned int  x_end,
unsigned int  y_end 
)

Draw line.

Standard Bresenham in all directions. For in-depth information have a look at http://de.wikipedia.org/wiki/Bresenham-Algorithmus

Parameters
x_startx coordinate of start point
y_starty coordinate of start point
x_endx coordinate of end point
y_endy coordinate of end point

Definition at line 381 of file drawer.cpp.

References firevision::YUV_t_struct::U, firevision::YUV_t_struct::V, and firevision::YUV_t_struct::Y.

Referenced by draw_cross(), firevision::FieldDrawer::draw_field(), firevision::FieldDrawer::draw_lines(), firevision::SEGenerator::linear(), and YuvViewerGtkWindow::~YuvViewerGtkWindow().

◆ draw_point()

void firevision::Drawer::draw_point ( unsigned int  x,
unsigned int  y 
)

Draw point.

Parameters
xx coordinate of point
yy coordinate of point

Definition at line 314 of file drawer.cpp.

References firevision::YUV_t_struct::U, firevision::YUV_t_struct::V, and firevision::YUV_t_struct::Y.

◆ draw_rectangle()

void firevision::Drawer::draw_rectangle ( unsigned int  x,
unsigned int  y,
unsigned int  w,
unsigned int  h 
)

Draw rectangle.

Parameters
xx coordinate of rectangle's upper left corner
yy coordinate of rectangle's upper left corner
wwidth of rectangle from x to the right
hheight of rectangle from y to the bottom

Definition at line 212 of file drawer.cpp.

References firevision::YUV_t_struct::U, firevision::YUV_t_struct::V, and firevision::YUV_t_struct::Y.

Referenced by Firestation::get_window().

◆ draw_rectangle_inverted()

void firevision::Drawer::draw_rectangle_inverted ( unsigned int  x,
unsigned int  y,
unsigned int  w,
unsigned int  h 
)

Draw inverted rectangle.

This draws a rectangle but instead of using the draw color it is drawn in the inverted color of the pixel where it is drawn.

Parameters
xx coordinate of rectangle's upper left corner
yy coordinate of rectangle's upper left corner
wwidth of rectangle from x to the right
hheight of rectangle from y to the bottom

Definition at line 268 of file drawer.cpp.

Referenced by ColorTrainWidget::click().

◆ set_buffer()

void firevision::Drawer::set_buffer ( unsigned char *  buffer,
unsigned int  width,
unsigned int  height 
)

◆ set_color() [1/2]

void firevision::Drawer::set_color ( unsigned char  y,
unsigned char  u,
unsigned char  v 
)

◆ set_color() [2/2]

void firevision::Drawer::set_color ( YUV_t  color)

Set drawing color.

Parameters
colorthe YUV drawing color

Definition at line 89 of file drawer.cpp.


The documentation for this class was generated from the following files: