Visual Servoing Platform  version 3.1.0
vpDisplay_rgba.cpp
1 #include <visp3/core/vpDisplay.h>
2 
3 #include "vpDisplay_impl.h"
4 
5 //************************************************************************
6 // Modifications done in this file should be reported in all vpDisplay_*.cpp
7 // files that implement other types (unsigned char, vpRGB, vpRGBa)
8 //************************************************************************
9 
13 void vpDisplay::close(vpImage<vpRGBa> &I) { vp_display_close(I); }
14 
23 void vpDisplay::displayArrow(const vpImage<vpRGBa> &I, const vpImagePoint &ip1, const vpImagePoint &ip2,
24  const vpColor &color, unsigned int w, unsigned int h, unsigned int thickness)
25 {
26  vp_display_display_arrow(I, ip1, ip2, color, w, h, thickness);
27 }
28 
39 void vpDisplay::displayArrow(const vpImage<vpRGBa> &I, int i1, int j1, int i2, int j2, const vpColor &color,
40  unsigned int w, unsigned int h, unsigned int thickness)
41 {
42  vp_display_display_arrow(I, i1, j1, i2, j2, color, w, h, thickness);
43 }
44 
59  double size, const vpColor &color, unsigned int thickness)
60 {
61  vp_display_display_camera(I, cMo, cam, size, color, thickness);
62 }
63 
77 void vpDisplay::displayCharString(const vpImage<vpRGBa> &I, const vpImagePoint &ip, const char *string,
78  const vpColor &color)
79 {
80  vp_display_display_char_string(I, ip, string, color);
81 }
82 
96 void vpDisplay::displayCharString(const vpImage<vpRGBa> &I, int i, int j, const char *string, const vpColor &color)
97 {
98  vp_display_display_char_string(I, i, j, string, color);
99 }
100 
111 void vpDisplay::displayCircle(const vpImage<vpRGBa> &I, const vpImagePoint &center, unsigned int radius,
112  const vpColor &color, bool fill, unsigned int thickness)
113 {
114  vp_display_display_circle(I, center, radius, color, fill, thickness);
115 }
116 
127 void vpDisplay::displayCircle(const vpImage<vpRGBa> &I, int i, int j, unsigned int radius, const vpColor &color,
128  bool fill, unsigned int thickness)
129 {
130  vp_display_display_circle(I, i, j, radius, color, fill, thickness);
131 }
132 
141 void vpDisplay::displayCross(const vpImage<vpRGBa> &I, const vpImagePoint &ip, unsigned int size, const vpColor &color,
142  unsigned int thickness)
143 {
144  vp_display_display_cross(I, ip, size, color, thickness);
145 }
146 
155 void vpDisplay::displayCross(const vpImage<vpRGBa> &I, int i, int j, unsigned int size, const vpColor &color,
156  unsigned int thickness)
157 {
158  vp_display_display_cross(I, i, j, size, color, thickness);
159 }
160 
169  const vpColor &color, unsigned int thickness)
170 {
171  vp_display_display_dot_line(I, ip1, ip2, color, thickness);
172 }
173 
182 void vpDisplay::displayDotLine(const vpImage<vpRGBa> &I, int i1, int j1, int i2, int j2, const vpColor &color,
183  unsigned int thickness)
184 {
185  vp_display_display_dot_line(I, i1, j1, i2, j2, color, thickness);
186 }
187 
196 void vpDisplay::displayDotLine(const vpImage<vpRGBa> &I, const std::vector<vpImagePoint> &ips, const bool closeTheShape,
197  const vpColor &color, unsigned int thickness)
198 {
199  if (ips.size() <= 1)
200  return;
201 
202  for (size_t i = 0; i < ips.size() - 1; i++)
203  vp_display_display_dot_line(I, ips[i], ips[i + 1], color, thickness);
204 
205  if (closeTheShape)
206  vp_display_display_dot_line(I, ips.front(), ips.back(), color, thickness);
207 }
208 
257 void vpDisplay::displayEllipse(const vpImage<vpRGBa> &I, const vpImagePoint &center, const double &coef1,
258  const double &coef2, const double &coef3, bool use_centered_moments,
259  const vpColor &color, unsigned int thickness)
260 {
261  vpDisplay::displayEllipse(I, center, coef1, coef2, coef3, 0., vpMath::rad(360), use_centered_moments, color,
262  thickness);
263 }
264 
318 void vpDisplay::displayEllipse(const vpImage<vpRGBa> &I, const vpImagePoint &center, const double &coef1,
319  const double &coef2, const double &coef3, const double &theta1, const double &theta2,
320  bool use_centered_moments, const vpColor &color, unsigned int thickness)
321 {
322  vp_display_display_ellipse(I, center, coef1, coef2, coef3, theta1, theta2, use_centered_moments, color, thickness);
323 }
324 
341  double size, const vpColor &color, unsigned int thickness, const vpImagePoint &offset)
342 {
343  vp_display_display_frame(I, cMo, cam, size, color, thickness, offset);
344 }
345 
353 void vpDisplay::displayLine(const vpImage<vpRGBa> &I, const vpImagePoint &ip1, const vpImagePoint &ip2,
354  const vpColor &color, unsigned int thickness)
355 {
356  vp_display_display_line(I, ip1, ip2, color, thickness);
357 }
358 
367 void vpDisplay::displayLine(const vpImage<vpRGBa> &I, int i1, int j1, int i2, int j2, const vpColor &color,
368  unsigned int thickness)
369 {
370  vp_display_display_line(I, i1, j1, i2, j2, color, thickness);
371 }
372 
380 void vpDisplay::displayLine(const vpImage<vpRGBa> &I, const std::vector<vpImagePoint> &ips, const bool closeTheShape,
381  const vpColor &color, unsigned int thickness)
382 {
383  if (ips.size() <= 1)
384  return;
385 
386  for (size_t i = 0; i < ips.size() - 1; i++)
387  vp_display_display_line(I, ips[i], ips[i + 1], color, thickness);
388 
389  if (closeTheShape)
390  vp_display_display_line(I, ips.front(), ips.back(), color, thickness);
391 }
392 
400 void vpDisplay::displayPoint(const vpImage<vpRGBa> &I, const vpImagePoint &ip, const vpColor &color,
401  unsigned int thickness)
402 {
403  vp_display_display_point(I, ip, color, thickness);
404 }
405 
413 void vpDisplay::displayPoint(const vpImage<vpRGBa> &I, int i, int j, const vpColor &color, unsigned int thickness)
414 {
415  vp_display_display_point(I, i, j, color, thickness);
416 }
417 
425 void vpDisplay::displayPolygon(const vpImage<vpRGBa> &I, const std::vector<vpImagePoint> &vip, const vpColor &color,
426  unsigned int thickness)
427 {
428  vp_display_display_polygon(I, vip, color, thickness);
429 }
430 
445 void vpDisplay::displayRectangle(const vpImage<vpRGBa> &I, const vpImagePoint &topLeft, unsigned int width,
446  unsigned int height, const vpColor &color, bool fill, unsigned int thickness)
447 {
448  vp_display_display_rectangle(I, topLeft, width, height, color, fill, thickness);
449 }
450 
465 void vpDisplay::displayRectangle(const vpImage<vpRGBa> &I, int i, int j, unsigned int width, unsigned int height,
466  const vpColor &color, bool fill, unsigned int thickness)
467 {
468  vp_display_display_rectangle(I, i, j, width, height, color, fill, thickness);
469 }
470 
484 void vpDisplay::displayRectangle(const vpImage<vpRGBa> &I, const vpRect &rectangle, const vpColor &color, bool fill,
485  unsigned int thickness)
486 {
487  vp_display_display_rectangle(I, rectangle, color, fill, thickness);
488 }
489 
503 void vpDisplay::displayRectangle(const vpImage<vpRGBa> &I, const vpImagePoint &center, float angle, unsigned int width,
504  unsigned int height, const vpColor &color, unsigned int thickness)
505 {
506  vp_display_display_rectangle(I, center, angle, width, height, color, thickness);
507 }
508 
523 void vpDisplay::displayRectangle(const vpImage<vpRGBa> &I, const vpImagePoint &topLeft, const vpImagePoint &bottomRight,
524  const vpColor &color, bool fill, unsigned int thickness)
525 {
526  vp_display_display_rectangle(I, topLeft, bottomRight, color, fill, thickness);
527 }
528 
542 void vpDisplay::displayRectangle(const vpImage<vpRGBa> &I, unsigned int i, unsigned int j, float angle,
543  unsigned int width, unsigned int height, const vpColor &color, unsigned int thickness)
544 {
545  vp_display_display_rectangle(I, i, j, angle, width, height, color, thickness);
546 }
547 
560 void vpDisplay::displayText(const vpImage<vpRGBa> &I, const vpImagePoint &ip, const std::string &s,
561  const vpColor &color)
562 {
563  vp_display_display_text(I, ip, s, color);
564 }
565 
578 void vpDisplay::displayText(const vpImage<vpRGBa> &I, int i, int j, const std::string &s, const vpColor &color)
579 {
580  vp_display_display_text(I, i, j, s, color);
581 }
582 
612 void vpDisplay::flush(const vpImage<vpRGBa> &I) { vp_display_flush(I); }
613 
623 void vpDisplay::flushROI(const vpImage<vpRGBa> &I, const vpRect &roi) { vp_display_flush_roi(I, roi); }
624 
636 void vpDisplay::display(const vpImage<vpRGBa> &I) { vp_display_display(I); }
637 
642 void vpDisplay::displayROI(const vpImage<vpRGBa> &I, const vpRect &roi) { vp_display_display_roi(I, roi); }
643 
661 bool vpDisplay::getClick(const vpImage<vpRGBa> &I, bool blocking) { return vp_display_get_click(I, blocking); }
662 
681 bool vpDisplay::getClick(const vpImage<vpRGBa> &I, vpImagePoint &ip, bool blocking)
682 {
683  return vp_display_get_click(I, ip, blocking);
684 }
685 
707  bool blocking)
708 {
709  return vp_display_get_click(I, ip, button, blocking);
710 }
711 
729 {
730  vpImagePoint ip;
731  return vpDisplay::getClick(I, ip, button, blocking);
732 }
733 
755  bool blocking)
756 {
757  return vp_display_get_click_up(I, ip, button, blocking);
758 }
759 
777 {
778  vpImagePoint ip;
779  return vpDisplay::getClickUp(I, ip, button, blocking);
780 }
781 
864 bool vpDisplay::getKeyboardEvent(const vpImage<vpRGBa> &I, bool blocking)
865 {
866  return vp_display_get_keyboard_event(I, blocking);
867 }
868 
955 bool vpDisplay::getKeyboardEvent(const vpImage<vpRGBa> &I, std::string &key, bool blocking)
956 {
957  return vp_display_get_keyboard_event(I, key, blocking);
958 }
959 
1046 bool vpDisplay::getKeyboardEvent(const vpImage<vpRGBa> &I, char *key, bool blocking)
1047 {
1048  return vp_display_get_keyboard_event(I, key, blocking);
1049 }
1050 
1061 {
1062  return vp_display_get_pointer_motion_event(I, ip);
1063 }
1064 
1075 {
1076  return vp_display_get_pointer_position(I, ip);
1077 }
1078 
1088 void vpDisplay::setBackground(const vpImage<vpRGBa> &I, const vpColor &color) { vp_display_set_background(I, color); }
1089 
1103 void vpDisplay::setFont(const vpImage<vpRGBa> &I, const std::string &fontname) { vp_display_set_font(I, fontname); }
1104 
1112 void vpDisplay::setTitle(const vpImage<vpRGBa> &I, const std::string &windowtitle)
1113 {
1114  vp_display_set_title(I, windowtitle);
1115 }
1116 
1127 void vpDisplay::setWindowPosition(const vpImage<vpRGBa> &I, int winx, int winy)
1128 {
1129  vp_display_set_window_position(I, winx, winy);
1130 }
1131 
1141 unsigned int vpDisplay::getDownScalingFactor(const vpImage<vpRGBa> &I) { return vp_display_get_down_scaling_factor(I); }
static void displayCamera(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam, double size, const vpColor &color, unsigned int thickness)
static void displayEllipse(const vpImage< unsigned char > &I, const vpImagePoint &center, const double &coef1, const double &coef2, const double &coef3, bool use_centered_moments, const vpColor &color, unsigned int thickness=1)
static bool getPointerPosition(const vpImage< unsigned char > &I, vpImagePoint &ip)
static bool getClick(const vpImage< unsigned char > &I, bool blocking=true)
static void close(vpImage< unsigned char > &I)
static bool getPointerMotionEvent(const vpImage< unsigned char > &I, vpImagePoint &ip)
Implementation of an homogeneous matrix and operations on such kind of matrices.
static void displayPolygon(const vpImage< unsigned char > &I, const std::vector< vpImagePoint > &vip, const vpColor &color, unsigned int thickness=1)
Class to define colors available for display functionnalities.
Definition: vpColor.h:120
static void displayText(const vpImage< unsigned char > &I, const vpImagePoint &ip, const std::string &s, const vpColor &color)
static bool getClickUp(const vpImage< unsigned char > &I, vpImagePoint &ip, vpMouseButton::vpMouseButtonType &button, bool blocking=true)
static void displayPoint(const vpImage< unsigned char > &I, const vpImagePoint &ip, const vpColor &color, unsigned int thickness=1)
static void flush(const vpImage< unsigned char > &I)
static void setFont(const vpImage< unsigned char > &I, const std::string &font)
static void displayArrow(const vpImage< unsigned char > &I, const vpImagePoint &ip1, const vpImagePoint &ip2, const vpColor &color=vpColor::white, unsigned int w=4, unsigned int h=2, unsigned int thickness=1)
static void display(const vpImage< unsigned char > &I)
Generic class defining intrinsic camera parameters.
static void displayRectangle(const vpImage< unsigned char > &I, const vpImagePoint &topLeft, unsigned int width, unsigned int height, const vpColor &color, bool fill=false, unsigned int thickness=1)
static double rad(double deg)
Definition: vpMath.h:102
static void displayCircle(const vpImage< unsigned char > &I, const vpImagePoint &center, unsigned int radius, const vpColor &color, bool fill=false, unsigned int thickness=1)
static void displayCross(const vpImage< unsigned char > &I, const vpImagePoint &ip, unsigned int size, const vpColor &color, unsigned int thickness=1)
static void setWindowPosition(const vpImage< unsigned char > &I, int winx, int winy)
static void displayFrame(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam, double size, const vpColor &color=vpColor::none, unsigned int thickness=1, const vpImagePoint &offset=vpImagePoint(0, 0))
unsigned int getDownScalingFactor()
Definition: vpDisplay.h:229
static void setBackground(const vpImage< unsigned char > &I, const vpColor &color)
Defines a rectangle in the plane.
Definition: vpRect.h:78
static void flushROI(const vpImage< unsigned char > &I, const vpRect &roi)
static void displayROI(const vpImage< unsigned char > &I, const vpRect &roi)
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...
Definition: vpImagePoint.h:88
static void displayLine(const vpImage< unsigned char > &I, const vpImagePoint &ip1, const vpImagePoint &ip2, const vpColor &color, unsigned int thickness=1)
static bool getKeyboardEvent(const vpImage< unsigned char > &I, bool blocking=true)
static void displayCharString(const vpImage< unsigned char > &I, const vpImagePoint &ip, const char *string, const vpColor &color)
static void setTitle(const vpImage< unsigned char > &I, const std::string &windowtitle)
static void displayDotLine(const vpImage< unsigned char > &I, const vpImagePoint &ip1, const vpImagePoint &ip2, const vpColor &color, unsigned int thickness=1)