replace dummy output with actual mandelbrot
This commit is contained in:
parent
4ff111b25a
commit
b6882bf52c
14
src/main.c
14
src/main.c
|
@ -3,20 +3,10 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "image.h"
|
#include "image.h"
|
||||||
|
#include "mandelbrot.h"
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
#include "ppm.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[]) {
|
int main(int argc, char *argv[]) {
|
||||||
struct options opt = parse_options(&argc, &argv);
|
struct options opt = parse_options(&argc, &argv);
|
||||||
|
|
||||||
|
@ -24,7 +14,7 @@ int main(int argc, char *argv[]) {
|
||||||
if (!image)
|
if (!image)
|
||||||
err(EXIT_FAILURE, "could not allocate image");
|
err(EXIT_FAILURE, "could not allocate image");
|
||||||
|
|
||||||
fill_image(image);
|
mandelbrot(image, 100);
|
||||||
print_ppm(image, opt.output);
|
print_ppm(image, opt.output);
|
||||||
|
|
||||||
fclose(opt.output);
|
fclose(opt.output);
|
||||||
|
|
Loading…
Reference in a new issue