BitmapConverter.cs 624 B

12345678910111213141516171819202122
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Drawing;
  4. using System.IO;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. using System.Windows.Media;
  9. using System.Windows.Media.Imaging;
  10. namespace PixiEditor.Models
  11. {
  12. public static class BitmapConverter
  13. {
  14. public static WriteableBitmap BytesToWriteableBitmap(int currentBitmapWidth, int currentBitmapHeight ,byte[] byteArray)
  15. {
  16. WriteableBitmap bitmap = BitmapFactory.New(currentBitmapWidth, currentBitmapHeight);
  17. bitmap.FromByteArray(byteArray);
  18. return bitmap;
  19. }
  20. }
  21. }