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,
96 "Image not initialized")) ;
99 window.renderer->setImg(I);
123 "Image not initialized")) ;
126 window.renderer->setImg(I);
146 title_ = std::string(title);
148 title_ = std::string(
" ");
156 threadParam * param =
new threadParam;
161 param->vpDisp =
this;
162 param->title = this->
title_;
182 if(!
window.isInitialized())
187 "Window not initialized")) ;
210 window.renderer->setImg(I);
239 window.renderer->setImgROI(I,iP,width,height);
262 window.renderer->setImg(I);
290 window.renderer->setImgROI(I,iP,width,height);
321 WaitForSingleObject(
window.semaClick, 0);
322 WaitForSingleObject(
window.semaClickUp, 0);
323 WaitForSingleObject(
window.semaClick, INFINITE);
327 ret = (WAIT_OBJECT_0 == WaitForSingleObject(
window.semaClick, 0));
361 WaitForSingleObject(
window.semaClick, 0);
362 WaitForSingleObject(
window.semaClickUp, 0);
363 WaitForSingleObject(
window.semaClick, INFINITE);
367 ret = (WAIT_OBJECT_0 == WaitForSingleObject(
window.semaClick, 0));
409 WaitForSingleObject(
window.semaClick, 0);
410 WaitForSingleObject(
window.semaClickUp, 0);
411 WaitForSingleObject(
window.semaClick, INFINITE);
415 ret = (WAIT_OBJECT_0 == WaitForSingleObject(
window.semaClick, 0));
421 button =
window.clickButton;
462 WaitForSingleObject(
window.semaClickUp, 0);
463 WaitForSingleObject(
window.semaClick, 0);
464 WaitForSingleObject(
window.semaClickUp, INFINITE);
468 ret = (WAIT_OBJECT_0 == WaitForSingleObject(
window.semaClickUp, 0));
474 button =
window.clickButtonUp;
502 WaitForSingleObject(
window.semaKey, 0);
503 WaitForSingleObject(
window.semaKey, 0);
504 WaitForSingleObject(
window.semaKey, INFINITE);
508 ret = (WAIT_OBJECT_0 == WaitForSingleObject(
window.semaKey, 0));
539 WaitForSingleObject(
window.semaKey, 0);
540 WaitForSingleObject(
window.semaKey, 0);
541 WaitForSingleObject(
window.semaKey, INFINITE);
545 ret = (WAIT_OBJECT_0 == WaitForSingleObject(
window.semaKey, 0));
548 sprintf(
string,
"%s",
window.lpString);
570 ret = (WAIT_OBJECT_0 == WaitForSingleObject(
window.semaMove, 0));
628 SetWindowPos(
window.hWnd,HWND_TOP, winx, winy, 0, 0,
629 SWP_ASYNCWINDOWPOS | SWP_NOACTIVATE | SWP_NOZORDER |SWP_NOSIZE);
643 SetWindowText(
window.hWnd, windowtitle);
669 PostMessage(
window.getHWnd(), vpWM_DISPLAY, 0,0);
686 WORD left = (WORD)iP.
get_u();
687 WORD right = (WORD)(iP.
get_u()+width-1);
689 WORD top = (WORD)iP.
get_v();
690 WORD bottom = (WORD)(iP.
get_v()+height-1);
693 WPARAM wp = MAKEWPARAM(left, right);
694 LPARAM lp = MAKELPARAM(top, bottom);
696 PostMessage(
window.getHWnd(), vpWM_DISPLAY_ROI, wp,lp);
710 window.renderer->setPixel(ip, color);
722 unsigned int thickness )
726 window.renderer->drawLine(ip1, ip2, color, thickness);
742 unsigned int thickness )
746 window.renderer->drawLine(ip1,ip2,color,thickness,PS_DASHDOT);
764 const vpColor &color,
bool fill,
765 unsigned int thickness )
769 window.renderer->drawRect(topLeft,width,height,color, fill, thickness);
787 const vpColor &color,
bool fill,
788 unsigned int thickness )
792 unsigned int width =
static_cast<unsigned int>( bottomRight.
get_j() - topLeft.
get_j() );
793 unsigned int height =
static_cast<unsigned int>(bottomRight.
get_i() - topLeft.
get_i() );
794 window.renderer->drawRect(topLeft,width,height,color, fill, thickness);
809 const vpColor &color,
bool fill,
810 unsigned int thickness )
817 window.renderer->drawRect(topLeft,
818 static_cast<unsigned int>( rectangle.
getWidth() ),
819 static_cast<unsigned int>( rectangle.
getHeight() ),
820 color, fill, thickness);
837 unsigned int thickness )
841 window.renderer->drawCircle(center,radius,color,fill,thickness);
856 window.renderer->drawText(ip,text,color);
869 unsigned int thickness)
873 window.renderer->drawCross(ip, size, color, thickness);
887 unsigned int w,
unsigned int h,
888 unsigned int thickness)
893 window.renderer->drawArrow(ip1, ip2, color, w, h, thickness);
904 window.renderer->clear(color);
916 PostMessage(
window.getHWnd(), vpWM_CLOSEDISPLAY, 0,0);
921 WaitForSingleObject(
hThread, INFINITE);
925 window.initialized = false ;
937 window.renderer->getImage(I);
940 #elif !defined(VISP_BUILD_SHARED_LIBS)
942 void dummy_vpDisplayWin32() {};
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.
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 set_i(const double ii)
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.
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.
int windowXPosition
display position
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 ...
int windowYPosition
display position
void setWindowPosition(int winx, int winy)
bool getPointerPosition(vpImagePoint &ip)
void getImage(vpImage< vpRGBa > &I)