Question:
How can I taken into account the rectangular shape of the screen to ensure that circles are drawn exactly to the padded boundary?
The following works for a ’round’ area, but not a rectangular one…
dx = abs(center.x - place.x);
dy = abs(center.y - place.y);
dh = Math.sqrt((dx * dx) + (dy * dy));
radius = dh - padding;
Halo Design:

If the problem doesn’t seem apparent, the following image represents the current approach which i’m using. Depending on where the place is effects how far it protrudes into the screen space.

I think this should work. Not tested.
edit: this is not in any particular language.