Edge pixels have a background pixel adjacent to them, so you should be able to establish that with a simple scan test. Also, I wouldn't go to the same depth as you do with the antialiasing. The overall effect is not antialiasing, but "rounding" of the edge. Just concentrate on individual adjacent background pixels and make them half-and-half foreground/background in hue.