0

I'm drawing an image on a control, rotated typically just a few degrees. This makes proper filtering important, but I am seeing artifacts that look like a nearest neighbor issue. Where can I set the filter to use when drawing the image?

The image is larger than the resulting size on the screen.

    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();
    }
Jesper
  • 1
  • 2

1 Answers1

0

If you're writing your code in .NET 4 then you need to up the filter to the higher quality Fant one.

Do that by putting an attached property on your Window or specific element.

Colin Smith
  • 12,375
  • 4
  • 39
  • 47