Quantcast
Channel: WriteableBitmapEx
Viewing all articles
Browse latest Browse all 360

New Post: From... methods

$
0
0
Many thanks for a great library!

I am not sure if this has been discussed before, but one thing I find a bit non-intuitive with the library are the FromContent, FromStream etc. methods in the WriteableBitmapConvertExtensions.cs file.

One example is FromStream that in one overload has the following signature:
public static WriteableBitmap FromStream(this WriteableBitmap bmp, Stream stream);
Upon exit, a newWriteableBitmap is created, and this same object is also returned from the method.

I would find it more intuitive if this was not implemented as an extension method. Instead, I would recommend to move all the From methods to BitmapFactory and remove the extension argument. For example:
public static class BitmapFactory {
  ...
  public static WriteableBitmap FromStream(Stream stream) { ... }
  ...
}
The code can remain practically the same, only that the extension argument assignment in each method is removed, e.g. delete statements like this from the moved methods:
bmp = new WriteableBitmap(/* BitmapImage */ bmpi);
What do you think?

Best regards,
Anders @ Cureos

Viewing all articles
Browse latest Browse all 360

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>