Advertisement
Chronos_Ouroboros

Untitled

May 24th, 2015
378
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 KB | None | 0 0
  1. public class IMG256Colours {
  2. private int _width;
  3. private int _height;
  4. private Palette256Colours _palette;
  5.  
  6. private byte [] _colours;
  7.  
  8.  
  9. /// <summary>
  10. /// Gets the image's width
  11. /// </summary>
  12. public int width {
  13. get {
  14. return _width;
  15. }
  16. }
  17.  
  18. /// <summary>
  19. /// Gets the image's height
  20. /// </summary>
  21. public int height {
  22. get {
  23. return _height;
  24. }
  25. }
  26.  
  27. /// <summary>
  28. /// Gets or sets the image's palette
  29. /// </summary>
  30. public Palette256Colours palette {
  31. get {
  32. return _palette;
  33. } set {
  34. _palette = value;
  35. }
  36. }
  37.  
  38. public IMG256Colours (int newWidth, int newHeight, Palette256Colours newPalette) {
  39. _width = newWidth;
  40. _height = newHeight;
  41. _palette = newPalette;
  42.  
  43. _colours = new byte [newWidth * newHeight];
  44. }
  45.  
  46. ~IMG256Colours () {
  47. _width = 0;
  48. _height = 0;
  49. }
  50.  
  51. public byte this [int index] {
  52. get {
  53. return _colours [index];
  54. } set {
  55. _colours [index] = value;
  56. }
  57. }
  58.  
  59. public Bitmap ToBitmap () {
  60. Bitmap bitmap = new Bitmap (_width, _height);
  61.  
  62. for (int i = 0; i < _width * _height; i++)
  63. bitmap.SetPixel (
  64.  
  65. return bitmap;
  66. }
  67. }
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement