paint rect functional