Visual Servoing Platform version 3.7.0
Loading...
Searching...
No Matches
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
46// Mute warning with clang-cl
47// warning : non-portable path to file '<WinSock2.h>'; specified path differs in case from file name on disk [-Wnonportable-system-include-path]
48// warning : non-portable path to file '<Windows.h>'; specified path differs in case from file name on disk [-Wnonportable-system-include-path]
49#if defined(__clang__)
50# pragma clang diagnostic push
51# pragma clang diagnostic ignored "-Wnonportable-system-include-path"
52#endif
53
54// Include WinSock2.h before windows.h to ensure that winsock.h is not
55// included by windows.h since winsock.h and winsock2.h are incompatible
56#include <WinSock2.h>
57#include <windows.h>
58
59#if defined(__clang__)
60# pragma clang diagnostic pop
61#endif
62
64
65class VISP_EXPORT vpWin32Renderer
66{
67
68protected:
69 // the size of the display
70 unsigned int m_rwidth;
71 unsigned int m_rheight;
72 unsigned int m_rscale;
73
74public:
78 vpWin32Renderer() : m_rwidth(0), m_rheight(0), m_rscale(1) { }
79
83 vpWin32Renderer(const vpWin32Renderer &renderer)
84 {
85 *this = renderer;
86 }
87
91 virtual ~vpWin32Renderer() { }
92
96 vpWin32Renderer &operator=(const vpWin32Renderer &renderer)
97 {
98 m_rwidth = renderer.m_rwidth;
99 m_rheight = renderer.m_rheight;
100 m_rscale = renderer.m_rscale;
101 return *this;
102 }
103
105 virtual bool init(HWND hWnd, unsigned int w, unsigned int h) = 0;
106
108 virtual bool render() = 0;
109
114 virtual void setImg(const vpImage<vpRGBa> &im) = 0;
115 virtual void setImg(const vpImage<unsigned char> &im) = 0;
116 virtual void setImgROI(const vpImage<vpRGBa> &im, const vpImagePoint &iP, unsigned int width,
117 unsigned int height) = 0;
118 virtual void setImgROI(const vpImage<unsigned char> &im, const vpImagePoint &iP, unsigned int width,
119 unsigned int height) = 0;
120
126 virtual void setPixel(const vpImagePoint &iP, const vpColor &color) = 0;
127
128 void setScale(unsigned int scale) { m_rscale = scale; }
129 void setHeight(unsigned int height) { m_rheight = height; }
130 void setWidth(unsigned int width) { m_rwidth = width; }
131
140 virtual void drawLine(const vpImagePoint &ip1, const vpImagePoint &ip2, const vpColor &color, unsigned int thickness,
141 int style = PS_SOLID) = 0;
142
152 virtual void drawRect(const vpImagePoint &topLeft, unsigned int width, unsigned int height, const vpColor &color,
153 bool fill = false, unsigned int thickness = 1) = 0;
154
159 virtual void clear(const vpColor &color) = 0;
160
169 virtual void drawCircle(const vpImagePoint &center, unsigned int radius, const vpColor &color, bool fill,
170 unsigned int thickness = 1) = 0;
171
178 virtual void drawText(const vpImagePoint &ip, const char *text, const vpColor &color) = 0;
179
187 virtual void drawCross(const vpImagePoint &ip, unsigned int size, const vpColor &color,
188 unsigned int thickness = 1) = 0;
189
199 virtual void drawArrow(const vpImagePoint &ip1, const vpImagePoint &ip2, const vpColor &color, unsigned int w,
200 unsigned int h, unsigned int thickness) = 0;
201
206 virtual void getImage(vpImage<vpRGBa> &I) = 0;
207};
208
209
210END_VISP_NAMESPACE
211#endif
212#endif
213#endif