- Draw methods for parametric curves: Cubic Beziér splines and the Cardinal splines similar to the GDI+ API.
- Clone method to copy the whole WriteableBitmap to a new instance.
- Boundary check for the Draw* (Shape) methods. The coordinates are
now clipped to the WriteableBitmap's size.
- A new, even faster DrawLine method overload that uses the bitmap's pixels int array, width and height directly as parameters. This method should be used if many lines are drawn to the same WriteableBitmap.
- Optimization of the byte array conversion methods using the Buffer.BlockCopy method. This improvement was suggested in this comment.
- WriteTga method to write a WriteableBitmap as a TGA image to a stream. The original method was provided in this blog post.
- Fast path for Blitting using the Buffer.BlockCopy method if the BlendMode is None and the bitmap should not be tinted. The result is a performance boost by factor 3.5 compared to traditional loop iteration. This improvement was suggested in this CodePlex discussion.
- Adam Kinney contributed two new blend modes for the Blit method: Multiply and Mask. He used these in his cool torn photo effect.
- A new method that takes a function as parameter and iterates over
each pixel and sets its color. The method is called ForEach and has two
overloads. Usage example:
writeableBmp.ForEach((x, y, color) => Color.FromArgb(color.A, color.R / 2, (byte)(x * y), 100));
The method was suggested in this CodePlex discussion.
LiveI also wrote a new sample application that shows the spline methods in action. The sample starts with a demo animation that uses the Cardinal spline DrawCurve method to draw an artificial plant that grows procedurally. The other part of the sample is interactive and allows to draw and manipulate Beziér and Cardinal splines with the mouse.
Uncheck the "Points" Checkbox to hide the control points and press the Clear Button to remove all control points. Click the Save Button to write the WriteableBitmap to a TGA image file.
The other controls should be self-explaining.