Kernel.cs 833 B

12345678910111213141516171819202122232425262728293031323334
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace PaintDotNet.Adjust.BaseImage
  7. {
  8. public class Kernel
  9. {
  10. public float[] Data { get; set; }
  11. public int Width { get; set; }
  12. public int Height { get; set; }
  13. public Kernel(int width, int height, float[] data)
  14. {
  15. if (data.Length < width * height)
  16. {
  17. throw new ArgumentException("Array should not be smaller than width*height");
  18. }
  19. Data = data;
  20. Width = width;
  21. Height = height;
  22. }
  23. public float[] GetKernel()
  24. {
  25. var data = new float[Data.Length];
  26. Array.Copy(Data, 0, data, 0, Data.Length);
  27. return data;
  28. }
  29. }
  30. }