I'm trying to saturate my colors and make sure they do not overflow so that they will draw a pretty Mandlebrot set without being pixelated. I'm using an Altera DE2 board to try and print this Mandlebrot set via VGA connection to a computer screen and the colors are slightly off (pixely).
How exactly do I correct the if statements in the code below to not always be false?
if (iteration == 500)
{
alt_up_pixel_buffer_dma_draw(my_pixel_buffer,0,0,0);
}
else
{
//double z = sqrt(xtemp * xtemp + y * y);
//int brightness = 256. * log2(1.75 + i - log2(log2(z))) / log2(500);
//color(brightness, brightness, 255);
//color is some function of iteration
alt_u8 Red = (iteration*8);///zoom);
if(Red > 255) // this if statement is always false
Red = 255;
alt_u8 Green = (iteration*4);///zoom);
if(Green > 255) // this if statement is always false
Green = 255;
alt_u8 Blue = (iteration*2);///zoom);
if(Blue > 255) // this if statement is always false
Blue = 255;
//draw the pixels
alt_up_pixel_buffer_dma_draw(my_pixel_buffer, (Blue) + (Green<<8) + (Red<<16),j,i);
}