WPF supports Photoshop-like filter functionality, called effect. In. Net 4.0, WPF deprecated support for bitmapeffect and shifted to using effect classes that support GPU acceleration, for example, we can use the following code to generate a button with a shadow effect.
1 <Button... >2 <Button.effect>3 <Dropshadoweffect/>4 </Button.effect>5 Hello6 </Button>
The system has brought in more than ten kinds of effect, basically can meet most of our processing requirements. If there is an HLSL basis, we can write our own special effects. The following two articles on MSDN describe this process in detail:
- gpu-accelerated Custom effects for WPF
- Writing Custom gpu-based Effects for WPF
Microsoft also offers some special effects libraries, the WPF effects library, which can be previewed on Channel 9, which provides a number of common filter effects: sharpening, highlighting, twisting, blurring, highlighting, and more, as well as a range of transition effects such as blinds, dissolve, rotate, zoom, and more. It's easy to create cool WPF programs. Also support sliverlight, but the egg WINRT is not support effect, WINRT API and WPF is almost weak, look forward to Win10 version of Metro programs, such as more open some API bar, otherwise it really does not mention what development power.
This library is a bit of a hassle to compile (some places do not compile with VS2013), so I uploaded a compiled version here to download. It should be stated that:
- Many preview images were built into the original project, resulting in a large volume, so I removed the built-in bitmap, and transitioneffects used the JPG format file in the local My Pictures folder, which cannot be previewed if there are no pictures in the folder.
- A few PNG files were used as masks in the Transitioneffects project, causing the library to reach a volume of 2m (feeling that the masks could be generated when they were fully operational) and that it was not easy to publish. So I compiled a version that removed the images.
Because the whole project is larger, I uploaded to the Baidu Network disk: Click to download.
Some of the filter effects in WPF--effect Library