Source: http://ggpointdoc.fr/wa_files/Exercices_20_E2_80_93_20Paint_20_26_20Paint_NET.pdf