all groups > dotnet drawing api > february 2004 >
You're in the

dotnet drawing api

group:

Solid brush with ARGB color produces dither on enhanced metafile (EMF)


Solid brush with ARGB color produces dither on enhanced metafile (EMF) google NO[at]SPAM phildavidson.com
2/26/2004 5:57:44 PM
dotnet drawing api:
(This question might pertain as much to GDI+ as to drawing in the .NET
drawing framework.)

I'm working in C#, drawing to a Graphics object initialized by a
handle of an enhanced metafile. When filling a path with a brush
created by

SolidBrush sb = new SolidBrush(FillColor);
g.FillPath(sb, MyPath);

the result appears dithered on the resulting metafile. The FillColor
was created by an ARGB value (alpha and RGB). The alpha value in
FillColor is intermediate between 0 and 255.

The dithering does not seem necessary. When the resulting metafile is
played against a solid background, most of the dots seem to be
correctly blended with the background color. Yet the remainder of the
dots are in a dithered pattern.

The size of the dither pattern varies according to the target
environment (screen or bitmap). It appears to be a fixed number of
pixels.

Here is my question: How can I draw with a solid color, with an
intermediate (semitransparent) alpha value, onto a Graphics object so
that it won't dither on an enhanced metafile?

Re: Solid brush with ARGB color produces dither on enhanced metafile (EMF) Feng Yuan [MSFT]
3/30/2004 9:16:53 PM
EMF corresponds to GDI, in which the only support for alpha channel is
AlphaBlend. But AlphaBlend is not supported on all Win32 OSes. So GDI+ can't
safely use AlphaBlend. That is the reason for using mask bitmap to simulate
alpha channel. This also happens during printing. So you can say it's
by-design.

--
Feng Yuan (www.fengyuan.com)

This posting is provided "AS IS" with no warranties, and confers no rights.

AddThis Social Bookmark Button