42 #include <visp/vpConfig.h>
44 #if ( defined(WIN32) )
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, NULL);
332 WaitForSingleObject(
window.semaClickUp, NULL);
333 WaitForSingleObject(
window.semaClick, INFINITE);
337 ret = (WAIT_OBJECT_0 == WaitForSingleObject(
window.semaClick, NULL));
370 WaitForSingleObject(
window.semaClick, NULL);
371 WaitForSingleObject(
window.semaClickUp, NULL);
372 WaitForSingleObject(
window.semaClick, INFINITE);
376 ret = (WAIT_OBJECT_0 == WaitForSingleObject(
window.semaClick, NULL));
417 WaitForSingleObject(
window.semaClick, NULL);
418 WaitForSingleObject(
window.semaClickUp, NULL);
419 WaitForSingleObject(
window.semaClick, INFINITE);
423 ret = (WAIT_OBJECT_0 == WaitForSingleObject(
window.semaClick, NULL));
429 button =
window.clickButton;
470 WaitForSingleObject(
window.semaClickUp, NULL);
471 WaitForSingleObject(
window.semaClick, NULL);
472 WaitForSingleObject(
window.semaClickUp, INFINITE);
476 ret = (WAIT_OBJECT_0 == WaitForSingleObject(
window.semaClickUp, NULL));
482 button =
window.clickButtonUp;
510 WaitForSingleObject(
window.semaKey, NULL);
511 WaitForSingleObject(
window.semaKey, NULL);
512 WaitForSingleObject(
window.semaKey, INFINITE);
516 ret = (WAIT_OBJECT_0 == WaitForSingleObject(
window.semaKey, NULL));
547 WaitForSingleObject(
window.semaKey, NULL);
548 WaitForSingleObject(
window.semaKey, NULL);
549 WaitForSingleObject(
window.semaKey, INFINITE);
553 ret = (WAIT_OBJECT_0 == WaitForSingleObject(
window.semaKey, NULL));
556 sprintf(
string,
"%s",
window.lpString);
578 ret = (WAIT_OBJECT_0 == WaitForSingleObject(
window.semaMove, NULL));
636 SetWindowPos(
window.hWnd,HWND_TOP, winx, winy, 0, 0,
637 SWP_ASYNCWINDOWPOS | SWP_NOACTIVATE | SWP_NOZORDER |SWP_NOSIZE);
651 SetWindowText(
window.hWnd, windowtitle);
677 PostMessage(
window.getHWnd(), vpWM_DISPLAY, 0,0);
696 typedef struct _half_rect_t{
697 unsigned short left_top;
698 unsigned short right_bottom;
704 hr1.left_top = (
unsigned short)iP.
get_u();
705 hr1.right_bottom = (
unsigned short)(iP.
get_u()+width-1);
707 hr2.left_top = (
unsigned short)iP.
get_v();
708 hr2.right_bottom = (
unsigned short)(iP.
get_v()+height-1);
711 WPARAM wp=*((WPARAM*)(&hr1));
712 LPARAM lp=*((WPARAM*)(&hr2));
713 PostMessage(
window.getHWnd(), vpWM_DISPLAY_ROI, wp,lp);
715 PostMessage(
window.getHWnd(), vpWM_DISPLAY, 0,0);
730 window.renderer->setPixel(ip, color);
742 unsigned int thickness )
746 window.renderer->drawLine(ip1, ip2, color, thickness);
762 unsigned int thickness )
766 window.renderer->drawLine(ip1,ip2,color,thickness,PS_DASHDOT);
783 unsigned int width,
unsigned int height,
784 const vpColor &color,
bool fill,
785 unsigned int thickness )
789 window.renderer->drawRect(topLeft,width,height,color, fill, thickness);
807 const vpColor &color,
bool fill,
808 unsigned int thickness )
812 unsigned int width =
static_cast<unsigned int>( bottomRight.
get_j() - topLeft.
get_j() );
813 unsigned int height =
static_cast<unsigned int>(bottomRight.
get_i() - topLeft.
get_i() );
814 window.renderer->drawRect(topLeft,width,height,color, fill, thickness);
829 const vpColor &color,
bool fill,
830 unsigned int thickness )
837 window.renderer->drawRect(topLeft,
838 static_cast<unsigned int>( rectangle.
getWidth() ),
839 static_cast<unsigned int>( rectangle.
getHeight() ),
840 color, fill, thickness);
857 unsigned int thickness )
861 window.renderer->drawCircle(center,radius,color,fill,thickness);
876 window.renderer->drawText(ip,text,color);
889 unsigned int thickness)
893 window.renderer->drawCross(ip, size, color, thickness);
907 unsigned int w,
unsigned int h,
908 unsigned int thickness)
913 window.renderer->drawArrow(ip1, ip2, color, w, h, thickness);
924 window.renderer->clear(color);
936 PostMessage(
window.getHWnd(), vpWM_CLOSEDISPLAY, 0,0);
941 WaitForSingleObject(
hThread, INFINITE);
945 window.initialized = false ;
947 if (this->
title != NULL) {
948 delete [] this->
title;
961 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)