Well if you are looking for a floodfill they are all over the net. Beware though - using a recursive floodfill will result in a stack overflow on large shapes.
Code:
void FloodFill(DWORD *Buffer,DWORD offset,DWORD width,RGB color,RGB bordercolor)
{
if (Buffer[offset]==bordercolor) return;
Buffer[offset]=color;
FloodFill(Buffer,offset-width,width,color,bordercolor);
FloodFill(Buffer,offset-1,width,color,bordercolor);
FloodFill(Buffer,offset+1,width,color,bordercolor);
FloodFill(Buffer,offset+width,width,color,bordercolor);
}