home *** CD-ROM | disk | FTP | other *** search
/ PC Pro 2002 April / pcpro0402.iso / essentials / graphics / Gimp / gimp-src-20001226.exe / src / gimp / plug-ins / common / AlienMap.c < prev    next >
Encoding:
C/C++ Source or Header  |  2000-08-28  |  75.7 KB  |  1,741 lines

  1. /**********************************************************************
  2.  *  AlienMap (Co-)sine color transformation plug-in (Version 1.01)
  3.  *  Daniel Cotting (cotting@mygale.org)
  4.  **********************************************************************
  5.  *  Official Homepage: http://www.mygale.org/~cotting
  6.  **********************************************************************
  7.  *  Homepages under construction: http://www.chez.com/cotting
  8.  *                                http://www.cyberbrain.com/cotting
  9.  *  You won't be able to see anything yet, as I don't really have the 
  10.  *  time to build up these two sites :-( 
  11.  *  Have a look at www.mygale.org/~cotting instead!
  12.  **********************************************************************    
  13.  */
  14.  
  15. /* The GIMP -- an image manipulation program
  16.  * Copyright (C) 1995 Spencer Kimball and Peter Mattis
  17.  *
  18.  * This program is free software; you can redistribute it and/or modify
  19.  * it under the terms of the GNU General Public License as published by
  20.  * the Free Software Foundation; either version 2 of the License, or
  21.  * (at your option) any later version.
  22.  *
  23.  * This program is distributed in the hope that it will be useful,
  24.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  25.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  26.  * GNU General Public License for more details.
  27.  *
  28.  * You should have received a copy of the GNU General Public License
  29.  * along with this program; if not, write to the Free Software
  30.  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  31.  */
  32.  
  33. #include "config.h"
  34.  
  35. #include <stdio.h>
  36. #include <stdlib.h>
  37.  
  38. #include <gtk/gtk.h>
  39.  
  40. #include <libgimp/gimp.h>
  41. #include <libgimp/gimpui.h>
  42.  
  43. #include "libgimp/stdplugins-intl.h"
  44.  
  45.  
  46. static unsigned int logo_width = 200;
  47. static unsigned int logo_height = 72;
  48.  
  49. #define HEADER_PIXEL(data,pixel) \
  50.   pixel[0] = palette_data[data[0]*3+2]; \
  51.   pixel[1] = palette_data[data[0]*3+1]; \
  52.   pixel[2] = palette_data[data[0]*3+0]; \
  53.   data--;
  54.  
  55. static unsigned char 
  56. palette_data[]  =  { 4,2,2,4,110,178,32,4,122,4,36,
  57. 86,15,3,66,4,58,127,36,8,186,4,34,122,17,2,
  58. 34,4,19,66,12,4,162,90,2,69,88,2,48,7,20,
  59. 2,25,2,103,8,14,48,4,58,186,90,3,154,82,2,
  60. 129,55,2,34,17,2,18,17,34,191,94,2,101,57,2,
  61. 70,7,32,154,12,22,157,17,3,50,4,88,150,96,3,
  62. 186,86,2,138,87,2,86,212,214,210,4,19,98,52,2,
  63. 154,15,11,2,4,132,216,7,18,125,12,6,82,37,12,
  64. 18,4,88,189,86,14,48,128,2,157,32,4,138,4,60,
  65. 155,4,48,126,60,2,218,7,10,52,13,12,66,129,2,
  66. 50,56,2,52,52,14,98,4,47,157,6,20,87,48,2,
  67. 24,58,2,101,120,2,141,52,5,170,4,113,215,127,2,
  68. 73,4,90,210,4,52,112,36,18,194,59,2,85,42,2,
  69. 10,107,2,173,95,2,114,31,3,52,4,79,160,84,3,
  70. 189,14,10,40,30,2,69,96,2,58,113,2,126,9,37,
  71. 231,17,33,170,28,14,2,4,30,146,68,10,37,132,2,
  72. 82,23,4,7,4,10,122,4,36,108,32,2,37,7,27,
  73. 2,4,98,175,84,10,146,4,101,191,4,14,146,8,29,
  74. 86,4,2,170,8,60,230,84,10,162,72,2,39,102,2,
  75. 142,4,142,221,4,49,143,68,12,170,4,124,213,15,4,
  76. 74,114,2,69,112,2,158,32,3,23,8,50,190,111,2,
  77. 104,6,40,154,96,2,210,6,28,104,60,2,138,61,2,
  78. 25,68,2,114,58,2,125,39,2,114,73,2,69,16,4,
  79. 58,4,88,177,56,14,26,138,2,173,4,68,176,71,2,
  80. 55,76,2,210,4,78,130,17,3,42,6,27,69,112,2,
  81. 49,12,26,178,47,13,159,18,11,10,13,11,74,141,2,
  82. 58,52,18,234,4,82,186,4,126,198,4,103,213,4,62,
  83. 206,4,72,226,12,46,210,72,12,222,12,26,146,20,34,
  84. 210,4,113,197,4,131,229,4,48,170,4,76,170,7,43,
  85. 95,52,30,218,15,11,170,52,14,202,12,14,86,4,40,
  86. 174,108,14,202,156,2,186,60,12,130,5,40,129,73,13,
  87. 189,12,42,138,44,14,202,4,59,143,4,124,229,4,69,
  88. 191,4,69,157,4,60,114,4,43,110,14,14,58,20,26,
  89. 157,28,26,210,4,87,162,4,91,202,4,110,226,4,98,
  90. 226,4,101,202,17,14,186,28,18,18,60,2,234,28,10,
  91. 114,4,30,114,8,10,162,12,54,186,20,26,130,100,10,
  92. 170,40,18,154,4,22,114,28,26,234,4,22,58,4,66,
  93. 226,4,54,202,12,42,202,4,38,98,4,145,234,4,76,
  94. 146,4,94,148,4,138,213,4,94,186,4,54,126,4,54,
  95. 154,4,118,211,4,106,178,4,106,188,4,54,142,4,94,
  96. 170,4,70,202,4,118,197,4,54,173,4,82,178,72,4,
  97. 172,36,10,138,76,14,162,4,98,210,4,118,226,112,2,
  98. 114,24,19,8,30,2,85,84,6,226,141,2,73,28,30,
  99. 10,28,46,186,112,4,206,36,10,90,36,2,174,108,2,
  100. 58,41,3,130,44,10,194,9,33,130,92,2,162,51,2,
  101. 42,12,32,162,81,3,146,44,11,26,28,6,146,44,2,
  102. 178,30,12,10,60,10,178,64,2,146,28,10,178,92,10,
  103. 210,5,41,146,40,2,102,96,2,125,100,2,88,74,2,
  104. 157,142,2,159,26,10,55,143,2,50,73,2,102,134,2,
  105. 142,73,2,84,127,2,126,142,2,82,156,2,178,28,10,
  106. 158,28,26,114,84,14,202,12,4,10,5,20,74,17,2,
  107. 26,92,2,194,7,19,106};
  108.  
  109. static unsigned char header_data[] = { 71,99,218,218,99,11,71,218,71,71,
  110. 218,99,99,99,71,99,218,99,99,99,99,218,71,218,99,218,218,99,99,218,
  111. 218,99,99,218,99,218,99,58,218,99,99,99,58,218,99,99,99,58,99,58,
  112. 99,58,11,58,99,58,58,11,99,58,99,58,99,99,99,218,99,218,99,58,
  113. 99,71,99,218,71,12,12,12,12,12,12,12,12,12,92,19,19,19,92,92,
  114. 92,92,19,108,19,19,19,19,19,19,53,53,53,53,101,19,19,53,53,19,
  115. 19,19,12,92,92,12,12,12,71,71,218,99,218,218,71,71,12,12,218,99,
  116. 58,58,58,99,99,99,58,99,99,99,11,58,11,58,58,99,58,99,99,99,
  117. 58,99,99,99,99,58,99,99,99,99,99,218,99,99,11,99,99,99,11,99,
  118. 99,218,218,218,99,218,99,99,218,218,99,99,218,99,218,218,99,99,218,11,
  119. 218,71,99,218,99,218,218,99,71,8,218,99,218,218,99,99,99,99,99,99,
  120. 218,218,99,99,218,99,218,99,218,71,99,99,99,218,99,99,218,99,99,99,
  121. 218,218,99,99,99,99,58,99,58,30,99,99,99,99,99,99,58,99,99,58,
  122. 99,58,99,58,99,99,58,58,58,99,58,58,99,218,218,71,99,99,71,71,
  123. 71,123,12,118,71,71,12,71,123,12,12,19,19,19,53,19,19,53,53,19,
  124. 19,53,101,63,20,63,20,63,53,53,53,101,53,53,53,19,53,53,53,19,
  125. 92,12,12,12,71,12,12,12,12,12,92,71,218,218,71,218,71,71,71,71,
  126. 99,218,58,58,58,99,99,99,99,58,58,58,99,58,99,58,58,99,58,58,
  127. 99,99,58,99,99,99,99,58,99,58,30,99,99,99,218,99,58,99,99,58,
  128. 11,99,99,218,99,218,218,99,99,218,71,99,218,99,99,218,99,99,218,99,
  129. 11,218,99,218,99,11,218,99,99,8,71,71,71,99,218,71,218,99,71,218,
  130. 11,99,218,218,99,218,99,218,99,99,99,99,218,99,99,99,99,99,218,99,
  131. 99,99,99,99,99,11,99,99,99,99,99,99,58,99,58,99,58,99,58,58,
  132. 99,11,58,58,99,58,99,99,58,58,218,99,123,71,71,71,123,71,71,218,
  133. 99,99,218,71,12,12,12,12,92,19,19,53,19,53,53,53,53,19,53,53,
  134. 53,53,19,53,19,53,53,53,53,53,63,63,101,63,63,20,53,19,53,53,
  135. 53,19,92,92,12,12,12,71,71,71,71,12,12,71,71,12,12,12,12,12,
  136. 12,218,218,99,58,58,99,58,99,58,99,58,99,99,58,218,58,99,58,99,
  137. 99,99,99,11,58,99,99,58,99,99,58,58,99,99,99,99,99,99,99,99,
  138. 99,58,218,99,218,99,99,99,218,99,99,218,99,11,218,99,218,218,99,99,
  139. 218,99,218,11,99,71,99,218,71,8,99,99,218,99,99,99,218,99,99,218,
  140. 218,99,11,99,99,218,99,218,99,218,218,99,58,99,99,99,58,11,99,99,
  141. 58,99,99,58,58,58,58,99,99,99,99,218,58,99,99,99,58,58,99,99,
  142. 58,58,99,58,99,58,99,99,58,58,99,218,71,71,218,218,218,58,58,58,
  143. 218,99,71,123,12,12,12,19,19,108,108,108,92,92,92,12,71,12,12,92,
  144. 19,53,53,53,101,53,53,19,53,101,53,20,53,79,79,0,34,79,20,63,
  145. 53,53,53,19,19,19,12,12,12,71,71,71,71,71,71,123,71,12,12,12,
  146. 12,12,71,71,218,58,99,58,218,58,218,99,58,99,58,99,99,218,58,58,
  147. 58,99,58,58,99,99,58,99,58,99,99,218,58,58,99,99,99,99,99,99,
  148. 58,11,99,99,218,218,218,99,218,99,99,218,218,99,218,99,99,218,218,99,
  149. 218,99,71,218,99,218,99,99,99,8,218,218,99,218,99,218,99,218,218,99,
  150. 11,218,218,218,218,99,71,99,218,99,99,99,218,58,99,99,99,99,218,30,
  151. 58,99,58,99,58,11,58,99,58,99,58,58,58,99,58,58,99,99,58,58,
  152. 58,99,58,99,58,58,99,58,218,99,99,218,58,99,58,58,58,58,58,218,
  153. 71,12,12,71,71,12,12,12,12,71,71,118,71,71,118,71,71,12,223,19,
  154. 19,53,53,53,53,63,229,20,79,20,34,0,20,101,101,63,20,101,101,53,
  155. 108,53,53,53,53,53,101,19,92,12,12,12,12,71,71,218,218,218,71,71,
  156. 118,12,71,71,218,218,58,58,58,58,58,58,218,58,58,58,99,99,218,99,
  157. 58,58,99,99,58,99,58,99,58,58,58,99,99,99,58,99,99,99,58,58,
  158. 99,58,58,99,99,99,99,99,99,99,218,99,99,218,99,218,218,99,99,218,
  159. 99,58,99,99,218,99,218,218,218,8,99,218,99,218,99,218,11,99,218,99,
  160. 99,99,99,99,218,99,58,99,99,99,58,99,218,99,99,99,99,99,58,99,
  161. 58,218,99,99,99,58,218,58,58,58,99,99,58,99,218,58,99,99,58,218,
  162. 58,99,58,99,99,99,58,99,58,58,58,58,99,58,58,58,58,218,218,12,
  163. 71,71,71,12,12,71,71,12,71,12,71,71,71,71,12,92,19,53,53,53,
  164. 101,63,79,34,251,0,0,63,20,53,19,53,53,53,53,19,19,53,19,19,
  165. 19,108,19,19,19,19,19,19,53,53,108,12,12,12,71,71,218,58,58,58,
  166. 99,218,71,71,71,12,218,99,99,58,58,58,58,218,58,58,58,58,58,99,
  167. 99,58,58,99,58,218,58,99,99,99,99,58,99,128,99,58,99,99,11,99,
  168. 99,58,11,58,99,99,99,218,58,11,99,58,99,218,99,99,218,99,99,99,
  169. 218,71,99,99,218,99,11,99,218,8,218,99,218,99,218,99,99,218,99,218,
  170. 58,218,58,218,99,99,218,99,58,99,99,99,99,78,11,58,99,58,99,99,
  171. 99,58,58,99,58,11,58,58,218,99,99,58,58,58,99,58,58,58,99,99,
  172. 58,58,58,58,58,58,99,58,99,99,99,58,58,58,58,58,218,71,118,12,
  173. 71,71,71,71,71,12,71,71,71,71,71,12,92,19,19,53,53,63,20,251,
  174. 0,79,79,0,79,34,34,79,0,63,229,20,63,101,53,101,19,53,19,92,
  175. 12,71,12,92,12,12,12,12,12,92,19,92,92,71,12,118,71,218,99,58,
  176. 58,58,58,58,218,123,71,218,58,58,58,99,58,58,58,218,58,218,58,58,
  177. 218,58,99,58,58,58,99,99,58,99,58,99,218,99,99,99,58,58,58,11,
  178. 58,58,99,58,99,99,30,99,99,99,58,218,218,30,99,218,99,99,99,218,
  179. 99,99,218,218,99,99,218,71,99,8,99,99,71,99,218,218,99,218,99,218,
  180. 99,218,99,58,11,58,99,99,11,58,99,58,99,99,99,99,58,58,99,99,
  181. 58,99,99,99,99,58,99,78,58,58,99,99,218,78,58,218,58,99,212,58,
  182. 99,58,58,58,218,58,58,58,58,58,58,58,58,58,218,71,12,12,71,71,
  183. 123,218,218,58,99,71,123,71,71,12,19,19,19,53,53,19,19,53,63,53,
  184. 101,101,101,63,101,101,20,20,79,0,0,79,79,34,251,79,79,251,101,53,
  185. 19,92,12,71,71,71,218,12,218,12,71,71,71,71,71,12,71,71,123,71,
  186. 58,58,58,58,58,58,58,99,99,58,58,58,99,58,58,58,99,58,99,58,
  187. 99,58,58,99,58,58,58,58,99,58,99,58,99,58,99,58,99,99,58,58,
  188. 99,99,99,58,99,58,58,58,99,99,99,30,128,58,99,99,99,99,99,58,
  189. 218,99,99,218,218,99,99,218,71,8,71,218,99,99,99,99,218,99,99,99,
  190. 99,30,58,11,58,58,99,58,58,58,58,30,58,58,99,99,99,58,99,58,
  191. 99,58,99,58,58,58,218,99,58,99,58,58,58,218,99,58,58,58,58,58,
  192. 58,99,99,99,58,99,99,58,58,212,99,58,58,218,71,71,218,218,99,58,
  193. 58,58,58,218,123,71,71,12,108,19,19,108,19,19,223,92,19,92,12,12,
  194. 19,19,19,19,53,53,63,63,229,0,34,34,79,0,79,0,75,34,0,34,
  195. 79,20,53,19,92,12,71,71,71,218,71,123,71,123,71,71,71,71,71,71,
  196. 71,218,58,58,58,58,58,58,58,99,58,58,58,58,58,58,58,58,99,58,
  197. 58,99,99,58,99,58,58,58,58,58,58,99,58,99,58,99,58,58,99,99,
  198. 58,58,99,99,58,58,218,58,58,99,58,99,11,58,58,99,58,218,99,99,
  199. 99,99,218,99,99,218,99,99,99,8,99,218,99,218,99,99,99,99,58,58,
  200. 11,58,99,58,58,30,58,11,58,11,58,99,99,58,99,58,58,58,99,58,
  201. 58,99,58,99,99,58,58,99,58,99,58,99,58,99,212,58,58,58,58,58,
  202. 58,58,58,58,58,58,58,58,58,58,212,58,218,218,218,99,58,58,58,58,
  203. 58,99,71,71,71,12,71,71,12,12,12,71,71,123,71,218,71,71,71,92,
  204. 19,108,63,79,229,126,0,79,0,0,34,34,34,126,34,251,79,0,126,34,
  205. 79,0,79,20,63,19,19,12,71,71,71,218,71,99,71,71,71,71,71,71,
  206. 71,71,218,58,58,58,212,58,58,58,58,58,58,58,58,58,58,58,58,58,
  207. 58,58,99,58,58,99,58,58,99,99,128,218,58,58,99,58,99,58,58,99,
  208. 218,58,58,218,99,99,99,99,99,99,58,99,99,58,30,218,99,99,99,99,
  209. 99,99,218,99,99,99,218,218,99,8,218,99,99,99,58,99,99,99,99,99,
  210. 58,58,218,99,99,99,58,99,58,58,58,99,58,99,58,99,99,99,58,58,
  211. 99,99,58,58,58,58,58,58,99,99,58,99,99,58,58,58,58,99,58,58,
  212. 99,58,99,58,78,212,99,212,99,58,58,99,58,58,78,78,246,99,212,58,
  213. 99,71,123,71,71,71,71,71,218,218,71,123,218,218,218,118,12,19,63,63,
  214. 0,0,0,34,34,0,34,79,79,79,0,34,79,79,20,101,53,101,53,19,
  215. 53,53,101,101,53,53,19,19,19,92,218,218,218,218,218,212,78,58,218,218,
  216. 71,71,71,11,58,246,58,78,246,58,58,58,99,99,58,58,99,58,212,58,
  217. 99,58,99,58,58,99,58,58,58,58,58,212,218,58,58,99,58,58,99,58,
  218. 99,99,99,58,58,99,99,99,58,99,58,58,99,99,99,58,58,99,99,99,
  219. 99,99,99,11,58,99,99,99,218,8,99,99,218,99,99,218,99,218,58,58,
  220. 11,78,58,99,58,99,58,99,58,11,58,99,58,99,58,58,58,99,99,58,
  221. 99,99,99,58,58,58,58,58,58,58,58,58,58,58,58,212,99,58,212,99,
  222. 58,58,78,58,78,58,58,58,58,58,58,58,58,58,246,58,246,58,58,71,
  223. 218,71,71,71,218,71,71,71,71,218,218,71,71,92,92,53,63,126,79,0,
  224. 0,79,0,79,34,79,0,126,79,79,79,79,79,229,229,101,53,108,92,71,
  225. 71,71,71,71,71,12,12,19,108,19,92,71,71,71,71,218,212,246,78,58,
  226. 58,218,218,71,71,58,58,212,212,78,212,78,78,58,58,58,58,58,99,58,
  227. 78,58,58,99,58,58,58,58,58,58,58,58,99,58,99,58,58,212,99,58,
  228. 58,99,58,99,58,99,99,58,58,99,99,58,58,58,58,11,78,99,99,99,
  229. 99,58,99,58,71,99,99,99,99,8,99,99,99,218,99,58,99,30,58,11,
  230. 58,11,58,58,99,58,58,99,58,99,58,99,99,58,99,58,99,58,58,99,
  231. 58,58,58,58,58,78,58,99,58,99,58,58,58,58,99,58,212,99,58,58,
  232. 58,78,78,78,58,58,58,58,58,212,58,78,58,78,78,78,58,99,218,218,
  233. 71,218,218,71,58,99,58,99,71,71,71,12,19,20,79,251,0,251,79,251,
  234. 79,63,126,79,79,79,79,229,79,79,79,126,126,79,79,63,20,53,53,92,
  235. 12,12,218,71,71,218,218,218,71,218,71,71,71,218,71,218,218,58,246,246,
  236. 78,212,78,58,218,218,58,58,58,246,78,212,78,212,58,58,58,58,58,212,
  237. 78,78,78,58,58,99,58,58,58,58,58,58,58,58,58,218,99,99,58,99,
  238. 58,58,218,99,58,58,99,58,99,99,58,99,99,99,58,99,99,58,58,58,
  239. 218,99,11,58,99,99,99,218,99,8,99,30,218,58,11,99,99,58,99,58,
  240. 99,58,58,99,218,99,218,58,99,99,58,58,58,58,99,58,99,99,58,99,
  241. 58,58,58,78,78,58,58,58,58,58,99,246,78,78,58,58,58,58,58,78,
  242. 78,212,78,246,246,58,58,58,212,58,212,246,78,246,58,212,218,218,218,218,
  243. 218,58,246,58,246,58,218,218,123,12,19,19,53,53,101,53,63,101,63,63,
  244. 63,63,63,63,63,101,63,53,63,53,53,53,53,108,19,19,19,19,108,19,
  245. 92,92,12,12,71,71,218,99,99,218,218,218,218,218,71,71,71,218,218,246,
  246. 78,78,246,78,78,78,58,58,58,78,78,78,78,246,58,58,58,58,58,78,
  247. 212,78,78,58,58,58,58,99,58,58,58,58,58,58,99,58,58,58,58,58,
  248. 58,99,58,58,99,58,58,58,58,58,58,99,58,58,58,58,58,99,99,99,
  249. 58,99,58,99,99,58,99,99,99,8,99,99,30,58,58,58,58,58,58,99,
  250. 58,11,99,58,99,58,58,58,58,58,58,99,58,58,58,58,58,58,99,58,
  251. 99,58,78,58,58,58,99,58,58,78,246,78,58,78,58,58,58,58,78,212,
  252. 246,78,246,78,78,99,212,246,78,246,58,246,246,78,246,218,218,218,58,58,
  253. 246,78,78,246,58,218,218,71,12,12,108,92,108,19,108,53,63,63,63,53,
  254. 53,53,19,223,92,92,49,118,118,118,118,118,118,118,71,118,118,12,12,12,
  255. 92,71,71,123,218,99,11,58,58,58,58,78,58,99,99,123,71,218,218,218,
  256. 246,246,78,212,78,212,78,246,78,78,58,78,246,78,246,78,58,58,58,58,
  257. 99,78,246,78,246,99,58,58,58,58,58,78,78,78,78,99,58,99,58,99,
  258. 78,58,58,99,58,218,218,58,58,99,58,58,58,218,99,58,58,58,58,11,
  259. 58,99,99,99,58,99,99,218,58,8,99,99,58,99,58,11,58,11,58,58,
  260. 99,58,99,58,99,58,99,58,58,218,58,58,58,99,58,99,58,58,58,99,
  261. 78,58,58,58,99,58,58,78,78,58,246,78,246,99,58,58,58,212,78,78,
  262. 246,58,246,58,78,78,78,58,246,78,78,58,246,58,58,58,212,58,246,78,
  263. 212,246,58,58,71,71,71,71,12,92,92,92,108,53,53,53,19,19,223,223,
  264. 49,223,92,49,49,223,92,49,118,118,118,71,118,112,118,11,11,112,71,112,
  265. 71,71,11,11,11,99,99,58,58,78,78,78,246,78,246,58,99,71,218,71,
  266. 218,78,78,246,78,246,58,246,78,246,212,58,246,58,246,78,212,78,246,58,
  267. 58,58,78,246,246,78,78,99,58,58,58,212,78,58,78,58,58,58,58,58,
  268. 78,58,78,99,58,58,99,58,58,58,58,99,58,58,99,218,58,99,58,58,
  269. 58,58,99,58,99,99,58,99,99,8,99,99,58,58,58,99,58,99,99,58,
  270. 99,58,58,58,58,58,58,218,99,58,99,58,58,58,58,58,99,58,58,78,
  271. 58,78,78,78,78,58,78,58,78,78,78,212,78,58,78,58,78,212,78,246,
  272. 78,246,78,78,212,246,246,78,246,212,246,246,78,246,58,246,78,246,58,246,
  273. 246,58,99,218,218,218,71,12,92,19,19,19,19,19,223,223,49,223,49,118,
  274. 49,112,30,30,237,103,208,208,245,208,245,208,245,245,245,103,208,103,22,237,
  275. 30,30,11,11,11,11,71,71,11,99,58,78,78,246,58,246,246,246,58,99,
  276. 99,218,212,78,246,78,246,78,246,58,78,58,246,78,58,246,78,212,78,246,
  277. 58,212,58,78,78,212,78,78,58,58,99,78,78,78,78,78,58,58,99,58,
  278. 58,78,78,78,58,58,99,58,99,58,58,99,58,218,58,58,99,58,58,218,
  279. 99,58,99,99,58,99,30,99,99,8,58,99,58,99,58,58,58,99,58,99,
  280. 58,218,218,58,99,58,99,58,58,58,78,99,78,58,99,58,58,78,58,78,
  281. 78,58,78,78,58,78,78,246,246,212,78,78,78,58,78,246,78,246,58,246,
  282. 212,78,58,78,78,58,246,78,78,78,58,246,78,246,78,58,246,78,78,78,
  283. 58,218,99,11,71,12,92,92,92,223,223,223,223,223,49,118,112,22,237,208,
  284. 72,245,55,243,245,72,72,72,65,208,236,208,208,245,72,55,243,55,55,243,
  285. 245,245,245,103,237,237,30,11,11,112,71,11,99,58,78,246,246,246,246,78,
  286. 58,218,58,58,246,78,212,78,246,78,246,78,212,78,78,212,78,246,78,78,
  287. 58,78,78,78,78,78,246,246,246,58,58,78,58,246,78,212,78,78,99,58,
  288. 58,78,58,58,58,58,58,99,58,58,58,58,78,58,58,99,99,58,58,58,
  289. 99,218,58,99,99,99,58,99,58,8,99,99,99,58,11,58,58,58,99,58,
  290. 58,58,58,58,58,58,58,99,99,78,78,58,58,78,58,58,99,78,78,78,
  291. 78,78,78,78,78,78,212,246,246,246,246,78,78,246,246,58,246,78,246,78,
  292. 78,78,212,246,246,246,78,78,212,246,246,246,58,246,246,78,246,246,78,58,
  293. 218,99,71,12,12,92,92,82,223,49,223,118,112,22,208,72,72,208,65,22,
  294. 22,112,11,112,112,112,112,112,118,118,118,112,112,112,30,244,244,30,237,65,
  295. 236,72,55,55,243,243,208,208,237,237,11,71,11,11,71,11,99,58,246,246,
  296. 246,78,78,246,58,246,78,246,58,246,58,246,58,246,246,78,78,78,212,78,
  297. 212,246,212,78,246,246,58,78,78,246,99,246,246,58,246,58,78,78,78,58,
  298. 78,78,78,78,78,78,58,58,58,99,58,58,78,99,58,58,58,218,99,99,
  299. 58,58,99,58,99,58,58,99,99,8,58,58,99,58,99,218,99,58,99,99,
  300. 99,58,99,58,99,58,58,58,58,78,58,58,58,58,58,58,58,78,212,78,
  301. 78,58,246,78,58,246,246,246,246,246,246,246,78,58,246,78,246,58,246,58,
  302. 246,78,78,78,58,246,212,78,78,78,58,246,78,212,246,58,78,212,58,99,
  303. 218,71,12,92,19,223,49,49,118,62,30,22,208,208,103,30,244,112,244,118,
  304. 112,23,49,49,49,49,49,49,49,49,82,82,223,82,49,118,23,118,118,112,
  305. 11,30,237,22,65,245,55,243,245,245,103,237,237,11,71,11,71,71,218,58,
  306. 246,246,78,246,78,212,78,246,246,78,246,246,78,78,212,78,212,78,246,78,
  307. 78,58,246,78,58,246,78,212,78,246,78,78,78,78,78,212,246,246,246,78,
  308. 58,78,78,78,58,78,78,58,58,58,58,58,99,58,58,58,58,58,99,58,
  309. 58,58,58,58,58,99,99,58,58,8,99,99,58,58,58,99,99,99,99,58,
  310. 58,99,78,58,78,99,58,58,99,78,78,78,58,78,58,58,78,246,78,212,
  311. 78,78,58,78,246,246,246,246,246,246,58,78,78,246,58,246,78,246,78,246,
  312. 78,212,78,212,212,246,78,78,246,246,78,212,58,99,212,246,246,58,99,218,
  313. 118,12,92,223,223,49,49,11,237,208,208,103,244,23,118,112,118,112,49,49,
  314. 19,82,82,82,223,49,66,49,49,82,223,223,101,19,223,82,223,82,223,82,
  315. 82,49,23,112,11,244,30,65,72,55,55,245,208,22,237,112,11,118,71,218,
  316. 218,58,58,78,246,78,212,78,78,212,99,78,212,246,78,246,78,246,78,212,
  317. 246,246,78,246,246,78,246,78,246,58,246,78,58,78,246,246,246,246,212,246,
  318. 78,78,78,78,78,58,78,78,99,58,78,78,78,99,58,58,99,58,99,99,
  319. 58,99,99,99,99,58,99,58,99,8,99,99,99,58,58,99,58,58,99,58,
  320. 58,58,78,78,58,58,58,58,58,58,78,78,78,78,78,58,246,246,246,246,
  321. 246,78,78,212,246,246,246,246,246,246,78,212,78,246,78,212,78,246,58,246,
  322. 78,246,78,58,58,212,246,58,78,246,246,58,58,58,58,246,58,218,71,12,
  323. 223,223,49,49,49,30,65,72,72,30,112,118,118,112,118,49,223,223,223,49,
  324. 244,244,244,244,23,23,23,23,70,66,49,70,49,70,70,118,23,23,23,23,
  325. 49,223,19,82,223,223,23,11,244,237,208,72,55,55,208,103,30,11,11,49,
  326. 71,71,99,58,246,78,246,246,58,246,58,58,246,212,78,246,58,246,78,58,
  327. 58,212,78,78,212,78,212,78,78,78,212,78,78,78,246,212,246,246,246,212,
  328. 246,58,78,78,78,78,58,78,78,99,58,58,78,58,58,58,99,58,58,58,
  329. 58,58,58,58,99,58,99,58,99,8,99,58,58,218,58,58,58,99,58,58,
  330. 58,99,58,58,99,58,78,78,78,78,78,78,78,58,246,246,246,212,246,246,
  331. 212,246,78,246,246,246,246,246,212,246,246,78,246,58,212,246,78,78,78,246,
  332. 58,246,212,99,58,246,78,246,246,58,58,58,58,78,246,58,99,118,12,92,
  333. 223,223,223,11,22,72,208,244,49,112,112,118,49,82,223,49,244,244,242,62,
  334. 23,62,23,23,244,244,244,244,244,244,62,30,244,244,244,244,23,112,210,23,
  335. 62,244,244,23,223,82,53,82,49,112,30,30,65,72,55,245,208,237,30,112,
  336. 71,49,118,71,99,78,78,78,246,246,58,99,58,246,212,78,246,58,246,212,
  337. 99,58,212,246,78,246,78,246,212,246,78,246,246,212,246,246,246,212,246,246,
  338. 246,246,78,78,246,246,78,78,78,78,58,58,78,58,58,58,58,58,99,99,
  339. 99,78,99,58,99,99,58,99,58,8,58,99,58,99,99,58,58,99,58,58,
  340. 58,58,58,58,78,58,78,78,58,78,58,246,78,78,78,212,246,246,212,246,
  341. 246,246,246,246,246,246,246,246,246,246,246,58,246,58,99,212,246,212,78,78,
  342. 78,99,58,58,78,246,58,78,246,58,58,58,58,212,58,218,71,12,49,49,
  343. 49,112,22,72,65,112,49,112,112,112,223,19,118,62,244,62,62,23,23,244,
  344. 244,244,244,112,23,49,49,223,19,223,82,223,223,49,223,23,118,112,244,30,
  345. 62,62,62,62,23,62,23,223,82,8,82,71,30,244,22,72,55,245,103,237,
  346. 11,71,12,12,71,99,78,78,78,58,212,58,58,58,58,212,78,58,246,78,
  347. 58,58,58,212,78,246,58,78,78,212,212,246,246,246,212,246,246,246,246,246,
  348. 246,246,58,78,78,58,246,212,78,78,58,78,58,78,78,78,58,78,58,58,
  349. 218,58,58,99,58,99,99,99,58,8,218,99,58,58,58,99,58,58,99,78,
  350. 78,58,99,58,58,78,58,78,246,78,78,58,78,212,246,246,246,246,246,246,
  351. 246,246,246,212,246,212,246,246,246,212,78,246,58,58,58,246,78,78,212,246,
  352. 58,58,58,58,212,78,246,212,58,58,58,58,58,58,71,12,49,223,223,49,
  353. 30,208,72,30,49,49,112,49,223,223,23,22,244,62,23,23,62,22,112,118,
  354. 49,49,223,118,23,244,30,242,22,242,242,62,242,244,244,112,23,49,49,223,
  355. 23,112,30,244,62,112,210,23,23,49,82,8,223,244,237,30,208,55,243,245,
  356. 22,30,71,118,12,71,99,78,78,246,212,58,58,58,58,246,246,246,78,246,
  357. 58,58,58,78,212,78,246,246,246,58,58,212,246,246,246,246,246,246,246,246,
  358. 246,78,246,58,246,246,246,78,212,78,78,78,58,78,58,78,58,58,99,58,
  359. 58,58,99,58,58,58,58,58,58,8,58,99,58,58,58,58,99,58,78,78,
  360. 58,58,78,58,58,78,78,58,78,78,78,78,78,246,212,246,246,246,246,246,
  361. 246,246,246,246,246,246,212,246,246,246,78,58,58,58,58,246,78,78,246,99,
  362. 212,58,212,58,212,78,78,58,58,218,58,212,58,99,71,49,223,49,49,30,
  363. 55,72,112,49,244,11,49,82,112,242,242,62,23,62,244,112,118,223,82,118,
  364. 30,236,29,225,231,33,248,42,42,42,219,2,42,219,110,107,231,29,65,244,
  365. 112,223,223,49,112,30,30,23,23,23,23,49,82,101,49,30,30,242,72,243,
  366. 208,103,30,71,118,12,71,99,78,78,78,58,58,58,58,58,78,58,246,78,
  367. 58,58,99,58,246,58,246,58,246,58,99,58,212,246,246,212,246,246,246,246,
  368. 246,246,246,246,212,246,246,246,246,78,58,78,78,78,78,78,58,78,78,78,
  369. 58,78,99,99,99,58,58,99,99,8,99,58,99,99,58,58,58,58,78,78,
  370. 78,78,58,58,58,78,78,78,78,78,246,246,58,246,246,246,246,246,246,246,
  371. 246,246,212,246,99,58,246,246,246,246,212,58,58,58,99,212,78,212,212,58,
  372. 78,58,58,58,246,246,78,58,71,218,58,58,11,71,118,223,49,23,103,243,
  373. 22,49,118,30,118,82,49,30,242,62,70,62,244,118,223,82,112,65,93,205,
  374. 217,42,80,147,98,4,26,8,8,8,8,121,8,8,26,4,98,210,111,219,
  375. 29,29,65,112,223,82,23,30,244,62,62,62,62,49,82,82,112,30,30,65,
  376. 243,245,103,30,71,118,12,71,218,212,246,58,58,212,212,58,58,246,212,78,
  377. 58,58,212,58,58,246,78,246,58,58,58,58,246,212,246,246,246,246,246,246,
  378. 246,212,246,246,246,246,212,246,246,212,78,246,212,78,58,78,78,78,58,78,
  379. 78,78,58,58,58,58,99,58,58,8,58,58,58,58,58,58,58,58,237,78,
  380. 58,78,78,58,78,78,212,78,246,78,78,246,246,246,246,246,246,246,246,246,
  381. 246,246,246,58,58,58,246,246,246,246,58,58,99,58,58,246,246,78,99,78,
  382. 246,78,58,58,58,58,58,218,12,99,58,99,71,92,49,223,118,22,41,65,
  383. 223,23,30,118,19,23,22,242,23,23,30,112,223,19,112,29,222,232,87,80,
  384. 98,26,121,8,20,253,20,20,20,20,101,20,20,20,253,253,20,8,121,26,
  385. 4,14,2,231,29,30,49,82,112,30,244,62,23,210,118,82,101,223,30,244,
  386. 65,55,243,103,237,71,118,71,71,99,58,58,58,58,218,58,58,58,246,212,
  387. 58,58,212,78,99,58,246,246,78,58,58,58,58,246,246,246,246,246,246,246,
  388. 246,246,246,212,246,246,246,246,246,246,246,78,78,78,78,78,58,78,58,78,
  389. 78,58,58,58,78,99,58,58,99,8,99,58,58,99,99,58,58,58,58,237,
  390. 78,78,58,78,78,246,78,246,78,246,78,246,246,246,246,246,246,246,246,246,
  391. 246,246,58,58,58,58,246,246,246,58,99,78,246,212,99,246,212,58,78,246,
  392. 58,246,58,58,58,212,218,12,118,58,58,71,12,49,19,49,237,41,65,49,
  393. 118,112,223,82,244,236,62,66,62,30,82,8,112,93,68,6,137,88,162,253,
  394. 253,20,253,19,223,23,244,244,54,242,54,242,244,62,112,49,223,20,20,20,
  395. 20,253,26,98,14,33,29,244,82,101,112,22,62,62,62,23,49,53,82,30,
  396. 112,22,243,243,208,11,71,118,12,218,99,58,58,58,12,71,58,58,58,58,
  397. 99,58,58,246,246,58,58,246,246,58,58,58,99,58,246,246,246,246,78,58,
  398. 246,212,246,246,246,246,246,212,246,246,78,78,78,78,58,78,78,78,78,58,
  399. 78,58,78,237,78,58,99,99,78,8,58,99,58,58,78,78,78,78,78,78,
  400. 58,78,78,58,78,246,78,212,246,246,246,246,246,246,246,246,246,103,246,246,
  401. 246,246,58,58,58,99,212,246,246,58,212,78,246,58,58,58,58,58,212,78,
  402. 78,78,58,58,58,58,123,49,218,99,11,118,223,223,82,237,41,208,23,118,
  403. 237,223,82,244,18,210,23,23,112,19,223,103,64,6,148,147,26,253,20,8,
  404. 66,23,54,111,219,219,137,24,76,24,163,25,137,42,204,42,151,109,244,223,
  405. 20,20,20,20,8,4,111,231,236,23,82,12,237,62,62,23,62,223,253,223,
  406. 237,244,22,41,245,103,11,112,118,71,218,58,58,99,92,92,128,58,58,58,
  407. 58,58,58,212,78,58,58,212,58,58,58,78,78,58,212,246,246,246,58,58,
  408. 212,246,212,246,246,246,246,246,246,212,246,78,246,246,78,78,78,78,78,58,
  409. 78,58,58,78,99,58,58,58,99,8,99,58,58,58,58,78,78,58,78,78,
  410. 78,78,78,78,78,58,246,246,246,246,246,246,246,246,103,246,246,246,246,246,
  411. 246,78,58,58,58,58,58,212,58,58,78,212,78,78,99,58,58,212,78,246,
  412. 212,212,58,58,58,218,92,12,218,99,71,12,223,82,118,243,55,23,223,30,
  413. 223,19,244,93,54,49,23,112,82,82,245,153,138,234,162,8,253,101,49,30,
  414. 111,125,24,201,142,16,159,142,43,95,197,156,193,193,51,141,224,25,248,231,
  415. 65,118,20,20,20,20,121,210,231,55,244,82,49,30,244,62,62,244,223,20,
  416. 118,237,112,208,243,245,237,71,118,49,71,58,58,218,92,92,12,58,58,99,
  417. 58,58,212,78,212,212,58,58,58,58,58,212,78,58,58,246,246,246,99,58,
  418. 99,246,246,246,246,246,246,246,246,246,212,246,58,78,78,78,78,78,58,78,
  419. 78,58,78,78,58,78,58,99,58,8,99,99,58,58,58,78,78,58,78,58,
  420. 78,78,78,246,78,78,78,246,246,246,246,246,246,246,246,103,246,246,246,246,
  421. 246,58,58,58,58,58,58,58,58,58,78,78,246,78,58,58,58,212,78,58,
  422. 58,78,58,58,58,12,92,12,99,218,118,19,82,223,22,116,237,49,112,112,
  423. 101,112,93,109,70,112,118,82,223,55,136,185,44,26,253,253,82,62,107,163,
  424. 117,16,114,159,161,106,98,46,26,26,26,26,26,4,32,81,44,142,43,234,
  425. 10,56,236,23,20,20,20,8,4,219,225,237,19,82,11,244,62,54,62,223,
  426. 20,112,30,244,72,239,103,237,71,12,12,71,58,71,92,92,12,128,58,58,
  427. 58,58,246,78,246,58,58,58,99,58,58,246,78,78,58,246,246,58,58,58,
  428. 58,212,246,212,246,246,246,246,246,246,78,78,246,58,246,58,78,246,78,58,
  429. 78,58,78,78,58,58,58,58,58,8,58,58,58,58,78,237,58,78,78,78,
  430. 78,78,78,58,246,246,212,246,246,246,246,246,246,246,246,246,246,246,246,246,
  431. 78,58,58,58,58,58,99,58,58,246,246,246,58,246,58,58,58,78,246,218,
  432. 11,58,58,58,58,12,92,71,218,11,49,223,101,23,239,93,23,118,244,223,
  433. 223,65,29,70,70,112,82,82,72,233,135,152,121,253,20,49,242,179,176,39,
  434. 198,156,32,47,26,26,69,113,26,47,9,47,162,113,26,121,113,252,152,159,
  435. 43,234,217,238,30,253,20,251,8,4,107,17,30,82,223,22,62,62,54,244,
  436. 82,19,237,112,244,41,245,30,112,71,92,71,99,71,12,92,92,71,78,58,
  437. 58,246,246,58,78,212,58,58,58,58,58,78,246,58,99,58,212,58,58,58,
  438. 58,78,246,246,246,246,246,246,246,246,246,246,78,78,78,78,246,58,78,78,
  439. 58,58,58,99,58,99,58,58,58,8,58,99,99,58,58,78,78,58,78,58,
  440. 78,58,78,78,78,78,78,246,246,246,246,246,246,246,246,246,78,246,246,246,
  441. 58,58,78,58,78,58,58,99,58,78,58,246,246,58,58,58,212,58,58,12,
  442. 71,58,58,58,99,92,92,71,218,71,223,8,19,22,150,30,49,11,23,101,
  443. 30,93,54,49,112,49,20,30,254,181,95,26,253,253,49,65,163,166,206,202,
  444. 52,26,8,121,4,161,43,114,139,131,57,200,195,188,192,88,26,26,121,98,
  445. 197,67,234,145,230,22,82,20,20,8,98,107,100,112,253,112,103,244,54,62,
  446. 49,20,49,237,118,208,243,103,11,11,12,92,92,92,92,12,49,12,58,58,
  447. 78,58,246,78,246,78,212,99,58,58,78,246,58,78,58,58,58,99,58,58,
  448. 58,99,246,246,246,246,246,246,246,246,246,246,246,78,246,78,246,78,58,78,
  449. 78,58,78,78,78,58,58,99,58,8,99,58,58,58,99,78,58,78,78,78,
  450. 78,78,78,78,78,246,246,246,246,246,246,246,246,246,246,246,58,212,58,246,
  451. 99,212,58,99,78,99,58,58,78,246,58,58,58,78,78,58,78,78,99,71,
  452. 12,71,58,58,12,12,12,71,11,12,223,101,49,243,100,118,223,112,82,19,
  453. 93,225,113,23,244,101,223,41,129,199,52,253,20,223,242,124,39,57,117,122,
  454. 121,121,47,44,195,35,94,196,165,189,189,189,27,84,200,139,67,186,26,121,
  455. 240,106,159,234,175,68,242,20,20,20,8,210,238,93,223,19,237,244,23,54,
  456. 62,19,101,244,112,30,243,208,237,11,12,92,49,223,12,12,92,12,58,78,
  457. 246,78,58,246,78,212,78,78,58,58,212,58,58,58,78,99,58,58,99,58,
  458. 58,58,246,246,246,246,246,246,246,246,246,246,78,246,58,78,58,78,78,78,
  459. 78,78,237,78,58,58,58,58,58,8,99,58,99,58,78,78,78,58,78,78,
  460. 78,78,78,78,78,58,246,246,246,246,103,246,246,246,246,218,58,58,78,78,
  461. 58,99,71,12,58,78,58,78,58,78,123,12,78,78,58,212,78,78,123,92,
  462. 12,12,99,99,12,92,92,71,11,118,82,101,112,116,236,82,112,112,82,118,
  463. 100,110,66,23,49,101,244,215,73,43,69,253,101,23,219,59,97,202,52,8,
  464. 8,4,120,97,187,139,27,143,46,113,26,26,46,88,60,27,131,200,192,47,
  465. 82,66,81,159,234,170,68,118,20,251,20,26,2,64,244,101,118,22,23,62,
  466. 62,49,20,118,244,23,208,245,30,11,71,12,92,12,12,49,12,12,71,58,
  467. 246,246,78,246,78,246,58,78,58,78,212,218,12,246,78,99,58,78,78,11,
  468. 12,58,58,246,246,103,246,246,58,246,246,246,246,78,246,78,78,78,58,78,
  469. 78,58,58,58,78,58,58,99,58,8,99,58,58,58,99,78,58,78,78,78,
  470. 78,212,78,246,246,78,99,58,246,246,246,246,246,246,71,12,99,58,58,99,
  471. 58,58,53,251,71,78,78,78,78,246,19,19,71,246,246,78,212,246,12,92,
  472. 12,12,12,12,92,12,12,71,218,118,19,101,244,239,65,223,244,11,53,112,
  473. 222,235,66,112,223,20,72,45,90,221,8,253,19,242,214,97,57,152,26,8,
  474. 26,188,57,187,139,186,8,8,8,8,121,121,8,8,26,4,44,131,94,67,
  475. 162,82,113,44,159,76,220,29,82,0,20,8,98,238,245,82,82,237,23,62,
  476. 54,112,20,223,237,49,22,245,237,11,71,49,12,92,12,12,12,12,71,78,
  477. 246,58,246,58,246,78,246,58,246,212,58,19,101,218,78,78,99,58,58,53,
  478. 101,71,58,246,246,246,78,71,92,58,246,246,212,246,78,58,58,78,78,58,
  479. 78,78,78,78,58,58,58,58,58,8,99,99,58,99,58,78,78,58,99,58,
  480. 78,78,58,246,78,58,71,92,218,246,246,246,103,246,12,92,92,58,58,58,
  481. 58,218,63,53,19,246,246,78,78,212,53,92,92,212,246,78,78,58,92,218,
  482. 12,12,92,92,92,12,12,71,11,118,101,101,22,116,242,223,237,11,8,30,
  483. 17,62,70,112,8,53,72,172,134,143,8,20,223,109,102,57,97,81,121,82,
  484. 252,114,35,157,165,26,253,8,8,46,182,4,26,26,8,8,113,160,190,35,
  485. 186,66,121,106,117,152,232,68,49,79,20,8,26,42,17,223,53,22,112,244,
  486. 54,244,8,82,30,118,30,245,30,11,99,12,12,92,123,12,12,12,71,78,
  487. 246,78,246,78,58,246,246,58,246,58,12,53,53,12,78,78,78,99,12,63,
  488. 63,92,78,78,246,246,78,229,229,12,246,246,246,212,78,71,71,58,78,78,
  489. 58,78,78,58,58,58,212,58,58,8,99,58,58,58,58,78,78,58,99,218,
  490. 99,58,246,78,78,58,12,92,12,78,246,246,246,218,92,92,19,71,58,58,
  491. 58,12,38,92,53,71,246,58,246,218,108,92,92,218,246,212,78,58,12,218,
  492. 12,12,12,92,12,92,12,71,71,118,82,8,103,116,242,82,244,11,82,30,
  493. 222,210,223,23,8,101,55,172,183,186,8,253,223,110,102,157,97,161,8,8,
  494. 127,67,190,140,189,26,8,8,69,127,120,5,52,26,26,8,121,9,84,187,
  495. 43,113,82,98,142,152,89,119,244,20,0,253,121,219,64,23,101,30,30,23,
  496. 54,244,82,101,30,112,112,72,237,71,30,12,12,92,118,12,12,12,71,58,
  497. 246,246,58,246,58,212,78,246,58,246,108,63,53,19,78,78,78,58,53,101,
  498. 53,108,78,246,246,246,108,79,20,53,246,246,246,78,99,92,92,12,99,78,
  499. 78,58,58,218,218,218,99,58,58,8,99,99,58,58,58,99,99,218,71,11,
  500. 99,99,78,246,212,71,218,71,92,71,246,246,246,71,92,92,19,19,58,58,
  501. 58,92,53,92,92,108,58,246,246,71,92,92,92,92,212,246,246,58,123,48,
  502. 12,12,12,92,92,12,12,12,99,118,19,101,237,116,65,49,30,112,82,244,
  503. 222,235,26,118,82,101,65,136,183,7,8,8,82,242,21,157,57,192,69,8,
  504. 26,7,191,157,190,60,9,8,26,52,84,131,60,4,121,8,26,113,67,94,
  505. 142,113,82,98,43,152,10,119,244,251,0,253,121,111,64,23,101,244,22,49,
  506. 62,62,82,101,112,23,112,103,30,71,11,12,12,118,12,12,118,12,71,78,
  507. 78,246,78,58,218,58,78,246,246,12,53,101,53,19,58,78,58,12,63,63,
  508. 53,63,218,246,246,71,79,20,63,101,218,246,246,218,12,19,108,12,99,58,
  509. 99,71,218,71,71,218,71,218,71,8,99,58,99,99,58,58,11,218,71,218,
  510. 71,71,218,58,58,99,218,99,71,92,218,78,246,92,92,12,223,53,71,58,
  511. 58,19,19,92,92,19,12,78,78,12,92,92,92,92,71,78,78,218,123,241,
  512. 48,12,12,92,49,12,118,12,71,49,223,101,11,116,65,66,112,11,82,112,
  513. 100,54,66,66,223,20,244,105,90,159,8,8,8,244,10,167,187,202,98,8,
  514. 121,47,192,169,190,35,195,188,188,195,57,84,106,47,8,8,8,122,195,140,
  515. 95,66,82,98,142,221,175,119,244,251,251,20,8,219,64,112,101,30,242,118,
  516. 23,62,19,20,11,118,112,22,11,11,99,12,12,12,12,71,12,118,71,58,
  517. 246,58,246,99,12,99,212,78,58,19,53,53,101,53,58,78,218,53,101,53,
  518. 53,63,218,246,246,63,0,101,19,53,12,78,58,12,108,92,19,108,92,71,
  519. 71,12,71,71,123,71,71,123,71,8,99,99,58,58,58,11,58,11,99,218,
  520. 99,11,99,99,218,99,218,99,71,12,12,99,99,92,92,92,12,19,53,71,
  521. 99,38,53,12,12,92,19,218,212,92,92,92,48,12,108,128,246,218,123,48,
  522. 128,123,12,12,12,12,12,118,71,71,223,8,112,41,55,49,49,244,223,49,
  523. 93,231,70,82,223,20,82,116,181,158,252,8,20,223,242,214,57,157,156,46,
  524. 8,66,26,147,44,198,86,196,86,198,44,52,4,8,8,8,46,60,97,194,
  525. 52,82,82,180,159,177,232,64,66,79,20,8,26,231,100,49,8,237,62,23,
  526. 62,244,82,82,30,223,11,237,112,11,11,12,12,71,12,12,118,12,71,218,
  527. 246,78,58,218,92,99,246,212,92,53,79,79,53,53,218,58,19,63,38,126,
  528. 53,101,92,58,19,251,63,223,19,19,92,71,12,223,92,223,223,92,19,92,
  529. 12,71,123,71,71,71,71,71,71,8,11,58,11,58,99,58,99,58,99,58,
  530. 58,218,218,218,99,218,11,99,99,71,92,92,12,49,92,71,99,12,53,53,
  531. 92,20,53,123,48,12,92,19,218,19,92,12,241,48,92,92,58,218,92,241,
  532. 128,212,71,12,118,12,12,71,71,112,223,19,82,55,116,112,49,244,223,19,
  533. 208,238,235,66,223,253,82,22,250,73,95,113,8,82,49,111,102,207,132,188,
  534. 252,69,8,121,162,4,47,52,127,4,4,26,26,8,8,46,186,86,169,95,
  535. 66,8,4,95,192,87,45,236,101,251,253,8,70,222,236,223,223,237,244,23,
  536. 54,244,82,82,237,118,11,244,71,11,99,71,118,12,12,12,12,12,12,58,
  537. 78,78,246,123,108,12,212,12,53,63,13,83,63,53,12,92,53,226,13,13,
  538. 53,53,53,226,75,63,12,71,92,19,19,92,92,92,19,12,12,12,92,12,
  539. 71,71,71,71,71,12,71,71,71,8,99,99,58,99,99,58,58,99,58,58,
  540. 11,218,71,71,11,218,99,99,58,218,12,19,92,92,92,99,78,58,92,101,
  541. 75,251,53,12,123,48,92,108,101,63,92,12,241,241,92,92,108,92,108,128,
  542. 212,246,58,12,12,12,49,12,12,118,12,49,19,237,116,22,49,118,244,82,
  543. 112,17,231,70,223,82,20,82,93,45,133,7,46,8,8,49,50,224,168,207,
  544. 142,60,127,46,8,26,8,8,8,8,8,8,121,26,47,192,166,169,7,113,
  545. 66,113,7,156,36,217,28,23,251,251,20,26,111,222,30,8,49,22,112,62,
  546. 242,112,101,112,30,49,244,11,112,11,99,71,12,12,118,12,12,12,71,246,
  547. 246,78,212,92,108,92,218,53,38,13,0,0,63,101,20,63,101,75,83,83,
  548. 63,101,229,79,126,92,58,78,12,19,92,92,19,92,12,71,71,118,71,71,
  549. 218,12,71,71,71,71,71,218,99,8,218,99,218,58,58,218,99,99,58,99,
  550. 58,58,99,99,218,99,218,99,58,58,99,92,92,92,19,58,78,78,99,108,
  551. 0,34,38,123,123,48,123,92,53,108,92,12,241,241,241,123,92,19,19,123,
  552. 241,212,246,99,12,71,12,71,12,71,118,223,82,118,245,100,112,49,30,118,
  553. 223,237,238,111,113,223,19,20,49,93,144,184,44,113,8,253,19,210,173,141,
  554. 168,57,196,142,60,52,122,182,113,113,122,3,60,159,130,86,43,122,26,223,
  555. 47,106,95,76,89,68,244,20,251,20,8,210,238,72,223,19,30,112,23,62,
  556. 244,223,20,118,112,112,244,118,11,99,99,218,71,218,71,12,12,71,58,58,
  557. 78,246,246,92,63,53,53,101,83,0,83,83,53,63,63,53,20,83,0,0,
  558. 53,53,79,0,226,78,58,78,12,108,92,19,92,71,58,58,99,71,71,123,
  559. 71,218,218,71,218,218,99,218,99,8,99,99,218,218,99,99,99,99,58,99,
  560. 99,58,99,11,71,99,99,58,58,58,58,71,92,92,19,78,78,58,78,218,
  561. 53,63,101,123,123,48,48,123,92,19,92,92,241,241,241,241,92,92,92,12,
  562. 241,212,78,78,123,118,12,12,12,12,112,92,49,223,30,247,65,49,23,112,
  563. 82,23,72,231,14,26,82,19,101,49,17,146,102,154,147,69,8,82,49,23,
  564. 249,104,158,39,206,169,86,130,202,142,202,114,39,117,76,88,4,66,66,113,
  565. 7,95,234,175,68,22,101,20,251,8,4,107,100,112,101,112,30,23,112,62,
  566. 49,101,49,244,118,112,112,118,11,78,99,99,99,58,71,12,92,99,246,78,
  567. 246,58,218,108,108,53,63,229,0,83,34,13,53,53,101,38,13,0,0,13,
  568. 53,101,63,101,99,78,58,78,71,19,19,92,71,58,99,58,11,218,218,71,
  569. 99,99,99,99,218,58,99,218,218,8,71,218,99,99,218,58,99,99,99,99,
  570. 99,58,99,58,99,218,11,58,58,99,58,58,71,92,92,58,78,78,78,78,
  571. 118,19,53,123,48,128,128,48,123,12,92,92,48,128,212,48,241,12,12,92,
  572. 241,128,246,246,246,71,12,12,12,71,71,118,49,223,49,208,116,22,49,23,
  573. 11,223,223,72,225,235,113,82,82,101,49,65,68,164,201,7,162,26,8,121,
  574. 66,223,23,216,14,36,177,152,154,152,80,255,98,66,66,223,66,4,32,152,
  575. 152,163,228,222,112,251,20,20,8,113,219,222,22,82,23,22,62,112,54,244,
  576. 101,82,112,112,23,118,112,11,11,78,58,58,246,99,71,71,99,58,246,212,
  577. 58,58,123,108,108,53,20,13,101,19,34,13,53,53,53,0,75,38,0,34,
  578. 63,53,53,71,58,78,58,78,11,92,92,71,58,58,58,58,99,218,11,99,
  579. 11,58,218,218,99,99,218,99,99,8,99,71,99,99,99,99,99,218,58,99,
  580. 218,58,99,99,99,58,58,78,58,99,58,58,58,71,12,78,78,78,78,78,
  581. 58,12,19,12,48,218,246,218,48,12,92,92,241,48,58,212,48,241,12,92,
  582. 48,241,212,58,212,212,123,118,12,71,118,118,12,223,49,118,55,239,244,223,
  583. 112,112,82,118,236,225,14,4,26,82,101,19,112,93,153,21,224,174,88,162,
  584. 26,26,121,82,66,66,66,66,66,66,26,82,66,26,113,127,32,44,51,87,
  585. 248,222,236,223,20,20,20,8,70,111,17,237,223,49,237,30,62,54,30,118,
  586. 253,49,112,118,23,118,118,11,99,58,58,58,212,99,71,218,246,78,78,58,
  587. 58,58,108,108,63,38,13,92,58,12,13,251,53,63,251,79,12,71,34,34,
  588. 251,53,19,58,78,78,78,58,58,71,71,58,99,99,58,99,58,11,58,99,
  589. 99,99,99,218,218,99,218,218,99,8,71,99,218,218,218,99,218,99,99,99,
  590. 99,71,58,99,99,99,99,58,58,99,58,58,78,58,99,78,58,78,58,78,
  591. 78,78,99,218,128,58,58,78,128,48,12,92,123,241,78,246,58,48,241,218,
  592. 12,128,212,212,58,58,212,218,71,12,71,12,118,12,223,49,11,243,55,244,
  593. 49,112,244,223,49,236,17,111,4,121,82,82,8,223,244,29,153,61,148,234,
  594. 152,32,147,52,4,4,113,26,113,26,98,98,147,255,7,193,24,163,217,238,
  595. 110,112,101,20,20,253,8,70,107,222,22,223,223,244,244,244,244,242,112,82,
  596. 223,118,23,23,49,118,71,11,58,58,58,246,246,58,99,78,58,212,212,78,
  597. 58,99,53,53,38,83,19,58,246,19,34,79,251,34,34,71,58,71,79,13,
  598. 83,63,218,58,58,99,58,78,58,99,78,58,99,99,99,58,58,99,99,58,
  599. 218,11,218,99,11,218,11,99,71,8,71,218,218,11,71,99,218,99,99,99,
  600. 99,218,11,99,58,58,58,58,11,58,99,218,58,58,78,78,78,78,58,58,
  601. 78,78,78,78,58,78,78,78,58,58,48,123,48,48,128,78,246,78,128,241,
  602. 241,241,128,212,58,58,58,58,218,12,118,71,71,112,118,223,49,11,245,55,
  603. 30,49,112,244,223,19,30,93,107,111,4,26,101,101,8,101,112,242,93,203,
  604. 6,170,21,74,51,51,104,24,234,76,24,104,76,124,232,56,225,18,30,223,
  605. 20,20,20,20,8,66,235,231,236,112,223,118,30,112,112,54,244,112,82,49,
  606. 112,23,118,118,12,11,99,99,246,58,58,58,78,58,246,246,78,78,212,78,
  607. 58,12,53,229,34,40,78,78,58,38,0,13,13,79,71,58,58,71,13,0,
  608. 38,71,58,99,58,99,58,99,78,58,58,99,99,99,71,99,58,99,218,99,
  609. 71,99,218,99,99,71,218,99,71,8,71,71,71,123,218,218,11,218,218,218,
  610. 218,99,218,218,99,99,99,99,58,99,99,99,99,99,58,78,78,58,58,99,
  611. 99,78,78,246,78,212,78,78,58,78,128,48,48,241,48,246,78,58,246,128,
  612. 128,128,128,128,212,78,212,78,58,218,71,71,12,12,118,118,49,49,112,208,
  613. 41,22,49,112,244,23,19,49,22,93,219,14,4,8,82,101,20,101,223,49,
  614. 30,65,18,29,17,203,228,230,56,96,91,225,225,236,242,112,49,82,20,20,
  615. 20,20,82,113,210,107,29,22,118,223,112,30,244,244,62,112,23,82,223,49,
  616. 118,118,49,49,118,71,99,246,58,58,212,246,246,78,212,58,246,246,78,58,
  617. 218,53,209,126,40,78,78,78,218,0,34,34,79,71,78,99,58,71,251,229,
  618. 12,58,99,99,99,58,58,58,58,99,99,99,99,218,99,58,99,99,99,218,
  619. 99,218,11,218,218,11,218,71,71,8,71,123,71,71,218,123,71,99,11,99,
  620. 218,11,99,71,218,99,58,99,99,58,218,218,99,99,58,58,58,58,99,58,
  621. 58,99,58,246,246,246,78,58,58,58,78,58,48,48,241,78,246,78,78,58,
  622. 58,241,241,241,212,58,246,78,246,58,218,71,71,71,118,118,118,49,49,112,
  623. 103,243,236,112,49,244,112,49,223,118,65,93,107,14,98,113,82,8,101,253,
  624. 101,20,101,82,82,223,118,118,49,49,49,82,82,101,101,20,20,253,253,121,
  625. 26,70,235,110,29,103,118,223,223,11,244,244,54,242,244,49,19,223,49,118,
  626. 118,49,12,71,11,99,212,246,78,78,78,78,212,246,78,58,78,212,78,58,
  627. 12,38,213,71,78,58,58,78,40,83,79,20,99,58,99,58,99,12,92,71,
  628. 78,58,99,99,99,99,99,99,99,99,218,218,99,218,218,99,218,218,11,218,
  629. 11,218,218,71,218,218,71,123,71,8,71,71,12,71,71,218,218,218,71,71,
  630. 218,218,218,218,71,218,218,99,99,218,99,99,99,99,99,99,58,99,58,99,
  631. 99,99,99,58,78,78,78,78,58,99,58,58,58,128,48,128,78,78,58,78,
  632. 212,212,212,241,128,58,246,246,58,246,58,218,218,118,71,71,118,12,118,49,
  633. 23,237,245,55,208,23,118,23,112,223,223,118,244,236,18,110,14,210,4,66,
  634. 121,8,82,20,82,101,101,251,20,20,20,101,8,20,8,8,26,26,210,235,
  635. 109,110,65,30,118,223,49,244,244,244,244,242,65,30,223,82,49,118,118,49,
  636. 92,49,118,71,11,78,246,78,58,246,212,246,78,78,246,78,246,78,212,218,
  637. 53,92,99,78,58,58,58,246,53,0,53,99,99,58,99,58,99,71,218,58,
  638. 99,58,99,218,58,99,58,78,99,99,11,99,71,99,99,218,99,99,218,71,
  639. 123,218,71,218,12,71,71,71,71,8,71,71,71,71,71,118,71,71,218,99,
  640. 71,71,71,123,71,71,218,99,99,218,218,71,11,218,99,99,58,99,58,99,
  641. 99,99,218,58,58,78,78,78,58,99,99,58,58,58,58,128,246,78,58,58,
  642. 58,58,246,128,128,58,212,246,78,78,78,58,58,218,71,71,11,118,118,49,
  643. 12,23,11,103,243,72,237,23,23,112,23,223,19,223,112,22,109,18,29,111,
  644. 111,210,210,70,4,26,26,26,26,26,26,4,4,70,98,235,2,18,29,65,
  645. 54,23,223,49,23,244,244,112,244,54,22,244,118,82,223,223,118,92,49,49,
  646. 223,71,11,99,99,78,246,58,246,78,58,212,78,78,58,58,246,78,58,218,
  647. 71,78,58,58,99,58,58,99,19,77,58,58,58,218,99,58,58,58,58,58,
  648. 218,99,11,218,58,99,218,58,218,218,71,218,218,71,99,71,218,71,71,218,
  649. 71,123,71,71,71,71,71,71,12,8,118,118,71,71,118,71,71,71,118,12,
  650. 71,123,71,71,71,71,71,71,218,99,99,99,218,218,71,218,99,99,58,99,
  651. 99,218,99,218,58,58,246,78,78,99,99,99,99,58,246,78,58,246,58,58,
  652. 58,58,58,78,78,58,58,58,246,212,99,58,58,58,218,99,71,118,11,118,
  653. 49,49,49,23,11,208,55,245,22,112,23,23,23,23,49,49,49,223,112,30,
  654. 22,236,18,18,18,29,18,18,18,18,107,236,29,236,236,22,30,23,223,223,
  655. 223,118,118,112,244,112,244,242,242,30,23,223,82,223,49,49,49,223,49,12,
  656. 71,71,99,58,246,212,58,58,58,78,78,78,58,58,58,58,78,212,246,78,
  657. 78,58,58,11,99,58,78,78,99,58,58,99,218,99,58,99,58,58,58,218,
  658. 99,71,218,99,218,58,99,218,218,71,218,123,71,99,71,218,71,71,71,12,
  659. 71,71,12,12,12,12,12,12,12,8,12,12,12,12,12,12,118,118,71,71,
  660. 71,218,71,123,71,71,71,71,123,71,218,11,218,71,218,123,218,99,218,58,
  661. 99,99,11,218,71,99,99,58,78,58,99,99,71,99,58,78,246,246,246,58,
  662. 58,218,58,99,78,78,246,78,78,246,58,58,58,212,58,58,99,71,71,118,
  663. 71,118,118,23,49,112,112,103,72,72,65,244,112,23,118,118,70,223,223,223,
  664. 223,49,118,23,118,112,112,244,112,112,23,23,23,49,49,223,223,49,23,118,
  665. 244,244,112,62,244,109,22,30,49,223,223,82,49,223,49,223,223,118,118,71,
  666. 99,99,99,78,78,246,58,58,78,78,58,58,58,99,78,246,78,78,78,78,
  667. 99,99,99,58,99,58,78,78,58,99,99,11,218,99,99,58,58,11,99,218,
  668. 218,218,71,99,218,218,11,218,123,71,218,71,71,218,71,71,123,71,118,12,
  669. 71,12,12,12,12,12,12,12,12,8,12,12,12,12,12,12,71,71,71,118,
  670. 71,118,71,71,118,12,71,71,71,71,99,218,123,71,218,71,218,71,99,99,
  671. 99,218,218,71,218,218,99,58,58,58,58,218,99,218,218,99,58,99,78,58,
  672. 58,99,99,99,58,58,78,246,246,78,78,78,58,99,58,58,99,58,99,71,
  673. 11,71,12,23,118,118,118,23,112,30,103,208,208,65,242,112,118,23,23,118,
  674. 118,118,49,112,23,112,11,112,112,112,118,49,49,49,49,112,23,23,112,244,
  675. 244,22,22,22,242,112,49,223,223,66,223,49,223,49,223,49,12,71,71,99,
  676. 99,58,212,212,246,58,78,78,58,58,99,99,99,58,78,78,78,78,58,58,
  677. 99,99,99,58,58,58,58,58,99,218,71,218,99,99,218,58,99,99,71,218,
  678. 71,71,218,99,71,99,123,71,118,118,123,71,71,123,71,71,12,12,118,12,
  679. 12,12,12,12,12,12,71,12,71,8,12,92,12,92,71,12,118,118,12,12,
  680. 118,71,71,12,71,71,118,12,12,71,118,218,71,71,71,12,71,12,218,218,
  681. 99,99,218,218,71,71,71,218,99,99,99,99,71,71,218,71,99,58,58,58,
  682. 58,58,99,11,99,99,99,58,246,78,246,78,58,99,99,99,58,58,99,99,
  683. 99,11,71,112,112,118,118,92,118,23,118,112,30,237,103,65,65,22,30,54,
  684. 244,244,23,112,244,112,244,112,244,23,244,23,112,62,244,244,30,242,22,242,
  685. 22,30,23,49,49,19,82,223,223,49,49,49,223,49,12,11,11,218,99,58,
  686. 58,78,78,78,246,78,78,99,99,58,99,58,58,78,78,78,58,99,218,218,
  687. 71,99,99,99,58,99,58,99,71,123,71,218,99,99,218,99,218,71,12,71,
  688. 71,218,71,71,218,71,71,71,71,71,12,71,71,71,118,12,12,12,71,71,
  689. 12,12,12,12,118,12,12,92,12,8,12,12,71,12,12,12,12,12,71,12,
  690. 118,12,12,12,118,12,71,12,12,71,71,71,71,123,71,12,12,71,71,218,
  691. 218,218,11,71,123,71,71,218,71,99,99,58,99,99,71,218,218,99,218,58,
  692. 58,58,58,99,218,71,99,218,58,58,58,246,212,58,58,99,99,58,99,58,
  693. 58,58,58,218,71,71,112,71,118,118,49,23,118,118,49,112,112,30,237,22,
  694. 22,22,103,22,22,22,22,22,30,242,22,22,22,103,22,22,30,112,112,23,
  695. 49,49,49,82,223,66,49,49,49,49,223,12,118,71,218,99,99,58,99,58,
  696. 78,246,78,246,58,58,99,99,218,218,99,99,99,58,58,58,99,218,71,218,
  697. 99,99,58,58,58,99,218,123,71,71,218,218,99,99,99,123,71,71,71,92,
  698. 71,71,218,218,71,12,12,12,118,71,12,118,71,71,71,12,12,12,12,12,
  699. 12,12,118,118,12,12,12,12,12,8,92,92,92,12,12,12,12,12,12,12,
  700. 92,12,12,12,71,12,118,12,12,12,12,12,71,71,71,12,12,71,118,71,
  701. 71,123,71,71,71,118,71,71,71,123,71,218,218,99,218,71,12,71,71,218,
  702. 218,58,58,99,58,71,71,218,218,218,99,58,58,58,58,58,99,99,99,218,
  703. 218,99,58,58,99,99,99,11,11,11,23,112,118,112,49,118,118,118,23,118,
  704. 49,118,23,112,112,112,112,244,112,112,118,112,118,49,49,223,49,223,223,49,
  705. 223,223,49,49,223,49,223,223,118,118,71,11,218,99,218,99,218,78,58,58,
  706. 58,58,58,218,218,218,218,218,58,99,58,58,58,58,218,99,71,71,123,71,
  707. 218,99,58,99,99,71,71,12,12,71,71,71,218,218,218,71,118,71,71,12,
  708. 123,71,12,71,71,12,12,12,118,71,12,12,12,118,118,12,71,118,12,118,
  709. 12,12,12,12,12,92,12,12,92,8,92,92,12,12,92,12,92,12,12,12,
  710. 12,12,118,12,12,12,12,12,12,12,118,12,12,71,118,71,12,12,71,118,
  711. 71,71,71,123,218,118,12,71,71,71,71,99,99,218,218,71,71,71,71,71,
  712. 99,218,99,58,99,218,218,71,71,71,218,71,58,99,58,58,99,58,218,99,
  713. 99,218,99,99,58,58,58,99,58,99,218,11,71,112,11,112,118,23,118,23,
  714. 49,118,118,92,49,92,49,92,49,92,49,223,223,49,223,49,49,49,49,82,
  715. 49,49,49,223,118,118,71,71,11,71,99,218,218,99,58,58,58,58,58,58,
  716. 58,218,218,218,71,218,218,99,99,99,99,58,218,218,71,123,71,71,218,11,
  717. 99,99,218,218,71,71,12,71,12,218,218,218,71,218,118,12,71,118,71,71,
  718. 71,71,71,71,118,71,12,12,12,71,12,12,12,12,12,12,12,49,12,12,
  719. 12,92,12,49,12,92,12,12,92,8,92,92,92,92,92,12,92,12,12,92,
  720. 12,92,12,92,12,71,71,12,12,12,12,71,12,118,71,118,71,118,12,12,
  721. 12,12,71,71,218,71,71,118,118,12,12,118,71,218,71,218,123,12,12,12,
  722. 12,71,71,99,99,99,218,71,71,71,71,123,71,218,218,58,99,99,58,218,
  723. 99,218,218,11,99,218,99,218,218,58,58,58,99,218,71,11,71,71,118,11,
  724. 112,71,112,118,112,12,118,118,118,118,118,118,118,118,118,118,223,223,49,49,
  725. 118,118,118,71,71,71,218,71,218,71,99,99,99,218,58,58,58,218,218,218,
  726. 218,71,71,218,123,71,218,99,58,218,218,99,71,118,12,71,71,71,218,218,
  727. 218,99,71,118,12,12,12,71,71,123,71,71,71,12,118,12,92,71,118,71,
  728. 12,12,71,12,12,92,12,12,12,118,12,12,12,12,12,92,12,12,12,92,
  729. 71,92,12,92,92,92,92,92,12,8,92,92,92,92,92,92,92,92,92,12,
  730. 92,12,92,12,92,92,12,118,92,12,12,92,92,12,12,12,12,12,12,12,
  731. 12,12,71,118,12,118,71,71,12,12,12,12,118,71,218,71,218,71,118,12,
  732. 12,71,12,71,218,71,99,218,123,71,71,12,71,118,71,71,99,218,218,99,
  733. 218,99,218,218,218,71,123,71,218,218,218,218,99,99,99,58,99,99,99,218,
  734. 99,71,71,71,11,71,11,11,11,11,11,11,11,11,71,118,12,118,218,218,
  735. 71,218,71,71,218,71,99,71,99,99,99,58,218,99,218,218,71,71,71,71,
  736. 71,71,123,71,11,99,99,99,218,218,71,71,12,12,12,71,123,218,71,218,
  737. 71,118,71,12,118,12,12,71,71,218,118,12,12,12,92,12,71,118,71,71,
  738. 12,71,92,12,92,12,12,12,118,12,12,92,92,12,92,12,92,92,92,92,
  739. 92,92,92,92,12,92,92,92,92,8,92,92,92,12,92,92,92,92,92,92,
  740. 92,92,92,12,92,92,12,12,92,92,92,12,92,92,12,12,118,12,12,92,
  741. 92,12,12,12,71,71,71,118,12,118,12,12,12,71,12,71,71,71,71,12,
  742. 12,12,118,12,12,118,218,71,71,71,12,71,71,71,12,12,71,71,71,11,
  743. 218,99,218,218,218,218,71,71,71,71,71,71,71,71,218,218,218,218,99,218,
  744. 218,218,99,218,99,218,218,218,218,218,218,218,218,99,218,11,218,71,71,71,
  745. 71,123,71,123,71,218,99,218,218,11,218,99,71,71,71,71,71,71,71,92,
  746. 71,71,71,123,71,218,71,71,71,118,12,12,12,12,71,71,71,218,71,71,
  747. 12,12,12,12,12,12,12,71,71,71,12,12,12,12,12,12,12,12,118,12,
  748. 12,92,92,92,12,92,12,71,12,92,92,12,92,92,92,92,92,12,92,92,
  749. 92,92,92,92,92,92,92,92,92,8,92,19,92,92,92,92,92,223,92,92,
  750. 92,92,92,92,92,92,92,92,92,92,92,92,12,92,12,92,12,118,12,12,
  751. 12,92,92,12,92,12,12,12,71,12,49,12,92,92,12,12,71,12,12,12,
  752. 12,71,12,12,12,12,71,12,71,71,218,218,71,118,12,12,12,71,12,12,
  753. 71,123,71,71,99,71,71,123,71,123,71,123,71,71,71,71,71,71,71,71,
  754. 71,218,218,218,71,71,218,71,218,71,218,71,71,123,71,123,71,123,71,123,
  755. 218,71,218,218,218,218,71,71,71,71,71,12,12,12,12,12,12,12,71,71,
  756. 71,123,218,218,71,71,12,12,12,71,12,12,12,12,71,71,71,12,118,12,
  757. 12,92,12,12,12,12,12,12,71,12,92,12,92,12,12,118,12,12,12,92,
  758. 92,92,92,92,92,12,92,92,12,92,92,92,92,19,12,92,92,92,92,92,
  759. 12,92,92,92,92,92,92,92,92,8,19,108,19,108,12,19,92,92,92,92,
  760. 92,92,92,92,92,19,92,92,92,92,92,92,92,92,92,92,92,92,12,92,
  761. 92,92,92,92,92,92,12,12,12,12,71,12,92,92,92,92,12,92,118,12,
  762. 12,12,12,12,92,12,12,12,71,12,71,71,71,12,12,12,12,12,12,92,
  763. 112,118,71,12,71,71,71,218,71,71,71,71,71,71,12,12,12,12,12,12,
  764. 12,118,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,
  765. 71,71,71,71,71,71,71,71,118,71,12,71,12,12,12,12,12,71,71,123,
  766. 71,71,71,92,12,12,12,12,92,92,71,12,12,12,12,71,12,12,92,12,
  767. 92,92,12,118,12,12,118,12,12,92,92,92,92,12,12,12,12,92,92,92,
  768. 92,12,92,12,92,12,92,92,92,92,92,92,92,92,92,92,92,92,92,92,
  769. 92,92,92,92,12,19,19,108,92,8,92,92,19,92,108,92,19,92,92,92,
  770. 92,108,92,92,92,12,92,92,12,92,92,92,92,92,92,92,92,92,92,12,
  771. 12,92,92,92,92,223,12,92,12,12,12,12,12,92,92,12,92,12,12,12,
  772. 12,12,12,12,49,12,92,92,92,92,12,12,71,12,12,12,12,12,12,12,
  773. 92,92,118,92,12,12,118,12,12,12,12,12,12,71,12,12,12,12,12,12,
  774. 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
  775. 12,12,118,118,12,118,12,12,12,12,12,12,12,12,12,12,12,12,71,12,
  776. 12,12,71,92,12,92,92,49,12,12,12,12,118,12,12,118,92,12,92,92,
  777. 12,12,12,12,123,12,92,92,92,92,92,92,12,92,12,92,92,92,92,92,
  778. 92,92,92,92,92,92,92,92,92,92,92,92,12,92,92,92,19,92,92,108,
  779. 92,19,92,108,108,92,108,92,108,8,19,108,19,92,19,108,108,108,92,19,
  780. 92,92,19,92,108,108,92,108,108,92,92,92,92,92,92,19,92,92,92,92,
  781. 92,92,92,92,92,92,92,92,92,92,92,92,12,92,12,92,92,92,92,92,
  782. 92,12,12,12,12,12,12,92,92,92,92,92,92,12,12,12,12,12,118,12,
  783. 12,12,12,92,12,12,12,12,71,12,12,12,12,71,71,12,12,71,118,118,
  784. 12,12,12,12,12,118,12,12,12,92,12,12,12,12,12,71,12,12,118,12,
  785. 12,71,12,12,12,12,12,92,118,118,12,12,12,12,71,12,12,12,49,12,
  786. 92,12,92,92,92,12,92,12,12,12,12,12,92,92,92,92,92,92,92,92,
  787. 12,12,71,92,92,92,12,92,223,92,92,92,12,92,92,92,92,92,12,19,
  788. 92,92,92,92,92,92,108,92,108,19,92,108,108,108,92,92,19,108,92,108,
  789. 19,92,19,92,108,92,108,19,19,8,19,108,19,108,108,19,92,19,108,19,
  790. 19,108,108,19,19,92,108,92,92,108,19,12,108,108,92,19,108,108,92,19,
  791. 92,92,92,92,92,92,108,19,92,92,92,92,12,92,92,92,92,92,92,92,
  792. 92,92,92,12,12,118,123,92,12,12,92,92,92,92,92,92,12,12,12,12,
  793. 12,92,12,12,92,12,92,92,92,92,92,92,12,12,12,12,12,12,12,71,
  794. 71,12,12,12,12,12,12,12,71,12,12,12,12,12,12,92,12,12,92,12,
  795. 92,12,12,49,12,92,12,12,12,12,12,71,12,12,12,12,92,12,92,12,
  796. 92,92,92,92,92,12,12,12,12,92,12,12,92,92,92,92,92,92,12,12,
  797. 12,92,92,92,92,19,108,92,92,92,92,92,92,92,92,19,92,108,108,92,
  798. 92,92,92,19,108,92,19,108,92,108,108,92,19,92,108,19,108,92,108,92,
  799. 19,108,108,92,108,108,19,92,108,8,19,19,19,19,19,108,19,19,108,92,
  800. 19,19,108,92,19,19,108,19,108,92,108,19,92,19,92,92,92,19,92,92,
  801. 92,92,92,92,92,92,19,108,92,19,19,92,92,92,92,92,92,92,223,92,
  802. 223,92,92,92,92,92,92,92,92,92,92,92,92,223,92,92,92,12,92,12,
  803. 12,12,12,12,92,12,12,92,12,92,92,92,92,92,92,92,92,92,92,92,
  804. 92,92,12,92,49,92,12,92,92,12,12,92,12,92,12,92,12,12,92,12,
  805. 12,12,12,12,12,12,12,92,92,92,12,92,92,92,92,92,92,92,92,92,
  806. 92,92,12,12,12,12,92,92,92,92,92,92,92,92,92,92,92,92,92,92,
  807. 92,92,12,19,92,92,108,12,92,92,92,12,19,92,92,108,92,19,19,92,
  808. 92,92,92,92,108,19,92,19,19,92,92,108,108,92,108,92,19,19,19,108,
  809. 19,19,19,19,19,19,108,19,19,8,19,53,19,53,19,53,19,53,19,108,
  810. 19,108,19,108,108,108,19,108,19,108,19,108,108,108,108,19,108,19,108,19,
  811. 19,92,108,19,19,12,108,92,108,92,108,19,108,92,92,92,92,92,92,19,
  812. 92,19,108,92,19,92,92,92,92,92,92,92,92,92,92,92,108,108,19,92,
  813. 92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,
  814. 92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,
  815. 92,92,92,92,12,92,92,92,12,92,19,92,92,92,92,92,92,92,92,92,
  816. 92,92,92,92,92,92,92,92,92,108,19,92,92,223,92,92,92,92,92,92,
  817. 19,108,108,108,108,19,92,92,92,92,108,108,108,108,108,92,108,92,108,19,
  818. 92,19,108,108,19,108,108,108,108,108,19,19,19,19,19,19,108,108,53,19,
  819. 108,19,108,53,19,53,19,53,19,8,19,19,19,19,19,19,19,19,19,19,
  820. 19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,108,19,108,19,
  821. 19,19,19,19,108,19,108,19,108,19,108,19,19,19,19,108,19,92,92,92,
  822. 19,19,108,19,108,19,19,92,92,92,92,92,92,92,92,19,19,108,19,108,
  823. 19,92,19,92,92,92,92,92,92,92,92,92,92,92,92,19,92,92,92,92,
  824. 92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,
  825. 92,92,92,19,19,19,92,19,19,92,19,19,108,92,92,92,19,92,92,92,
  826. 92,92,92,92,92,19,19,19,19,108,19,108,92,92,92,92,92,92,19,19,
  827. 92,19,223,19,108,19,108,92,19,19,19,19,19,19,108,19,108,19,108,19,
  828. 19,19,19,19,19,19,19,19,19,108,19,108,19,108,19,19,19,19,19,19,
  829. 19,19,19,19,19,19,19,19,19,8};
  830.  
  831. /***** Magic numbers *****/
  832.  
  833. #define PREVIEW_SIZE 128
  834. #define SCALE_WIDTH  200
  835. #define ENTRY_WIDTH   45
  836.  
  837. #define SINUS   0
  838. #define COSINUS 1
  839. #define NONE    2
  840.  
  841. /***** Types *****/
  842. typedef struct
  843. {
  844.   gdouble redstretch;
  845.   gdouble greenstretch;
  846.   gdouble bluestretch;
  847.   gint    redmode;
  848.   gint    greenmode;
  849.   gint    bluemode;
  850. } alienmap_vals_t;
  851.  
  852. typedef struct
  853. {
  854.   GtkWidget *preview;
  855.   guchar    *image;
  856.   guchar    *wimage;
  857.   gint run;
  858. } alienmap_interface_t;
  859.  
  860.  
  861.  
  862. /* Declare local functions. */
  863.  
  864. static void      query  (void);
  865. static void      run    (char         *name,
  866.                  int           nparams,
  867.                  GimpParam    *param,
  868.                  int          *nreturn_vals,
  869.                  GimpParam   **return_vals);
  870.  
  871. static void      alienmap          (GimpDrawable  *drawable);
  872. static void      alienmap_render_row (const guchar *src_row,
  873.                       guchar *dest_row,
  874.                       gint row,
  875.                       gint row_width,
  876.                       gint bytes, double, double, double);
  877. static void      alienmap_get_pixel  (int x, int y, guchar *pixel);
  878. static void         transform           (short int *, short int *, short int *,
  879.                       double, double, double);
  880.  
  881. static void      build_preview_source_image( void);
  882.  
  883. static gint      alienmap_dialog        (void);
  884. static void      dialog_update_preview  (void);
  885. static void      dialog_scale_update    (GtkAdjustment *adjustment,
  886.                      gdouble       *value);
  887. static void      dialog_ok_callback     (GtkWidget *widget, gpointer data);
  888. static void      alienmap_toggle_update (GtkWidget *widget,
  889.                      gpointer   data);
  890. static void      alienmap_logo_dialog   (void);
  891.  
  892. /***** Variables *****/
  893.  
  894. GtkWidget   *maindlg;
  895. GtkWidget   *logodlg;
  896.  
  897. GimpPlugInInfo PLUG_IN_INFO =
  898. {
  899.   NULL,  /* init_proc  */
  900.   NULL,  /* quit_proc  */
  901.   query, /* query_proc */
  902.   run,   /* run_proc   */
  903. };
  904.  
  905. static alienmap_interface_t wint =
  906. {
  907.   NULL,  /* preview */
  908.   NULL,  /* image   */
  909.   NULL,  /* wimage  */
  910.   FALSE  /* run     */
  911. };
  912.  
  913. static alienmap_vals_t wvals =
  914. {
  915.   128,
  916.   128,
  917.   128,
  918.   COSINUS,
  919.   SINUS,
  920.   SINUS,
  921. };
  922.  
  923. static GimpDrawable *drawable;
  924. static gint          tile_width, tile_height;
  925. static gint          img_width, img_height, img_bpp;
  926. static gint          sel_x1, sel_y1, sel_x2, sel_y2;
  927. static gint          sel_width, sel_height;
  928. static gint          preview_width, preview_height;
  929. static GimpTile     *the_tile = NULL;
  930. static gdouble       cen_x, cen_y;
  931. static gdouble       scale_x, scale_y;
  932.  
  933. /***** Functions *****/
  934.  
  935. MAIN ()
  936.  
  937. static void
  938. query (void)
  939. {
  940.   static GimpParamDef args[] =
  941.   {
  942.     { GIMP_PDB_INT32,    "run_mode",     "Interactive, non-interactive" },
  943.     { GIMP_PDB_IMAGE,    "image",        "Input image" },
  944.     { GIMP_PDB_DRAWABLE, "drawable",     "Input drawable" },
  945.     { GIMP_PDB_INT8,    "redstretch",   "Red component stretching factor (0-128)" },
  946.     { GIMP_PDB_INT8,    "greenstretch", "Green component stretching factor (0-128)" },
  947.     { GIMP_PDB_INT8,    "bluestretch",  "Blue component stretching factor (0-128)" },
  948.     { GIMP_PDB_INT8,    "redmode",      "Red application mode (0:SIN;1:COS;2:NONE)" },
  949.     { GIMP_PDB_INT8,    "greenmode",    "Green application mode (0:SIN;1:COS;2:NONE)" },
  950.     { GIMP_PDB_INT8,    "bluemode",     "Blue application mode (0:SIN;1:COS;2:NONE)" },
  951.   };
  952.   static GimpParamDef *return_vals = NULL;
  953.   static int nargs = sizeof (args) / sizeof (args[0]);
  954.   static int nreturn_vals = 0;
  955.  
  956.   INIT_I18N();
  957.  
  958.   gimp_install_procedure ("plug_in_alienmap",
  959.                   "AlienMap Color Transformation Plug-In",
  960.                   "No help yet. Just try it and you'll see!",
  961.                   "Daniel Cotting (cotting@mygale.org, http://www.mygale.org/~cotting)",
  962.                   "Daniel Cotting (cotting@mygale.org, http://www.mygale.org/~cotting)",
  963.                   "1th May 1997",
  964.                   N_("<Image>/Filters/Colors/Map/Alien Map..."),
  965.                   "RGB*",
  966.                   GIMP_PLUGIN,
  967.                   nargs, nreturn_vals,
  968.                   args, return_vals);
  969. }
  970.  
  971. static void
  972. transform (short int *r,
  973.        short int *g,
  974.        short int *b,
  975.        double     redstretch,
  976.        double     greenstretch,
  977.        double     bluestretch)
  978. {
  979.   int red, green, blue;
  980.   const double pi = G_PI;
  981.  
  982.   red = *r;
  983.   green = *g;
  984.   blue = *b;
  985.  
  986.   switch (wvals.redmode)
  987.     {
  988.     case SINUS:
  989.       red    = (int) redstretch*(1.0+sin((red/128.0-1)*pi));
  990.       break;
  991.     case COSINUS:
  992.       red    = (int) redstretch*(1.0+cos((red/128.0-1)*pi));
  993.       break;
  994.     default:
  995.       break;
  996.     }
  997.  
  998.   switch (wvals.greenmode)
  999.     {
  1000.     case SINUS:
  1001.       green    = (int) greenstretch*(1.0+sin((green/128.0-1)*pi));
  1002.       break;
  1003.     case COSINUS:
  1004.       green    = (int) greenstretch*(1.0+cos((green/128.0-1)*pi));
  1005.       break;
  1006.     default:
  1007.       break;
  1008.     }
  1009.  
  1010.   switch (wvals.bluemode)
  1011.     {
  1012.     case SINUS:
  1013.       blue    = (int) bluestretch*(1.0+sin((blue/128.0-1)*pi));
  1014.       break;
  1015.     case COSINUS:
  1016.       blue    = (int) bluestretch*(1.0+cos((blue/128.0-1)*pi));
  1017.       break;
  1018.     default:
  1019.       break;
  1020.     }
  1021.  
  1022.   if (red== 256)
  1023.     {
  1024.       red= 255;
  1025.     }
  1026.   if (green== 256)
  1027.     {
  1028.       green= 255;
  1029.     }
  1030.   if (blue== 256)
  1031.     {
  1032.       blue= 255;
  1033.     }
  1034.  
  1035.   *r = red;
  1036.   *g = green;
  1037.   *b = blue;
  1038. }
  1039.  
  1040.  
  1041. static void
  1042. run (char       *name,
  1043.      int         nparams,
  1044.      GimpParam  *param,
  1045.      int        *nreturn_vals,
  1046.      GimpParam  **return_vals)
  1047. {
  1048.   static GimpParam values[1];
  1049. /*   GDrawable *drawable; */
  1050. /*   gint32 image_ID; */
  1051.   GimpRunModeType   run_mode;
  1052.   double            xhsiz, yhsiz;
  1053.   int           pwidth, pheight;
  1054.   GimpPDBStatusType status = GIMP_PDB_SUCCESS;
  1055.  
  1056.   INIT_I18N_UI ();
  1057.  
  1058.   run_mode = param[0].data.d_int32;
  1059.  
  1060.   values[0].type = GIMP_PDB_STATUS;
  1061.   values[0].data.d_status = status;
  1062.  
  1063.   *nreturn_vals = 1;
  1064.   *return_vals = values;
  1065.  
  1066.   /*  Get the specified drawable  */
  1067.   drawable = gimp_drawable_get (param[2].data.d_drawable);
  1068.   /* image_ID = param[1].data.d_image; */
  1069.   tile_width  = gimp_tile_width();
  1070.   tile_height = gimp_tile_height();
  1071.  
  1072.   img_width  = gimp_drawable_width(drawable->id);
  1073.   img_height = gimp_drawable_height(drawable->id);
  1074.   img_bpp    = gimp_drawable_bpp(drawable->id);
  1075.  
  1076.   gimp_drawable_mask_bounds(drawable->id, &sel_x1, &sel_y1, &sel_x2, &sel_y2);
  1077.  
  1078.   sel_width  = sel_x2 - sel_x1;
  1079.   sel_height = sel_y2 - sel_y1;
  1080.  
  1081.   cen_x = (double) (sel_x2 - 1 + sel_x1) / 2.0;
  1082.   cen_y = (double) (sel_y2 - 1 + sel_y1) / 2.0;
  1083.  
  1084.   xhsiz = (double) (sel_width - 1) / 2.0;
  1085.   yhsiz = (double) (sel_height - 1) / 2.0;
  1086.  
  1087.   if (xhsiz < yhsiz)
  1088.     {
  1089.       scale_x = yhsiz / xhsiz;
  1090.       scale_y = 1.0;
  1091.     }
  1092.   else if (xhsiz > yhsiz)
  1093.     {
  1094.       scale_x = 1.0;
  1095.       scale_y = xhsiz / yhsiz;
  1096.     }
  1097.   else
  1098.     {
  1099.       scale_x = 1.0;
  1100.       scale_y = 1.0;
  1101.     }
  1102.  
  1103.   /* Calculate preview size */
  1104.   if (sel_width > sel_height)
  1105.     {
  1106.       pwidth  = MIN (sel_width, PREVIEW_SIZE);
  1107.       pheight = sel_height * pwidth / sel_width;
  1108.     }
  1109.   else
  1110.     {
  1111.       pheight = MIN (sel_height, PREVIEW_SIZE);
  1112.       pwidth  = sel_width * pheight / sel_height;
  1113.     }
  1114.  
  1115.   preview_width  = MAX (pwidth, 2);  /* Min size is 2 */
  1116.   preview_height = MAX (pheight, 2);
  1117.  
  1118.   /* See how we will run */
  1119.   switch (run_mode)
  1120.     {
  1121.     case GIMP_RUN_INTERACTIVE:
  1122.       /* Possibly retrieve data */
  1123.       gimp_get_data("plug_in_alienmap", &wvals);
  1124.  
  1125.       /* Get information from the dialog */
  1126.       if (!alienmap_dialog())
  1127.     return;
  1128.  
  1129.       break;
  1130.  
  1131.     case GIMP_RUN_NONINTERACTIVE:
  1132.       /* Make sure all the arguments are present */
  1133.       if (nparams != 9)
  1134.     status = GIMP_PDB_CALLING_ERROR;
  1135.  
  1136.       if (status == GIMP_PDB_SUCCESS)
  1137.     {
  1138.       wvals.redstretch   = param[3].data.d_int8;
  1139.       wvals.greenstretch = param[4].data.d_int8;
  1140.       wvals.bluestretch  = param[5].data.d_int8;
  1141.       wvals.redmode      = param[6].data.d_int8;
  1142.       wvals.greenmode    = param[7].data.d_int8;
  1143.       wvals.bluemode     = param[8].data.d_int8;
  1144.     }
  1145.  
  1146.       break;
  1147.  
  1148.     case GIMP_RUN_WITH_LAST_VALS:
  1149.       /* Possibly retrieve data */
  1150.       gimp_get_data ("plug_in_alienmap", &wvals);
  1151.       break;
  1152.  
  1153.     default:
  1154.       break;
  1155.     }
  1156.  
  1157.   if (status == GIMP_PDB_SUCCESS)
  1158.     {
  1159.       /*  Make sure that the drawable is indexed or RGB color  */
  1160.       if (gimp_drawable_is_rgb (drawable->id))
  1161.         {
  1162.           gimp_progress_init (_("AlienMap: Transforming..."));
  1163.  
  1164.       /* Set the tile cache size */
  1165.       gimp_tile_cache_ntiles(2*(drawable->width / gimp_tile_width()+1));
  1166.  
  1167.       /* Run! */
  1168.  
  1169.           alienmap (drawable);
  1170.       if (run_mode != GIMP_RUN_NONINTERACTIVE)
  1171.         gimp_displays_flush();
  1172.  
  1173.       /* Store data */
  1174.       if (run_mode == GIMP_RUN_INTERACTIVE)
  1175.         gimp_set_data("plug_in_alienmap", &wvals, sizeof(alienmap_vals_t));
  1176.         }
  1177.       else
  1178.         {
  1179.           status = GIMP_PDB_EXECUTION_ERROR;
  1180.         }
  1181.     }
  1182.  
  1183.   values[0].data.d_status = status;
  1184.  
  1185.   gimp_drawable_detach (drawable);
  1186. }
  1187.  
  1188. static void
  1189. alienmap_get_pixel (int     x,
  1190.             int     y,
  1191.             guchar *pixel)
  1192. {
  1193.   static gint row  = -1;
  1194.   static gint col  = -1;
  1195.  
  1196.   gint    newcol, newrow;
  1197.   gint    newcoloff, newrowoff;
  1198.   guchar *p;
  1199.   int     i;
  1200.  
  1201.   if ((x < 0) || (x >= img_width) || (y < 0) || (y >= img_height))
  1202.     {
  1203.       pixel[0] = 0;
  1204.       pixel[1] = 0;
  1205.       pixel[2] = 0;
  1206.       pixel[3] = 0;
  1207.  
  1208.       return;
  1209.     }
  1210.  
  1211.   newcol    = x / tile_width; /* The compiler should optimize this */
  1212.   newcoloff = x % tile_width;
  1213.   newrow    = y / tile_height;
  1214.   newrowoff = y % tile_height;
  1215.  
  1216.   if ((col != newcol) || (row != newrow) || (the_tile == NULL))
  1217.     {
  1218.       if (the_tile != NULL)
  1219.     gimp_tile_unref(the_tile, FALSE);
  1220.  
  1221.       the_tile = gimp_drawable_get_tile(drawable, FALSE, newrow, newcol);
  1222.       gimp_tile_ref(the_tile);
  1223.       col = newcol;
  1224.       row = newrow;
  1225.     }
  1226.   p = the_tile->data + the_tile->bpp * (the_tile->ewidth * newrowoff + newcoloff);
  1227.   for (i = img_bpp; i; i--)
  1228.     *pixel++ = *p++;
  1229. }
  1230.  
  1231. static void
  1232. alienmap_render_row (const guchar *src_row,
  1233.              guchar       *dest_row,
  1234.              gint          row,
  1235.              gint          row_width,
  1236.              gint          bytes,
  1237.              double        redstretch,
  1238.              double        greenstretch,
  1239.              double        bluestretch)
  1240. {
  1241.   gint col, bytenum;
  1242.  
  1243.   for (col = 0; col < row_width ; col++)
  1244.     {
  1245.       short int v1, v2, v3;
  1246.  
  1247.       v1 = (short int)src_row[col*bytes];
  1248.       v2 = (short int)src_row[col*bytes +1];
  1249.       v3 = (short int)src_row[col*bytes +2];
  1250.  
  1251.       transform(&v1, &v2, &v3, redstretch, greenstretch, bluestretch);
  1252.  
  1253.       dest_row[col*bytes] = (int)v1;
  1254.       dest_row[col*bytes +1] = (int)v2;
  1255.       dest_row[col*bytes +2] = (int)v3;
  1256.  
  1257.       if (bytes>3)
  1258.         for (bytenum = 3; bytenum<bytes; bytenum++)
  1259.           {
  1260.             dest_row[col*bytes+bytenum] = src_row[col*bytes+bytenum];
  1261.           }
  1262.     }
  1263. }
  1264.  
  1265. static void
  1266. alienmap (GimpDrawable *drawable)
  1267. {
  1268.   GimpPixelRgn srcPR, destPR;
  1269.   gint width, height;
  1270.   gint bytes;
  1271.   guchar *src_row;
  1272.   guchar *dest_row;
  1273.   gint row;
  1274.   gint x1, y1, x2, y2;
  1275.   double redstretch,greenstretch,bluestretch;
  1276.  
  1277.   /* Get the input area. This is the bounding box of the selection in
  1278.    *  the image (or the entire image if there is no selection). Only
  1279.    *  operating on the input area is simply an optimization. It doesn't
  1280.    *  need to be done for correct operation. (It simply makes it go
  1281.    *  faster, since fewer pixels need to be operated on).
  1282.    */
  1283.   gimp_drawable_mask_bounds (drawable->id, &x1, &y1, &x2, &y2);
  1284.  
  1285.   /* Get the size of the input image. (This will/must be the same
  1286.    *  as the size of the output image.
  1287.    */
  1288.   width = drawable->width;
  1289.   height = drawable->height;
  1290.   bytes = drawable->bpp;
  1291.  
  1292.   /*  allocate row buffers  */
  1293.   src_row = (guchar *) malloc ((x2 - x1) * bytes);
  1294.   dest_row = (guchar *) malloc ((x2 - x1) * bytes);
  1295.  
  1296.   /*  initialize the pixel regions  */
  1297.   gimp_pixel_rgn_init (&srcPR, drawable, 0, 0, width, height, FALSE, FALSE);
  1298.   gimp_pixel_rgn_init (&destPR, drawable, 0, 0, width, height, TRUE, TRUE);
  1299.  
  1300.   redstretch = wvals.redstretch;
  1301.   greenstretch = wvals.greenstretch;
  1302.   bluestretch = wvals.bluestretch;
  1303.  
  1304.   for (row = y1; row < y2; row++)
  1305.     {
  1306.       gimp_pixel_rgn_get_row (&srcPR, src_row, x1, row, (x2 - x1));
  1307.  
  1308.       alienmap_render_row (src_row,
  1309.                 dest_row,
  1310.                 row,
  1311.                 (x2 - x1),
  1312.                 bytes,
  1313.                 redstretch, greenstretch, bluestretch);
  1314.  
  1315.       /*  store the dest  */
  1316.       gimp_pixel_rgn_set_row (&destPR, dest_row, x1, row, (x2 - x1));
  1317.  
  1318.       if ((row % 10) == 0)
  1319.         gimp_progress_update ((double) row / (double) (y2 - y1));
  1320.     }
  1321.  
  1322.   /*  update the processed region  */
  1323.   gimp_drawable_flush (drawable);
  1324.   gimp_drawable_merge_shadow (drawable->id, TRUE);
  1325.   gimp_drawable_update (drawable->id, x1, y1, (x2 - x1), (y2 - y1));
  1326.  
  1327.   free (src_row);
  1328.   free (dest_row);
  1329. }
  1330.  
  1331. static void
  1332. build_preview_source_image (void)
  1333. {
  1334.   double  left, right, bottom, top;
  1335.   double  px, py;
  1336.   double  dx, dy;
  1337.   int     x, y;
  1338.   guchar *p;
  1339.   guchar  pixel[4];
  1340.  
  1341.   wint.image  = g_malloc(preview_width * preview_height * 3 * sizeof(guchar));
  1342.   wint.wimage = g_malloc(preview_width * preview_height * 3 * sizeof(guchar));
  1343.  
  1344.   left   = sel_x1;
  1345.   right  = sel_x2 - 1;
  1346.   bottom = sel_y2 - 1;
  1347.   top    = sel_y1;
  1348.  
  1349.   dx = (right - left) / (preview_width - 1);
  1350.   dy = (bottom - top) / (preview_height - 1);
  1351.  
  1352.   py = top;
  1353.  
  1354.   p = wint.image;
  1355.  
  1356.   for (y = 0; y < preview_height; y++)
  1357.     {
  1358.       px = left;
  1359.       for (x = 0; x < preview_width; x++)
  1360.     {
  1361.       alienmap_get_pixel((int) px, (int) py, pixel);
  1362.  
  1363.       *p++ = pixel[0];
  1364.       *p++ = pixel[1];
  1365.       *p++ = pixel[2];
  1366.  
  1367.       px += dx;
  1368.     }
  1369.  
  1370.       py += dy;
  1371.     }
  1372. }
  1373.  
  1374. static gint
  1375. alienmap_dialog (void)
  1376. {
  1377.   GtkWidget *dialog;
  1378.   GtkWidget *top_table;
  1379.   GtkWidget *frame;
  1380.   GtkWidget *toggle1;
  1381.   GtkWidget *toggle2;
  1382.   GtkWidget *toggle3;
  1383.   GtkWidget *table;
  1384.   GtkObject *adj;
  1385.  
  1386.   gimp_ui_init ("alienmap", TRUE);
  1387.  
  1388.   build_preview_source_image ();
  1389.  
  1390.   dialog = maindlg =
  1391.     gimp_dialog_new (_("AlienMap"), "alienmap",
  1392.              gimp_standard_help_func, "filters/alienmap.html",
  1393.              GTK_WIN_POS_MOUSE,
  1394.              FALSE, TRUE, FALSE,
  1395.  
  1396.              _("About"), alienmap_logo_dialog,
  1397.              NULL, NULL, NULL, FALSE, FALSE,
  1398.              _("OK"), dialog_ok_callback,
  1399.              NULL, NULL, NULL, TRUE, FALSE,
  1400.              _("Cancel"), gtk_widget_destroy,
  1401.              NULL, 1, NULL, FALSE, TRUE,
  1402.  
  1403.              NULL);
  1404.  
  1405.   gtk_signal_connect (GTK_OBJECT (dialog), "destroy",
  1406.               GTK_SIGNAL_FUNC (gtk_main_quit),
  1407.               NULL);
  1408.  
  1409.   top_table = gtk_table_new (2, 4, FALSE);
  1410.   gtk_container_set_border_width (GTK_CONTAINER (top_table), 6);
  1411.   gtk_table_set_row_spacings (GTK_TABLE (top_table), 4);
  1412.   gtk_table_set_col_spacings (GTK_TABLE (top_table), 4);
  1413.   gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), top_table,
  1414.               FALSE, FALSE, 0);
  1415.   gtk_widget_show (top_table);
  1416.  
  1417.   gimp_help_init ();
  1418.  
  1419.   /* Preview */
  1420.   frame = gtk_frame_new (NULL);
  1421.   gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
  1422.   gtk_table_attach (GTK_TABLE (top_table), frame, 0, 1, 0, 1, 0, 0, 0, 0);
  1423.   gtk_widget_show (frame);
  1424.  
  1425.   wint.preview = gtk_preview_new (GTK_PREVIEW_COLOR);
  1426.   gtk_preview_size (GTK_PREVIEW (wint.preview), preview_width, preview_height);
  1427.   gtk_container_add (GTK_CONTAINER (frame), wint.preview);
  1428.   gtk_widget_show (wint.preview);
  1429.  
  1430.   /* Controls */
  1431.   table = gtk_table_new (3, 3, FALSE);
  1432.   gtk_table_set_col_spacings (GTK_TABLE (table), 4);
  1433.   gtk_table_set_row_spacings (GTK_TABLE (table), 2);
  1434.   gtk_table_attach (GTK_TABLE (top_table), table, 0, 4, 1, 2,
  1435.             GTK_EXPAND | GTK_FILL, 0, 0, 0);
  1436.   gtk_widget_show (table);
  1437.  
  1438.   adj = gimp_scale_entry_new (GTK_TABLE (table), 0, 0,
  1439.                   _("Red:"), SCALE_WIDTH, 0,
  1440.                   wvals.redstretch, 0, 128, 1, 8, 2,
  1441.                   TRUE, 0, 0,
  1442.                   _("Change intensity of the red channel"), NULL);
  1443.   gtk_signal_connect (GTK_OBJECT (adj), "value_changed",
  1444.               GTK_SIGNAL_FUNC (dialog_scale_update),
  1445.               &wvals.redstretch);
  1446.                   
  1447.   adj = gimp_scale_entry_new (GTK_TABLE (table), 0, 1,
  1448.                   _("Green:"), SCALE_WIDTH, 0,
  1449.                   wvals.greenstretch, 0, 128, 1, 8, 2,
  1450.                   TRUE, 0, 0,
  1451.                   _("Change intensity of the green channel"), NULL);
  1452.   gtk_signal_connect (GTK_OBJECT (adj), "value_changed",
  1453.               GTK_SIGNAL_FUNC (dialog_scale_update),
  1454.               &wvals.greenstretch);
  1455.                   
  1456.   adj = gimp_scale_entry_new (GTK_TABLE (table), 0, 2,
  1457.                   _("Blue:"), SCALE_WIDTH, 0,
  1458.                   wvals.bluestretch, 0, 128, 1, 8, 2,
  1459.                   TRUE, 0, 0,
  1460.                   _("Change intensity of the blue channel"), NULL);
  1461.   gtk_signal_connect (GTK_OBJECT (adj), "value_changed",
  1462.               GTK_SIGNAL_FUNC (dialog_scale_update),
  1463.               &wvals.bluestretch);
  1464.  
  1465.   /*  Redmode toggle box  */
  1466.   frame = gimp_radio_group_new2 (TRUE, _("Red"),
  1467.                  alienmap_toggle_update,
  1468.                  &wvals.redmode, (gpointer) wvals.redmode,
  1469.  
  1470.                  _("Sine"),   (gpointer) SINUS, &toggle1,
  1471.                  _("Cosine"), (gpointer) COSINUS, &toggle2,
  1472.                  _("None"),   (gpointer) NONE, &toggle3,
  1473.  
  1474.                  NULL);
  1475.  
  1476.   gimp_help_set_help_data (toggle1,
  1477.                _("Use sine-function for red component."), NULL);
  1478.   gimp_help_set_help_data (toggle2,
  1479.                _("Use cosine-function for red component."), NULL);
  1480.   gimp_help_set_help_data (toggle3,
  1481.                _("Red channel: use linear mapping instead "
  1482.                  "of any trigonometrical function"), NULL);
  1483.  
  1484.   gtk_table_attach (GTK_TABLE (top_table), frame, 1, 2, 0, 1,
  1485.             GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND, 0, 0);
  1486.   gtk_widget_show (frame);
  1487.  
  1488.   /*  Greenmode toggle box  */
  1489.   frame = gimp_radio_group_new2 (TRUE, _("Green"),
  1490.                  alienmap_toggle_update,
  1491.                  &wvals.greenmode, (gpointer) wvals.greenmode,
  1492.  
  1493.                  _("Sine"),   (gpointer) SINUS, &toggle1,
  1494.                  _("Cosine"), (gpointer) COSINUS, &toggle2,
  1495.                  _("None"),   (gpointer) NONE, &toggle3,
  1496.  
  1497.                  NULL);
  1498.  
  1499.   gimp_help_set_help_data (toggle1,
  1500.                _("Use sine-function for green component."), NULL);
  1501.   gimp_help_set_help_data (toggle2,
  1502.                _("Use cosine-function for green component."), NULL);
  1503.   gimp_help_set_help_data (toggle3,
  1504.                _("Green channel: use linear mapping instead "
  1505.                  "of any trigonometrical function"), NULL);
  1506.  
  1507.   gtk_table_attach (GTK_TABLE (top_table), frame, 2, 3, 0, 1,
  1508.             GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND, 0, 0);
  1509.   gtk_widget_show (frame);
  1510.  
  1511.   /*  Bluemode toggle box  */
  1512.   frame = gimp_radio_group_new2 (TRUE, _("Blue"),
  1513.                  alienmap_toggle_update,
  1514.                  &wvals.bluemode, (gpointer) wvals.bluemode,
  1515.  
  1516.                  _("Sine"),   (gpointer) SINUS, &toggle1,
  1517.                  _("Cosine"), (gpointer) COSINUS, &toggle2,
  1518.                  _("None"),   (gpointer) NONE, &toggle3,
  1519.  
  1520.                  NULL);
  1521.  
  1522.   gimp_help_set_help_data (toggle1,
  1523.                _("Use sine-function for blue component."), NULL);
  1524.   gimp_help_set_help_data (toggle2,
  1525.                _("Use cosine-function for blue component."), NULL);
  1526.   gimp_help_set_help_data (toggle3,
  1527.                _("Blue channel: use linear mapping instead "
  1528.                  "of any trigonometrical function"), NULL);
  1529.  
  1530.   gtk_table_attach (GTK_TABLE (top_table), frame, 3, 4, 0, 1,
  1531.             GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND, 0, 0);
  1532.   gtk_widget_show (frame);
  1533.  
  1534.   gtk_widget_show (dialog);
  1535.   dialog_update_preview ();
  1536.  
  1537.   gtk_main ();
  1538.   gimp_help_free ();
  1539.   gdk_flush ();
  1540.  
  1541.   if (the_tile != NULL)
  1542.     {
  1543.       gimp_tile_unref (the_tile, FALSE);
  1544.       the_tile = NULL;
  1545.     }
  1546.  
  1547.   g_free (wint.image);
  1548.   g_free (wint.wimage);
  1549.  
  1550.   return wint.run;
  1551. }
  1552.  
  1553. static void
  1554. dialog_update_preview (void)
  1555. {
  1556.   double  left, right, bottom, top;
  1557.   double  dx, dy;
  1558.   int  px, py;
  1559.   int     x, y;
  1560.   double  redstretch, greenstretch, bluestretch;
  1561.   short int r,g,b;
  1562.   double  scale_x, scale_y;
  1563.   guchar *p_ul, *i, *p;
  1564.  
  1565.   left   = sel_x1;
  1566.   right  = sel_x2 - 1;
  1567.   bottom = sel_y2 - 1;
  1568.   top    = sel_y1;
  1569.   dx = (right - left) / (preview_width - 1);
  1570.   dy = (bottom - top) / (preview_height - 1);
  1571.  
  1572.   redstretch = wvals.redstretch;
  1573.   greenstretch = wvals.greenstretch;
  1574.   bluestretch = wvals.bluestretch;
  1575.  
  1576.   scale_x = (double) (preview_width - 1) / (right - left);
  1577.   scale_y = (double) (preview_height - 1) / (bottom - top);
  1578.  
  1579.   py = 0;
  1580.  
  1581.   p_ul = wint.wimage;
  1582.  
  1583.   for (y = 0; y < preview_height; y++)
  1584.     {
  1585.       px = 0;
  1586.  
  1587.       for (x = 0; x < preview_width; x++)
  1588.     {
  1589.       i = wint.image + 3 * (preview_width * py + px);
  1590.       r = *i++;
  1591.       g = *i++;
  1592.       b = *i;
  1593.       transform(&r,&g,&b,redstretch, greenstretch, bluestretch);
  1594.       p_ul[0] = r;
  1595.       p_ul[1] = g;
  1596.       p_ul[2] = b;
  1597.       p_ul += 3;
  1598.       px += 1; /* dx; */
  1599.     }
  1600.       py +=1; /* dy; */
  1601.     }
  1602.  
  1603.   p = wint.wimage;
  1604.  
  1605.   for (y = 0; y < preview_height; y++)
  1606.     {
  1607.       gtk_preview_draw_row(GTK_PREVIEW(wint.preview), p, 0, y, preview_width);
  1608.       p += preview_width * 3;
  1609.     }
  1610.   gtk_widget_draw(wint.preview, NULL);
  1611.   gdk_flush();
  1612. }
  1613.  
  1614. static void
  1615. dialog_scale_update (GtkAdjustment *adjustment,
  1616.              gdouble       *value)
  1617. {
  1618.   gimp_double_adjustment_update (adjustment, value);
  1619.  
  1620.   dialog_update_preview ();
  1621. }
  1622.  
  1623. static void
  1624. dialog_ok_callback (GtkWidget *widget,
  1625.             gpointer   data)
  1626. {
  1627.   wint.run = TRUE;
  1628.  
  1629.   gtk_widget_destroy (GTK_WIDGET (data));
  1630. }
  1631.  
  1632. static void
  1633. alienmap_toggle_update (GtkWidget *widget,
  1634.                 gpointer   data)
  1635. {
  1636.   gimp_radio_button_update (widget, data);
  1637.  
  1638.   dialog_update_preview ();
  1639. }
  1640.  
  1641. static void
  1642. alienmap_logo_dialog (void)
  1643. {
  1644.   GtkWidget *xlabel;
  1645.   GtkWidget *xlogo_box;
  1646.   GtkWidget *xpreview;
  1647.   GtkWidget *xframe, *xframe2;
  1648.   GtkWidget *xvbox;
  1649.   GtkWidget *xhbox;
  1650.   gchar  *text;
  1651.   guchar *temp, *temp2;
  1652.   guchar *datapointer;
  1653.   gint    y,x;
  1654.  
  1655.   if (!logodlg)
  1656.     {
  1657.       logodlg = gimp_dialog_new (_("About AlienMap"), "alienmap",
  1658.                  gimp_standard_help_func, "filters/alienmap.html",
  1659.                  GTK_WIN_POS_MOUSE,
  1660.                  FALSE, TRUE, FALSE,
  1661.  
  1662.                  _("OK"), gtk_widget_hide,
  1663.                  NULL, 1, NULL, TRUE, TRUE,
  1664.  
  1665.                  NULL);
  1666.  
  1667.       gtk_signal_connect (GTK_OBJECT (logodlg), "destroy",
  1668.               GTK_SIGNAL_FUNC (gtk_widget_destroyed),
  1669.               &logodlg);
  1670.       gtk_quit_add_destroy (1, GTK_OBJECT (logodlg));
  1671.  
  1672.       xframe = gtk_frame_new (NULL);
  1673.       gtk_frame_set_shadow_type (GTK_FRAME (xframe), GTK_SHADOW_ETCHED_IN);
  1674.       gtk_container_set_border_width (GTK_CONTAINER (xframe), 6);
  1675.       gtk_box_pack_start (GTK_BOX (GTK_DIALOG(logodlg)->vbox), xframe,
  1676.               TRUE, TRUE, 0);
  1677.       xvbox = gtk_vbox_new (FALSE, 4);
  1678.       gtk_container_set_border_width (GTK_CONTAINER (xvbox), 4);
  1679.       gtk_container_add (GTK_CONTAINER (xframe), xvbox);
  1680.  
  1681.       /*  The logo frame & drawing area  */
  1682.       xhbox = gtk_hbox_new (FALSE, 5);
  1683.       gtk_box_pack_start (GTK_BOX (xvbox), xhbox, FALSE, TRUE, 0);
  1684.       
  1685.       xlogo_box = gtk_vbox_new (FALSE, 0);
  1686.       gtk_box_pack_start (GTK_BOX (xhbox), xlogo_box, FALSE, FALSE, 0);
  1687.       
  1688.       xframe2 = gtk_frame_new (NULL);
  1689.       gtk_frame_set_shadow_type (GTK_FRAME (xframe2), GTK_SHADOW_IN);
  1690.       gtk_box_pack_start (GTK_BOX (xlogo_box), xframe2, FALSE, FALSE, 0);
  1691.       
  1692.       xpreview = gtk_preview_new (GTK_PREVIEW_COLOR);
  1693.       gtk_preview_size (GTK_PREVIEW (xpreview), logo_width, logo_height);
  1694.       temp = g_malloc ((logo_width + 10) * 3);
  1695.       datapointer = header_data+logo_width*logo_height-1;
  1696.  
  1697.       for (y = 0; y < logo_height; y++)
  1698.         {
  1699.       temp2=temp;
  1700.       for (x = 0; x< logo_width; x++)
  1701.         {
  1702.           HEADER_PIXEL (datapointer,temp2); 
  1703.           temp2+=3;
  1704.         }
  1705.       gtk_preview_draw_row (GTK_PREVIEW (xpreview),
  1706.                 temp,
  1707.                 0, y, logo_width); 
  1708.     }              
  1709.       g_free (temp);
  1710.       gtk_container_add (GTK_CONTAINER (xframe2), xpreview);
  1711.       gtk_widget_show (xpreview);
  1712.       gtk_widget_show (xframe2);
  1713.       gtk_widget_show (xlogo_box);
  1714.       gtk_widget_show (xhbox);
  1715.  
  1716.       xhbox = gtk_hbox_new (FALSE, 4);
  1717.       gtk_box_pack_start (GTK_BOX(xvbox), xhbox, TRUE, TRUE, 0);
  1718.       text = ("\nCotting Software Productions\n"
  1719.           "Bahnhofstrasse 31\n"
  1720.           "CH-3066 Stettlen (Switzerland)\n\n"
  1721.           "cotting@mygale.org\n"
  1722.           "http://www.mygale.org/~cotting\n\n"
  1723.           "AlienMap Plug-In for the GIMP\n"
  1724.           "Version 1.01\n");
  1725.       xlabel = gtk_label_new (text);
  1726.       gtk_box_pack_start (GTK_BOX(xhbox), xlabel, TRUE, FALSE, 0);
  1727.       gtk_widget_show (xlabel);
  1728.       
  1729.       gtk_widget_show (xhbox);
  1730.       
  1731.       gtk_widget_show (xvbox);
  1732.       gtk_widget_show (xframe);
  1733.       gtk_widget_show (logodlg);
  1734.     }
  1735.   else
  1736.     {
  1737.       gtk_widget_show (logodlg);
  1738.       gdk_window_raise (logodlg->window);
  1739.     }
  1740. }
  1741.