width=d3_l->max_x;
height=d3_l->max_y;
}
-
+ if(window==7)
+ {
+ sprintf(bmpfile,"x-z_a_cdistr_%d.bmp",y);
+ foo=3*d3_l->max_x;
+ size=(foo+(4-foo%4))*d3_l->max_z;
+ height=d3_l->max_z;
+ width=d3_l->max_x;
+ }
+ if(window==8)
+ {
+ sprintf(bmpfile,"y-z_a_cdistr_%d.bmp",x);
+ foo=3*d3_l->max_y;
+ size=(foo+(4-foo%4))*d3_l->max_z;
+ height=d3_l->max_z;
+ width=d3_l->max_y;
+ }
+ if(window==9)
+ {
+ sprintf(bmpfile,"x-y_a_cdistr_%d.bmp",z);
+ foo=3*d3_l->max_x;
+ size=(foo+(4-foo%4))*d3_l->max_y;
+ height=d3_l->max_y;
+ width=d3_l->max_x;
+ }
+ if(window==10)
+ {
+ sprintf(bmpfile,"x-z_c_cdistr_%d.bmp",y);
+ foo=3*d3_l->max_x;
+ size=(foo+(4-foo%4))*d3_l->max_z;
+ height=d3_l->max_z;
+ width=d3_l->max_x;
+ }
+ if(window==11)
+ {
+ sprintf(bmpfile,"y-z_c_cdistr_%d.bmp",x);
+ foo=3*d3_l->max_y;
+ size=(foo+(4-foo%4))*d3_l->max_z;
+ height=d3_l->max_z;
+ width=d3_l->max_y;
+ }
+ if(window==12)
+ {
+ sprintf(bmpfile,"x-y_c_cdistr_%d.bmp",z);
+ foo=3*d3_l->max_x;
+ size=(foo+(4-foo%4))*d3_l->max_y;
+ height=d3_l->max_y;
+ width=d3_l->max_x;
+ }
if((fd=open(bmpfile,O_WRONLY|O_CREAT))<0)
{
puts("cannot open bmp file");
}
if(window==6)
{
- for(j=0;j<d3_l->max_z;j++)
+ for(j=0;j<d3_l->max_y;j++)
{
for(i=0;i<d3_l->max_x;i++)
{
}
}
}
+ if(window==7)
+ {
+ for(j=0;j<d3_l->max_z;j++)
+ {
+ for(i=0;i<d3_l->max_x;i++)
+ {
+ if(*(d3_l->status+i+y*d3_l->max_x+(d3_l->max_z-j-1)*d3_l->max_x*d3_l->max_y)&RED) sum=*(d3_l->extra+i+y*d3_l->max_x+(d3_l->max_z-j-1)*d3_l->max_x*d3_l->max_y);
+ else sum=0;
+ sum=sum*255/max;
+ memset(buf,(unsigned char)sum,3);
+ if(write(fd,buf,3)<3)
+ {
+ puts("failed writing rgb values to bmp file");
+ return-1;
+ }
+ }
+ if(foo%4)
+ {
+ memset(buf,0,4-foo%4);
+ if(write(fd,buf,4-foo%4)<4-foo%4)
+ {
+ puts("failed writing 4 byte ending");
+ return -1;
+ }
+ }
+ }
+ }
+ if(window==8)
+ {
+ for(j=0;j<d3_l->max_z;j++)
+ {
+ for(i=0;i<d3_l->max_x;i++)
+ {
+ if(*(d3_l->status+x+i*d3_l->max_x+(d3_l->max_z-j-1)*d3_l->max_x*d3_l->max_y)&RED) sum=*(d3_l->extra+x+i*d3_l->max_x+(d3_l->max_z-j-1)*d3_l->max_x*d3_l->max_y);
+ else sum=0;
+ sum=sum*255/max;
+ memset(buf,(unsigned char)sum,3);
+ if(write(fd,buf,3)<3)
+ {
+ puts("failed writing rgb values to bmp file");
+ return-1;
+ }
+ }
+ if(foo%4)
+ {
+ memset(buf,0,4-foo%4);
+ if(write(fd,buf,4-foo%4)<4-foo%4)
+ {
+ puts("failed writing 4 byte ending");
+ return -1;
+ }
+ }
+ }
+ }
+ if(window==9)
+ {
+ for(j=0;j<d3_l->max_y;j++)
+ {
+ for(i=0;i<d3_l->max_x;i++)
+ {
+ if(*(d3_l->status+i+(d3_l->max_y-j-1)*d3_l->max_x+z*d3_l->max_x*d3_l->max_y)&RED) sum=*(d3_l->extra+i+(d3_l->max_y-j-1)*d3_l->max_x+z*d3_l->max_x*d3_l->max_y);
+ else sum=0;
+ sum=sum*255/max;
+ memset(buf,(unsigned char)sum,3);
+ if(write(fd,buf,3)<3)
+ {
+ puts("failed writing rgb values to bmp file");
+ return-1;
+ }
+ }
+ if(foo%4)
+ {
+ memset(buf,0,4-foo%4);
+ if(write(fd,buf,4-foo%4)<4-foo%4)
+ {
+ puts("failed writing 4 byte ending");
+ return -1;
+ }
+ }
+ }
+ }
+ if(window==10)
+ {
+ for(j=0;j<d3_l->max_z;j++)
+ {
+ for(i=0;i<d3_l->max_x;i++)
+ {
+ if(!(*(d3_l->status+i+y*d3_l->max_x+(d3_l->max_z-j-1)*d3_l->max_x*d3_l->max_y)&RED)) sum=*(d3_l->extra+i+y*d3_l->max_x+(d3_l->max_z-j-1)*d3_l->max_x*d3_l->max_y);
+ else sum=0;
+ sum=sum*255/max;
+ memset(buf,(unsigned char)sum,3);
+ if(write(fd,buf,3)<3)
+ {
+ puts("failed writing rgb values to bmp file");
+ return-1;
+ }
+ }
+ if(foo%4)
+ {
+ memset(buf,0,4-foo%4);
+ if(write(fd,buf,4-foo%4)<4-foo%4)
+ {
+ puts("failed writing 4 byte ending");
+ return -1;
+ }
+ }
+ }
+ }
+ if(window==11)
+ {
+ for(j=0;j<d3_l->max_z;j++)
+ {
+ for(i=0;i<d3_l->max_x;i++)
+ {
+ if(!(*(d3_l->status+x+i*d3_l->max_x+(d3_l->max_z-j-1)*d3_l->max_x*d3_l->max_y)&RED)) sum=*(d3_l->extra+x+i*d3_l->max_x+(d3_l->max_z-j-1)*d3_l->max_x*d3_l->max_y);
+ else sum=0;
+ sum=sum*255/max;
+ memset(buf,(unsigned char)sum,3);
+ if(write(fd,buf,3)<3)
+ {
+ puts("failed writing rgb values to bmp file");
+ return-1;
+ }
+ }
+ if(foo%4)
+ {
+ memset(buf,0,4-foo%4);
+ if(write(fd,buf,4-foo%4)<4-foo%4)
+ {
+ puts("failed writing 4 byte ending");
+ return -1;
+ }
+ }
+ }
+ }
+ if(window==12)
+ {
+ for(j=0;j<d3_l->max_y;j++)
+ {
+ for(i=0;i<d3_l->max_x;i++)
+ {
+ if(!(*(d3_l->status+i+(d3_l->max_y-j-1)*d3_l->max_x+z*d3_l->max_x*d3_l->max_y)&RED)) sum=*(d3_l->extra+i+(d3_l->max_y-j-1)*d3_l->max_x+z*d3_l->max_x*d3_l->max_y);
+ else sum=0;
+ sum=sum*255/max;
+ memset(buf,(unsigned char)sum,3);
+ if(write(fd,buf,3)<3)
+ {
+ puts("failed writing rgb values to bmp file");
+ return-1;
+ }
+ }
+ if(foo%4)
+ {
+ memset(buf,0,4-foo%4);
+ if(write(fd,buf,4-foo%4)<4-foo%4)
+ {
+ puts("failed writing 4 byte ending");
+ return -1;
+ }
+ }
+ }
+ }
close(fd);
return 1;