ColorImage.cs 837 B

12345678910111213141516171819202122232425262728293031323334353637
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace bbiwarg.DataSource
  7. {
  8. class ColorImage
  9. {
  10. private int width, height;
  11. private byte[] data;
  12. public ColorImage(int width, int height, byte[] data)
  13. {
  14. this.width = width;
  15. this.height = height;
  16. this.data = data;
  17. }
  18. public int getWidth()
  19. {
  20. return width;
  21. }
  22. public int getHeight()
  23. {
  24. return height;
  25. }
  26. public Color4 getColor(int x, int y)
  27. {
  28. return new Color4(data[4 * (y * width + x) + 3], data[4 * (y * width + x) + 0],
  29. data[4 * (y * width + x) + 1], data[4 * (y * width + x) + 2]);
  30. }
  31. }
  32. }