0
我在控件上绘制图像,通常只旋转几度。这使得适当的过滤变得重要,但是我看到了看起来像最近邻居问题的工件。我在哪里可以设置绘图时使用的过滤器?在WPF上绘制旋转图像时DrawImage过滤DrawingContext
图像大于屏幕上显示的大小。
private void drawRotatedImage(DrawingContext dc , double width_px , double x , double y , double angle)
{
dc.PushTransform(new TranslateTransform(x,y));
dc.PushTransform(new RotateTransform(angle));
double scale = width_px/image.Width;
Rect rr = new Rect(-image.Width*0.5*scale , -image.Height*0.5*scale , image.Width*scale , image.Height*scale);
dc.DrawImage(image , rr);
dc.Pop();
dc.Pop();
}