Visual Servoing Platform version 3.6.0
Loading...
Searching...
No Matches
vpDisplayGTK.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 * Authors:
35 * Christophe Collewet
36 *
37*****************************************************************************/
38
39#ifndef vpDisplayGTK_h
40#define vpDisplayGTK_h
41
42#include <visp3/core/vpConfig.h>
43#if (defined(VISP_HAVE_GTK))
44
45#include <visp3/core/vpDisplay.h>
46#include <visp3/core/vpImage.h>
47
133class VISP_EXPORT vpDisplayGTK : public vpDisplay
134{
135private:
136 typedef enum {
137 id_black = 0,
138 id_white,
139 id_lightGray,
140 id_gray,
141 id_darkGray,
142 id_lightRed,
143 id_red,
144 id_darkRed,
145 id_lightGreen,
146 id_green,
147 id_darkGreen,
148 id_lightBlue,
149 id_blue,
150 id_darkBlue,
151 id_yellow,
152 id_cyan,
153 id_orange,
154 id_purple,
155 id_npredefined // Number of predefined colors
156 } vpColorIdentifier;
157
158public:
159 vpDisplayGTK();
160 vpDisplayGTK(int win_x, int win_y, const std::string &win_title = "");
162 vpDisplayGTK(vpImage<unsigned char> &I, int win_x = -1, int win_y = -1, const std::string &win_title = "",
163 vpScaleType type = SCALE_DEFAULT);
165 vpDisplayGTK(vpImage<vpRGBa> &I, int win_x = -1, int win_y = -1, const std::string &win_title = "",
166 vpScaleType type = SCALE_DEFAULT);
167
168 virtual ~vpDisplayGTK();
169
170 void getImage(vpImage<vpRGBa> &I);
171 unsigned int getScreenDepth();
172 unsigned int getScreenHeight();
173 void getScreenSize(unsigned int &screen_width, unsigned int &screen_height);
174 unsigned int getScreenWidth();
175
176 void init(vpImage<unsigned char> &I, int win_x = -1, int win_y = -1, const std::string &win_title = "");
177 void init(vpImage<vpRGBa> &I, int win_x = -1, int win_y = -1, const std::string &win_title = "");
178 void init(unsigned int win_width, unsigned int win_height, int win_x = -1, int win_y = -1,
179 const std::string &win_title = "");
180
181protected:
182 void setFont(const std::string &fontname);
183 void setTitle(const std::string &win_title);
184 void setWindowPosition(int win_x, int win_y);
185
186 void clearDisplay(const vpColor &color = vpColor::white);
187
188 void closeDisplay();
189
190 void displayArrow(const vpImagePoint &ip1, const vpImagePoint &ip2, const vpColor &color = vpColor::white,
191 unsigned int w = 4, unsigned int h = 2, unsigned int thickness = 1);
192 void displayCharString(const vpImagePoint &ip, const char *text, const vpColor &color = vpColor::green);
193
194 void displayCircle(const vpImagePoint &center, unsigned int radius, const vpColor &color, bool fill = false,
195 unsigned int thickness = 1);
196 void displayCross(const vpImagePoint &ip, unsigned int size, const vpColor &color, unsigned int thickness = 1);
197 void displayDotLine(const vpImagePoint &ip1, const vpImagePoint &ip2, const vpColor &color,
198 unsigned int thickness = 1);
199
200 void displayImage(const vpImage<vpRGBa> &I);
201 void displayImage(const vpImage<unsigned char> &I);
202 void displayImage(const unsigned char *I);
203
204 void displayImageROI(const vpImage<unsigned char> &I, const vpImagePoint &iP, unsigned int width,
205 unsigned int height);
206 void displayImageROI(const vpImage<vpRGBa> &I, const vpImagePoint &iP, unsigned int width, unsigned int height);
207
208 void displayLine(const vpImagePoint &ip1, const vpImagePoint &ip2, const vpColor &color, unsigned int thickness = 1);
209
210 void displayPoint(const vpImagePoint &ip, const vpColor &color, unsigned int thickness = 1);
211 void displayRectangle(const vpImagePoint &topLeft, unsigned int width, unsigned int height, const vpColor &color,
212 bool fill = false, unsigned int thickness = 1);
213 void displayRectangle(const vpImagePoint &topLeft, const vpImagePoint &bottomRight, const vpColor &color,
214 bool fill = false, unsigned int thickness = 1);
215 void displayRectangle(const vpRect &rectangle, const vpColor &color, bool fill = false, unsigned int thickness = 1);
216
217 void flushDisplay();
218 void flushDisplayROI(const vpImagePoint &iP, unsigned int width, unsigned int height);
219
220 bool getClick(bool blocking = true);
221 bool getClick(vpImagePoint &ip, bool blocking = true);
222 bool getClick(vpImagePoint &ip, vpMouseButton::vpMouseButtonType &button, bool blocking = true);
223 bool getClickUp(vpImagePoint &ip, vpMouseButton::vpMouseButtonType &button, bool blocking = true);
224 bool getKeyboardEvent(bool blocking = true);
225 bool getKeyboardEvent(std::string &key, bool blocking = true);
228
229private:
230 // Implementation
231 class Impl;
232 Impl *m_impl;
233};
234
235#endif
236#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
The vpDisplayGTK allows to display image using the GTK 3rd party library. Thus to enable this class G...
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