Pergunta de entrevista da empresa BlackBerry

How would you implement paints "fill" function?