Learn Something New
Wednesday, July 1st, 2009Wordpress has a For Dummies! ISBN:0470149469
Wordpress has a For Dummies! ISBN:0470149469
Pseudo-algorithm:
Extract the RGB color values of the initial and to be drawn pixels colors.
Add each of the extract RGB values together and multiply by 0.5 (basically find the average of the two colors.
//The initial pixel color.
int color_initial = PIXELCOLOR;
//The pixel color to draw.
int color_draw = DRAWCOLOR;
//Extract each of the R, G, and B for each color of the initial pixel color.
int red_initial = RED_OF(color_initial);
int green_initial = GREEN_OF(color_initial);
int blue_initial = BLUE_OF(color_initial);
int red_draw = RED_OF(color_draw);
int green_draw = GREEN_OF(color_draw);
int blue_draw = BLUE_OF(color_draw);
//Find the average of the initial and new pixel colors.
int new_red = (red_initial + red_draw) * 0.5f;
int new_green = (green_initial + green_draw) * 0.5f;
int new_blue = (blue_initial + blue_draw) * 0.5f;
int new_color = RGB_OF(new_red, new_green, new_blue);
Next up… gray values…
GameProgrammerArt is Digg proof thanks to caching by WP Super Cache!