Efgrafich
Efgrafich

Reputation: 27

WPF render translation worsens image quality

I have Image with some text and icons, where source was rendered from UserControl like this:

control.Measure(new Size(300, 300));
control.Arrange(new Rect(new Size(300,300)));

RenderTargetBitmap bmp = new RenderTargetBitmap(300, 300, 96, 96, PixelFormats.Pbgra32);

bmp.Render(control);

ImageSource source = BitmapFrame.Create(bmp);

It is to be expected to lose quality when scaling/rotating non-vector images, especially if there some text involved. Problem is that it also happens with translation. It doesn't matter if i translate Image itself or its parent container. What's strange is that quality worsens seemenly equally with rotation and translation. What's very strange is that the quality only degrades with horizontal translation, not vertical translation. Is there something can be done about this?

P.S. Only reason that i need do render UserControl is text with icons inside (InlineContainers). If there is a way to convert and put it inside certain bounds as group of Drawings without manually calculating each block's position, it would be nice.

Upvotes: 0

Views: 59

Answers (0)

Related Questions