42 #include <visp/vpConfig.h>
43 #if ( defined(VISP_HAVE_GDI) || defined(VISP_HAVE_D3D9) )
46 #include <visp/vpDisplayWin32.h>
47 #include <visp/vpDisplayException.h>
58 void vpCreateWindow(threadParam * param)
60 char* title = param->title;
61 (param->vpDisp)->window.initWindow(title, param->x, param->y,
70 iStatus(false), window(rend)
103 "Image not initialized")) ;
106 window.renderer->setImg(I);
130 "Image not initialized")) ;
133 window.renderer->setImg(I);
154 if (this->title != NULL)
156 delete [] this->
title;
161 this->title =
new char[strlen(title) + 1] ;
162 strcpy(this->title, title) ;
166 threadParam * param =
new threadParam;
171 param->vpDisp =
this;
172 param->title = this->
title;
192 if(!
window.isInitialized())
197 "Window not initialized")) ;
220 window.renderer->setImg(I);
249 window.renderer->setImgROI(I,iP,width,height);
272 window.renderer->setImg(I);
300 window.renderer->setImgROI(I,iP,width,height);
331 WaitForSingleObject(
window.semaClick, 0);
332 WaitForSingleObject(
window.semaClickUp, 0);
333 WaitForSingleObject(
window.semaClick, INFINITE);
337 ret = (WAIT_OBJECT_0 == WaitForSingleObject(
window.semaClick, 0));
371 WaitForSingleObject(
window.semaClick, 0);
372 WaitForSingleObject(
window.semaClickUp, 0);
373 WaitForSingleObject(
window.semaClick, INFINITE);
377 ret = (WAIT_OBJECT_0 == WaitForSingleObject(
window.semaClick, 0));
419 WaitForSingleObject(
window.semaClick, 0);
420 WaitForSingleObject(
window.semaClickUp, 0);
421 WaitForSingleObject(
window.semaClick, INFINITE);
425 ret = (WAIT_OBJECT_0 == WaitForSingleObject(
window.semaClick, 0));
431 button =
window.clickButton;
472 WaitForSingleObject(
window.semaClickUp, 0);
473 WaitForSingleObject(
window.semaClick, 0);
474 WaitForSingleObject(
window.semaClickUp, INFINITE);
478 ret = (WAIT_OBJECT_0 == WaitForSingleObject(
window.semaClickUp, 0));
484 button =
window.clickButtonUp;
512 WaitForSingleObject(
window.semaKey, 0);
513 WaitForSingleObject(
window.semaKey, 0);
514 WaitForSingleObject(
window.semaKey, INFINITE);
518 ret = (WAIT_OBJECT_0 == WaitForSingleObject(
window.semaKey, 0));
549 WaitForSingleObject(
window.semaKey, 0);
550 WaitForSingleObject(
window.semaKey, 0);
551 WaitForSingleObject(
window.semaKey, INFINITE);
555 ret = (WAIT_OBJECT_0 == WaitForSingleObject(
window.semaKey, 0));
558 sprintf(
string,
"%s",
window.lpString);
580 ret = (WAIT_OBJECT_0 == WaitForSingleObject(
window.semaMove, 0));
638 SetWindowPos(
window.hWnd,HWND_TOP, winx, winy, 0, 0,
639 SWP_ASYNCWINDOWPOS | SWP_NOACTIVATE | SWP_NOZORDER |SWP_NOSIZE);
653 SetWindowText(
window.hWnd, windowtitle);
679 PostMessage(
window.getHWnd(), vpWM_DISPLAY, 0,0);
698 typedef struct _half_rect_t{
699 unsigned short left_top;
700 unsigned short right_bottom;
706 hr1.left_top = (
unsigned short)iP.
get_u();
707 hr1.right_bottom = (
unsigned short)(iP.
get_u()+width-1);
709 hr2.left_top = (
unsigned short)iP.
get_v();
710 hr2.right_bottom = (
unsigned short)(iP.
get_v()+height-1);
713 # if 1 // new version FS
714 WPARAM wp = (hr1.left_top <<
sizeof(
unsigned short)) + hr1.right_bottom;
715 LPARAM lp = (hr2.left_top <<
sizeof(
unsigned short)) + hr2.right_bottom;
716 # else // produce warnings with MinGW
717 WPARAM wp=*((WPARAM*)(&hr1));
718 LPARAM lp=*((WPARAM*)(&hr2));
720 PostMessage(
window.getHWnd(), vpWM_DISPLAY_ROI, wp,lp);
722 PostMessage(
window.getHWnd(), vpWM_DISPLAY, 0,0);
737 window.renderer->setPixel(ip, color);
749 unsigned int thickness )
753 window.renderer->drawLine(ip1, ip2, color, thickness);
769 unsigned int thickness )
773 window.renderer->drawLine(ip1,ip2,color,thickness,PS_DASHDOT);
790 unsigned int width,
unsigned int height,
791 const vpColor &color,
bool fill,
792 unsigned int thickness )
796 window.renderer->drawRect(topLeft,width,height,color, fill, thickness);
814 const vpColor &color,
bool fill,
815 unsigned int thickness )
819 unsigned int width =
static_cast<unsigned int>( bottomRight.
get_j() - topLeft.
get_j() );
820 unsigned int height =
static_cast<unsigned int>(bottomRight.
get_i() - topLeft.
get_i() );
821 window.renderer->drawRect(topLeft,width,height,color, fill, thickness);
836 const vpColor &color,
bool fill,
837 unsigned int thickness )
844 window.renderer->drawRect(topLeft,
845 static_cast<unsigned int>( rectangle.
getWidth() ),
846 static_cast<unsigned int>( rectangle.
getHeight() ),
847 color, fill, thickness);
864 unsigned int thickness )
868 window.renderer->drawCircle(center,radius,color,fill,thickness);
883 window.renderer->drawText(ip,text,color);
896 unsigned int thickness)
900 window.renderer->drawCross(ip, size, color, thickness);
914 unsigned int w,
unsigned int h,
915 unsigned int thickness)
920 window.renderer->drawArrow(ip1, ip2, color, w, h, thickness);
931 window.renderer->clear(color);
943 PostMessage(
window.getHWnd(), vpWM_CLOSEDISPLAY, 0,0);
948 WaitForSingleObject(
hThread, INFINITE);
952 window.initialized = false ;
954 if (this->
title != NULL) {
955 delete [] this->
title;
968 window.renderer->getImage(I);