template.c

Go to the documentation of this file.
00001 
00002 /* template.c  image post-processor                                     */
00003 
00004 #include <stdlib.h>
00005 #include <stdio.h>
00006 #include <float.h>
00007 #include <math.h>
00008 #include <windows.h>
00009 #include "struct.h"           /* general structures    */
00010 #include "..\common\postprocess\ximage.h"
00011 #include "local.h"
00012 
00013 #include "template.h"
00014 
00015 #if __X__MIPS__
00016 BOOL WINAPI _CRT_INIT(HINSTANCE ,DWORD , LPVOID );
00017 #endif
00018 
00019 static HINSTANCE hDLLinstance=NULL; /* use to pick up resources from DLL   */
00020 static long version=1;
00021 
00022 /************************** Local Utility Functions ***********************/
00023 
00024 #include "utils.h"
00025 #include "paint.c"
00026 
00027 /************************** DLL entry point ********************************/
00028 
00029 #if __WATCOMC__
00030 int APIENTRY LibMain(HANDLE hDLL, DWORD dwReason, LPVOID lpReserved){
00031 #elif __BC__
00032 BOOL WINAPI DllEntryPoint(HANDLE hDLL, DWORD dwReason, LPVOID lpReserved){
00033 #else
00034 BOOL WINAPI DllMain(HANDLE hDLL, DWORD dwReason, LPVOID lpReserved){
00035 #endif
00036   switch (dwReason) {
00037     case DLL_PROCESS_ATTACH:
00038 #if __X__MIPS__
00039       if(!_CRT_INIT(hDLL,dwReason,lpReserved))return(int)FALSE;
00040 #endif
00041       hDLLinstance = hDLL;  /* handle to DLL file */
00042       break;
00043     case DLL_PROCESS_DETACH:
00044 #if __X__MIPS__
00045       if(!_CRT_INIT(hDLL,dwReason,lpReserved))return(int)FALSE;
00046 #endif
00047       break;
00048   }
00049 return (int)TRUE;
00050 }
00051 
00052 #if __SC__
00053 #pragma startaddress(DllMain)
00054 #endif
00055 
00056 long _RenderImageProcess(char *PrmList, XIMAGE *lpXimage){
00057  double mr;
00058  float *Zb;
00059 
00060  //sscanf(PrmList,"%s %ld %ld %ld %ld %ld",dummy,&version, &iradius,&hide,&type,&id);
00061  if(lpXimage->Morph && lpXimage->mParameters != NULL){
00062    mr=lpXimage->MorphRatio;
00063    // read the effect parameters
00064    //sscanf(lpXimage->mParameters,"  ",  read parameters);
00065  }
00066  Zb=lpXimage->Zbuffer;
00067  // put code here  
00068 
00069 
00070 
00071  return 1;
00072 }
00073 
00074 /*************** Function that renders any of the OpenGL Functionality ************/
00075 
00076 long _RenderGLexternal(char *PrmList, XIMAGE *lpXimage){
00077  // put necessary code heree 
00078  return 1;
00079 }
00080 
00081 
00082 /*************** Functions used to set up      ***************/
00083 
00084 
00085 /* Dialog box callback  */
00086 BOOL CALLBACK DlgProc(HWND hwnd,UINT msg,WPARAM wparam,LPARAM lparam);
00087 
00088 char * _SetExternalParameters(
00089   char *Op,                 /* string for the parameters                  */
00090   HWND hWnd,                /* parent window                              */
00091   long ruler,               /* ruler scale value to facilitate scaling    */
00092   char *name,               /* name of DLL file with the effect           */
00093   X__MEMORY_MANAGER *lpEVI /* pointer to structure with memory functions */
00094                                     ){
00095  /* output name and buffer should be as long as necessary to hold full string */
00096  char buffer[256];
00097  if(Op != NULL){  /* parameters exist so read them off the list */
00098    //sscanf(Op,"    ",  Local Parameters );
00099  }
00100  /*   Do the user interface as required to set up the effect, may use a */
00101  /*   dialog box etc. Return old string if cancelled (no change)        */
00102 
00103  if(DialogBox(hDLLinstance,MAKEINTRESOURCE(DLG_TEMPLATE),hWnd,
00104               (DLGPROC)DlgProc) == FALSE)return Op;
00105  /* Free space occupied by old parameter string      */
00106  if(Op != NULL)CALL_FREE(Op);  /* free the old string */
00107 
00108 
00109 
00110 
00111  strcpy(buffer,"Text parameter contents");
00112  /* Prepare the output buffer to take copy of parameter list */
00113  if((Op=(char *)CALL_MALLOC(strlen(buffer)+1)) == NULL){
00114   MessageBox (GetFocus(),"External effect: Out of memory","Error",
00115                 MB_OK|MB_TASKMODAL|MB_ICONSTOP);
00116    return NULL;
00117  }
00118  /* Copy the parameter string to the output buffer */
00119  strcpy(Op,buffer);
00120  return Op;
00121 }
00122 
00123 // setup control dialog 
00124 
00125 BOOL CALLBACK DlgProc(HWND hwnd,UINT msg,WPARAM wparam,LPARAM lparam){
00126  char str[32];
00127  switch( msg ) {
00128    case WM_INITDIALOG:
00129 
00130      CentreDialogOnScreen(hwnd);
00131      return TRUE;
00132    case WM_PAINT:
00133      PaintBackground(hwnd);
00134      break;
00135    case WM_COMMAND:
00136      switch(LOWORD(wparam)){
00137         case IDCANCEL:
00138           EndDialog(hwnd,FALSE);
00139           return(TRUE);
00140         case IDOK:
00141 
00142           EndDialog(hwnd,TRUE);
00143           return(TRUE);
00144         default:
00145           break;
00146       }
00147       break;
00148     default: break;
00149  }
00150  return FALSE;
00151 }
00152 

Generated on Sun Apr 27 14:20:12 2014 for OpenFX by  doxygen 1.5.6