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 
00028 
00029 
00030 
00031 
00032 
00033 
00034 
00035 
00036 
00037 
00038 #include "resource.h"
00039 #include <stdlib.h>
00040 #include <stdio.h>
00041 #include <float.h>
00042 #include <math.h>
00043 #include <windows.h>
00044 #include "struct.h"           
00045 #include "..\common\postprocess\ximage.h"
00046 #include "local.h"
00047 #include <commctrl.h>
00048 #include "stereo1.h"
00049 
00050 #if __X__MIPS__
00051 BOOL WINAPI _CRT_INIT(HINSTANCE ,DWORD , LPVOID );
00052 #endif
00053 
00054 static HINSTANCE hDLLinstance=NULL; 
00055 
00056 
00057 
00058 #include "utils.h"
00059 
00060 
00061 
00062 #if __WATCOMC__
00063 int APIENTRY LibMain(HANDLE hDLL, DWORD dwReason, LPVOID lpReserved){
00064 #elif __BC__
00065 BOOL WINAPI DllEntryPoint(HANDLE hDLL, DWORD dwReason, LPVOID lpReserved){
00066 #else
00067 BOOL WINAPI DllMain(HANDLE hDLL, DWORD dwReason, LPVOID lpReserved){
00068 #endif
00069   switch (dwReason) {
00070     case DLL_PROCESS_ATTACH:
00071 #if __X__MIPS__
00072       if(!_CRT_INIT(hDLL,dwReason,lpReserved))return(int)FALSE;
00073 #endif
00074 
00075       hDLLinstance = hDLL;  
00076       break;
00077     case DLL_PROCESS_DETACH:
00078 #if __X__MIPS__
00079       if(!_CRT_INIT(hDLL,dwReason,lpReserved))return(int)FALSE;
00080 #endif
00081 
00082       break;
00083   }
00084 return (int)TRUE;
00085 }
00086 
00087 #if __SC__
00088 #pragma startaddress(DllMain)
00089 #endif
00090 
00091 
00092 
00093 
00094 
00095 long _RenderImageProcess(char *PrmList, XIMAGE *lpXimage){
00096  int i,j;
00097  BOOL LR,RL;
00098  char dummy[255];
00099  fullscreenbuffer *S;
00100  
00101  sscanf(PrmList,"%s %d %d",dummy,&LR,&RL);
00102  
00103  
00104  
00105  S=lpXimage->Screen;
00106  for(j=0;j<lpXimage->Ymax;j++)   
00107  for(i=0;i<lpXimage->Xmax;i++){  
00108    
00109    S->R = min(255,(unsigned char)((double)S->R * LR));
00110    S->G = min(255,(unsigned char)((double)S->G * 0));
00111    S->B = min(255,(unsigned char)((double)S->B * RL));
00112    S++;             
00113  }
00114  return 1;          
00115 }
00116 
00117 
00118 
00119 long _RenderGLexternal(char *PrmList, XIMAGE *lpXimage){
00120 MessageBox(NULL,"OpenGL function called","OK",MB_OK);
00121  return 1;
00122 }
00123 
00124 
00125 
00126 
00127 
00128 
00129 
00130 BOOL LorR=1,RorL=0;
00131 
00132 
00133 BOOL CALLBACK DlgProc(HWND hwnd,UINT msg,WPARAM wparam,LPARAM lparam);
00134 
00135 char * _SetExternalParameters(
00136   char *Op,                 
00137   HWND hWnd,                
00138   long ruler,               
00139   char *name,               
00140   X__MEMORY_MANAGER *lpEVI 
00141                                     ){
00142  
00143  char buffer[256];
00144  if(Op != NULL){  
00145    sscanf(Op,"%s %d %d",buffer,&LorR,&RorL);
00146  }
00147  
00148  
00149  if(DialogBox(hDLLinstance,MAKEINTRESOURCE(DLG_FILTER),hWnd,
00150               (DLGPROC)DlgProc) == FALSE)return Op;
00151  
00152  if(Op != NULL)CALL_FREE(Op);  
00153  
00154  sprintf(buffer,"%s %d %d",name,LorR,RorL);
00155  
00156  if((Op=(char *)CALL_MALLOC(strlen(buffer)+1)) == NULL){
00157   MessageBox (GetFocus(),"External effect: Out of memory","Error",
00158                 MB_OK|MB_TASKMODAL|MB_ICONSTOP);
00159    return NULL;
00160  }
00161  
00162  strcpy(Op,buffer);
00163  return Op;
00164 }
00165 
00166 BOOL CALLBACK DlgProc(HWND hwnd,UINT msg,WPARAM wparam,LPARAM lparam){
00167  int str[32];
00168  char filmname[255],*c;
00169  switch( msg ) {
00170    case WM_INITDIALOG:
00171      
00172      GetModuleFileName(hDLLinstance,filmname,255);
00173          if((c=strrchr(filmname,'.')) != NULL){
00174            strcpy(c,".avi");
00175            Animate_Open(GetDlgItem(hwnd,IDR_ANIMATION1),filmname);
00176            Animate_Play(GetDlgItem(hwnd,IDR_ANIMATION1),0,-1,-1);
00177          }
00178            if(LorR == 1)
00179                  SendDlgItemMessage(hwnd,IDC_RADIO_LEFT,BM_SETCHECK,1,0);
00180            else{
00181                  SendDlgItemMessage(hwnd,IDC_RADIO_RIGHT,BM_SETCHECK,1,0);
00182            }
00183      CentreDialogOnScreen(hwnd);
00184      return TRUE;
00185    case WM_COMMAND:
00186      switch(LOWORD(wparam)){
00187             case IDC_RADIO_LEFT:
00188           MessageBox(NULL,"Activate Left Camera","Don't Forget!",MB_OK);
00189                   return(TRUE);
00190                 case IDC_RADIO_RIGHT:
00191           MessageBox(NULL,"Activate Right Camera","Don't Forget!",MB_OK);
00192                   return(TRUE);
00193             case IDCANCEL:    
00194           EndDialog(hwnd,FALSE);
00195           return(TRUE);
00196         case IDOK:        
00197                   if (SendDlgItemMessage(hwnd,IDC_RADIO_LEFT,BM_GETCHECK,0,0) == 1)
00198                     LorR=1,RorL=0;
00199                   else {
00200                         LorR=0,RorL=1;
00201           }
00202                         EndDialog(hwnd,TRUE);
00203           return(TRUE);
00204                 
00205         default:
00206           break;
00207       }
00208       break;
00209     default: break;
00210  }
00211  return FALSE;
00212 }
00213