Example #1
0
inline void		ft_resalpha(t_color *c, t_color bg)
{
	t_big			delta;

	if (INVI(*c))
	{
		*c = bg;
		return ;
	}
	delta = BIG(c->b.a) / 255;
	c->b.a = 255;
	c->b.r = ft_mix(c->b.r, bg.b.r, delta);
	c->b.g = ft_mix(c->b.g, bg.b.g, delta);
	c->b.b = ft_mix(c->b.b, bg.b.b, delta);
}
Example #2
0
void	calculate_m(t_env *e, double x0, double y0)
{
	double	x;
	double	y;
	double	x2;
	double	y2;
	double	i;

	x = 0.0;
	y = 0.0;
	x2 = e->xs;
	y2 = e->ys;
	i = -1.0;
	while (++i < e->iter && (x2 + y2) < e->iter)
	{
		y = 2.0 * x * y + y0;
		x = x2 - y2 + x0;
		x2 = x * x;
		y2 = y * y;
	}
	if (e->theme < 3)
		i = ft_mix(i, i - log2(log2(x2 + y2)), 1.0);
	e->color = palette(i, (e->theme > 2 ? e->theme - 3 : e->theme));
	pixel_put(e);
}