Visual Servoing Platform  version 3.6.1 under development (2024-07-27)
vpWin32Renderer.h
1 /*
2  * ViSP, open source Visual Servoing Platform software.
3  * Copyright (C) 2005 - 2024 by Inria. All rights reserved.
4  *
5  * This software is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  * See the file LICENSE.txt at the root directory of this source
10  * distribution for additional information about the GNU GPL.
11  *
12  * For using ViSP with software that can not be combined with the GNU
13  * GPL, please contact Inria about acquiring a ViSP Professional
14  * Edition License.
15  *
16  * See https://visp.inria.fr for more information.
17  *
18  * This software was developed at:
19  * Inria Rennes - Bretagne Atlantique
20  * Campus Universitaire de Beaulieu
21  * 35042 Rennes Cedex
22  * France
23  *
24  * If you have questions regarding the use of this file, please contact
25  * Inria at visp@inria.fr
26  *
27  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
28  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
29  *
30  * Description:
31  * Windows 32 renderer base class
32  */
33 
34 #ifndef VP_WIN32_RENDERER_H
35 #define VP_WIN32_RENDERER_H
36 
37 #include <visp3/core/vpConfig.h>
38 
39 #if (defined(VISP_HAVE_GDI) || defined(VISP_HAVE_D3D9))
40 
41 #ifndef DOXYGEN_SHOULD_SKIP_THIS
42 
43 #include <visp3/core/vpColor.h>
44 #include <visp3/core/vpImage.h>
45 // Include WinSock2.h before windows.h to ensure that winsock.h is not
46 // included by windows.h since winsock.h and winsock2.h are incompatible
47 #include <WinSock2.h>
48 #include <windows.h>
49 
51 
52 class VISP_EXPORT vpWin32Renderer
53 {
54 
55 protected:
56  // the size of the display
57  unsigned int m_rwidth;
58  unsigned int m_rheight;
59  unsigned int m_rscale;
60 
61 public:
62  vpWin32Renderer() : m_rwidth(0), m_rheight(0), m_rscale(1) { };
64  virtual ~vpWin32Renderer() { };
65 
67  virtual bool init(HWND hWnd, unsigned int w, unsigned int h) = 0;
68 
70  virtual bool render() = 0;
71 
76  virtual void setImg(const vpImage<vpRGBa> &im) = 0;
77  virtual void setImg(const vpImage<unsigned char> &im) = 0;
78  virtual void setImgROI(const vpImage<vpRGBa> &im, const vpImagePoint &iP, unsigned int width,
79  unsigned int height) = 0;
80  virtual void setImgROI(const vpImage<unsigned char> &im, const vpImagePoint &iP, unsigned int width,
81  unsigned int height) = 0;
82 
88  virtual void setPixel(const vpImagePoint &iP, const vpColor &color) = 0;
89 
90  void setScale(unsigned int scale) { m_rscale = scale; }
91  void setHeight(unsigned int height) { m_rheight = height; }
92  void setWidth(unsigned int width) { m_rwidth = width; }
93 
102  virtual void drawLine(const vpImagePoint &ip1, const vpImagePoint &ip2, const vpColor &color, unsigned int thickness,
103  int style = PS_SOLID) = 0;
104 
114  virtual void drawRect(const vpImagePoint &topLeft, unsigned int width, unsigned int height, const vpColor &color,
115  bool fill = false, unsigned int thickness = 1) = 0;
116 
121  virtual void clear(const vpColor &color) = 0;
122 
131  virtual void drawCircle(const vpImagePoint &center, unsigned int radius, const vpColor &color, bool fill,
132  unsigned int thickness = 1) = 0;
133 
140  virtual void drawText(const vpImagePoint &ip, const char *text, const vpColor &color) = 0;
141 
149  virtual void drawCross(const vpImagePoint &ip, unsigned int size, const vpColor &color,
150  unsigned int thickness = 1) = 0;
151 
160  virtual void drawArrow(const vpImagePoint &ip1, const vpImagePoint &ip2, const vpColor &color, unsigned int w,
161  unsigned int h, unsigned int thickness) = 0;
162 
167  virtual void getImage(vpImage<vpRGBa> &I) = 0;
168 };
169 
170 
171 END_VISP_NAMESPACE
172 #endif
173 #endif
174 #endif
Class to define RGB colors available for display functionalities.
Definition: vpColor.h:157
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...
Definition: vpImagePoint.h:82