bx_mean_color.c

Computes an approximation of the color c averaging two colors c1 and c2, that is if c1=(r1,g1,b1) and c2=(r2,g2,b2) as (Red,Green,Blue) triplets, then c=((r1+r2)/2, (g1+g2)/2,(b1+b2)/2).

Parameters:
c1 the first color.
c2 the second color.
Returns:
the mean color c of c1 and c2.
#include <bx.h>

int main (void)
{
  bx_window win;
  bx_color c1, c2, c3;
  int w= 180, h= 60;
  
  bx_init ();
  win= bx_create_window ("bx_mean_color", 10 , 10, w, h);
  c1= bx_pink (); c3= bx_orange ();
  c2= bx_mean_color (c1, c3);
  bx_set_color (c1); bx_draw_box (win, 0*w/3, 0, w/3, h, BX_FILLED);
  bx_set_color (c2); bx_draw_box (win, 1*w/3, 0, w/3, h, BX_FILLED);
  bx_set_color (c3); bx_draw_box (win, 2*w/3, 0, w/3, h, BX_FILLED);
  bx_show_canvas (win, 0);
  bx_loop();
  return 0;
}

Generated on Thu Oct 23 22:16:23 2008 for bx-lib : the Basic X11 Library tuned for C beginners by  doxygen 1.5.6