Visual Servoing Platform version 3.6.0
Loading...
Searching...
No Matches
vpDisplayX.h
1/****************************************************************************
2 *
3 * ViSP, open source Visual Servoing Platform software.
4 * Copyright (C) 2005 - 2023 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 https://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 * Image display.
33 *
34*****************************************************************************/
35
36#ifndef vpDisplayX_h
37#define vpDisplayX_h
38
39#include <visp3/core/vpConfig.h>
40#ifdef VISP_HAVE_X11
41#include <visp3/core/vpDisplay.h>
42#include <visp3/core/vpImage.h>
43#include <visp3/core/vpRect.h>
44
131class VISP_EXPORT vpDisplayX : public vpDisplay
132{
133 // private:
134 //#ifndef DOXYGEN_SHOULD_SKIP_THIS
135 // vpDisplayX(const vpDisplayX &)
136 // : vpDisplay(), display(NULL), window(), Ximage(NULL), lut(),
137 // context(), screen(), event(), pixmap(),
138 // x_color(NULL), screen_depth(8), xcolor(), values(),
139 // ximage_data_init(false), RMask(0), GMask(0), BMask(0), RShift(0),
140 // GShift(0), BShift(0)
141 // {
142 // throw vpException(vpException::functionNotImplementedError, "Not
143 // implemented!");
144 // }
145 // vpDisplayX &operator=(const vpDisplayX &){
146 // throw vpException(vpException::functionNotImplementedError, "Not
147 // implemented!"); return *this;
148 // }
149 //#endif
150
151public:
152 vpDisplayX();
153 vpDisplayX(int winx, int winy, const std::string &title = "");
155 vpDisplayX(vpImage<unsigned char> &I, int winx = -1, int winy = -1, const std::string &title = "",
156 vpScaleType type = SCALE_DEFAULT);
158 vpDisplayX(vpImage<vpRGBa> &I, int winx = -1, int winy = -1, const std::string &title = "",
159 vpScaleType type = SCALE_DEFAULT);
160
161 virtual ~vpDisplayX();
162
163 void getImage(vpImage<vpRGBa> &I);
164 unsigned int getScreenDepth();
165 unsigned int getScreenHeight();
166 void getScreenSize(unsigned int &width, unsigned int &height);
167 unsigned int getScreenWidth();
168
169 void init(vpImage<unsigned char> &I, int win_x = -1, int win_y = -1, const std::string &win_title = "");
170 void init(vpImage<vpRGBa> &I, int win_x = -1, int win_y = -1, const std::string &win_title = "");
171 void init(unsigned int win_width, unsigned int win_height, int win_x = -1, int win_y = -1,
172 const std::string &win_title = "");
173
174protected:
175 void clearDisplay(const vpColor &color = vpColor::white);
176
177 void closeDisplay();
178
179 void displayArrow(const vpImagePoint &ip1, const vpImagePoint &ip2, const vpColor &color = vpColor::white,
180 unsigned int w = 4, unsigned int h = 2, unsigned int thickness = 1);
181
182 void displayCharString(const vpImagePoint &ip, const char *text, const vpColor &color = vpColor::green);
183
184 void displayCircle(const vpImagePoint &center, unsigned int radius, const vpColor &color, bool fill = false,
185 unsigned int thickness = 1);
186 void displayCross(const vpImagePoint &ip, unsigned int size, const vpColor &color, unsigned int thickness = 1);
187 void displayDotLine(const vpImagePoint &ip1, const vpImagePoint &ip2, const vpColor &color,
188 unsigned int thickness = 1);
189
190 void displayImage(const vpImage<unsigned char> &I);
191 void displayImage(const vpImage<vpRGBa> &I);
192 void displayImage(const unsigned char *I);
193
194 void displayImageROI(const vpImage<unsigned char> &I, const vpImagePoint &iP, unsigned int width,
195 unsigned int height);
196 void displayImageROI(const vpImage<vpRGBa> &I, const vpImagePoint &iP, unsigned int width, unsigned int height);
197
198 void displayLine(const vpImagePoint &ip1, const vpImagePoint &ip2, const vpColor &color, unsigned int thickness = 1);
199 void displayPoint(const vpImagePoint &ip, const vpColor &color, unsigned int thickness = 1);
200
201 void displayRectangle(const vpImagePoint &topLeft, unsigned int width, unsigned int height, const vpColor &color,
202 bool fill = false, unsigned int thickness = 1);
203 void displayRectangle(const vpImagePoint &topLeft, const vpImagePoint &bottomRight, const vpColor &color,
204 bool fill = false, unsigned int thickness = 1);
205 void displayRectangle(const vpRect &rectangle, const vpColor &color, bool fill = false, unsigned int thickness = 1);
206
207 void flushDisplay();
208 void flushDisplayROI(const vpImagePoint &iP, unsigned int width, unsigned int height);
209
210 bool getClick(bool blocking = true);
211 bool getClick(vpImagePoint &ip, bool blocking = true);
212 bool getClick(vpImagePoint &ip, vpMouseButton::vpMouseButtonType &button, bool blocking = true);
213 bool getClickUp(vpImagePoint &ip, vpMouseButton::vpMouseButtonType &button, bool blocking = true);
214
215 bool getKeyboardEvent(bool blocking = true);
216 bool getKeyboardEvent(std::string &key, bool blocking = true);
217
220
221 void setFont(const std::string &font);
222 void setTitle(const std::string &title);
223 void setWindowPosition(int win_x, int win_y);
224
225private:
226 // Implementation
227 class Impl;
228 Impl *m_impl;
229};
230
231#endif
232#endif
Class to define RGB colors available for display functionalities.
Definition vpColor.h:152
static const vpColor white
Definition vpColor.h:206
static const vpColor green
Definition vpColor.h:214
Use the X11 console to display images on unix-like OS. Thus to enable this class X11 should be instal...
Definition vpDisplayX.h:132
Class that defines generic functionalities for display.
Definition vpDisplay.h:173
static bool getClick(const vpImage< unsigned char > &I, bool blocking=true)
static void displayCircle(const vpImage< unsigned char > &I, const vpImageCircle &circle, const vpColor &color, bool fill=false, unsigned int thickness=1)
static bool getKeyboardEvent(const vpImage< unsigned char > &I, bool blocking=true)
static void displayLine(const vpImage< unsigned char > &I, const vpImagePoint &ip1, const vpImagePoint &ip2, const vpColor &color, unsigned int thickness=1, bool segment=true)
static void getImage(const vpImage< unsigned char > &Is, vpImage< vpRGBa > &Id)
static bool getClickUp(const vpImage< unsigned char > &I, vpImagePoint &ip, vpMouseButton::vpMouseButtonType &button, bool blocking=true)
static void displayCross(const vpImage< unsigned char > &I, const vpImagePoint &ip, unsigned int size, const vpColor &color, unsigned int thickness=1)
static void displayCharString(const vpImage< unsigned char > &I, const vpImagePoint &ip, const char *string, const vpColor &color)
static void setTitle(const vpImage< unsigned char > &I, const std::string &windowtitle)
static void displayArrow(const vpImage< unsigned char > &I, const vpImagePoint &ip1, const vpImagePoint &ip2, const vpColor &color=vpColor::white, unsigned int w=4, unsigned int h=2, unsigned int thickness=1)
static void displayPoint(const vpImage< unsigned char > &I, const vpImagePoint &ip, const vpColor &color, unsigned int thickness=1)
static void setFont(const vpImage< unsigned char > &I, const std::string &font)
static void displayDotLine(const vpImage< unsigned char > &I, const vpImagePoint &ip1, const vpImagePoint &ip2, const vpColor &color, unsigned int thickness=1)
static bool getPointerPosition(const vpImage< unsigned char > &I, vpImagePoint &ip)
static bool getPointerMotionEvent(const vpImage< unsigned char > &I, vpImagePoint &ip)
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)
static void setWindowPosition(const vpImage< unsigned char > &I, int winx, int winy)
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...
Definition of the vpImage class member functions.
Definition vpImage.h:135
Defines a rectangle in the plane.
Definition vpRect.h:76