JPG_MAP.C

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

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