Draw to an image. More...
#include <>>
Public Member Functions | |
Drawer () | |
Constructor. | |
~Drawer () | |
Destructor. | |
void | draw_circle (int center_x, int center_y, unsigned int radius) |
Draw circle. | |
void | draw_rectangle (unsigned int x, unsigned int y, unsigned int w, unsigned int h) |
Draw rectangle. | |
void | draw_rectangle_inverted (unsigned int x, unsigned int y, unsigned int w, unsigned int h) |
Draw inverted rectangle. | |
void | draw_point (unsigned int x, unsigned int y) |
Draw point. | |
void | color_point (unsigned int x, unsigned int y) |
Color the given point. | |
void | color_point (unsigned int x, unsigned int y, YUV_t color) |
Color the given point. | |
void | draw_line (unsigned int x_start, unsigned int y_start, unsigned int x_end, unsigned int y_end) |
Draw line. | |
void | draw_cross (unsigned int x_center, unsigned int y_center, unsigned int width) |
Draws a cross. | |
void | set_buffer (unsigned char *buffer, unsigned int width, unsigned int height) |
Set the buffer to draw to. | |
void | set_color (unsigned char y, unsigned char u, unsigned char v) |
Set drawing color. | |
void | set_color (YUV_t color) |
Set drawing color. |
Draw to an image.
Definition at line 34 of file drawer.h.
firevision::Drawer::Drawer | ( | ) |
Constructor.
Default paint color is white.
Definition at line 44 of file drawer.cpp.
References firevision::YUV_t_struct::white().
firevision::Drawer::~Drawer | ( | ) |
Destructor.
Definition at line 51 of file drawer.cpp.
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.
x | x coordinate of point | |
y | y 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().
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)
x | x coordinate of point | |
y | y coordinate of point | |
color | Color 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.
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.
center_x | x coordinate of circle center | |
center_y | y coordinate of circle center | |
radius | radius 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().
void firevision::Drawer::draw_cross | ( | unsigned int | x_center, | |
unsigned int | y_center, | |||
unsigned int | width | |||
) |
Draws a cross.
x_center | Center of the cross | |
y_center | Center of the cross | |
width | of the bars |
Definition at line 467 of file drawer.cpp.
References draw_line().
Referenced by firevision::FieldDrawer::draw_line_points().
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
x_start | x coordinate of start point | |
y_start | y coordinate of start point | |
x_end | x coordinate of end point | |
y_end | y 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(), and firevision::SEGenerator::linear().
void firevision::Drawer::draw_point | ( | unsigned int | x, | |
unsigned int | y | |||
) |
Draw point.
x | x coordinate of point | |
y | y 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.
void firevision::Drawer::draw_rectangle | ( | unsigned int | x, | |
unsigned int | y, | |||
unsigned int | w, | |||
unsigned int | h | |||
) |
Draw rectangle.
x | x coordinate of rectangle's upper left corner | |
y | y coordinate of rectangle's upper left corner | |
w | width of rectangle from x to the right | |
h | height 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.
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.
x | x coordinate of rectangle's upper left corner | |
y | y coordinate of rectangle's upper left corner | |
w | width of rectangle from x to the right | |
h | height of rectangle from y to the bottom |
Definition at line 268 of file drawer.cpp.
Referenced by ColorTrainWidget::click().
void firevision::Drawer::set_buffer | ( | unsigned char * | buffer, | |
unsigned int | width, | |||
unsigned int | height | |||
) |
Set the buffer to draw to.
buffer | buffer to draw to, must be YUV422 planar formatted | |
width | width of the buffer | |
height | height of the buffer |
Definition at line 62 of file drawer.cpp.
Referenced by ColorTrainWidget::click(), firevision::FieldDrawer::draw_field(), firevision::FieldDrawer::draw_line_points(), firevision::FieldDrawer::draw_lines(), ColorTrainWidget::draw_segmentation_result(), and firevision::SEGenerator::linear().
void firevision::Drawer::set_color | ( | unsigned char | y, | |
unsigned char | u, | |||
unsigned char | v | |||
) |
Set drawing color.
y | Y component of YUV drawing color | |
u | U component of YUV drawing color | |
v | V component of YUV drawing color |
Definition at line 77 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(), firevision::FieldDrawer::draw_line_points(), firevision::FieldDrawer::draw_lines(), ColorTrainWidget::draw_segmentation_result(), and firevision::SEGenerator::linear().
void firevision::Drawer::set_color | ( | YUV_t | color | ) |
Set drawing color.
color | the YUV drawing color |
Definition at line 89 of file drawer.cpp.