470,849 Members | 1,133 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,849 developers. It's quick & easy.

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

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?
May 27 '06 #1
2 4347
Hi,

You can use the following GDI+ methods to improve the output:

Graphics::SetInterpolationMode

Graphics::SetSmoothingMode

Graphics::SetPixelOffsetMode

http://msdn.microsoft.com/library/de...lationMode.asp

http://msdn.microsoft.com/library/de...othingmode.asp

http://msdn.microsoft.com/library/de...OffsetMode.asp

http://msdn.microsoft.com/library/de...us/gdiplus.asp

http://msdn.microsoft.com/library/de...ce/flatapi.asp

Hope these suggestions helps,

Kellie.

May 27 '06 #2
"Lloyd Dupont" <net.galador@ld> wrote in message
news:uf**************@TK2MSFTNGP02.phx.gbl...
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.

How come output on the Bitmap is so bad?
Any tips?

May 29 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Frecklefoot | last post: by
8 posts views Thread by active | last post: by
5 posts views Thread by Charles A. Lackman | last post: by
9 posts views Thread by poifull | last post: by
2 posts views Thread by Jeff | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.