You can use the WriteableBitmap
and manipulate it's pixels data in unsafe
way, like here.
Then you can use
public static void ToSepia(this WriteableBitmap wrb)
{
// ForEach...
// (...ForEach(this WriteableBitmap bmp, Func<int, int, Color, Color> func)...)
//
wrb.ForEach((x, y, c) =>
{
// Convert color to grayscale.
byte grayScale = (byte)((c.R * .3) + (c.G * .59) + (c.B * .11));
// Init new color with taking same alpha.
Color newColor = Color.FromArgb(c.A, grayScale, grayScale, grayScale);
// Apply sepia and return new color.
return new Color()
{
R = (byte)(newColor.R * 1),
G = (byte)(newColor.G * 0.95),
B = (byte)(newColor.B * 0.82),
};
});
}
Here is a helper library for SL, but recently a wpf version is also made (Check in branches in source control). http://writeablebitmapex.codeplex.com/