Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Rendering bitmap is Blurry in WPF

34 views
Skip to first unread message

pym

unread,
Dec 14, 2008, 10:07:46 AM12/14/08
to

Hello,

I am trying to convert some vector based objects into a raster bitmap.
I manage to do that, but the result is blurry, meaning, edges are
blurry instead of jagged.
I assume an anti-aliasing algorithm is applied, but I do not want to be
applied...

here is my simplified code in which I draw a circle and make a raster
out of it to an Image Control:


Code:
--------------------
DrawingVisual drawingVisual = new DrawingVisual();
DrawingContext drawingContext = drawingVisual.RenderOpen();
drawingContext.DrawEllipse(Brushes.Red, new Pen(Brushes.Red, 1), new Point(50, 50), 50, 50);
drawingContext.Close();

RenderTargetBitmap bmp = new RenderTargetBitmap(180, 180, 96, 96, PixelFormats.Pbgra32);
bmp.Render(drawingVisual);

RenderOptions.SetEdgeMode(_image, EdgeMode.Aliased);
_image.Source = bmp;
--------------------
Here is an image to make it clearer.
What I want is the jagged edged circle...
'ImageShack - Image Hosting :: 98299814ew8.png'
(http://img131.imageshack.us/my.php?image=98299814ew8.png)

Does anyone have any idea why this happens???
Thanks!


--
pym

0 new messages