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);
127 void vpDisplayWin32::init(
unsigned int width,
unsigned int height,
int x,
int y,
const std::string &title)
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));
382 WaitForSingleObject(
window.semaClick, 0);
383 WaitForSingleObject(
window.semaClickUp, 0);
384 WaitForSingleObject(
window.semaClick, INFINITE);
387 ret = (WAIT_OBJECT_0 == WaitForSingleObject(
window.semaClick, 0));
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));
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));
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);
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(){};