From: hackbard Date: Mon, 15 Sep 2003 16:55:39 +0000 (+0000) Subject: bmp write function implemented (stil small bugs) X-Git-Tag: fpb~13 X-Git-Url: https://hackdaworld.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9cf6b39411438c9113f573a7971fb1beebbcf30b;p=physik%2Fnlsop.git bmp write function implemented (stil small bugs) --- diff --git a/nlsop.c b/nlsop.c index ff89e7c..372af4e 100644 --- a/nlsop.c +++ b/nlsop.c @@ -315,23 +315,23 @@ int write_bmp(d3_lattice *d3_l,int window,u32 x,u32 y,u32 z) if(window==1) { sprintf(bmpfile,"x-z_%d.bmp",y); - size=x*z; - width=x; - height=z; + size=3*d3_l->max_x*d3_l->max_z; + width=d3_l->max_x; + height=d3_l->max_z; } if(window==2) { sprintf(bmpfile,"y-z_%d.bmp",x); - size=y*z; - width=y; - height=z; + size=3*d3_l->max_y*d3_l->max_z; + width=d3_l->max_y; + height=d3_l->max_z; } if(window==3) { sprintf(bmpfile,"x-y_%d.bmp",z); - size=x*y; - width=x; - height=y; + size=3*d3_l->max_x*d3_l->max_y; + width=d3_l->max_x; + height=d3_l->max_y; } if((fd=open(bmpfile,O_WRONLY|O_CREAT))<0) @@ -379,11 +379,11 @@ int write_bmp(d3_lattice *d3_l,int window,u32 x,u32 y,u32 z) } if(window==1) { - for(i=0;imax_x;i++) + for(j=0;jmax_z;j++) { - for(j=0;jmax_z;j++) + for(i=0;imax_x;i++) { - if(*(d3_l->status+i+y*d3_l->max_x+j*d3_l->max_x*d3_l->max_y)&RED) memset(buf,0xff,3); + if(*(d3_l->status+i+y*d3_l->max_x+(d3_l->max_z-j)*d3_l->max_x*d3_l->max_y)&RED) memset(buf,0xff,3); else memset(buf,0,3); if(write(fd,buf,3)<3) { @@ -395,11 +395,11 @@ int write_bmp(d3_lattice *d3_l,int window,u32 x,u32 y,u32 z) } if(window==2) { - for(i=0;imax_y;i++) + for(j=0;jmax_z;j++) { - for(j=0;jmax_z;j++) + for(i=0;imax_y;i++) { - if(*(d3_l->status+x+i*d3_l->max_x+j*d3_l->max_x*d3_l->max_y)&RED) memset(buf,0xff,3); + if(*(d3_l->status+x+i*d3_l->max_x+(d3_l->max_z-j)*d3_l->max_x*d3_l->max_y)&RED) memset(buf,0xff,3); else memset(buf,0,3); if(write(fd,buf,3)<3) { @@ -411,11 +411,11 @@ int write_bmp(d3_lattice *d3_l,int window,u32 x,u32 y,u32 z) } if(window==3) { - for(i=0;imax_x;i++) + for(j=0;jmax_y;j++) { - for(j=0;jmax_y;j++) + for(i=0;imax_x;i++) { - if(*(d3_l->status+i+j*d3_l->max_x+z*d3_l->max_x*d3_l->max_y)&RED) memset(buf,0xff,3); + if(*(d3_l->status+i+(d3_l->max_y-j)*d3_l->max_x+z*d3_l->max_x*d3_l->max_y)&RED) memset(buf,0xff,3); else memset(buf,0,3); if(write(fd,buf,3)<3) {