Tuesday, June 1, 2010

Filled To The Bursting Point - WriteableBitmapEx 0.9.5.0

We're slowly getting to the first feature complete release of the WriteableBitmapEx library. The last version (0.9.0.0) brought the parametric curves, optimizations and other features. This new version 0.9.5.0 focuses on filling routines, transformations, bug fixes and more optimizations.
The new Fill* extension methods are equivalent to the Draw* shape functions. The FillRectangle and FillEllipse methods use specialized implementations to get the best performance. FillPolygon and the other functions use a simple scanline conversion algorithm with the even-odd-rule. The implemented algorithm supports concave and convex shapes.

New features
  • Fast FillRectangle method that uses Buffer.BlockCopy.
  • Optimized FillEllipse and FillEllipseCentered functions to draw a filled ellipse / circle.
  • FillPolygon, FillTriangle and FillQuad methods that use a scanline conversion algorithm. 
  • FillCurve, FillCurveClosed to draw a filled Cardinal spline similar to the GDI+ API.
  • FillBeziers draws a filled Cubic Beziér spline.
  • Resize method with support for Bilinear and Nearest neighbor interpolation.
  • Fast Crop method to cut out a portion of the WriteableBitmap.
  • GetPixel and GetPixeli methods to get the color as Color struct at a specified x, y coordinate.
  • FromResource method to load an image from the application's resource only by passing the relative path without the need of the full Pack URI syntax. Example: "Data/flower2.png" instead of "MyAssemblyName;component/Data/flower2.png".
  • Optimized Clear(Color) method that uses Buffer.BlockCopy.
  • Renamed BlendMode "AlphaBlend" to "Alpha".
  • Fixed the clipping of the DrawEllipse methods.
  • Fixed some missing alpha pre-multiplications.
  • Other minor tweaks and bug fixes.
  • Updated the solutions to Microsoft Visual Studio 2010.
    The code listing on the project's CodePlex site was updated to demonstrate how to use the new methods.
      Live
      As usual I also wrote a new sample application that shows the Fill* methods in action. The sample starts with a real-time demo that animates the Cardinal spline's tension of the FillCurveClosed method, plus some random animated filled ellipses. The sample also contains a static page showing some of the possible filled shapes.

      Go and grab it
      The WriteableBitmapEx library is hosted at CodePlex. You can find the new binary release here and the samples in the Subversion repository.

        2 comments:

        1. VERY cool. Are you looking into anti-aliasing as well? You might want to take a look at AGG-sharp: http://agg-sharp.sourceforge.net/

          ReplyDelete
        2. Hi Morten,

          thanks for the link about AGG-sharp. I didn't know the library. Sounds interesting.

          Please see this regarding anti-aliasing:
          http://writeablebitmapex.codeplex.com/Thread/View.aspx?ThreadId=77374
          And feel free to open to suggest it here:
          http://writeablebitmapex.codeplex.com/workitem/list/basic

          I'm not planning to add this for release 1.0, but if enough people vote for it I'll surely implement in 1.1

          ReplyDelete