WWDisplay.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563
  1. /*****************************************************************************/
  2. /* ここから */
  3. /*****************************************************************************/
  4. #include "wonx_include/disp.h"
  5. #include "wonx_include/text.h"
  6. #include "wonx_include/libwwc.h"
  7. #include "WWDisplayP.h"
  8. #include "WonX.h"
  9. /*****************************************************************************/
  10. /* メンバ関数の定義 */
  11. /*****************************************************************************/
  12. /*===========================================================================*/
  13. /* メンバの取得 */
  14. /*===========================================================================*/
  15. WWColorMap WWDisplay_GetColorMap(WWDisplay d) { return (d->color_map); }
  16. WWPalette WWDisplay_GetPalette(WWDisplay d, int n) { return (d->palette[n]); }
  17. WWCharacter WWDisplay_GetCharacter(WWDisplay d, int n)
  18. { return (d->character[n]); }
  19. WWSprite WWDisplay_GetSprite(WWDisplay d, int n) { return (d->sprite[n]); }
  20. WWScreen WWDisplay_GetScreen(WWDisplay d, int n) { return (d->screen[n]); }
  21. WWLCDPanel WWDisplay_GetLCDPanel(WWDisplay d) { return (d->lcd_panel); }
  22. WWText WWDisplay_GetText(WWDisplay d) { return (d->text); }
  23. WWCursor WWDisplay_GetCursor(WWDisplay d) { return (d->cursor); }
  24. unsigned int WWDisplay_GetColorMode(WWDisplay d) { return (d->color_mode); }
  25. int WWDisplay_GetSpriteEnable(WWDisplay d) { return (d->sprite_enable); }
  26. int WWDisplay_GetSpriteWindowEnable(WWDisplay d)
  27. { return (d->sprite_window_enable); }
  28. int WWDisplay_GetSpriteWindowX(WWDisplay d)
  29. { return (d->sprite_window_x); }
  30. int WWDisplay_GetSpriteWindowY(WWDisplay d)
  31. { return (d->sprite_window_y); }
  32. int WWDisplay_GetSpriteWindowWidth(WWDisplay d)
  33. { return (d->sprite_window_width); }
  34. int WWDisplay_GetSpriteWindowHeight(WWDisplay d)
  35. { return (d->sprite_window_height); }
  36. WWPalette WWDisplay_GetBorderPalette(WWDisplay d)
  37. { return (d->border_palette); }
  38. int WWDisplay_GetBorderColor(WWDisplay d)
  39. { return (d->border_color); }
  40. int WWDisplay_GetForegroundColor(WWDisplay d) { return (d->foreground_color); }
  41. int WWDisplay_GetBackgroundColor(WWDisplay d) { return (d->background_color); }
  42. int WWDisplay_GetSpriteStart(WWDisplay d) { return (d->sprite_start); }
  43. int WWDisplay_GetSpriteCount(WWDisplay d) { return (d->sprite_count); }
  44. /*===========================================================================*/
  45. /* メンバの設定 */
  46. /*===========================================================================*/
  47. WWColorMap WWDisplay_SetColorMap(WWDisplay d, WWColorMap cm)
  48. { return (d->color_map = cm); }
  49. WWPalette WWDisplay_SetPalette(WWDisplay d, int n, WWPalette p)
  50. { return (d->palette[n] = p); }
  51. WWCharacter WWDisplay_SetCharacter(WWDisplay d, int n, WWCharacter c)
  52. { return (d->character[n] = c); }
  53. WWSprite WWDisplay_SetSprite(WWDisplay d, int n, WWSprite s)
  54. { return (d->sprite[n] = s); }
  55. WWScreen WWDisplay_SetScreen(WWDisplay d, int n, WWScreen s)
  56. { return (d->screen[n] = s); }
  57. WWLCDPanel WWDisplay_SetLCDPanel(WWDisplay d, WWLCDPanel p)
  58. { return (d->lcd_panel = p); }
  59. WWText WWDisplay_SetText(WWDisplay d, WWText p)
  60. { return (d->text = p); }
  61. WWCursor WWDisplay_SetCursor(WWDisplay d, WWCursor p)
  62. { return (d->cursor = p); }
  63. unsigned int WWDisplay_SetColorMode(WWDisplay d, unsigned int mode)
  64. { return (d->color_mode = mode); }
  65. int WWDisplay_SetSpriteEnable(WWDisplay d, int f)
  66. { return (d->sprite_enable = f); }
  67. int WWDisplay_SetSpriteWindowEnable(WWDisplay d, int f)
  68. { return (d->sprite_window_enable = f); }
  69. int WWDisplay_SetSpriteWindowX(WWDisplay d, int n)
  70. { return (d->sprite_window_x = n); }
  71. int WWDisplay_SetSpriteWindowY(WWDisplay d, int n)
  72. { return (d->sprite_window_y = n); }
  73. int WWDisplay_SetSpriteWindowWidth(WWDisplay d, int n)
  74. { return (d->sprite_window_width = n); }
  75. int WWDisplay_SetSpriteWindowHeight(WWDisplay d, int n)
  76. { return (d->sprite_window_height = n); }
  77. WWPalette WWDisplay_SetBorderPalette(WWDisplay d, WWPalette p)
  78. { return (d->border_palette = p); }
  79. int WWDisplay_SetBorderColor(WWDisplay d, int b)
  80. { return (d->border_color = b); }
  81. int WWDisplay_SetForegroundColor(WWDisplay d, int c)
  82. { return (d->foreground_color = c); }
  83. int WWDisplay_SetBackgroundColor(WWDisplay d, int c)
  84. { return (d->background_color = c); }
  85. int WWDisplay_SetSpriteStart(WWDisplay d, int n)
  86. { return (d->sprite_start = n); }
  87. int WWDisplay_SetSpriteCount(WWDisplay d, int n)
  88. { return (d->sprite_count = n); }
  89. /*===========================================================================*/
  90. /* オブジェクトの生成と消去 */
  91. /*===========================================================================*/
  92. WWDisplay WWDisplay_Create(int lcd_panel_width, int lcd_panel_height,
  93. int screen_width, int screen_height)
  94. {
  95. WWDisplay display;
  96. int i;
  97. static int default_lcd_colors[] = {
  98. 0x00, 0x02, 0x04, 0x06, 0x08, 0x0a, 0x0c, 0x0f
  99. };
  100. static struct palette_colors {
  101. int colors[4];
  102. } default_palette_colors[] = {
  103. {{0, 3, 5, 7}}, {{2, 3, 5, 7}}, {{0, 0, 0, 7}}, {{2, 0, 0, 7}},
  104. {{0, 0, 3, 7}}, {{0, 7, 7, 7}}, {{0, 7, 7, 7}}, {{0, 0, 2, 7}},
  105. {{2, 5, 7, 7}}, {{7, 7, 7, 7}}, {{7, 6, 5, 7}}, {{3, 7, 5, 7}},
  106. {{0, 0, 4, 7}}, {{0, 0, 0, 7}}, {{0, 7, 7, 5}}, {{0, 7, 3, 7}}
  107. };
  108. display = (WWDisplay)malloc(sizeof(_WWDisplay));
  109. if (display == NULL)
  110. WonX_Error("WWDisplay_Create", "Cannot allocate memory.");
  111. WWDisplay_SetColorMap(display, WWColorMap_Create(default_lcd_colors));
  112. for (i = 0; i < 16; i++) {
  113. /*
  114. * WonX-2.0 以降では,透明色は WWPalette クラスでは管理しないように
  115. * 変更したので,透明色の設定は必要無くなった.
  116. */
  117. #if 1
  118. WWDisplay_SetPalette(display, i,
  119. WWPalette_Create(i,default_palette_colors[i].colors));
  120. #else /* WonX-2.0 以前では,透明色の設定が必要だった.一応コードを残しておく */
  121. WWDisplay_SetPalette(display, i,
  122. WWPalette_Create(i,
  123. default_palette_colors[i].colors,
  124. ((i / 4) % 2) ? 1 : 0));
  125. #endif
  126. }
  127. for (i = 0; i < 512; i++) {
  128. WWDisplay_SetCharacter(display, i, WWCharacter_Create(i));
  129. }
  130. for (i = 0; i < 128; i++) {
  131. WWDisplay_SetSprite(display, i,
  132. WWSprite_Create(i, 0, 0, 0, 0, 0, 0,
  133. WWDisplay_GetPalette(display, 0),
  134. WWDisplay_GetCharacter(display, 0)));
  135. }
  136. for (i = 0; i < 2; i++) {
  137. WWDisplay_SetScreen(display, i,
  138. WWScreen_Create(i, screen_width, screen_height,
  139. WWDisplay_GetPalette(display, 0),
  140. WWDisplay_GetCharacter(display, 0),
  141. 0, 0,
  142. lcd_panel_width, lcd_panel_height));
  143. }
  144. WWDisplay_SetLCDPanel(display, WWLCDPanel_Create(lcd_panel_width,
  145. lcd_panel_height));
  146. /* デフォルトのテキスト表示用パレットは0 */
  147. WWDisplay_SetText(display,
  148. WWText_Create(WWDisplay_GetScreen(display, SCREEN2),
  149. 0, 0,
  150. TEXT_SCREEN_WIDTH, TEXT_SCREEN_HEIGHT,
  151. WWDisplay_GetPalette(display, 0)));
  152. /*
  153. * WWDisplay_GetPalette() を呼び出すので,パレットを設定してから
  154. * カーソルの設定を行うこと.
  155. * デフォルトのカーソルパレットは1
  156. */
  157. WWDisplay_SetCursor(display,
  158. WWCursor_Create(WWDisplay_GetPalette(display, 1)));
  159. /* デフォルトのカラーモードは白黒モード */
  160. WWDisplay_SetColorMode(display, COLOR_MODE_GRAYSCALE);
  161. WWDisplay_SetSpriteEnable(display, 0);
  162. WWDisplay_SetSpriteWindowEnable(display, 0);
  163. WWDisplay_SetSpriteWindowX( display, 0);
  164. WWDisplay_SetSpriteWindowY( display, 0);
  165. WWDisplay_SetSpriteWindowWidth( display, lcd_panel_width);
  166. WWDisplay_SetSpriteWindowHeight(display, lcd_panel_height);
  167. WWDisplay_SetBorderPalette(display, WWDisplay_GetPalette(display, 0));
  168. WWDisplay_SetBorderColor(display, 0);
  169. WWDisplay_SetForegroundColor(display, 3);
  170. WWDisplay_SetBackgroundColor(display, 0);
  171. WWDisplay_SetSpriteStart(display, 0);
  172. WWDisplay_SetSpriteCount(display, 0);
  173. return (display);
  174. }
  175. WWDisplay WWDisplay_Destroy(WWDisplay display)
  176. {
  177. int i;
  178. if (display == NULL) return (NULL);
  179. if (WWDisplay_GetColorMap(display) != NULL)
  180. WWDisplay_SetColorMap(display,
  181. WWColorMap_Destroy(WWDisplay_GetColorMap(display)));
  182. for (i = 0; i < 16; i++) {
  183. if (WWDisplay_GetPalette(display, i) != NULL)
  184. WWDisplay_SetPalette(display, i,
  185. WWPalette_Destroy(WWDisplay_GetPalette(display, i))
  186. );
  187. }
  188. for (i = 0; i < 512; i++) {
  189. if (WWDisplay_GetCharacter(display, i) != NULL)
  190. WWDisplay_SetCharacter(display, i,
  191. WWCharacter_Destroy(WWDisplay_GetCharacter(display
  192. , i)));
  193. }
  194. for (i = 0; i < 128; i++) {
  195. if (WWDisplay_GetSprite(display, i) != NULL)
  196. WWDisplay_SetSprite(display, i,
  197. WWSprite_Destroy(WWDisplay_GetSprite(display, i)));
  198. }
  199. for (i = 0; i < 2; i++) {
  200. if (WWDisplay_GetScreen(display, i) != NULL)
  201. WWDisplay_SetScreen(display, i,
  202. WWScreen_Destroy(WWDisplay_GetScreen(display, i)));
  203. }
  204. if (WWDisplay_GetLCDPanel(display) != NULL)
  205. WWDisplay_SetLCDPanel(display,
  206. WWLCDPanel_Destroy(WWDisplay_GetLCDPanel(display)));
  207. if (WWDisplay_GetText(display) != NULL)
  208. WWDisplay_SetText(display,
  209. WWText_Destroy(WWDisplay_GetText(display)));
  210. if (WWDisplay_GetCursor(display) != NULL)
  211. WWDisplay_SetCursor(display,
  212. WWCursor_Destroy(WWDisplay_GetCursor(display)));
  213. free(display);
  214. return (NULL);
  215. }
  216. /*===========================================================================*/
  217. /* LCDパネルの描画 */
  218. /*===========================================================================*/
  219. static int WWDisplay_DrawScreen(WWDisplay display, WWScreen screen,
  220. WWCursor cursor)
  221. {
  222. WWLCDPanel lcd_panel;
  223. int lcd_panel_width;
  224. int lcd_panel_height;
  225. int pixel;
  226. int x, y, px, py;
  227. int sx = 0, sy = 0, ex = 0, ey = 0;
  228. int mode;
  229. if (!WWScreen_GetEnable(screen)) return (0);
  230. lcd_panel = WWDisplay_GetLCDPanel(display);
  231. lcd_panel_width = WWLCDPanel_GetWidth( lcd_panel);
  232. lcd_panel_height = WWLCDPanel_GetHeight(lcd_panel);
  233. if ( (WWScreen_GetMode(screen) == WW_SCREEN_INSIDE_ONLY) ||
  234. (WWScreen_GetMode(screen) == WW_SCREEN_OUTSIDE_ONLY) ) {
  235. sx = WWScreen_GetDrawX(screen);
  236. sy = WWScreen_GetDrawX(screen);
  237. /*
  238. * マニュアルの screen2_set_window() の説明には「表示領域の横幅と縦幅」と
  239. * 書いてあるが,実際には「表示領域の横幅+1と縦幅+1」で動作する
  240. * みたい?(未確認)なので,-1 しなくてよい?
  241. * もしくは,WonderWitch での実際の動作は,
  242. * ex = sx + WWScreen_GetDrawWidth( screen);
  243. * でなく
  244. * ex = WWScreen_GetDrawWidth( screen);
  245. * なのかもしれない.
  246. */
  247. #if 0
  248. ex = sx + WWScreen_GetDrawWidth( screen) - 1;
  249. ey = sy + WWScreen_GetDrawHeight(screen) - 1;
  250. #else
  251. ex = sx + WWScreen_GetDrawWidth( screen);
  252. ey = sy + WWScreen_GetDrawHeight(screen);
  253. #endif
  254. }
  255. mode = WWScreen_GetMode(screen);
  256. /* 以下はホットスポットになるので,そのうちループアンローリング */
  257. /* したほうがいいかも */
  258. for (y = 0; y < lcd_panel_height; y++) {
  259. if (mode == WW_SCREEN_INSIDE_ONLY) {
  260. if (y > ey) { break; }
  261. if (y < sy) { y = sy - 1; continue; }
  262. }
  263. py = y + WWScreen_GetRollY(screen);
  264. for (x = 0; x < lcd_panel_width; x++) {
  265. if (mode == WW_SCREEN_INSIDE_ONLY) {
  266. if (x > ex) { x = lcd_panel_width - 1; continue; }
  267. if (x < sx) { x = sx - 1; continue; }
  268. } else if (mode == WW_SCREEN_OUTSIDE_ONLY) {
  269. if ( (x >= sx) && (x <= ex) && (y >= sy) && (y <= ey) ) {
  270. x = ex;
  271. continue;
  272. }
  273. }
  274. px = x + WWScreen_GetRollX(screen);
  275. /* 透明色の場合には,-1が返ってくる */
  276. pixel = WWScreen_GetPixel(screen, px, py, display, cursor);
  277. /* 透明色の場合 */
  278. if (pixel == -1) continue;
  279. /* カラー対応 */
  280. switch (WWDisplay_GetColorMode(display)) {
  281. case COLOR_MODE_GRAYSCALE:
  282. pixel = WWColorMap_GetLCDColor(WWDisplay_GetColorMap(display), pixel);
  283. break;
  284. case COLOR_MODE_4COLOR:
  285. case COLOR_MODE_16COLOR:
  286. case COLOR_MODE_16PACKED:
  287. break;
  288. default:
  289. WonX_Error("WWDisplay_DrawSprite", "Unknown color mode.");
  290. }
  291. WWLCDPanel_SetPixel(lcd_panel, x, y, pixel);
  292. }
  293. }
  294. return (0);
  295. }
  296. static int WWDisplay_DrawSprite(WWDisplay display, WWSprite sprite)
  297. {
  298. int x, y, lcd_x, lcd_y;
  299. int sx, sy, ex, ey;
  300. int pixel, outside;
  301. sx = WWDisplay_GetSpriteWindowX(display) - 1;
  302. sy = WWDisplay_GetSpriteWindowY(display) - 1;
  303. /* 以下は WWDisplay_DrawScreen() に合わせた */
  304. #if 0
  305. ex = sx + WWDisplay_GetSpriteWindowWidth(display) - 1;
  306. ey = sy + WWDisplay_GetSpriteWindowHeight(display) - 1;
  307. #else
  308. ex = sx + WWDisplay_GetSpriteWindowWidth(display);
  309. ey = sy + WWDisplay_GetSpriteWindowHeight(display);
  310. #endif
  311. for (y = 0; y < 8; y++) {
  312. for (x = 0; x < 8; x++) {
  313. /* 透明色は-1が返ってくる */
  314. pixel = WWSprite_GetPixel(sprite, x, y, display);
  315. /* 透明色の場合 */
  316. if (pixel == -1) continue;
  317. lcd_x = WWSprite_GetX(sprite) + x;
  318. lcd_y = WWSprite_GetY(sprite) + y;
  319. if (WWDisplay_GetSpriteWindowEnable(display)) {
  320. if ( (lcd_x < sx) || (lcd_y < sy) || (lcd_x > ex) || (lcd_y > ey) )
  321. outside = 1;
  322. else
  323. outside = 0;
  324. if (WWSprite_GetClipping(sprite)) { /* ウインドウの外側部分を表示 */
  325. if (!outside) continue;
  326. } else { /* ウインドウの内側部分を表示 */
  327. if (outside) continue;
  328. }
  329. }
  330. /* カラー対応 */
  331. switch (WWDisplay_GetColorMode(display)) {
  332. case COLOR_MODE_GRAYSCALE:
  333. pixel = WWColorMap_GetLCDColor(WWDisplay_GetColorMap(display), pixel);
  334. break;
  335. case COLOR_MODE_4COLOR:
  336. case COLOR_MODE_16COLOR:
  337. case COLOR_MODE_16PACKED:
  338. break;
  339. default:
  340. WonX_Error("WWDisplay_DrawSprite", "Unknown color mode.");
  341. }
  342. WWLCDPanel_SetPixel(WWDisplay_GetLCDPanel(display), lcd_x, lcd_y, pixel);
  343. }
  344. }
  345. return (0);
  346. }
  347. int WWDisplay_DrawLCDPanel(WWDisplay display)
  348. {
  349. WWLCDPanel lcd_panel;
  350. int x, y, i;
  351. int lcd_panel_width;
  352. int lcd_panel_height;
  353. WWColorMap color_map;
  354. WWPalette border_palette;
  355. int border_color;
  356. WWScreen screen;
  357. WWSprite sprite;
  358. WWCursor cursor;
  359. lcd_panel = WWDisplay_GetLCDPanel(display);
  360. lcd_panel_width = WWLCDPanel_GetWidth( lcd_panel);
  361. lcd_panel_height = WWLCDPanel_GetHeight(lcd_panel);
  362. color_map = WWDisplay_GetColorMap(display);
  363. border_palette = WWDisplay_GetBorderPalette(display);
  364. border_color = WWDisplay_GetBorderColor(display);
  365. /* カラー対応 */
  366. switch (WWDisplay_GetColorMode(display)) {
  367. case COLOR_MODE_GRAYSCALE:
  368. border_color &= (DCM_BORDER_COLOR >> 8);
  369. border_color = WWColorMap_GetLCDColor(color_map, border_color);
  370. break;
  371. case COLOR_MODE_4COLOR:
  372. border_color &= 0x03;
  373. border_color =
  374. ((unsigned short int)WWPalette_GetRed( border_palette,border_color)<<8)|
  375. ((unsigned short int)WWPalette_GetGreen(border_palette,border_color)<<4)|
  376. ((unsigned short int)WWPalette_GetBlue( border_palette,border_color)<<0);
  377. break;
  378. case COLOR_MODE_16COLOR:
  379. case COLOR_MODE_16PACKED:
  380. border_color &= 0x0f;
  381. border_color =
  382. ((unsigned short int)WWPalette_GetRed( border_palette,border_color)<<8)|
  383. ((unsigned short int)WWPalette_GetGreen(border_palette,border_color)<<4)|
  384. ((unsigned short int)WWPalette_GetBlue( border_palette,border_color)<<0);
  385. break;
  386. default:
  387. WonX_Error("WWDisplay_DrawLCDPanel", "Unknown color mode.");
  388. }
  389. /* ボーダーカラーで埋める */
  390. for (x = 0; x < lcd_panel_width; x++) {
  391. for (y = 0; y < lcd_panel_height; y++) {
  392. WWLCDPanel_SetPixel(lcd_panel, x, y, border_color);
  393. }
  394. }
  395. /* スクリーン1描画 */
  396. screen = WWDisplay_GetScreen(display, 0);
  397. if (WWText_GetScreen(WWDisplay_GetText(display)) == screen)
  398. cursor = WWDisplay_GetCursor(display);
  399. else
  400. cursor = NULL;
  401. WWDisplay_DrawScreen(display, screen, cursor);
  402. /* スプライト描画(スクリーン2より優先でないもの) */
  403. /* 重なった場合は,番号の若いものが手前に表示される */
  404. if (WWDisplay_GetSpriteEnable(display)) {
  405. for (i = WWDisplay_GetSpriteCount(display) - 1; i >= 0; i--) {
  406. sprite = WWDisplay_GetSprite(display,
  407. i + WWDisplay_GetSpriteStart(display));
  408. if (!WWSprite_GetPriority(sprite)) {
  409. WWDisplay_DrawSprite(display, sprite);
  410. }
  411. }
  412. }
  413. /* スクリーン2描画 */
  414. screen = WWDisplay_GetScreen(display, 1);
  415. if (WWText_GetScreen(WWDisplay_GetText(display)) == screen)
  416. cursor = WWDisplay_GetCursor(display);
  417. else
  418. cursor = NULL;
  419. WWDisplay_DrawScreen(display, screen, cursor);
  420. /* スプライト描画(スクリーン2より優先なもの) */
  421. /* 重なった場合は,番号の若いものが手前に表示される */
  422. if (WWDisplay_GetSpriteEnable(display)) {
  423. for (i = WWDisplay_GetSpriteCount(display) - 1; i >= 0; i--) {
  424. sprite = WWDisplay_GetSprite(display,
  425. i + WWDisplay_GetSpriteStart(display));
  426. if (WWSprite_GetPriority(sprite)) {
  427. WWDisplay_DrawSprite(display, sprite);
  428. }
  429. }
  430. }
  431. return (0);
  432. }
  433. /*===========================================================================*/
  434. /* 透明色かどうか調べる */
  435. /*===========================================================================*/
  436. int WWDisplay_IsTransparent(WWDisplay display, WWPalette palette, int color)
  437. {
  438. int mode;
  439. int palette_num;
  440. int ret;
  441. if (color != 0) return (0);
  442. mode = WWDisplay_GetColorMode(display);
  443. palette_num = WWPalette_GetNumber(palette);
  444. ret = 0;
  445. switch (mode) {
  446. case COLOR_MODE_GRAYSCALE :
  447. case COLOR_MODE_4COLOR :
  448. ret = ((palette_num / 4) % 2) ? 1 : 0;
  449. break;
  450. case COLOR_MODE_16COLOR :
  451. case COLOR_MODE_16PACKED :
  452. ret = 1;
  453. break;
  454. default :
  455. WonX_Error("WWDisplay_IsTransparent", "Unknown color mode.");
  456. }
  457. return (ret);
  458. }
  459. /*****************************************************************************/
  460. /* ここまで */
  461. /*****************************************************************************/
  462. /*****************************************************************************/
  463. /* End of File. */
  464. /*****************************************************************************/