locked
Outline Issue. RRS feed

  • Question

  • User-1991182345 posted
    I'm having a couple problems when I use drawpath to outline objects (text specifically).

    1) The outline draws on the path itself with the brush being in the center. So if I use a 5 pixel brush, 2 pixels are outside the path, 2 pixels are inside the path, and 1 pixel is on the path. I know this is how GDI+ works, but is there a way to draw on the outside of the path (ala photoshop's stroke)?

    2) Once again, I'm outlining text, and here's my scenario:
        - Text is "Hello My Western Friends"
        - Font is Arial Bold
        - Size is 80 pixels
        - Brush size is 6 pixels
    My problem is on certain letters (M and W usually) I get collisions that create artifacts (the M will get horns).
    My Code:
    Bitmap _bitmap = new Bitmap(500, 200);
    Image _image = (Image)_bitmap;
    Graphics _graphics = Graphics.FromImage(_image);

    GraphicsPath _path = new GraphicsPath();
    _path.AddString("Hello My Western Friends", new System.Drawing.FontFamily("Arial"),
    1, 80, new Point(20, 20), StringFormat.GenericDefault);

    Pen _pen = new Pen(Color.Red, 6);
    _graphics.FillPath(new SolidBrush(Color.White), _path);
    Is there anyway to keep that from happening?


    Any and all help would be GREATLY appreciated.
       
       
      
    Monday, April 10, 2006 3:25 PM

All replies

  • User-1525784084 posted
    What your problem? I've tried the code and it wnet great.
    Saturday, April 22, 2006 6:51 AM
  • User-1991182345 posted
    The problem was, on the M and the W and certain other characters there was a collision that happened, causing "horns" to form where the lines met up.

    After speaking with Bob Powell, he provideded me with the solution:
    p.MiterLimit = 0.01f;
     
    It did wonders and now my issue is solved.
    Monday, April 24, 2006 2:49 PM
  • User-1991182345 posted
    Actually that's

    _pen.MiterLimit = 0.01f;
    Monday, April 24, 2006 2:50 PM
  • User-1525784084 posted
    oh, i see what was the problem now.
    Friday, April 28, 2006 11:29 AM