Adding toStyle method for rect.