|
@@ -4,9 +4,21 @@
|
|
|
#include <stdlib.h>
|
|
|
#include <stdio.h>
|
|
|
|
|
|
+int main(int argc, char** argv){
|
|
|
|
|
|
-int main(){
|
|
|
- pix_row rows[1920];
|
|
|
+ if (argc != 4)
|
|
|
+ {
|
|
|
+ fprintf(stderr, "\nusage: %s count width height", argv[0]);
|
|
|
+ exit(EXIT_FAILURE);
|
|
|
+ }
|
|
|
+
|
|
|
+ int width, height, c;
|
|
|
+
|
|
|
+ c = atoi(argv[1]);
|
|
|
+ width = atoi(argv[2]);
|
|
|
+ height = atoi(argv[3]);
|
|
|
+
|
|
|
+ pix_row rows[width];
|
|
|
pix p;
|
|
|
char filename[60];
|
|
|
int i,j,x,y,count;
|
|
@@ -14,22 +26,29 @@ int main(){
|
|
|
p.r = 200;
|
|
|
p.g = 200;
|
|
|
p.b = 200;
|
|
|
+
|
|
|
+ srand48(1000);
|
|
|
|
|
|
- for (count=0; count<(3600*60);count++){
|
|
|
+ for (count=0; count<(1000);count++){
|
|
|
|
|
|
- for (i=0;i<1920;i++){
|
|
|
- rows[i].p = malloc (1080 * sizeof(pix));
|
|
|
- for (j=0 ;j<1080; j++){
|
|
|
+ for (i=0;i<width;i++){
|
|
|
+ rows[i].p = malloc (height * sizeof(pix));
|
|
|
+ for (j=0 ;j<height; j++){
|
|
|
p.r = (int) (drand48() * 255);
|
|
|
p.g = (int) (drand48() * 255);
|
|
|
p.b = (int) (drand48() * 255);
|
|
|
rows[i].p[j] = p;
|
|
|
}
|
|
|
}
|
|
|
- sprintf(filename, "images/image%5d.png", count);
|
|
|
- img = initialize_png("image010", filename, 1920, 1080);
|
|
|
+ sprintf(filename, "images/image%05d.png", count);
|
|
|
+ img = initialize_png("image010", filename, width, height);
|
|
|
write_image(&img, rows);
|
|
|
finish_image(&img);
|
|
|
+
|
|
|
+ for (i=0; i<width;i++){
|
|
|
+
|
|
|
+ free(rows[i].p);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
return (0);
|