implement graphics algorithms