Main Page | Class Hierarchy | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages | Examples

vetWindow32.cpp

Go to the documentation of this file.
00001 
00018 #include "vetWindow32.h"
00019 
00020 
00028 vetWindow32::vetWindow32(HINSTANCE hInstance) : vetOutput()
00029  {
00030         INFO("vetWindow32::vetWindow32(HINSTANCE hInstance) : vetOutput() [CONTRUCTOR]")
00031 
00032         parentHistance = hInstance;
00033         myHandle = 0;
00034         width = 0;
00035         height = 0;
00036 
00037         if (parentHistance)
00038                 createWindow(VETW32_DEF_WIDTH, VETW32_DEF_HEIGHT);
00039  }
00040 
00044 vetWindow32::~vetWindow32()
00045  {
00046         INFO("vetWindow32::~vetWindow32() : [DESTRUCTOR]")
00047 
00048         ReleaseDC(myHandle, hDisplay);
00049  }
00050 
00063 VETRESULT vetWindow32::createWindow(unsigned int w, unsigned int h)
00064  {
00065         if (parentHistance == 0)
00066                 return VETRET_ILLEGAL_USE;
00067 
00068         width = w;
00069         height = h;
00070 
00071     // Create the main window.  The WS_CLIPCHILDREN style is required.
00072         myHandle = CreateWindow(VETW32_DEF_CLSNAME, VETW32_DEF_TITLE,
00073                                                         WS_OVERLAPPEDWINDOW | WS_CAPTION | WS_CLIPCHILDREN,
00074                                                         CW_USEDEFAULT, CW_USEDEFAULT,
00075                                                         width, height,
00076                                                         0, 0, parentHistance, 0);
00077 
00078 
00079         if (myHandle == 0)
00080                 return VETRET_INTERNAL_ERR;
00081 
00082         GetClientRect(myHandle, &myRect);
00083 
00084         hDisplay = GetDC(myHandle);
00085 
00086         InvalidateRect(myHandle, NULL, FALSE);
00087 
00088         return VETRET_OK;
00089  }
00090 
00098 VETRESULT vetWindow32::show(int nCmdShow)
00099  {
00100         if (myHandle == 0)
00101                 return VETRET_ILLEGAL_USE;
00102 
00103         ShowWindow(myHandle, nCmdShow);
00104         UpdateWindow(myHandle);
00105 
00106         return VETRET_OK;
00107  }
00108 
00114 VETRESULT vetWindow32::hide()
00115  {
00116         if (myHandle == 0)
00117                 return VETRET_ILLEGAL_USE;
00118 
00119         ShowWindow(myHandle, SW_HIDE);
00120         UpdateWindow(myHandle);
00121 
00122         return VETRET_OK;
00123  }
00124 
00125 
00131 VETRESULT vetWindow32::welcomeText()
00132 {
00133         if (myHandle == 0)
00134                 return VETRET_ILLEGAL_USE;
00135 
00136         PAINTSTRUCT ps;
00137         HDC hdc = BeginPaint(myHandle, &ps);
00138         EndPaint(myHandle, &ps);
00139 
00140         char buf[2048];
00141         int x=50;
00142         int y=60;
00143         SetTextColor(hdc,RGB(rand()%255,rand()%255,rand()%255));
00144         int len=sprintf(buf,"VETLib is Ready!");
00145         TextOut(hdc,x,y,buf,len);
00146 
00147         return VETRET_OK;
00148  }
00149 
00150 
00151 
00157 VETRESULT vetWindow32::setHeight(unsigned int value)
00158  {
00159         height = value;
00160         SetWindowPos(myHandle, NULL, 0, 0, width, height, SWP_NOACTIVATE | SWP_NOMOVE);
00161 
00162         return VETRET_OK;
00163  }
00164 
00170 VETRESULT vetWindow32::setWidth(unsigned int value)
00171  {
00172         width = value;
00173         SetWindowPos(myHandle, NULL, 0, 0, width, height, SWP_NOACTIVATE | SWP_NOMOVE);
00174 
00175         return VETRET_OK;
00176  }
00177 
00178 
00189 VETRESULT vetWindow32::importFrom(vetFrameYUV420& img)
00190  {
00191         INFO("int vetWindow32::importFrom(vetFrameYUV420& img) [reading data]")
00192 
00193         return VETRET_NOT_IMPLEMENTED;
00194  }
00195 
00196 
00207 VETRESULT vetWindow32::importFrom(vetFrameRGB24& img)
00208  {
00209         INFO("int vetWindow32::importFrom(vetFrameRGB24& img) [reading data]")
00210 
00211         if (&img == NULL)
00212                 return VETRET_PARAM_ERR;
00213 
00214         for (int y=0; y<(int)img.height; y++ )
00215 
00216                 for (int x=0; x<(int)img.width; x++ )
00217 
00218                         SetPixel(hDisplay, x, y, RGB(img.data[y*img.width+x][0],img.data[y*img.width+x][1],img.data[y*img.width+x][2]));
00219 
00220         return VETRET_OK;
00221  }
00222 
00223 
00234 VETRESULT vetWindow32::importFrom(vetFrameT<unsigned char>& img)
00235  {
00236         INFO("int vetWindow32::importFrom(vetFrameT<unsigned char>& img) [reading data]")
00237 
00238         return VETRET_NOT_IMPLEMENTED;
00239  }
00240 
00241 
00242 

Generated on Tue Jan 24 11:59:06 2006 for VETLib by  doxygen 1.4.4