If you call FillRectangle and pass a rectangle with width 1 and height 1, it instead fills an area 2 pixels wide and 2 pixels high.
It appears that WriteableBitmapEx's FillRectangle is including x2 and y2 in its rectangle. This is inconsistent with both System.Drawing and WPF, as well as every other graphics library I've ever used (GDI, GDI+, Delphi's TCanvas, ImageMagick, PyGame, etc.) FillRect calls typically do not fill the right-most column or the bottom-most row. That's because rectangle coordinates typically represent the grid lines between pixels, and that's because the math is far, far easier that way. (Raymond Chen has a good explanation at http://blogs.msdn.com/b/oldnewthing/archive/2004/02/18/75652.aspx.)
Repro:
var bitmap = BitmapFactory.New(2, 2);
// Should fill an area (1 - 0) pixels wide and (1 - 0) pixels high
bitmap.FillRectangle(0, 0, 1, 1, Colors.Red);
MyImage.Source = bitmap;
Expected: a 2x2 bitmap with one red pixel in the top left.
Actual: a 2x2 bitmap completely filled with red.
It appears that WriteableBitmapEx's FillRectangle is including x2 and y2 in its rectangle. This is inconsistent with both System.Drawing and WPF, as well as every other graphics library I've ever used (GDI, GDI+, Delphi's TCanvas, ImageMagick, PyGame, etc.) FillRect calls typically do not fill the right-most column or the bottom-most row. That's because rectangle coordinates typically represent the grid lines between pixels, and that's because the math is far, far easier that way. (Raymond Chen has a good explanation at http://blogs.msdn.com/b/oldnewthing/archive/2004/02/18/75652.aspx.)
Repro:
var bitmap = BitmapFactory.New(2, 2);
// Should fill an area (1 - 0) pixels wide and (1 - 0) pixels high
bitmap.FillRectangle(0, 0, 1, 1, Colors.Red);
MyImage.Source = bitmap;
Expected: a 2x2 bitmap with one red pixel in the top left.
Actual: a 2x2 bitmap completely filled with red.