replace dummy output with actual mandelbrot

This commit is contained in:
Bruno BELANYI 2020-11-10 18:23:14 +01:00
parent 4ff111b25a
commit b6882bf52c
1 changed files with 2 additions and 12 deletions

View File

@ -3,20 +3,10 @@
#include <stdlib.h>
#include "image.h"
#include "mandelbrot.h"
#include "options.h"
#include "ppm.h"
static void fill_image(struct image *image) {
for (size_t i = 0; i < image->h; ++i) {
for (size_t j = 0; j < image->w; ++j) {
struct pixel *p = &image->buf[to_index(i, j, image)];
p->r = 255 * i / image->h;
p->g = 255 * j / image->w;
p->g = 255 * (i + j) / (image->h + image->w);
}
}
}
int main(int argc, char *argv[]) {
struct options opt = parse_options(&argc, &argv);
@ -24,7 +14,7 @@ int main(int argc, char *argv[]) {
if (!image)
err(EXIT_FAILURE, "could not allocate image");
fill_image(image);
mandelbrot(image, 100);
print_ppm(image, opt.output);
fclose(opt.output);