Draw Anti-Aliased Text Image like Graphics Software
I would like to generate text images like the following (source: http://www.zune.开发者_Python百科net/en-US):
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:
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
:
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)
.
精彩评论