38 #include <visp3/core/vpConfig.h> 39 #if ( defined(VISP_HAVE_GDI) || defined(VISP_HAVE_D3D9) ) 41 #include <visp3/gui/vpDisplayWin32.h> 42 #include <visp3/core/vpDisplayException.h> 54 (param->vpDisp)->
window.initWindow(param->title.c_str(), param->x, param->y,
90 const std::string &title)
96 "Image not initialized")) ;
103 window.renderer->setImg(I);
120 const std::string &title)
126 "Image not initialized")) ;
133 window.renderer->setImg(I);
149 const std::string &title)
163 threadParam * param =
new threadParam;
168 param->vpDisp =
this;
189 if(!
window.isInitialized())
194 "Window not initialized")) ;
217 window.renderer->setImg(I);
246 window.renderer->setImgROI(I,iP,width,height);
269 window.renderer->setImg(I);
297 window.renderer->setImgROI(I,iP,width,height);
328 WaitForSingleObject(
window.semaClick, 0);
329 WaitForSingleObject(
window.semaClickUp, 0);
330 WaitForSingleObject(
window.semaClick, INFINITE);
334 ret = (WAIT_OBJECT_0 == WaitForSingleObject(
window.semaClick, 0));
368 WaitForSingleObject(
window.semaClick, 0);
369 WaitForSingleObject(
window.semaClickUp, 0);
370 WaitForSingleObject(
window.semaClick, INFINITE);
374 ret = (WAIT_OBJECT_0 == WaitForSingleObject(
window.semaClick, 0));
380 ip.
set_v( v*m_scale);
416 WaitForSingleObject(
window.semaClick, 0);
417 WaitForSingleObject(
window.semaClickUp, 0);
418 WaitForSingleObject(
window.semaClick, INFINITE);
422 ret = (WAIT_OBJECT_0 == WaitForSingleObject(
window.semaClick, 0));
427 ip.
set_v( v*m_scale);
428 button =
window.clickButton;
469 WaitForSingleObject(
window.semaClickUp, 0);
470 WaitForSingleObject(
window.semaClick, 0);
471 WaitForSingleObject(
window.semaClickUp, INFINITE);
475 ret = (WAIT_OBJECT_0 == WaitForSingleObject(
window.semaClickUp, 0));
480 ip.
set_v( v*m_scale);
481 button =
window.clickButtonUp;
509 WaitForSingleObject(
window.semaKey, 0);
510 WaitForSingleObject(
window.semaKey, 0);
511 WaitForSingleObject(
window.semaKey, INFINITE);
515 ret = (WAIT_OBJECT_0 == WaitForSingleObject(
window.semaKey, 0));
546 WaitForSingleObject(
window.semaKey, 0);
547 WaitForSingleObject(
window.semaKey, 0);
548 WaitForSingleObject(
window.semaKey, INFINITE);
552 ret = (WAIT_OBJECT_0 == WaitForSingleObject(
window.semaKey, 0));
555 std::stringstream ss;
577 bool ret = (WAIT_OBJECT_0 == WaitForSingleObject(
window.semaMove, 0));
587 ip.
set_v( v*m_scale);
617 ip.
set_v( v*m_scale);
634 SetWindowPos(
window.hWnd,HWND_TOP, winx, winy, 0, 0,
635 SWP_ASYNCWINDOWPOS | SWP_NOACTIVATE | SWP_NOZORDER |SWP_NOSIZE);
649 SetWindowText(
window.hWnd, windowtitle.c_str());
675 PostMessage(
window.getHWnd(), vpWM_DISPLAY, 0,0);
692 WORD left = (WORD)iP.
get_u();
693 WORD right = (WORD)(iP.
get_u()+width-1);
695 WORD top = (WORD)iP.
get_v();
696 WORD bottom = (WORD)(iP.
get_v()+height-1);
699 WPARAM wp = MAKEWPARAM(left, right);
700 LPARAM lp = MAKELPARAM(top, bottom);
702 PostMessage(
window.getHWnd(), vpWM_DISPLAY_ROI, wp,lp);
713 const vpColor &color,
unsigned int thickness)
717 if (thickness == 1) {
718 window.renderer->setPixel(ip, color);
721 window.renderer->drawRect(ip, thickness*
m_scale, thickness*m_scale, color,
true, 1);
734 unsigned int thickness )
738 window.renderer->drawLine(ip1, ip2, color, thickness);
754 unsigned int thickness )
758 window.renderer->drawLine(ip1, ip2, color, thickness, PS_DASHDOT);
775 unsigned int width,
unsigned int height,
776 const vpColor &color,
bool fill,
777 unsigned int thickness )
781 window.renderer->drawRect(topLeft,width,height,color, fill, thickness);
799 const vpColor &color,
bool fill,
800 unsigned int thickness )
804 unsigned int width =
static_cast<unsigned int>( bottomRight.
get_j() - topLeft.
get_j() );
805 unsigned int height =
static_cast<unsigned int>(bottomRight.
get_i() - topLeft.
get_i() );
806 window.renderer->drawRect(topLeft,width,height,color, fill, thickness);
821 const vpColor &color,
bool fill,
822 unsigned int thickness )
829 window.renderer->drawRect(topLeft,
830 static_cast<unsigned int>( rectangle.
getWidth() ),
831 static_cast<unsigned int>( rectangle.
getHeight() ),
832 color, fill, thickness);
849 unsigned int thickness )
853 window.renderer->drawCircle(center,radius,color,fill,thickness);
868 window.renderer->drawText(ip,text,color);
881 unsigned int thickness)
885 window.renderer->drawCross(ip, size, color, thickness);
899 unsigned int w,
unsigned int h,
900 unsigned int thickness)
905 window.renderer->drawArrow(ip1, ip2, color, w, h, thickness);
916 window.renderer->clear(color);
928 PostMessage(
window.getHWnd(), vpWM_CLOSEDISPLAY, 0,0);
933 WaitForSingleObject(
hThread, INFINITE);
937 window.initialized = false ;
949 window.renderer->getImage(I);
958 w = GetSystemMetrics(SM_CXSCREEN);
959 h = GetSystemMetrics(SM_CYSCREEN);
967 unsigned int width, height;
977 unsigned int width, height;
981 #elif !defined(VISP_BUILD_SHARED_LIBS) 983 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.
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.
unsigned int getHeight() const
HANDLE hThread
Handle of the window's thread.
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)
unsigned int getWidth() const
bool getPointerPosition(vpImagePoint &ip)
void getImage(vpImage< vpRGBa > &I)