ImageGenerator.cs 686 B

123456789101112131415161718192021222324
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Windows.Controls;
  7. using System.Windows.Media;
  8. namespace PixiEditor.Models
  9. {
  10. public static class ImageGenerator
  11. {
  12. public static Image GenerateForPixelArts(int width, int height)
  13. {
  14. Image image = new Image();
  15. RenderOptions.SetBitmapScalingMode(image, BitmapScalingMode.NearestNeighbor);
  16. RenderOptions.SetEdgeMode(image, EdgeMode.Aliased);
  17. image.Stretch = Stretch.Uniform;
  18. image.Width = width;
  19. image.Height = height;
  20. return image;
  21. }
  22. }
  23. }