Visual Servoing Platform  version 3.6.1 under development (2024-11-15)
tutorial-draw-rectangle.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  vpImage<unsigned char> I(2160, 3840, 128);
12 
13  try {
14 
15 #if defined(VISP_HAVE_X11)
16  vpDisplayX d(I, vpDisplay::SCALE_AUTO);
17 #elif defined(VISP_HAVE_GDI)
19 #endif
20 
21  vpDisplay::setTitle(I, "My image");
24  vpDisplay::displayRectangle(I, I.getHeight() / 4, I.getWidth() / 4, I.getWidth() / 2, I.getHeight() / 2,
25  vpColor::red, true);
28  std::cout << "A click to quit..." << std::endl;
30 }
31  catch (const vpException &e) {
32  std::cout << "Catch an exception: " << e.getMessage() << std::endl;
33  }
34 }
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 setTitle(const vpImage< unsigned char > &I, const std::string &windowtitle)
static void flush(const vpImage< unsigned char > &I)
@ SCALE_AUTO
Definition: vpDisplay.h:184
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)
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