/* By: ljiriste <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/10/27 14:29:26 by ljiriste #+# #+# */
-/* Updated: 2024/04/10 12:07:49 by ljiriste ### ########.fr */
+/* Updated: 2024/04/10 13:39:05 by ljiriste ### ########.fr */
/* */
/* ************************************************************************** */
{
double palette_param;
- if (!*(bool *)ft_mat_access(&s->img.calced, x, y))
+ if (!*(bool *)ft_mat_access(&s->img.calced, y, x))
{
palette_param = s->view.fractal(&s->set,
s->view.window_coord.x + s->view.pixel_size.x * x,
j = 0;
while (j < s->img.undersample && y + j < s->img.height)
{
- if (!*(bool *)ft_mat_access(&s->img.calced, x + i, y + j))
+ if (!*(bool *)ft_mat_access(&s->img.calced, y + j, x + i))
ft_putpx_img(&s->img, x + i, y + j, color);
++j;
}
++i;
}
- *(bool *)ft_mat_access(&s->img.calced, x, y) = 1;
+ *(bool *)ft_mat_access(&s->img.calced, y, x) = 1;
return ;
}
{
color = get_img_pixel_color(img, x, y);
ft_putpx_img(img, x - delta_x, y - delta_y, color);
- *(bool *)ft_mat_access(&img->calced, x - delta_x, y - delta_y) =
- *(bool *)ft_mat_access(&img->calced, x, y);
+ *(bool *)ft_mat_access(&img->calced, y - delta_y, x - delta_x) =
+ *(bool *)ft_mat_access(&img->calced, y, x);
}
if (!(0 <= x + delta_x && x + delta_x < img->width &&
0 <= y + delta_y && y + delta_y < img->height))
- *(bool *)ft_mat_access(&img->calced, x, y) = false;
+ *(bool *)ft_mat_access(&img->calced, y, x) = false;
y += 1 - 2 * (delta_y < 0);
}
x += 1 - 2 * (delta_x < 0);
return ;
}
-int process_arg(__attribute((unused)) char *arg, __attribute((unused)) t_session *s)
-{
- return (0);
-}
-
int parse_args(int argc, char **argv, t_session *s)
{
- int i;
+ int i;
+ if (argc % 2 == 0)
+ return (1);
set_default(s);
i = 1;
- while (i < argc)
+ while (i + 1 < argc)
{
- if (process_arg(argv[i], s))
+ if (!ft_strcmp(argv[i], "-w") && ft_isint(argv[i + 1]))
+ s->img.width = ft_atoi(argv[++i]);
+ else if (!ft_strcmp(argv[i], "-h") && ft_isint(argv[i + 1]))
+ s->img.height = ft_atoi(argv[++i]);
+ else if (!ft_strcmp(argv[i], "-u") && ft_isint(argv[i + 1]))
+ s->img.undersample_max = ft_atoi(argv[++i]);
+ else if (!ft_strcmp(argv[i], "-d") && ft_isint(argv[i + 1]))
+ s->set.man.detail = ft_atoi(argv[++i]);
+ else
return (1);
++i;
}