Visual Servoing Platform  version 3.6.1 under development (2024-11-15)
tutorial-draw-line.cpp
1 #include <visp3/core/vpConfig.h>
3 #include <visp3/gui/vpDisplayGDI.h>
4 #include <visp3/gui/vpDisplayX.h>
5 
6 int main()
7 {
8 #ifdef ENABLE_VISP_NAMESPACE
9  using namespace VISP_NAMESPACE_NAME;
10 #endif
11 
12  vpImage<unsigned char> I(2160, 3840, 128);
13 
14  try {
15 
16 #if defined(VISP_HAVE_X11)
17  vpDisplayX d(I, vpDisplay::SCALE_AUTO);
18 #elif defined(VISP_HAVE_GDI)
20 #endif
21 
22  vpDisplay::setTitle(I, "My image");
25  vpDisplay::displayLine(I, I.getHeight() / 4, I.getWidth() / 4, (3 * I.getHeight()) / 4, (3 * I.getWidth()) / 4,
26  vpColor::red, 10);
29  std::cout << "A click to quit..." << std::endl;
31  }
32  catch (const vpException &e) {
33  std::cout << "Catch an exception: " << e.getMessage() << std::endl;
34  }
35 }
static const vpColor red
Definition: vpColor.h:217
Display for windows using GDI (available on any windows 32 platform).
Definition: vpDisplayGDI.h:130
static bool getClick(const vpImage< unsigned char > &I, bool blocking=true)
static void display(const vpImage< unsigned char > &I)
static void displayLine(const vpImage< unsigned char > &I, const vpImagePoint &ip1, const vpImagePoint &ip2, const vpColor &color, unsigned int thickness=1, bool segment=true)
static void setTitle(const vpImage< unsigned char > &I, const std::string &windowtitle)
static void flush(const vpImage< unsigned char > &I)
@ SCALE_AUTO
Definition: vpDisplay.h:184
error that can be emitted by ViSP classes.
Definition: vpException.h:60
const char * getMessage() const
Definition: vpException.cpp:65
unsigned int getWidth() const
Definition: vpImage.h:242
unsigned int getHeight() const
Definition: vpImage.h:181