#include "fill.h" #include "mygraph.h" #include "Xroutines.h" void print_screen(environment * env) { int x,y; unsigned long k; Get_Image_From_Server(env); for (y=0;yymax;y++) { for (x=0;xxmax;x++){ k = Get_Pixel(env,x,y); printf("%3i",k); } printf("\n"); } printf("\n"); } void fill_it(int x, int y,int fg, int bg, environment * env) { int here; here = Get_Pixel(env,x,y); if ((here != bg) && (here != fg)) { SetPixel(env,x,y); if (fg == 0) { XPutPixel(env->the_screen,x,y,env->fg);} if (fg == 1) { XPutPixel(env->the_screen,x,y,env->bg);} fill_it(x+1,y,fg,bg,env); fill_it(x,y+1,fg,bg,env); fill_it(x-1,y,fg,bg,env); fill_it(x,y-1,fg,bg,env); } } void fill(int x, int y, int fg, int bg, environment * env) { int hold_color; hold_color = Set_Color(env, fg); Get_Image_From_Server(env); fill_it(x,y,fg,bg,env); Set_Color(env,hold_color); } void paint_screen(environment * env, int color) { int x,y; int hold_color; hold_color = Set_Color(env, color); for (y=0;yymax;y++) { for (x=0;xxmax;x++){ SetPixel(env,x,y); } } Set_Color(env,hold_color); }