2012-06-19 48 views
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(); 
    } 

回答