#include "mandelbrot.h" #include int main() { int width = 800; int height = 600; int max_iter = 100; double x_min = -2.0, x_max = 1.0; double y_min = -1.2, y_max = 1.2; // PPM header (P3 = ASCII, width, height, max color value) printf("P3\n%d %d\n255\n", width, height); for (int py = 0; py < height; py++) { for (int px = 0; px < width; px++) { double cr = x_min + (x_max - x_min) * px / (width - 1); double ci = y_min + (y_max - y_min) * py / (height - 1); int iter = mandelbrot_iterations(cr, ci, max_iter); int r, g, b; get_color(iter, max_iter, &r, &g, &b); printf("%d %d %d ", r, g, b); } printf("\n"); } return 0; }