]> hackdaworld.org Git - physik/nlsop.git/commitdiff
c-conc and p-val colour table output added
authorhackbard <hackbard>
Tue, 18 Oct 2005 07:30:33 +0000 (07:30 +0000)
committerhackbard <hackbard>
Tue, 18 Oct 2005 07:30:33 +0000 (07:30 +0000)
nlsop.c

diff --git a/nlsop.c b/nlsop.c
index 88818e8ea36bf0ebc53f44b7bfbb60c4fd0ba358..2222fca666f3d1ae19afbf3fb9affdbce61335b2 100644 (file)
--- 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;i<d3_l->max_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;i<d3_l->max_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;i<d3_l->max_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");