Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
W

WriteableBitmapEx

> 编程语言
Open source

Collection of extension methods for the XAML WriteableBitmap

558 stars0 likes3 views
WebsiteGitHub

About

Collection of extension methods for the XAML WriteableBitmap

WriteableBitmapEx

The WriteableBitmapEx library is a collection of extension methods for the WriteableBitmap. The WriteableBitmap class is available for WPF. It supports the .NET Framework and .NET Core 3. WriteableBitmapEx allows the direct manipulation of a bitmap and can be used for image manipulation, to generate fast procedural images by drawing directly to a bitmap and more.

The WriteableBitmap API is very minimalistic and there's only the raw Pixels array for such operations. The WriteableBitmapEx library tries to compensate that with extensions methods that are easy to use like built in methods and offer GDI+ like functionality. The library extends the WriteableBitmap class with elementary and fast (2D drawing) functionality, conversion methods and functions to combine (blit) WriteableBitmaps.

The extension methods are grouped into different C# files using a partial class approach. It is possible to include just a few methods by using the specific source code files directly or the full functionality via the built binaries.

The latest binaries are available as NuGet package.

Please use the GitHub Issues functionality to add new issues which are not already reported.

News

  • now supports text rendering (outline and fill)

Features

GDI+ like drawing functionality for the WriteableBitmap. Support for WPF with .NET Framework and .NET Core 3.

  • Base
    • Support for the Color structure (alpha premultiplication will be performed)
    • Also overloads for faster int32 as color (assumed to be already alpha premultiplied)
    • SetPixel method with various overloads
    • GetPixel method to get the pixel color at a specified x, y coordinate
    • Fast Clear methods
    • Fast Clone method to copy a WriteableBitmap
    • ForEach method to apply a given function to all pixels of the bitmap
  • Transformation
    • Crop method to extract a defined region
    • Resize method with support for bilinear interpolation and nearest neighbor
    • Rotate in 90° steps clockwise and any arbitrary angle
    • Flip vertical and horizontal
  • Shapes
    • Fast line drawing algorithms including various anti-aliased algorithm
    • Variable stroke thickness, dotted and penned / stamp lines
    • Ellipse, polyline, quad, rectangle and triangle
    • Cubic Beziér, Cardinal spline and closed curves
  • Filled shapes
    • Fast ellipse and rectangle fill method
    • Triangle, quad, simple and complex polygons
    • Beziér and Cardinal spline curves
  • Text
    • Fill and draw outline of text strings. text is highly flexible, it is instance of FormattedText thus any text and characted which is supported by wpf, can be rendered (options like FlowDirection, FontWeight and ... can be changed).
  • Blitting
    • Different blend modes including alpha, additive, subtractive, multiply, mask and none
    • Optimized fast path for non blended blitting
    • Special BlitRender to apply affine transformation with bilinear interpolation
  • Filtering
    • Convolution, Blur
    • Brightness, contrast, gamma adjustments
    • Gray/brightness, invert
  • Conversion
    • Convert a WriteableBitmap to a byte array
    • Create a WriteableBitmap from a byte array
    • Create a WriteableBitmap easily from the application resource or content
    • Create a WriteableBitmap from an any platform supported image stream
    • Write a WriteableBitmap as a TGA image to a stream
    • Separate extension method to save as a PNG image. Download here
  • Windows Phone specific methods
    • Save to media library and the camera roll

Performance!

The WriteableBitmapEx methods are much faster than the XAML Shape subclasses. For example, the WriteableBitmapEx line drawing approach is more than 20-30 times faster than the Silverlight Line element. If a lot of shapes need to be drawn, the WriteableBitmapEx methods are the right choice.

Easy to use!

…

Additional Information

The WriteableBitmapEx library has its origin in several blog posts that also describe the implemenation and usage of some aspects in detail. The blog posts might be seen as the documentation:

  • WriteableBitmap Extension Methods introduced the SetPixel methods.
  • Drawing Lines - Silverlight WriteableBitmap Extensions II provided the DrawLine methods.
  • Drawing Shapes - Silverlight WriteableBitmap Extensions III brought the shape functionality (ellipse, polyline, quad, rectangle, triangle).
  • Convert, Encode And Decode Silverlight WriteableBitmap Data came with the byte array conversion methods and hows how to encode / decode a WriteableBitmap to JPEG.
  • Blitting and Blending with Silverlight’s WriteableBitmap provided the Blit functions.
  • WriteableBitmapEx - WriteableBitmap extensions now on CodePlex announced this project.
  • Quick and Dirty Output of WriteableBitmap as TGA Image provided the original TgaWrite function.
  • Rounder, Faster, Better - WriteableBitmapEx 0.9.0.0 announced version 0.9.0.0 and gives some further information about the curve sample.
  • Let it ring - WriteableBitmapEx for Windows Phone introtuced the WriteableBitmapEx version for the Windows Phone and a sample.
  • Filled To The Bursting Point - WriteableBitmapEx 0.9.5.0 announced version 0.9.5.0, has some information about the new Fill methods and comes with a nice sample.
  • One Bitmap to Rule Them All - WriteableBitmapEx for WinRT Metro Style announced version 1.0.0.0 and provides some background about the WinRT Metro Style version.
  • Space Navigator is a great project on Code Project that compares the performance of the WriteableBitmapEx to other methods in WPF for visualizing large hierarchical data in a Tree Map.

Support it

Credits

  • Rene Schulte started this project, maintains it and provided most of the code.
  • Dr. Andrew Burnett-Thompsonand his team proposed the portability refactoring, provided the WPF port and much more beneficial functions.
  • Nikola Mihaylov (Nokola) made some optimizations on the DrawLine and DrawRectangle methods, provided the original TgaWrite and the anti-aliased line drawing function.
  • Bill Reiss wrote the Blit methods.

And all the other amazing contributors you can see in the Contributors tab here on GitHub.

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

C#

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言