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);
void set_j(const double j)
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)
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)
unsigned int getWidth() const
virtual ~vpDisplayWin32()
bool getClick(bool blocking=true)
Class to define colors available for display functionnalities.
void setFont(const char *fontname)
Set the font used to display text.
void set_i(const double i)
char * title
display title
bool displayHasBeenInitialized
display has been initialized
void displayCross(const vpImagePoint &ip, unsigned int size, const vpColor &color, unsigned int thickness=1)
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)
vpDisplayWin32(vpWin32Renderer *rend=NULL)
vpWin32Window window
The window.
bool getClickUp(vpImagePoint &ip, vpMouseButton::vpMouseButtonType &button, bool blocking=true)
void displayImage(const vpImage< vpRGBa > &I)
void set_u(const double u)
void set_v(const double v)
void setTitle(const char *windowtitle)
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)
void init(vpImage< unsigned char > &I, int winx=-1, int winy=-1, const char *title=NULL)
void displayPoint(const vpImagePoint &ip, const vpColor &color)
friend void vpCreateWindow(threadParam *param)
Function used to launch the window in a thread.
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
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)