JPS_MAP.C

Go to the documentation of this file.
00001 /* --
00002 OpenFX - Modelling, Animation and Rendering Package
00003 -- */
00004 
00005 /*  JPS_MAP.C  */
00006 
00007 #include <windows.h>
00008 #include <stdio.h>
00009 
00010 #include <windows.h>
00011 
00012 
00013 int x_size, y_size;
00014 
00015 unsigned char *R,*G,*B;
00016 
00017 extern long ReadJPG(char *filename, short info_only);
00018 
00019 static HINSTANCE hThisInstance;
00020 
00021 #if __WATCOMC__
00022 int APIENTRY LibMain(HANDLE hDLL, DWORD dwReason, LPVOID lpReserved){
00023 #else
00024 BOOL WINAPI DllMain(HANDLE hDLL, DWORD dwReason, LPVOID lpReserved){
00025 #endif
00026   switch (dwReason) {
00027     case DLL_PROCESS_ATTACH: {
00028       hThisInstance=hDLL;
00029       break;
00030     }
00031     case DLL_PROCESS_DETACH:
00032       break;
00033   }
00034   return TRUE;
00035 }
00036 
00037 void jpg_display_line(unsigned char *pbgr, long line){
00038  register long i;
00039  for(i=0;i<x_size;i++){
00040   *R++ = *(pbgr);
00041   *G++ = *(pbgr+1);
00042   *B++ = *(pbgr+2);
00043   pbgr+=3;
00044  }
00045 }
00046 
00047 BOOL _GetExternalImageSize
00048  (char *filename,
00049   long *x,
00050   long *y,
00051   unsigned char *source_buffer){
00052  if(ReadJPG(filename,1) == 0){
00053 //MessageBox(NULL,filename,"BAD READ 1",MB_OK);
00054    return FALSE;
00055  }
00056  *x = x_size;
00057  *y = y_size;
00058  return TRUE;
00059 }
00060 
00061 BOOL _GetExternalImage
00062  (char *filename,
00063   long x, long y,
00064   unsigned char *Red,
00065   unsigned char *Green,
00066   unsigned char *Blue,
00067   unsigned char *source_buffer){
00068  x_size=x;
00069  y_size=y;
00070  R=Red;
00071  G=Green;
00072  B=Blue;
00073 //{char str[256]; sprintf(str,"x=%d y=%d",x,y);
00074 //MessageBox(NULL,filename,str,MB_OK);}
00075  if(ReadJPG(filename,0) == 0){
00076 //MessageBox(NULL,filename,"BAD READ 2",MB_OK);
00077    return FALSE;
00078  }
00079 //MessageBox(NULL,filename,"READ OK",MB_OK);
00080  return TRUE;
00081 }
00082 
00083 typedef struct SCREENBUFFER {
00084  unsigned char A,R,G,B;
00085 } fullscreenbuffer;
00086 
00087 extern long WriteJPS(char *, long, long, long, fullscreenbuffer *);
00088 
00089 BOOL _PutExternalImage
00090  (char *filename,
00091   long x, long y,
00092   long quality,
00093   fullscreenbuffer *image){
00094   if(WriteJPS(filename,x,y*2,quality,image) == 0)  // image is twice as high 
00095     MessageBox(NULL,"Bad JPS",NULL,MB_OK);
00096 //MessageBox(NULL,filename,"Read finished",MB_OK);
00097  return FALSE;
00098 }

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