/* Listing 5: Example of how to use the code given in the other listings */ // Reads from a 320x200 monochrome raw file called // c:\testin.raw // outputs a sequence of blurred images to // c:\testout*.raw #include "stdafx.h" #include "memory.h" #include "string.h" typedef unsigned char UBYTE; typedef unsigned long ULONG; #include "listing1.cpp" #include "listing2.cpp" #include "listing3.cpp" #include "listing4.cpp" int main(int argc, char* argv[]) { printf("Gamasutra-article blurring code (c) Alex Evans 2001"); UBYTE *src=new UBYTE[320*200]; UBYTE *dst=new UBYTE[320*200]; ULONG *p=new ULONG[320*200]; FILE *f=fopen("c:\\testin.raw","rb"); fread(src,320,200,f); fclose(f); GenerateOneMipMap(src,320,200,320,dst,160); f=fopen("c:\\testout1.raw","wb"); fwrite(dst,160,100,f); fclose(f); float ker[3][3]={0,0.2f,0, 0.2f,0.2f,0.2f, 0,0.2f,0}; DoBlur(src,320,200,dst,(float*)ker,1); f=fopen("c:\\testout2.raw","wb"); fwrite(dst,320,200,f); fclose(f); DoPreComputation(src,320,200,p); DoBoxBlur(src,320,200,dst,p,5,5); f=fopen("c:\\testout3.raw","wb"); fwrite(dst,320,200,f); fclose(f); DoHorizBlur(src,320,200,dst,10); f=fopen("c:\\testout4.raw","wb"); fwrite(dst,320,200,f); fclose(f); return 0; }