58 vars->
pixels = (uint32_t *)data->
img->pixels;
82 *c_re = (
double *)malloc(
WIDTH *
sizeof(
double));
83 *c_im = (
double *)malloc(
HEIGHT *
sizeof(
double));
84 if (!(*c_re) || !(*c_im))
85 return (free(*c_re), free(*c_im), 0);
138 base_gray = (30 + 190 * (it_count * (1 - 0.2 * it_count)));
139 color.
r = base_gray - (5 * (1 - it_count) * it_count * it_count);
140 color.
g = base_gray - (10 * (1 - it_count) * (1 - it_count));
141 color.
b = base_gray - (15 * (1 - it_count) * it_count);
142 return ((0xFF << 24) | (color.
r << 16) | (color.
g << 8) | color.
b);
void render_fractal(t_data *data)
Renders the chosen fractal on the screen.
int precompute_coords(double **c_re, double **c_im, t_render_vars *vars)
Precomputes the coordinates for each pixel in the fractal.
void calculate_scales_and_limits(t_render_vars *vars, t_data *data)
Calculates the scales and starting points for the fractal rendering.
int calculate_color(int iterations)
Calculates the color of a pixel based on how many iterations it takes to "escape".
void render_mandelbrot(t_data *data)
Render the Mandelbrot fractal.
void render_julia(t_data *data)
Renders the Julia fractal.
Data structure for fractal rendering.
t_fractal_type fractal_type
Variables used for fractal rendering calculations.