00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #include <stdlib.h>
00028 #include <stdio.h>
00029 #include <float.h>
00030 #include <math.h>
00031 #include <windows.h>
00032 #include <commctrl.h>
00033 #include <vfw.h>
00034 #include "struct.h"
00035 #include "..\common\postprocess\ximage.h"
00036 #include "local.h"
00037
00038
00039
00040 #include "lens.h"
00041
00042 #if __X__MIPS__
00043 BOOL WINAPI _CRT_INIT(HINSTANCE ,DWORD , LPVOID );
00044 #endif
00045
00046 static HINSTANCE hDLLinstance=NULL;
00047
00048 #include "utils.h"
00049
00050 #include "paint.c"
00051
00052 #if __WATCOMC__
00053 int APIENTRY LibMain(HANDLE hDLL, DWORD dwReason, LPVOID lpReserved){
00054 #elif __BC__
00055 BOOL WINAPI DllEntryPoint(HANDLE hDLL, DWORD dwReason, LPVOID lpReserved){
00056 #else
00057 BOOL WINAPI DllMain(HANDLE hDLL, DWORD dwReason, LPVOID lpReserved){
00058 #endif
00059 switch (dwReason) {
00060 case DLL_PROCESS_ATTACH:
00061 #if __X__MIPS__
00062 if(!_CRT_INIT(hDLL,dwReason,lpReserved))return(int)FALSE;
00063 #endif
00064 hDLLinstance = hDLL;
00065 break;
00066 case DLL_PROCESS_DETACH:
00067 #if __X__MIPS__
00068 if(!_CRT_INIT(hDLL,dwReason,lpReserved))return(int)FALSE;
00069 #endif
00070 break;
00071 }
00072 return (int)TRUE;
00073 }
00074
00075 #if __SC__
00076 #pragma startaddress(DllMain)
00077 #endif
00078
00079 #include "lens1.c"
00080
00081
00082
00083 long _RenderGLexternal(char *PrmList, XIMAGE *lpXimage){
00084
00085 return 1;
00086 }
00087
00088
00089 BOOL CALLBACK DlgProc(HWND hwnd,UINT msg,WPARAM wparam,LPARAM lparam);
00090
00091 static long version=1,type=1,model=1,flicker=0,hide=1,id= -1,
00092 sx=0,sy=0,ipx=0,ipy=0,ipz=0;
00093 static double bscale=1.0,rscale=1.0,angle=22.5;
00094 static double px,py,pz;
00095 static X__MEMORY_MANAGER *lpLocalEVI;
00096
00097 char * _SetExternalParameters(
00098 char *Op,
00099 HWND hWnd,
00100 long ruler,
00101 char *name,
00102 X__MEMORY_MANAGER *lpEVI
00103 ){
00104 char buffer[256];
00105 if(Op != NULL){
00106 sscanf(Op,"%s %ld %ld %ld %ld %ld %ld %ld %ld %ld %ld %f %f %ld %f",
00107 buffer,&type,&flicker,&hide,&sx,&sy,&ipx,&ipy,&ipz,&model,&version,
00108 &bscale,&rscale,&id,&angle);
00109 px=(double)ipx/(double)ruler;
00110 py=(double)ipy/(double)ruler;
00111 pz=(double)ipz/(double)ruler;
00112 }
00113 lpLocalEVI=lpEVI;
00114 if(DialogBox(hDLLinstance,MAKEINTRESOURCE(DLG_LENS),hWnd,
00115 (DLGPROC)DlgProc) == FALSE)return Op;
00116 if(Op != NULL)CALL_FREE(Op);
00117 ipx=(long)(px*(double)ruler);
00118 ipy=(long)(py*(double)ruler);
00119 ipz=(long)(pz*(double)ruler);
00120 sprintf(buffer,"%s %ld %ld %ld %ld %ld %ld %ld %ld %ld %ld %f %f %ld %f",
00121 name,type,flicker,hide,sx,sy,ipx,ipy,ipz,model,version,
00122 bscale,rscale,id,angle);
00123 if((Op=(char *)CALL_MALLOC(strlen(buffer)+1)) == NULL){
00124 return NULL;
00125 }
00126 strcpy(Op,buffer);
00127 return Op;
00128 }
00129
00130 #define D_BORDER 4
00131 #define N_TABS 6
00132
00133 typedef struct tag_dlghdr1 {
00134 HWND hwndDlg[N_TABS];
00135 RECT rcTab;
00136 } DLGHDR1;
00137
00138 static DLGHDR1 DlgHdrLens,*lpDlgHdrLens;
00139 static HWND hwndTabLens;
00140 static HDRAWDIB hDrawDib = NULL;
00141 static long BitmapSizeX,BitmapSizeY;
00142 static LPSTR lpBitmapBits=NULL,lpBitmapHeader=NULL,lpBits;
00143
00144 static BOOL InitiatePreviewUpdateView(HWND);
00145 static void TerminatePreviewUpdateView(void);
00146 static void PaintPreviewUpdateView(HDC, RECT);
00147 static void MakePreview(HWND);
00148
00149 BOOL CALLBACK Flare6DlgProc(HWND hwnd,UINT msg,WPARAM wparam,LPARAM lparam){
00150 switch( msg ) {
00151 case WM_INITDIALOG:
00152 return TRUE;
00153 case WM_COMMAND:
00154 switch(LOWORD(wparam)){
00155 case IDCANCEL:
00156 break;
00157 case IDOK:
00158 break;
00159 default:
00160 break;
00161 }
00162 break;
00163 default: break;
00164 }
00165 return FALSE;
00166 }
00167
00168 BOOL CALLBACK Flare5DlgProc(HWND hwnd,UINT msg,WPARAM wparam,LPARAM lparam){
00169 switch( msg ) {
00170 case WM_INITDIALOG:
00171 return TRUE;
00172 case WM_COMMAND:
00173 switch(LOWORD(wparam)){
00174 case IDCANCEL:
00175 break;
00176 case IDOK:
00177 break;
00178 default:
00179 break;
00180 }
00181 break;
00182 default: break;
00183 }
00184 return FALSE;
00185 }
00186
00187 BOOL CALLBACK Flare4DlgProc(HWND hwnd,UINT msg,WPARAM wparam,LPARAM lparam){
00188 switch( msg ) {
00189 case WM_INITDIALOG:
00190 return TRUE;
00191 case WM_COMMAND:
00192 switch(LOWORD(wparam)){
00193 case IDCANCEL:
00194 break;
00195 case IDOK:
00196 break;
00197 default:
00198 break;
00199 }
00200 break;
00201 default: break;
00202 }
00203 return FALSE;
00204 }
00205
00206 BOOL CALLBACK Flare3DlgProc(HWND hwnd,UINT msg,WPARAM wparam,LPARAM lparam){
00207 switch( msg ) {
00208 case WM_INITDIALOG:
00209 return TRUE;
00210 case WM_COMMAND:
00211 switch(LOWORD(wparam)){
00212 case IDCANCEL:
00213 break;
00214 case IDOK:
00215 break;
00216 default:
00217 break;
00218 }
00219 break;
00220 default: break;
00221 }
00222 return FALSE;
00223 }
00224
00225 BOOL CALLBACK Flare2DlgProc(HWND hwnd,UINT msg,WPARAM wparam,LPARAM lparam){
00226 switch( msg ) {
00227 case WM_INITDIALOG:
00228 if (model == 1)
00229 SendDlgItemMessage(hwnd,DLG_FLARE_MODEL1,BM_SETCHECK,TRUE,0);
00230 else if(model == 2)
00231 SendDlgItemMessage(hwnd,DLG_FLARE_MODEL2,BM_SETCHECK,TRUE,0);
00232 else if(model == 3)
00233 SendDlgItemMessage(hwnd,DLG_FLARE_MODEL3,BM_SETCHECK,TRUE,0);
00234 else if(model == 4)
00235 SendDlgItemMessage(hwnd,DLG_FLARE_MODEL4,BM_SETCHECK,TRUE,0);
00236 return TRUE;
00237 case WM_COMMAND:
00238 switch(LOWORD(wparam)){
00239 case IDCANCEL:
00240 break;
00241 case IDOK:
00242 if (SendDlgItemMessage(hwnd,DLG_FLARE_MODEL4,BM_GETCHECK,0,0))
00243 model=4;
00244 else if(SendDlgItemMessage(hwnd,DLG_FLARE_MODEL3,BM_GETCHECK,0,0))
00245 model=3;
00246 else if(SendDlgItemMessage(hwnd,DLG_FLARE_MODEL2,BM_GETCHECK,0,0))
00247 model=2;
00248 else model=1;
00249 break;
00250 default:
00251 break;
00252 }
00253 break;
00254 default: break;
00255 }
00256 return FALSE;
00257 }
00258
00259 BOOL CALLBACK Flare1DlgProc(HWND hwnd,UINT msg,WPARAM wparam,LPARAM lparam){
00260 BOOL err;
00261 char str[32];
00262 switch( msg ) {
00263 case WM_INITDIALOG:
00264 if(hide)SendDlgItemMessage(hwnd,DLG_FLARE_HIDE,BM_SETCHECK,TRUE,0);
00265 if (type == 1)
00266 SendDlgItemMessage(hwnd,DLG_FLARE_TYPE1,BM_SETCHECK,TRUE,0);
00267 else if(type == 2)
00268 SendDlgItemMessage(hwnd,DLG_FLARE_TYPE2,BM_SETCHECK,TRUE,0);
00269 else if(type == 3)
00270 SendDlgItemMessage(hwnd,DLG_FLARE_TYPE3,BM_SETCHECK,TRUE,0);
00271 else if(type == 4)
00272 SendDlgItemMessage(hwnd,DLG_FLARE_TYPE4,BM_SETCHECK,TRUE,0);
00273 else if(type == 5)
00274 SendDlgItemMessage(hwnd,DLG_FLARE_TYPE5,BM_SETCHECK,TRUE,0);
00275 sprintf(str,"%.3f",px);
00276 SetDlgItemText(hwnd,DLG_FLARE_PX,str);
00277 sprintf(str,"%.3f",py);
00278 SetDlgItemText(hwnd,DLG_FLARE_PY,str);
00279 sprintf(str,"%.3f",pz);
00280 SetDlgItemText(hwnd,DLG_FLARE_PZ,str);
00281 SetDlgItemInt(hwnd,DLG_FLARE_SX,sx,FALSE);
00282 SetDlgItemInt(hwnd,DLG_FLARE_SY,sy,FALSE);
00283 sprintf(str,"%.3f",bscale);
00284 SetDlgItemText(hwnd,DLG_FLARE_BSCALE,str);
00285 sprintf(str,"%.3f",rscale);
00286 SetDlgItemText(hwnd,DLG_FLARE_RSCALE,str);
00287 if(id >= 0)SendDlgItemMessage(hwnd,DLG_FLARE_NAME,WM_SETTEXT,
00288 0,(LPARAM)GetActorsName(lpLocalEVI->lpAni,id));
00289 return TRUE;
00290 case WM_COMMAND:
00291 switch(LOWORD(wparam)){
00292 case DLG_FLARE_SETID:
00293 id=GetActorsID(lpLocalEVI->lpAni,hwnd);
00294 if(id >= 0)SendDlgItemMessage(hwnd,DLG_FLARE_NAME,WM_SETTEXT,
00295 0,(LPARAM)GetActorsName(lpLocalEVI->lpAni,id));
00296 break;
00297 case IDCANCEL:
00298 break;
00299 case IDOK:
00300 if(GetDlgItemText(hwnd,DLG_FLARE_PX,str,12) != 0)
00301 sscanf(str,"%f",&px);
00302 if(GetDlgItemText(hwnd,DLG_FLARE_PY,str,12) != 0)
00303 sscanf(str,"%f",&py);
00304 if(GetDlgItemText(hwnd,DLG_FLARE_PZ,str,12) != 0)
00305 sscanf(str,"%f",&pz);
00306 if(GetDlgItemText(hwnd,DLG_FLARE_BSCALE,str,12) != 0)
00307 sscanf(str,"%f",&bscale);
00308 if(GetDlgItemText(hwnd,DLG_FLARE_RSCALE,str,12) != 0)
00309 sscanf(str,"%f",&rscale);
00310 sx=GetDlgItemInt(hwnd,DLG_FLARE_SX,&err,FALSE);
00311 sy=GetDlgItemInt(hwnd,DLG_FLARE_SY,&err,FALSE);
00312 if (SendDlgItemMessage(hwnd,DLG_FLARE_TYPE5,BM_GETCHECK,0,0))
00313 type=5;
00314 else if(SendDlgItemMessage(hwnd,DLG_FLARE_TYPE4,BM_GETCHECK,0,0))
00315 type=4;
00316 else if(SendDlgItemMessage(hwnd,DLG_FLARE_TYPE3,BM_GETCHECK,0,0))
00317 type=3;
00318 else if(SendDlgItemMessage(hwnd,DLG_FLARE_TYPE2,BM_GETCHECK,0,0))
00319 type=2;
00320 else type=1;
00321 if(SendDlgItemMessage(hwnd,DLG_FLARE_HIDE,BM_GETCHECK,0,0))
00322 hide=1;
00323 else hide=0;
00324 break;
00325 default:
00326 break;
00327 }
00328 break;
00329 default: break;
00330 }
00331 return FALSE;
00332 }
00333
00334 BOOL CALLBACK DlgProc(HWND hdlg,UINT msg,
00335 WPARAM wparam,LPARAM lparam){
00336 int i,xp,yp;
00337 RECT rc,rd,re;
00338 char str[32];
00339 switch( msg ){
00340 case WM_INITDIALOG:{
00341 TC_ITEM tie;
00342 int h,w;
00343 DWORD dwDlgBase=GetDialogBaseUnits();
00344 lpDlgHdrLens=&DlgHdrLens;
00345 GetWindowRect(hdlg,&rc);
00346 GetWindowRect(GetDlgItem(hdlg,IDOK),&rd);
00347 GetWindowRect(GetDlgItem(hdlg,DLG_LENS_PREVIEW_W),&re);
00348 h=rc.bottom-rc.top-GetSystemMetrics(SM_CYCAPTION);
00349 w=re.left-rc.left;
00350 GetClientRect(hdlg,&rc);
00351 hwndTabLens=CreateWindowEx(
00352 0,
00353 WC_TABCONTROL," ",
00354 TCS_MULTILINE |
00355 WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS,
00356 (D_BORDER*LOWORD(dwDlgBase))/4,
00357 (D_BORDER*HIWORD(dwDlgBase))/8,
00358 w-(4*D_BORDER*LOWORD(dwDlgBase))/4,
00359 h-(4*D_BORDER*HIWORD(dwDlgBase))/8,
00360 hdlg,NULL,hDLLinstance,NULL);
00361 SendMessage(hwndTabLens,WM_SETFONT,
00362 (WPARAM)GetStockObject(ANSI_VAR_FONT),0);
00363 memset(&tie,0,sizeof(TC_ITEM));
00364 tie.mask = TCIF_TEXT;
00365 tie.pszText=str;
00366 LoadString(hDLLinstance,IDI_TEXT1,str,32);
00367 TabCtrl_InsertItem(hwndTabLens,0,&tie);
00368 LoadString(hDLLinstance,IDI_TEXT2,str,32);
00369 TabCtrl_InsertItem(hwndTabLens,1,&tie);
00370 LoadString(hDLLinstance,IDI_TEXT3,str,32);
00371 TabCtrl_InsertItem(hwndTabLens,2,&tie);
00372 LoadString(hDLLinstance,IDI_TEXT4,str,32);
00373 TabCtrl_InsertItem(hwndTabLens,3,&tie);
00374 LoadString(hDLLinstance,IDI_TEXT5,str,32);
00375 TabCtrl_InsertItem(hwndTabLens,4,&tie);
00376 LoadString(hDLLinstance,IDI_TEXT6,str,32);
00377 TabCtrl_InsertItem(hwndTabLens,6,&tie);
00378 SetRectEmpty(&rc);
00379 TabCtrl_AdjustRect(hwndTabLens,FALSE,&rc);
00380 rc.left += (D_BORDER*LOWORD(dwDlgBase))/4;
00381 rc.top += (D_BORDER*HIWORD(dwDlgBase))/8;
00382 CopyRect(&(lpDlgHdrLens->rcTab),&rc);
00383 for(i=0;i<N_TABS;i++)lpDlgHdrLens->hwndDlg[i]=NULL;
00384 lpDlgHdrLens->hwndDlg[0]=CreateDialog(hDLLinstance,
00385 MAKEINTRESOURCE(DLG_FLARE),
00386 hdlg,(DLGPROC)Flare1DlgProc);
00387 SetWindowPos(lpDlgHdrLens->hwndDlg[0],NULL,
00388 lpDlgHdrLens->rcTab.left,
00389 lpDlgHdrLens->rcTab.top,0,0,
00390 SWP_NOSIZE | SWP_NOZORDER);
00391 ShowWindow(lpDlgHdrLens->hwndDlg[0],SW_SHOW);
00392 }
00393 InitiatePreviewUpdateView(GetDlgItem(hdlg,DLG_LENS_PREVIEW_W));
00394 CentreDialogOnScreen(hdlg);
00395 return TRUE;
00396 case WM_NOTIFY:
00397 if( ((LPNMHDR)lparam)->code == TCN_SELCHANGING){
00398 int id=TabCtrl_GetCurSel(hwndTabLens);
00399 }
00400 if( ((LPNMHDR)lparam)->code == TCN_SELCHANGE){
00401 int id=TabCtrl_GetCurSel(hwndTabLens);
00402 for(i=0;i<N_TABS;i++){
00403 if(lpDlgHdrLens->hwndDlg[i] != NULL){
00404 SendMessage(lpDlgHdrLens->hwndDlg[i],
00405 WM_COMMAND,(WPARAM)IDOK,0);
00406 DestroyWindow(lpDlgHdrLens->hwndDlg[i]);
00407 lpDlgHdrLens->hwndDlg[i]=NULL;
00408 }
00409 }
00410 if(id == 0)lpDlgHdrLens->hwndDlg[0]=CreateDialog(hDLLinstance,
00411 MAKEINTRESOURCE(DLG_FLARE),
00412 hdlg,(DLGPROC)Flare1DlgProc);
00413 if(id == 1)lpDlgHdrLens->hwndDlg[1]=CreateDialog(hDLLinstance,
00414 MAKEINTRESOURCE(DLG_FLARE2),
00415 hdlg,(DLGPROC)Flare2DlgProc);
00416 if(id == 2)lpDlgHdrLens->hwndDlg[2]=CreateDialog(hDLLinstance,
00417 MAKEINTRESOURCE(DLG_FLARE3),
00418 hdlg,(DLGPROC)Flare3DlgProc);
00419 if(id == 3)lpDlgHdrLens->hwndDlg[3]=CreateDialog(hDLLinstance,
00420 MAKEINTRESOURCE(DLG_FLARE4),
00421 hdlg,(DLGPROC)Flare4DlgProc);
00422 if(id == 4)lpDlgHdrLens->hwndDlg[4]=CreateDialog(hDLLinstance,
00423 MAKEINTRESOURCE(DLG_FLARE5),
00424 hdlg,(DLGPROC)Flare5DlgProc);
00425 if(id == 4)lpDlgHdrLens->hwndDlg[5]=CreateDialog(hDLLinstance,
00426 MAKEINTRESOURCE(DLG_FLARE6),
00427 hdlg,(DLGPROC)Flare6DlgProc);
00428 if(lpDlgHdrLens->hwndDlg[id] != NULL){
00429 SetWindowPos(lpDlgHdrLens->hwndDlg[id],NULL,
00430 lpDlgHdrLens->rcTab.left,
00431 lpDlgHdrLens->rcTab.top,0,0,
00432 SWP_NOSIZE | SWP_NOZORDER);
00433 ShowWindow(lpDlgHdrLens->hwndDlg[id],SW_SHOW);
00434 }
00435 }
00436 break;
00437 case WM_DRAWITEM:{
00438 LPDRAWITEMSTRUCT lpdis;
00439 HBRUSH hbr,hbrold;
00440 BYTE r,g,b;
00441 RECT rc;
00442 lpdis=(LPDRAWITEMSTRUCT)lparam;
00443 if(lpdis->CtlID == DLG_LENS_PREVIEW_W){
00444 if(lpdis->itemAction == ODA_DRAWENTIRE){
00445 PaintPreviewUpdateView(lpdis->hDC,lpdis->rcItem);
00446 }
00447 }
00448 }
00449 return TRUE;
00450 case WM_PAINT:
00451 PaintBackground(hdlg);
00452 break;
00453 case WM_COMMAND:
00454 switch( LOWORD(wparam) ){
00455 case IDOK:
00456 for(i=0;i<N_TABS;i++){
00457 if(lpDlgHdrLens->hwndDlg[i] != NULL)
00458 SendMessage(lpDlgHdrLens->hwndDlg[i],WM_COMMAND,
00459 (WPARAM)IDOK,0);
00460 }
00461 EndDialog(hdlg,TRUE);
00462 return(TRUE);
00463 case IDCANCEL:
00464 EndDialog(hdlg,FALSE);
00465 return(TRUE);
00466 case DLG_LENS_PREVIEW:
00467 for(i=0;i<N_TABS;i++){
00468 if(lpDlgHdrLens->hwndDlg[i] != NULL)
00469 SendMessage(lpDlgHdrLens->hwndDlg[i],WM_COMMAND,
00470 (WPARAM)IDOK,0);
00471 }
00472 MakePreview(GetDlgItem(hdlg,DLG_LENS_PREVIEW_W));
00473 break;
00474 default:
00475 break;
00476 }
00477 break;
00478 case WM_DESTROY:
00479 for(i=0;i<N_TABS;i++){
00480 if(lpDlgHdrLens->hwndDlg[i] != NULL)
00481 DestroyWindow(lpDlgHdrLens->hwndDlg[i]);
00482 lpDlgHdrLens->hwndDlg[i]=NULL;
00483 }
00484 TerminatePreviewUpdateView();
00485 break;
00486 default: break;
00487 }
00488 return( FALSE );
00489 }
00490
00491 static BOOL InitiatePreviewUpdateView(HWND hwnd_control){
00492 long imagesize;
00493 int i;
00494 RECT rc;
00495 LPBITMAPINFOHEADER lpbi;
00496 lpBitmapHeader = (LPSTR)X__Malloc((long)sizeof(BITMAPINFOHEADER));
00497 if(lpBitmapHeader == NULL){
00498 return FALSE;
00499 }
00500 GetClientRect(hwnd_control,&rc);
00501 BitmapSizeX=max(10,rc.right);
00502 BitmapSizeX=((BitmapSizeX+3)/4*4);
00503 BitmapSizeY=max(10,rc.bottom);
00504 lpbi=(LPBITMAPINFOHEADER)lpBitmapHeader;
00505 lpbi->biSize=sizeof(BITMAPINFOHEADER);
00506 lpbi->biWidth=(DWORD)BitmapSizeX;
00507 lpbi->biHeight=(DWORD)BitmapSizeY;
00508 lpbi->biPlanes=1;
00509 lpbi->biBitCount=24;
00510 lpbi->biCompression=BI_RGB;
00511 imagesize = lpbi->biSizeImage = BitmapSizeX*BitmapSizeY*3L;
00512 lpbi->biXPelsPerMeter=0;
00513 lpbi->biYPelsPerMeter=0;
00514 lpbi->biClrUsed=0;
00515 lpbi->biClrImportant=0;
00516 lpBitmapBits=(LPSTR)X__Malloc(imagesize);
00517 if(lpBitmapBits == NULL){
00518 if(lpBitmapHeader != NULL)X__Free((char *)lpBitmapHeader);
00519 lpBitmapHeader = NULL;
00520 return FALSE;
00521 }
00522 memset(lpBitmapBits,0,imagesize);
00523 if((hDrawDib=DrawDibOpen()) == NULL)MessageBox(NULL,"No Dib",NULL,MB_OK);
00524 return TRUE;
00525 }
00526
00527 static void TerminatePreviewUpdateView(void){
00528 if(hDrawDib != NULL)DrawDibClose(hDrawDib);
00529 if(lpBitmapBits != NULL)X__Free((char *)lpBitmapBits);
00530 if(lpBitmapHeader != NULL)X__Free((char *)lpBitmapHeader);
00531 hDrawDib = NULL;
00532 lpBitmapHeader = NULL;
00533 lpBitmapBits = NULL;
00534 return;
00535 }
00536
00537 static void PaintPreviewUpdateView(HDC hDC,RECT rc){
00538 if(hDrawDib != NULL && lpBitmapHeader != NULL && lpBitmapBits != NULL){
00539 DrawDibRealize(hDrawDib,hDC,TRUE);
00540 DrawDibDraw(hDrawDib,hDC,
00541 0,
00542 0,
00543 rc.right,
00544 rc.bottom,
00545 (LPBITMAPINFOHEADER)lpBitmapHeader,lpBitmapBits,
00546 0,0,
00547 (int)((LPBITMAPINFOHEADER)lpBitmapHeader)->biWidth,
00548 (int)((LPBITMAPINFOHEADER)lpBitmapHeader)->biHeight,
00549 0);
00550 }
00551 return;
00552 }
00553
00554 static void MakePreview(HWND hwnd_control){
00555 LPSTR p;
00556 XIMAGE Ximage;
00557 fullscreenbuffer *fsb,*f;
00558 char buffer[256];
00559 long i,j,id=0,index;
00560 if(lpBitmapBits == NULL)return;
00561 if((fsb=(fullscreenbuffer *)
00562 X__Malloc(BitmapSizeX*BitmapSizeY*sizeof(fullscreenbuffer))) == NULL){
00563 MessageBeep(MB_OK);
00564 return;
00565 }
00566 memset(fsb,0,BitmapSizeX*BitmapSizeY*sizeof(fullscreenbuffer));
00567 sprintf(buffer,"%s %ld %ld %ld %ld %ld %ld %ld %ld %ld %ld %f %f %ld %f",
00568 "FLARE.DLL",3,flicker,0,(BitmapSizeX*2)/3,(BitmapSizeY*1)/3,
00569 ipx,ipy,ipz,model,version,
00570 bscale,rscale,id,angle);
00571 memset(&Ximage,0,sizeof(XIMAGE));
00572 Ximage.version=1;
00573 Ximage.Frame=1;
00574 Ximage.Xmax=BitmapSizeX;
00575 Ximage.Ymax=BitmapSizeY;
00576 Ximage.Screen=fsb;
00577 _RenderImageProcess(buffer,&Ximage);
00578 for(j=0;j<BitmapSizeY;j++){
00579 index = BitmapSizeY - 1 - j;
00580 p=(lpBitmapBits+index*BitmapSizeX*3);
00581 id=(j*Ximage.Ymax)/BitmapSizeY;
00582 id *= Ximage.Xmax;
00583 for(i=0;i<BitmapSizeX;i++){
00584 f = (fsb + id + (i*Ximage.Xmax)/BitmapSizeX);
00585 *p++ = f->B;
00586 *p++ = f->G;
00587 *p++ = f->R;
00588 }
00589 if((j%10) == 0){
00590 InvalidateRect(hwnd_control,NULL,FALSE);
00591 UpdateWindow(hwnd_control);
00592 }
00593 }
00594 InvalidateRect(hwnd_control,NULL,FALSE);
00595 UpdateWindow(hwnd_control);
00596 X__Free(fsb);
00597 return;
00598 }