|
#include<stdio.h>
main(){
unsigned char image[480][640][3];
unsigned char out[480][640][3];
int x,y;
FILE *fp;
for(y=0;y<480;y++){
for(x=0;x<640;x++){
image[y][x][0]=((x+y)*1)%256;
image[y][x][1]=((x+y)*2)%256;
image[y][x][2]=((x+y)*3)%256;
}
}
for(y=0;y<480;y++){
for(x=0;x<640;x++){
out[y][x][0]=image[y][640-x][0];
out[y][x][1]=image[y][640-x][1];
out[y][x][2]=image[y][640-x][2];
}
}
fp=fopen("image.ppm","wb");
fprintf(fp,"P6\n640 480\n255\n");
fwrite(image,sizeof(char),640*480*3,fp);
fclose(fp);
fp=fopen("out.ppm","wb");
fprintf(fp,"P6\n640 480\n255\n");
fwrite(out,sizeof(char),640*480*3,fp);
fclose(fp);
}
unsigned char image[480][640][3]改成unsigned char ***image
可能吗?? |
|