.NET Bitmap's Graphics.DrawString() // HDC ExtTExtout issues

  • Thread starter Thread starter Lloyd Dupont
  • Start date Start date
L

Lloyd Dupont

In my .NET application I have some text rendered through GDI.
It draws and print nicely.

Now I would like to implement image export.
So I create a
new System.Drawing.Bitmap(width, height)
then I create a Graphic g = Graphics.FromImage(bmp)
then I use
HDC hdc = g.GetHdc();
and use ExtTextOut ....

problem is the output is horrible!
in fact even g.DrawString() has an horrible output.. (ultra heavy/bold
characters, so much so that's almost unreadable...)

With the HDC if I CreateFont(......, ANTIALIASED_QUALITY, ...) I have
something which is better but on the screen I better use CreateFont(......,
CLEARTYPE_QUALITY, ...)

How come output on the Bitmap is so bad?
Any tips?
 
Lloyd Dupont said:
In my .NET application I have some text rendered through GDI.
It draws and print nicely.

Now I would like to implement image export.
So I create a
new System.Drawing.Bitmap(width, height)
then I create a Graphic g = Graphics.FromImage(bmp)
then I use
HDC hdc = g.GetHdc();
and use ExtTextOut ....

problem is the output is horrible!
in fact even g.DrawString() has an horrible output.. (ultra heavy/bold
characters, so much so that's almost unreadable...)

With the HDC if I CreateFont(......, ANTIALIASED_QUALITY, ...) I have
something which is better but on the screen I better use
CreateFont(......, CLEARTYPE_QUALITY, ...)

I suspect your image export is losing the alpha channel, so all your
partially transparent pixels on the edges of the text are becoming solid.

You might try filling in the image with an opaque background first so you
get blending and no transparency.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top