You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
734 B
C
33 lines
734 B
C
#include <stdlib.h>
|
|
#include <stdio.h>
|
|
#include "images/images.h"
|
|
|
|
int main(int argc, char* argv[]) {
|
|
|
|
Image img;
|
|
image_new(255,255, &img);
|
|
|
|
int r,g,b;
|
|
|
|
for (int i = 0; i < 255; i++) {
|
|
for (int j = 0; j < 255; j++) {
|
|
double factor = (i*i + j*j) / (100*100);
|
|
r = i;
|
|
g = 255 -j;
|
|
b = i -255;
|
|
|
|
|
|
image_set_px(&img, i, j, factor * r, factor * g, factor * b);
|
|
|
|
}
|
|
}
|
|
|
|
printf("Writing file to /home/anton/projects/mona/chaos/test.bmp\n");
|
|
|
|
if (!image_save(&img, "/home/anton/projects/mona/chaos/test.bmp")) {
|
|
printf("Error writing file!\n");
|
|
} else {
|
|
printf("Wrote file successfully\n");
|
|
}
|
|
image_destroy(&img);
|
|
} |