图形旋转的 C 语言源程序 /*****************************************************************/ /* CONVOLVE.C - Turbo C 2.0 implementation of image convolution */ /* ---------- by Wesley G. Faler. All code is "as is". There */ /* is NO copyright. Use this code as you will, and if you make */ /* money at it, good for you. */ /*****************************************************************/ #include
#include #include #include #include int load_cut(char *fname); int load_convolution_matrix(char *fname); int convolve_image(void); int swap_pictures(void); int minx,maxx,miny,maxy; int LOADPAGE=0; int ENHANCEPAGE=1; int *cmat, *pmat, *vmat; int cmx,cmy,cmnum; struct palettetype palette,newpal; int driver,mode; int cleancut=-1; int init_graphics(void) { driver=DETECT; mode=0; detectgraph(&driver,&mode); if(driver==VGA) mode=VGAMED; initgraph(&driver,&mode,""); getpalette(&palette); getpalette(&newpal); } int cleanup_image(void) { int i,j,num,x,y,k; if(cleancut<0) return; setactivepage(LOADPAGE); setvisualpage(ENHANCEPAGE); for(x=minx;xcleancut) { k=getpixel(x,y); setactivepage(ENHANCEPAGE); putpixel(x,y,k); setactivepage(LOADPAGE); } } } k=ENHANCEPAGE; ENHANCEPAGE=LOADPAGE; LOADPAGE=k; } void show_test_image(void) { int i; minx=cmx; miny=cmy; maxx=100+minx; maxy=100+miny; setcolor(1); moveto(minx,miny); randomize(); for(i=0;i<20;i++) lineto(random(100)+minx,random(100)+miny); for(i=0;i<10;i++) fillellipse(random(50)+25+minx,random(50)+25+miny,random(25),random(25)); } main() { char fname[50]; int flag=0; load_convolution_matrix("matrix.dat"); printf(".CUT file (1) or test image (0)?"); scanf("%d",&flag...