palette.h 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. /*
  2. pygame - Python Game Library
  3. Copyright (C) 2000-2001 Pete Shinners
  4. This library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Library General Public
  6. License as published by the Free Software Foundation; either
  7. version 2 of the License, or (at your option) any later version.
  8. This library is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Library General Public License for more details.
  12. You should have received a copy of the GNU Library General Public
  13. License along with this library; if not, write to the Free
  14. Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  15. Pete Shinners
  16. pete@shinners.org
  17. */
  18. #ifndef PALETTE_H
  19. #define PALETTE_H
  20. #include <SDL.h>
  21. /* SDL 2 does not assign a default palette color scheme to a new 8 bit
  22. * surface. Instead, the palette is set all white. This defines the SDL 1.2
  23. * default palette.
  24. */
  25. static const SDL_Color default_palette_colors[] = {
  26. {0, 0, 0, 255}, {0, 0, 85, 255}, {0, 0, 170, 255},
  27. {0, 0, 255, 255}, {0, 36, 0, 255}, {0, 36, 85, 255},
  28. {0, 36, 170, 255}, {0, 36, 255, 255}, {0, 73, 0, 255},
  29. {0, 73, 85, 255}, {0, 73, 170, 255}, {0, 73, 255, 255},
  30. {0, 109, 0, 255}, {0, 109, 85, 255}, {0, 109, 170, 255},
  31. {0, 109, 255, 255}, {0, 146, 0, 255}, {0, 146, 85, 255},
  32. {0, 146, 170, 255}, {0, 146, 255, 255}, {0, 182, 0, 255},
  33. {0, 182, 85, 255}, {0, 182, 170, 255}, {0, 182, 255, 255},
  34. {0, 219, 0, 255}, {0, 219, 85, 255}, {0, 219, 170, 255},
  35. {0, 219, 255, 255}, {0, 255, 0, 255}, {0, 255, 85, 255},
  36. {0, 255, 170, 255}, {0, 255, 255, 255}, {85, 0, 0, 255},
  37. {85, 0, 85, 255}, {85, 0, 170, 255}, {85, 0, 255, 255},
  38. {85, 36, 0, 255}, {85, 36, 85, 255}, {85, 36, 170, 255},
  39. {85, 36, 255, 255}, {85, 73, 0, 255}, {85, 73, 85, 255},
  40. {85, 73, 170, 255}, {85, 73, 255, 255}, {85, 109, 0, 255},
  41. {85, 109, 85, 255}, {85, 109, 170, 255}, {85, 109, 255, 255},
  42. {85, 146, 0, 255}, {85, 146, 85, 255}, {85, 146, 170, 255},
  43. {85, 146, 255, 255}, {85, 182, 0, 255}, {85, 182, 85, 255},
  44. {85, 182, 170, 255}, {85, 182, 255, 255}, {85, 219, 0, 255},
  45. {85, 219, 85, 255}, {85, 219, 170, 255}, {85, 219, 255, 255},
  46. {85, 255, 0, 255}, {85, 255, 85, 255}, {85, 255, 170, 255},
  47. {85, 255, 255, 255}, {170, 0, 0, 255}, {170, 0, 85, 255},
  48. {170, 0, 170, 255}, {170, 0, 255, 255}, {170, 36, 0, 255},
  49. {170, 36, 85, 255}, {170, 36, 170, 255}, {170, 36, 255, 255},
  50. {170, 73, 0, 255}, {170, 73, 85, 255}, {170, 73, 170, 255},
  51. {170, 73, 255, 255}, {170, 109, 0, 255}, {170, 109, 85, 255},
  52. {170, 109, 170, 255}, {170, 109, 255, 255}, {170, 146, 0, 255},
  53. {170, 146, 85, 255}, {170, 146, 170, 255}, {170, 146, 255, 255},
  54. {170, 182, 0, 255}, {170, 182, 85, 255}, {170, 182, 170, 255},
  55. {170, 182, 255, 255}, {170, 219, 0, 255}, {170, 219, 85, 255},
  56. {170, 219, 170, 255}, {170, 219, 255, 255}, {170, 255, 0, 255},
  57. {170, 255, 85, 255}, {170, 255, 170, 255}, {170, 255, 255, 255},
  58. {255, 0, 0, 255}, {255, 0, 85, 255}, {255, 0, 170, 255},
  59. {255, 0, 255, 255}, {255, 36, 0, 255}, {255, 36, 85, 255},
  60. {255, 36, 170, 255}, {255, 36, 255, 255}, {255, 73, 0, 255},
  61. {255, 73, 85, 255}, {255, 73, 170, 255}, {255, 73, 255, 255},
  62. {255, 109, 0, 255}, {255, 109, 85, 255}, {255, 109, 170, 255},
  63. {255, 109, 255, 255}, {255, 146, 0, 255}, {255, 146, 85, 255},
  64. {255, 146, 170, 255}, {255, 146, 255, 255}, {255, 182, 0, 255},
  65. {255, 182, 85, 255}, {255, 182, 170, 255}, {255, 182, 255, 255},
  66. {255, 219, 0, 255}, {255, 219, 85, 255}, {255, 219, 170, 255},
  67. {255, 219, 255, 255}, {255, 255, 0, 255}, {255, 255, 85, 255},
  68. {255, 255, 170, 255}, {255, 255, 255, 255}, {0, 0, 0, 255},
  69. {0, 0, 85, 255}, {0, 0, 170, 255}, {0, 0, 255, 255},
  70. {0, 36, 0, 255}, {0, 36, 85, 255}, {0, 36, 170, 255},
  71. {0, 36, 255, 255}, {0, 73, 0, 255}, {0, 73, 85, 255},
  72. {0, 73, 170, 255}, {0, 73, 255, 255}, {0, 109, 0, 255},
  73. {0, 109, 85, 255}, {0, 109, 170, 255}, {0, 109, 255, 255},
  74. {0, 146, 0, 255}, {0, 146, 85, 255}, {0, 146, 170, 255},
  75. {0, 146, 255, 255}, {0, 182, 0, 255}, {0, 182, 85, 255},
  76. {0, 182, 170, 255}, {0, 182, 255, 255}, {0, 219, 0, 255},
  77. {0, 219, 85, 255}, {0, 219, 170, 255}, {0, 219, 255, 255},
  78. {0, 255, 0, 255}, {0, 255, 85, 255}, {0, 255, 170, 255},
  79. {0, 255, 255, 255}, {85, 0, 0, 255}, {85, 0, 85, 255},
  80. {85, 0, 170, 255}, {85, 0, 255, 255}, {85, 36, 0, 255},
  81. {85, 36, 85, 255}, {85, 36, 170, 255}, {85, 36, 255, 255},
  82. {85, 73, 0, 255}, {85, 73, 85, 255}, {85, 73, 170, 255},
  83. {85, 73, 255, 255}, {85, 109, 0, 255}, {85, 109, 85, 255},
  84. {85, 109, 170, 255}, {85, 109, 255, 255}, {85, 146, 0, 255},
  85. {85, 146, 85, 255}, {85, 146, 170, 255}, {85, 146, 255, 255},
  86. {85, 182, 0, 255}, {85, 182, 85, 255}, {85, 182, 170, 255},
  87. {85, 182, 255, 255}, {85, 219, 0, 255}, {85, 219, 85, 255},
  88. {85, 219, 170, 255}, {85, 219, 255, 255}, {85, 255, 0, 255},
  89. {85, 255, 85, 255}, {85, 255, 170, 255}, {85, 255, 255, 255},
  90. {170, 0, 0, 255}, {170, 0, 85, 255}, {170, 0, 170, 255},
  91. {170, 0, 255, 255}, {170, 36, 0, 255}, {170, 36, 85, 255},
  92. {170, 36, 170, 255}, {170, 36, 255, 255}, {170, 73, 0, 255},
  93. {170, 73, 85, 255}, {170, 73, 170, 255}, {170, 73, 255, 255},
  94. {170, 109, 0, 255}, {170, 109, 85, 255}, {170, 109, 170, 255},
  95. {170, 109, 255, 255}, {170, 146, 0, 255}, {170, 146, 85, 255},
  96. {170, 146, 170, 255}, {170, 146, 255, 255}, {170, 182, 0, 255},
  97. {170, 182, 85, 255}, {170, 182, 170, 255}, {170, 182, 255, 255},
  98. {170, 219, 0, 255}, {170, 219, 85, 255}, {170, 219, 170, 255},
  99. {170, 219, 255, 255}, {170, 255, 0, 255}, {170, 255, 85, 255},
  100. {170, 255, 170, 255}, {170, 255, 255, 255}, {255, 0, 0, 255},
  101. {255, 0, 85, 255}, {255, 0, 170, 255}, {255, 0, 255, 255},
  102. {255, 36, 0, 255}, {255, 36, 85, 255}, {255, 36, 170, 255},
  103. {255, 36, 255, 255}, {255, 73, 0, 255}, {255, 73, 85, 255},
  104. {255, 73, 170, 255}, {255, 73, 255, 255}, {255, 109, 0, 255},
  105. {255, 109, 85, 255}, {255, 109, 170, 255}, {255, 109, 255, 255},
  106. {255, 146, 0, 255}, {255, 146, 85, 255}, {255, 146, 170, 255},
  107. {255, 146, 255, 255}, {255, 182, 0, 255}, {255, 182, 85, 255},
  108. {255, 182, 170, 255}, {255, 182, 255, 255}, {255, 219, 0, 255},
  109. {255, 219, 85, 255}, {255, 219, 170, 255}, {255, 219, 255, 255},
  110. {255, 255, 0, 255}, {255, 255, 85, 255}, {255, 255, 170, 255},
  111. {255, 255, 255, 255}};
  112. static const int default_palette_size =
  113. (int)(sizeof(default_palette_colors) / sizeof(SDL_Color));
  114. #endif