Visual Servoing Platform version 3.5.0
vpWin32Renderer.h
1/****************************************************************************
2 *
3 * ViSP, open source Visual Servoing Platform software.
4 * Copyright (C) 2005 - 2019 by Inria. All rights reserved.
5 *
6 * This software is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 * See the file LICENSE.txt at the root directory of this source
11 * distribution for additional information about the GNU GPL.
12 *
13 * For using ViSP with software that can not be combined with the GNU
14 * GPL, please contact Inria about acquiring a ViSP Professional
15 * Edition License.
16 *
17 * See http://visp.inria.fr for more information.
18 *
19 * This software was developed at:
20 * Inria Rennes - Bretagne Atlantique
21 * Campus Universitaire de Beaulieu
22 * 35042 Rennes Cedex
23 * France
24 *
25 * If you have questions regarding the use of this file, please contact
26 * Inria at visp@inria.fr
27 *
28 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
29 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
30 *
31 * Description:
32 * Windows 32 renderer base class
33 *
34 * Authors:
35 * Bruno Renier
36 *
37 *****************************************************************************/
38
39#include <visp3/core/vpConfig.h>
40
41#if (defined(VISP_HAVE_GDI) || defined(VISP_HAVE_D3D9))
42
43#ifndef vpWin32Renderer_HH
44#define vpWin32Renderer_HH
45
46#ifndef DOXYGEN_SHOULD_SKIP_THIS
47
48#include <visp3/core/vpColor.h>
49#include <visp3/core/vpImage.h>
50// Include WinSock2.h before windows.h to ensure that winsock.h is not
51// included by windows.h since winsock.h and winsock2.h are incompatible
52#include <WinSock2.h>
53#include <visp3/core/vpDebug.h>
54#include <windows.h>
55
56class VISP_EXPORT vpWin32Renderer
57{
58
59protected:
60 // the size of the display
61 unsigned int m_rwidth;
62 unsigned int m_rheight;
63 unsigned int m_rscale;
64
65public:
66 vpWin32Renderer() : m_rwidth(0), m_rheight(0), m_rscale(1){};
68 virtual ~vpWin32Renderer(){};
69
71 virtual bool init(HWND hWnd, unsigned int w, unsigned int h) = 0;
72
74 virtual bool render() = 0;
75
80 virtual void setImg(const vpImage<vpRGBa> &im) = 0;
81 virtual void setImg(const vpImage<unsigned char> &im) = 0;
82 virtual void setImgROI(const vpImage<vpRGBa> &im, const vpImagePoint &iP, unsigned int width,
83 unsigned int height) = 0;
84 virtual void setImgROI(const vpImage<unsigned char> &im, const vpImagePoint &iP, unsigned int width,
85 unsigned int height) = 0;
86
92 virtual void setPixel(const vpImagePoint &iP, const vpColor &color) = 0;
93
94 void setScale(unsigned int scale) { m_rscale = scale; }
95 void setHeight(unsigned int height) { m_rheight = height; }
96 void setWidth(unsigned int width) { m_rwidth = width; }
97
106 virtual void drawLine(const vpImagePoint &ip1, const vpImagePoint &ip2, const vpColor &color, unsigned int thickness,
107 int style = PS_SOLID) = 0;
108
118 virtual void drawRect(const vpImagePoint &topLeft, unsigned int width, unsigned int height, const vpColor &color,
119 bool fill = false, unsigned int thickness = 1) = 0;
120
125 virtual void clear(const vpColor &color) = 0;
126
135 virtual void drawCircle(const vpImagePoint &center, unsigned int radius, const vpColor &color, bool fill,
136 unsigned int thickness = 1) = 0;
137
144 virtual void drawText(const vpImagePoint &ip, const char *text, const vpColor &color) = 0;
145
153 virtual void drawCross(const vpImagePoint &ip, unsigned int size, const vpColor &color,
154 unsigned int thickness = 1) = 0;
155
164 virtual void drawArrow(const vpImagePoint &ip1, const vpImagePoint &ip2, const vpColor &color, unsigned int w,
165 unsigned int h, unsigned int thickness) = 0;
166
171 virtual void getImage(vpImage<vpRGBa> &I) = 0;
172};
173
174#endif
175#endif
176#endif
Class to define RGB colors available for display functionnalities.
Definition: vpColor.h:158
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...
Definition: vpImagePoint.h:88