开发者

Draw Anti-Aliased Text Image like Graphics Software

开发者 https://www.devze.com 2023-03-20 14:33 出处:网络
I would like to generate text images like the following (source: http://www.zune.开发者_Python百科net/en-US):

I would like to generate text images like the following (source: http://www.zune.开发者_Python百科net/en-US):

Draw Anti-Aliased Text Image like Graphics Software

The text has a nice thickness and is perfectly anti-aliased. Vector graphics software – such as Inkscape – produces the same result. However, the images I managed to create using GDI+ look like this:

Draw Anti-Aliased Text Image like Graphics Software

These rendered text is too thin although the font family, size, weight etc. are identical. How can I increase the thickness of the text? Does WPF provide functionality to render the text as described above?


[Update] I created the following images using TextRenderer.DrawText(). The first one uses TextRenderingHint.ClearTypeGridFit, the second one TextRenderingHint.AntiAlias:

Draw Anti-Aliased Text Image like Graphics Software

Draw Anti-Aliased Text Image like Graphics Software


I managed to create nice-looking text images by rendering a WPF User Control containing a TextBlock inside a Canvas to a RenderTargetBitmap that – using a PngBitmapEncoder – is saved to a MemoryStream and turned to an image using Image.FromStream(Stream).

0

精彩评论

暂无评论...
验证码 换一张
取 消