0

I load a ttf file and create a bitmap (256x256) with transparent background, I then draw the characters (font glyphs) on the bitmap.

What I would like to do is create an thin (1 or 2 pixels) white outline around all the characters, maybe using edge detection.

How would I accomplish this?

Hank
  • 2,456
  • 3
  • 35
  • 83

1 Answers1

1

I'm sure there's a more formal/cleaner way to do this, but if you only need a 1 pixel border, why not just render the font as white 4 times, one for each diagonal 1-pixel offset, and then draw the black over it?

I.e, draw white at (x-1,y-1), (x-1,y+1), (x+1,y-1), (x+1,y+1), then draw black at (x,y)

torquestomp
  • 3,304
  • 19
  • 26
  • Ahmm how about when doing 2 or more pixel round... Ill have a problem with this coz It will probably Look like this '+' right? But what I want is like this '*' – Sheychan Sep 07 '15 at 02:12