void threshold(Bitmap& bmp, const threshold_range_t& range, const Paint& in, const Paint& out){
  const Interval interval(range.GetInterval());
  set_pixels_if_else(bmp, in, out,
    [&interval, &bmp](int x, int y){
      return interval.Has(color_sum(get_color_raw(bmp, x, y)));
    });
}
Beispiel #2
0
t_rgba					color_moy(unsigned int n, ...)
{
	va_list ap;
	unsigned int len;
	t_rgba		newcolor;

	len = n;
	ft_bzero(&newcolor, sizeof(t_rgba));
	if (len <= 0)
		return ((t_rgba){0, 0, 0, 0});
	va_start(ap, n);
	newcolor = color_cpy(va_arg(ap, t_rgba));
	while (len > 0)
		newcolor = color_sum(newcolor, va_arg(ap, t_rgba));
	va_end(ap);
	return (color_div(newcolor, n));
}