The main problem arises when WPF has an effect on a tree having a partial pixel offset. There are two main approaches that we could take for the hardware path:
1) Create an intermediate texture that matches the pixels on the screen and render the tree with a partial pixel offset inside that texture. Then, when we transfer this intermediate element back to the screen, we can use pixel-aligned quadrants and use a simple selection of the nearest neighbor, because the content is pixel-aligned.
2) Create an intermediate texture that matches the borders of the tree and render the tree at offset 0 inside this texture. Then, when moving the intermediate element back to the screen, we need to use a square that covers partial pixels. Since the quadrant can span partial pixels, sampling is very important. Sampling modes, such as NearestNeighbor, can cause anti-aliasing artifacts, which can be GPU dependent.
WPF chose # 2 and forcibly chose the closest neighbor sample - if only a tree that had no transformation other than an offset or scale (most often a rotation), in this case it forced a bilinear selection. This is subtly different from the software rasterization path, which will use the interpolation mode valid for the tree, unless the tree had a transformation other than offset or scale, in which case it also forcibly took a bilinear sample.
We "fix" this problem by bringing the hardware path in line with the software path. This means that we will refer to the sampling mode in effect for the displayed tree. This can be set from managed code with the RenderOptions.BitmapScalingMode property attached. The default value is Linear, which is a more acceptable sampling mode when the square covers partial pixels. However, it introduces a noticeable blur - but the same thing as software rasterization.
There are several ways in 4.0:
1) Prohibit the location of the element tree on a partial pixel. For example, you can set the UseLayoutRounding property to true in containers that position the item with the effect.
2) Apply a little rotation to force the rendering path to use bilinear interpolation. It can be very small, for example, RenderTransform with <RotateTransform Angle="0.00000000001"/>
Note that custom ShaderEffects use explicit samplers with custom sampling modes.
Clients will be able to get the current behavior by setting the attached RenderOptions.BitmapScalingMode property to "NearestNeighbor". Note that even this will be ignored if the tree is rotated and bilinear sampling will be used instead. It remains true that on some GPUs, effects like DropShadow can occur with anti-aliasing artifacts when using the NearestNeighbor selection.
Also note that when applying an effect to an image, the same value of the property of the attached property RenderOptions.BitmapScalingMode will be used both for the image content and for the intermediate texture of the effect. If you want to get an image using NearestNeighbor selection, but the effect of using linear selection, you will need to apply the effect to the image container, for example, to a simple canvas containing the image.