From: hackbard Date: Tue, 18 Oct 2005 07:30:33 +0000 (+0000) Subject: c-conc and p-val colour table output added X-Git-Url: https://www.hackdaworld.org/gitweb/?a=commitdiff_plain;ds=inline;h=21bb2d2c6e2d1de0e1c4a75d114a87a94b39ba8c;p=physik%2Fnlsop.git c-conc and p-val colour table output added --- diff --git a/nlsop.c b/nlsop.c index 88818e8..2222fca 100644 --- a/nlsop.c +++ b/nlsop.c @@ -612,9 +612,15 @@ int write_bmp(d3_lattice *d3_l,int window,u32 x,u32 y,u32 z,int max) for(i=0;imax_x;i++) { sum=*(d3_l->extra+i+y*d3_l->max_x+(d3_l->max_z-j-1)*d3_l->max_x*d3_l->max_y); - sum=sum*255/max; - memset(buf+1,(unsigned char)sum,2); - buf[0]=0xff; + sum=sum*500/max; + buf[2]=0; + if(sum<=255) { + buf[1]=0; + buf[0]=sum; + } else { + buf[1]=(sum-255); + buf[0]=0xff; + } if(write(fd,buf,3)<3) { puts("failed writing rgb values to bmp file"); @@ -639,9 +645,15 @@ int write_bmp(d3_lattice *d3_l,int window,u32 x,u32 y,u32 z,int max) for(i=0;imax_x;i++) { sum=*(d3_l->extra+x+i*d3_l->max_x+(d3_l->max_z-j-1)*d3_l->max_x*d3_l->max_y); - sum=sum*255/max; - memset(buf+1,(unsigned char)sum,2); - buf[0]=0xff; + sum=sum*500/max; + buf[2]=0; + if(sum<=255) { + buf[1]=0; + buf[0]=sum; + } else { + buf[1]=(sum-255); + buf[0]=0xff; + } if(write(fd,buf,3)<3) { puts("failed writing rgb values to bmp file"); @@ -666,9 +678,15 @@ int write_bmp(d3_lattice *d3_l,int window,u32 x,u32 y,u32 z,int max) for(i=0;imax_x;i++) { sum=*(d3_l->extra+i+(d3_l->max_y-j-1)*d3_l->max_x+z*d3_l->max_x*d3_l->max_y); - sum=sum*255/max; - memset(buf+1,(unsigned char)sum,2); - buf[0]=0xff; + sum=sum*500/max; + buf[2]=0; + if(sum<=255) { + buf[1]=0; + buf[0]=sum; + } else { + buf[1]=(sum-255); + buf[0]=0xff; + } if(write(fd,buf,3)<3) { puts("failed writing rgb values to bmp file");