39 #include <visp3/core/vpConfig.h> 40 #if (defined(VISP_HAVE_GDI) || defined(VISP_HAVE_D3D9)) 43 #include <visp3/core/vpDisplayException.h> 44 #include <visp3/gui/vpDisplayWin32.h> 55 (param->vpDisp)->
window.initWindow(param->title.c_str(), param->x, param->y, param->w, param->h);
90 window.renderer->setImg(I);
114 window.renderer->setImg(I);
141 threadParam *param =
new threadParam;
146 param->vpDisp =
this;
165 if (!
window.isInitialized()) {
190 window.renderer->setImg(I);
213 const unsigned int height)
219 window.renderer->setImgROI(I, iP, width, height);
241 window.renderer->setImg(I);
264 const unsigned int height)
270 window.renderer->setImgROI(I, iP, width, height);
300 WaitForSingleObject(
window.semaClick, 0);
301 WaitForSingleObject(
window.semaClickUp, 0);
302 WaitForSingleObject(
window.semaClick, INFINITE);
305 ret = (WAIT_OBJECT_0 == WaitForSingleObject(
window.semaClick, 0));
338 WaitForSingleObject(
window.semaClick, 0);
339 WaitForSingleObject(
window.semaClickUp, 0);
340 WaitForSingleObject(
window.semaClick, INFINITE);
343 ret = (WAIT_OBJECT_0 == WaitForSingleObject(
window.semaClick, 0));
349 ip.
set_v(v * m_scale);
382 WaitForSingleObject(
window.semaClick, 0);
383 WaitForSingleObject(
window.semaClickUp, 0);
384 WaitForSingleObject(
window.semaClick, INFINITE);
387 ret = (WAIT_OBJECT_0 == WaitForSingleObject(
window.semaClick, 0));
392 ip.
set_v(v * m_scale);
393 button =
window.clickButton;
431 WaitForSingleObject(
window.semaClickUp, 0);
432 WaitForSingleObject(
window.semaClick, 0);
433 WaitForSingleObject(
window.semaClickUp, INFINITE);
436 ret = (WAIT_OBJECT_0 == WaitForSingleObject(
window.semaClickUp, 0));
441 ip.
set_v(v * m_scale);
442 button =
window.clickButtonUp;
470 WaitForSingleObject(
window.semaKey, 0);
471 WaitForSingleObject(
window.semaKey, 0);
472 WaitForSingleObject(
window.semaKey, INFINITE);
475 ret = (WAIT_OBJECT_0 == WaitForSingleObject(
window.semaKey, 0));
506 WaitForSingleObject(
window.semaKey, 0);
507 WaitForSingleObject(
window.semaKey, 0);
508 WaitForSingleObject(
window.semaKey, INFINITE);
511 ret = (WAIT_OBJECT_0 == WaitForSingleObject(
window.semaKey, 0));
514 std::stringstream ss;
535 bool ret = (WAIT_OBJECT_0 == WaitForSingleObject(
window.semaMove, 0));
544 ip.
set_v(v * m_scale);
573 ip.
set_v(v * m_scale);
591 SetWindowPos(
window.hWnd, HWND_TOP, winx, winy, 0, 0,
592 SWP_ASYNCWINDOWPOS | SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOSIZE);
604 SetWindowText(
window.hWnd, windowtitle.c_str());
625 PostMessage(
window.getHWnd(), vpWM_DISPLAY, 0, 0);
642 WORD left = (WORD)iP.
get_u();
643 WORD right = (WORD)(iP.
get_u() + width - 1);
645 WORD top = (WORD)iP.
get_v();
646 WORD bottom = (WORD)(iP.
get_v() + height - 1);
649 WPARAM wp = MAKEWPARAM(left, right);
650 LPARAM lp = MAKELPARAM(top, bottom);
652 PostMessage(
window.getHWnd(), vpWM_DISPLAY_ROI, wp, lp);
665 if (thickness == 1) {
666 window.renderer->setPixel(ip, color);
668 window.renderer->drawRect(ip, thickness *
m_scale, thickness * m_scale, color,
true, 1);
679 unsigned int thickness)
683 window.renderer->drawLine(ip1, ip2, color, thickness);
696 unsigned int thickness)
700 window.renderer->drawLine(ip1, ip2, color, thickness, PS_DASHDOT);
717 const vpColor &color,
bool fill,
unsigned int thickness)
721 window.renderer->drawRect(topLeft, width, height, color, fill, thickness);
737 const vpColor &color,
bool fill,
unsigned int thickness)
741 unsigned int width =
static_cast<unsigned int>(bottomRight.
get_j() - topLeft.
get_j());
742 unsigned int height =
static_cast<unsigned int>(bottomRight.
get_i() - topLeft.
get_i());
743 window.renderer->drawRect(topLeft, width, height, color, fill, thickness);
764 window.renderer->drawRect(topLeft, static_cast<unsigned int>(rectangle.
getWidth()),
765 static_cast<unsigned int>(rectangle.
getHeight()), color, fill, thickness);
778 unsigned int thickness)
782 window.renderer->drawCircle(center, radius, color, fill, thickness);
795 window.renderer->drawText(ip, text, color);
806 unsigned int thickness)
810 window.renderer->drawCross(ip, size, color, thickness);
821 unsigned int w,
unsigned int h,
unsigned int thickness)
826 window.renderer->drawArrow(ip1, ip2, color, w, h, thickness);
837 window.renderer->clear(color);
848 PostMessage(
window.getHWnd(), vpWM_CLOSEDISPLAY, 0, 0);
853 WaitForSingleObject(
hThread, INFINITE);
857 window.initialized =
false;
869 window.renderer->getImage(I);
878 w = GetSystemMetrics(SM_CXSCREEN);
879 h = GetSystemMetrics(SM_CYSCREEN);
887 unsigned int width, height;
897 unsigned int width, height;
901 #elif !defined(VISP_BUILD_SHARED_LIBS) 904 void dummy_vpDisplayWin32(){};
void getScreenSize(unsigned int &width, unsigned int &height)
static const int MAX_INIT_DELAY
Maximum delay for window initialization.
DWORD threadId
Id of the window's thread.
void displayCharString(const vpImagePoint &ip, const char *text, const vpColor &color=vpColor::green)
int m_windowYPosition
display position
void displayDotLine(const vpImagePoint &ip1, const vpImagePoint &ip2, const vpColor &color, unsigned int thickness=1)
void displayCircle(const vpImagePoint ¢er, unsigned int radius, const vpColor &color, bool fill=false, unsigned int thickness=1)
void setFont(const std::string &fontname)
Set the font used to display text.
unsigned int getWidth() const
virtual ~vpDisplayWin32()
bool getClick(bool blocking=true)
Class to define colors available for display functionnalities.
void displayPoint(const vpImagePoint &ip, const vpColor &color, unsigned int thickness=1)
unsigned int getScreenWidth()
void displayCross(const vpImagePoint &ip, unsigned int size, const vpColor &color, unsigned int thickness=1)
bool m_displayHasBeenInitialized
display has been initialized
bool iStatus
Initialization status.
void displayLine(const vpImagePoint &ip1, const vpImagePoint &ip2, const vpColor &color, unsigned int thickness=1)
void displayImageROI(const vpImage< unsigned char > &I, const vpImagePoint &iP, const unsigned int width, const unsigned int height)
bool getKeyboardEvent(bool blocking=true)
void setTitle(const std::string &windowtitle)
vpDisplayWin32(vpWin32Renderer *rend=NULL)
vpWin32Window window
The window.
bool getClickUp(vpImagePoint &ip, vpMouseButton::vpMouseButtonType &button, bool blocking=true)
void set_i(const double ii)
void displayImage(const vpImage< vpRGBa > &I)
int m_windowXPosition
display position
void setScale(vpScaleType scaleType, unsigned int width, unsigned int height)
void set_u(const double u)
void set_v(const double v)
void displayRectangle(const vpImagePoint &topLeft, unsigned int width, unsigned int height, const vpColor &color, bool fill=false, unsigned int thickness=1)
void displayArrow(const vpImagePoint &ip1, const vpImagePoint &ip2, const vpColor &color=vpColor::white, unsigned int w=4, unsigned int h=2, unsigned int thickness=1)
unsigned int getScreenHeight()
friend void vpCreateWindow(threadParam *param)
Function used to launch the window in a thread.
void set_j(const double jj)
bool getPointerMotionEvent(vpImagePoint &ip)
Error that can be emited by the vpDisplay class and its derivates.
HANDLE hThread
Handle of the window's thread.
unsigned int getHeight() const
void init(vpImage< unsigned char > &I, int winx=-1, int winy=-1, const std::string &title="")
Defines a rectangle in the plane.
void flushDisplayROI(const vpImagePoint &iP, const unsigned int width, const unsigned int height)
flush the Win32 buffer It's necessary to use this function to see the results of any drawing ...
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...
void clearDisplay(const vpColor &color=vpColor::white)
void flushDisplay()
flush the Win32 buffer It's necessary to use this function to see the results of any drawing ...
void setWindowPosition(int winx, int winy)
bool getPointerPosition(vpImagePoint &ip)
void getImage(vpImage< vpRGBa > &I)