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)
61 (param->vpDisp)->window.initWindow(param->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);
153 strcpy(this->title, title) ;
161 threadParam * param =
new threadParam;
166 param->vpDisp =
this;
167 param->title = this->
title;
187 if(!
window.isInitialized())
192 "Window not initialized")) ;
215 window.renderer->setImg(I);
244 window.renderer->setImgROI(I,iP,width,height);
267 window.renderer->setImg(I);
295 window.renderer->setImgROI(I,iP,width,height);
326 WaitForSingleObject(
window.semaClick, 0);
327 WaitForSingleObject(
window.semaClickUp, 0);
328 WaitForSingleObject(
window.semaClick, INFINITE);
332 ret = (WAIT_OBJECT_0 == WaitForSingleObject(
window.semaClick, 0));
366 WaitForSingleObject(
window.semaClick, 0);
367 WaitForSingleObject(
window.semaClickUp, 0);
368 WaitForSingleObject(
window.semaClick, INFINITE);
372 ret = (WAIT_OBJECT_0 == WaitForSingleObject(
window.semaClick, 0));
414 WaitForSingleObject(
window.semaClick, 0);
415 WaitForSingleObject(
window.semaClickUp, 0);
416 WaitForSingleObject(
window.semaClick, INFINITE);
420 ret = (WAIT_OBJECT_0 == WaitForSingleObject(
window.semaClick, 0));
426 button =
window.clickButton;
467 WaitForSingleObject(
window.semaClickUp, 0);
468 WaitForSingleObject(
window.semaClick, 0);
469 WaitForSingleObject(
window.semaClickUp, INFINITE);
473 ret = (WAIT_OBJECT_0 == WaitForSingleObject(
window.semaClickUp, 0));
479 button =
window.clickButtonUp;
507 WaitForSingleObject(
window.semaKey, 0);
508 WaitForSingleObject(
window.semaKey, 0);
509 WaitForSingleObject(
window.semaKey, INFINITE);
513 ret = (WAIT_OBJECT_0 == WaitForSingleObject(
window.semaKey, 0));
544 WaitForSingleObject(
window.semaKey, 0);
545 WaitForSingleObject(
window.semaKey, 0);
546 WaitForSingleObject(
window.semaKey, INFINITE);
550 ret = (WAIT_OBJECT_0 == WaitForSingleObject(
window.semaKey, 0));
553 sprintf(
string,
"%s",
window.lpString);
575 ret = (WAIT_OBJECT_0 == WaitForSingleObject(
window.semaMove, 0));
633 SetWindowPos(
window.hWnd,HWND_TOP, winx, winy, 0, 0,
634 SWP_ASYNCWINDOWPOS | SWP_NOACTIVATE | SWP_NOZORDER |SWP_NOSIZE);
648 SetWindowText(
window.hWnd, windowtitle);
674 PostMessage(
window.getHWnd(), vpWM_DISPLAY, 0,0);
693 typedef struct _half_rect_t{
694 unsigned short left_top;
695 unsigned short right_bottom;
701 hr1.left_top = (
unsigned short)iP.
get_u();
702 hr1.right_bottom = (
unsigned short)(iP.
get_u()+width-1);
704 hr2.left_top = (
unsigned short)iP.
get_v();
705 hr2.right_bottom = (
unsigned short)(iP.
get_v()+height-1);
708 # if 1 // new version FS
709 WPARAM wp = (hr1.left_top <<
sizeof(
unsigned short)) + hr1.right_bottom;
710 LPARAM lp = (hr2.left_top <<
sizeof(
unsigned short)) + hr2.right_bottom;
711 # else // produce warnings with MinGW
712 WPARAM wp=*((WPARAM*)(&hr1));
713 LPARAM lp=*((WPARAM*)(&hr2));
715 PostMessage(
window.getHWnd(), vpWM_DISPLAY_ROI, wp,lp);
717 PostMessage(
window.getHWnd(), vpWM_DISPLAY, 0,0);
732 window.renderer->setPixel(ip, color);
744 unsigned int thickness )
748 window.renderer->drawLine(ip1, ip2, color, thickness);
764 unsigned int thickness )
768 window.renderer->drawLine(ip1,ip2,color,thickness,PS_DASHDOT);
785 unsigned int width,
unsigned int height,
786 const vpColor &color,
bool fill,
787 unsigned int thickness )
791 window.renderer->drawRect(topLeft,width,height,color, fill, thickness);
809 const vpColor &color,
bool fill,
810 unsigned int thickness )
814 unsigned int width =
static_cast<unsigned int>( bottomRight.
get_j() - topLeft.
get_j() );
815 unsigned int height =
static_cast<unsigned int>(bottomRight.
get_i() - topLeft.
get_i() );
816 window.renderer->drawRect(topLeft,width,height,color, fill, thickness);
831 const vpColor &color,
bool fill,
832 unsigned int thickness )
839 window.renderer->drawRect(topLeft,
840 static_cast<unsigned int>( rectangle.
getWidth() ),
841 static_cast<unsigned int>( rectangle.
getHeight() ),
842 color, fill, thickness);
859 unsigned int thickness )
863 window.renderer->drawCircle(center,radius,color,fill,thickness);
878 window.renderer->drawText(ip,text,color);
891 unsigned int thickness)
895 window.renderer->drawCross(ip, size, color, thickness);
909 unsigned int w,
unsigned int h,
910 unsigned int thickness)
915 window.renderer->drawArrow(ip1, ip2, color, w, h, thickness);
926 window.renderer->clear(color);
938 PostMessage(
window.getHWnd(), vpWM_CLOSEDISPLAY, 0,0);
943 WaitForSingleObject(
hThread, INFINITE);
947 window.initialized = false ;
959 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.
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)