FileModeWinding和DrawPath会导致奇数峰值出现

reu*_*cam 6 gdi+

我正在使用gdiplus来"抚摸"一个短信.在某些情况下,我们看到图形的顶部或底部出现"尖峰",我不确定为什么.我们可以通过调整笔划宽度和字体大小来最小化这个,但这不是一个好的解决方案.我希望有人可以向我解释这个问题.

Spikey Bug

并生成此代码示例4,其轮廓和尖峰(无意)

GraphicsPath path(FillModeWinding);   

      path.AddString(text,wcslen(text),&fontFamily,StateInfo.TheFont.TheWeight,(REAL)minSize,PointF((REAL)ptStart.x, (REAL)ptStart.y),&sf);
      // Draw the outline first
      if (StateInfo.StrokeWidth > 0) {
        Gdiplus::Color strokecolor(GetRValue(StateInfo.StrokeColor), GetGValue(StateInfo.StrokeColor), GetBValue(StateInfo.StrokeColor));
        Pen pen(strokecolor,(REAL)StateInfo.StrokeWidth);      
        graphics.SetSmoothingMode(Gdiplus::SmoothingModeAntiAlias);
        graphics.SetPixelOffsetMode(Gdiplus::PixelOffsetModeHighQuality);
        graphics.DrawPath(&pen, &path);
        }
      // Draw the text by filling the path        
      graphics.FillPath(&solidBrush, &path);
Run Code Online (Sandbox Code Playgroud)

use*_*034 7

在你用来绘制轮廓的笔上使用Pen :: SetLineJoin,并使用除LineJoinMiter之外的其他东西.