Visual Servoing Platform  version 3.0.1
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
vpWin32Renderer.h
1 /****************************************************************************
2  *
3  * This file is part of the ViSP software.
4  * Copyright (C) 2005 - 2017 by Inria. All rights reserved.
5  *
6  * This software is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * ("GPL") version 2 as published by the Free Software Foundation.
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 http://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  * Authors:
34  * Bruno Renier
35  *
36  *****************************************************************************/
37 
38 #include <visp3/core/vpConfig.h>
39 
40 #if ( defined(VISP_HAVE_GDI) || defined(VISP_HAVE_D3D9) )
41 
42 #ifndef vpWin32Renderer_HH
43 #define vpWin32Renderer_HH
44 
45 #ifndef DOXYGEN_SHOULD_SKIP_THIS
46 
47 #include <visp3/core/vpImage.h>
48 #include <visp3/core/vpColor.h>
49 #include <windows.h>
50 #include <visp3/core/vpDebug.h>
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, const unsigned int width, const unsigned int height ) =0;
79  virtual void setImgROI(const vpImage<unsigned char>& im, const vpImagePoint &iP, const unsigned int width, const unsigned int height ) =0;
80 
86  virtual void setPixel(const vpImagePoint &iP, const vpColor &color) =0;
87 
88  void setScale(unsigned int scale) { m_rscale = scale; }
89  void setHeight(unsigned int height) { m_rheight = height; }
90  void setWidth(unsigned int width) { m_rwidth = width; }
91 
100  virtual void drawLine(const vpImagePoint &ip1,
101  const vpImagePoint &ip2,
102  const vpColor &color, unsigned int thickness, int style=PS_SOLID) =0;
103 
113  virtual void drawRect(const vpImagePoint &topLeft,
114  unsigned int width, unsigned int height,
115  const vpColor &color, bool fill=false,
116  unsigned int thickness=1) =0;
117 
122  virtual void clear(const vpColor &color) =0;
123 
132  virtual void drawCircle(const vpImagePoint &center, unsigned int radius,
133  const vpColor &color, bool fill, unsigned int thickness=1) =0;
134 
141  virtual void drawText(const vpImagePoint &ip, const char * text,
142  const vpColor &color) =0;
143 
151  virtual void drawCross(const vpImagePoint &ip, unsigned int size,
152  const vpColor &color, unsigned int thickness=1) =0;
153 
162  virtual void drawArrow(const vpImagePoint &ip1,
163  const vpImagePoint &ip2,
164  const vpColor &color, unsigned int w, unsigned int h, unsigned int thickness) =0;
165 
170  virtual void getImage(vpImage<vpRGBa> &I) =0;
171 };
172 
173 #endif
174 #endif
175 #endif
Class to define colors available for display functionnalities.
Definition: vpColor.h:121
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...
Definition: vpImagePoint.h:88