home *** CD-ROM | disk | FTP | other *** search
/ Phoenix Heaven Sunny 2 / APPARE2.BIN / oh_towns / art2 / src.lzh / ICONDAT.C < prev    next >
C/C++ Source or Header  |  1995-06-18  |  14KB  |  358 lines

  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #include <winb.h>
  5. #include <te.h>
  6. #include <fntb.h>
  7. #include <gui.h>
  8. #include "art.h"
  9. #include "icondat.h"
  10.  
  11. /* 自由点描、自由曲線、直線などの 24×24dot アイコン(ビットパターン) */
  12.  
  13. static unsigned char toolbox_icon[][24*24/8] =
  14. {
  15.     /* 自由点描 */
  16.     { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  17.       0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x01,0x98,0x00,0x01,0x80,
  18.       0x00,0x18,0x00,0x01,0x9b,0x00,0x01,0x83,0x00,0x00,0x30,0x00,
  19.       0x0c,0x31,0x80,0x0c,0x01,0x80,0x00,0x18,0x00,0x00,0x1b,0x00,
  20.       0x00,0x03,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x00,0x00,0x00,
  21.       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 },
  22.     /* 自由曲線 */
  23.     { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  24.       0x00,0x00,0x00,0x00,0x00,0xf8,0x00,0x07,0x00,0x00,0x08,0x00,
  25.       0x00,0x7c,0x00,0x01,0x92,0x00,0x02,0x21,0x00,0x04,0x21,0x00,
  26.       0x08,0x21,0x00,0x08,0x21,0x00,0x10,0x11,0x00,0x10,0x0e,0x00,
  27.       0x10,0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  28.       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 },
  29.     /* 直線 */
  30.     { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  31.       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,
  32.       0x00,0x00,0x30,0x00,0x00,0xc0,0x00,0x03,0x00,0x00,0x0c,0x00,
  33.       0x00,0x30,0x00,0x00,0xc0,0x00,0x03,0x00,0x00,0x0c,0x00,0x00,
  34.       0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  35.       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 },
  36.     /* 長方形フィル */
  37.     { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  38.       0x00,0x00,0x00,0x00,0x00,0x00,0x1f,0xff,0xf8,0x15,0x55,0x58,
  39.       0x1a,0xaa,0xa8,0x15,0x55,0x58,0x1a,0xaa,0xa8,0x15,0x55,0x58,
  40.       0x1a,0xaa,0xa8,0x15,0x55,0x58,0x1a,0xaa,0xa8,0x15,0x55,0x58,
  41.       0x1a,0xaa,0xa8,0x1f,0xff,0xf8,0x00,0x00,0x00,0x00,0x00,0x00,
  42.       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 },
  43.     // 楕円フィル
  44.     { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  45.       0x00,0x00,0x00,0x00,0xff,0x00,0x03,0x55,0xc0,0x06,0xaa,0xa0,
  46.       0x0d,0x55,0x50,0x0a,0xaa,0xb0,0x15,0x55,0x58,0x1a,0xaa,0xa8,
  47.       0x15,0x55,0x58,0x1a,0xaa,0xa8,0x0d,0x55,0x50,0x0a,0xaa,0xb0,
  48.       0x05,0x55,0x60,0x03,0xaa,0xc0,0x00,0xff,0x00,0x00,0x00,0x00,
  49.       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 },
  50.     // 楕円枠線
  51.     { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  52.       0x00,0x00,0x00,0x00,0xff,0x00,0x03,0x00,0xc0,0x04,0x00,0x20,
  53.       0x08,0x00,0x10,0x08,0x00,0x10,0x10,0x00,0x08,0x10,0x00,0x08,
  54.       0x10,0x00,0x08,0x10,0x00,0x08,0x08,0x00,0x10,0x08,0x00,0x10,
  55.       0x04,0x00,0x20,0x03,0x00,0xc0,0x00,0xff,0x00,0x00,0x00,0x00,
  56.       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 },
  57.     // 矩形枠線
  58.     { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  59.       0x00,0x00,0x00,0x00,0x00,0x00,0x1f,0xff,0xf8,0x10,0x00,0x08,
  60.       0x10,0x00,0x08,0x10,0x00,0x08,0x10,0x00,0x08,0x10,0x00,0x08,
  61.       0x10,0x00,0x08,0x10,0x00,0x08,0x10,0x00,0x08,0x10,0x00,0x08,
  62.       0x10,0x00,0x08,0x1f,0xff,0xf8,0x00,0x00,0x00,0x00,0x00,0x00,
  63.       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 },
  64.     // 擦りペン
  65.     { 0x00,0x00,0x00,0x00,0x00,0x00,0x1c,0x1e,0x00,0x1c,0x0e,0x78,
  66.       0x0d,0xff,0xfc,0x0d,0x80,0x08,0x0d,0xfd,0xf0,0x07,0x66,0x60,
  67.       0x06,0x5d,0x40,0x7f,0x59,0xe0,0x14,0x92,0x38,0x04,0x37,0x80,
  68.       0x06,0xcf,0x00,0x07,0x00,0x00,0x06,0x3f,0xe0,0x0c,0x3e,0x60,
  69.       0x3c,0x06,0x00,0x34,0x06,0x40,0x14,0x62,0x30,0x04,0x67,0x18,
  70.       0x00,0x0f,0x18,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00 },
  71.     // 矩形コピー
  72.     { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xf8,0x00,0x80,0x08,
  73.       0x00,0x80,0x08,0x00,0x80,0x08,0x00,0x80,0x08,0x1f,0xff,0x08,
  74.       0x10,0x01,0x08,0x10,0x01,0x08,0x10,0x00,0x88,0x10,0x01,0xc8,
  75.       0x10,0x0b,0x88,0x10,0x0f,0x08,0x10,0x0e,0x08,0x10,0x0f,0x08,
  76.       0x10,0x00,0xf8,0x10,0x01,0x00,0x10,0x01,0x00,0x10,0x01,0x00,
  77.       0x10,0x01,0x00,0x1f,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00 },
  78.     // 領域塗りつぶし
  79.     { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x14,0x00,
  80.       0x00,0x22,0x00,0x00,0x41,0x00,0x00,0x80,0x80,0x01,0x00,0x40,
  81.       0x02,0x00,0x20,0x04,0x00,0x10,0x07,0xff,0xf8,0x04,0xff,0xf8,
  82.       0x04,0x7f,0xf0,0x04,0x3f,0xe0,0x04,0x1f,0xc0,0x04,0x0f,0x80,
  83.       0x04,0x07,0x00,0x04,0x00,0x00,0x0e,0x00,0x00,0x3f,0xf0,0x00,
  84.       0x3f,0xff,0xe0,0x1f,0xfc,0x00,0x00,0x00,0x00,0x00,0x00,0x00 },
  85.     // 滲
  86.     { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0e,0x00,0x0e,0x0c,0x00,
  87.       0x0e,0x08,0x20,0x03,0x10,0x20,0x00,0x3f,0xf0,0x00,0x7a,0x30,
  88.       0x00,0x06,0x18,0x3c,0xff,0xfc,0x39,0xfe,0x80,0x20,0x18,0xc0,
  89.       0x00,0x11,0x60,0x00,0x37,0x70,0x01,0xee,0x3c,0x03,0xcc,0x9c,
  90.       0x06,0xc1,0x8c,0x1e,0x1f,0x20,0x1e,0x0e,0x40,0x1c,0x01,0x80,
  91.       0x0c,0x3f,0x00,0x04,0x1e,0x00,0x00,0x00,0x00,0x00,0x00,0x00 },
  92.     // 朦
  93.     { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x11,0x80,0x0d,0x11,0x80,
  94.       0x0f,0x7d,0xf8,0x09,0x65,0x00,0x09,0x2d,0xfc,0x0f,0x29,0xec,
  95.       0x09,0xfc,0x0c,0x0d,0x00,0xfc,0x0f,0x7d,0x80,0x09,0x4d,0x80,
  96.       0x09,0x45,0x78,0x19,0x7d,0xe0,0x19,0x4d,0x40,0x19,0x7d,0xf0,
  97.       0x19,0x4d,0x00,0x19,0x45,0xf0,0x1b,0x45,0x84,0x3b,0x5d,0x0c,
  98.       0x3b,0x5d,0xfc,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 },
  99.     // 砂
  100.     { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x80,0x00,0x03,0x80,
  101.       0x00,0x01,0x80,0x00,0x01,0x80,0x0f,0xc0,0xd0,0x06,0x04,0xd8,
  102.       0x06,0x08,0xc8,0x06,0x1a,0xcc,0x0d,0xb9,0x8c,0x0f,0x99,0x8c,
  103.       0x0d,0x80,0xac,0x19,0x80,0x20,0x39,0x80,0x40,0x2f,0x80,0xc0,
  104.       0x01,0x81,0x80,0x00,0x03,0x80,0x00,0x07,0x00,0x00,0x1e,0x00,
  105.       0x00,0x3c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 },
  106.     // ポリゴンフィル
  107.     { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,
  108.       0x00,0x06,0x80,0x00,0x3d,0x40,0x00,0xea,0xc0,0x07,0x55,0x40,
  109.       0x06,0xaa,0xa0,0x05,0x55,0x60,0x06,0xaa,0xa0,0x0d,0x55,0x50,
  110.       0x0a,0xaa,0xb0,0x0d,0x55,0x50,0x0a,0xaa,0xa8,0x0d,0x55,0x58,
  111.       0x0a,0xaa,0xa8,0x15,0x55,0x54,0x1a,0xaa,0xfc,0x15,0xff,0x80,
  112.       0x1f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 },
  113.     // ポリゴンコピー
  114.     { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x01,0xa0,
  115.       0x00,0x0e,0x20,0x00,0x30,0x10,0x00,0x20,0x10,0x00,0x0c,0x10,
  116.       0x00,0x34,0x10,0x01,0xc4,0x10,0x06,0x00,0x88,0x04,0x01,0xc8,
  117.       0x04,0x0b,0x88,0x08,0x0f,0x08,0x08,0x0e,0x04,0x08,0x0f,0x04,
  118.       0x10,0x00,0x7c,0x10,0x01,0x00,0x10,0x01,0x00,0x20,0x00,0x80,
  119.       0x20,0x00,0x80,0x3f,0xff,0x80,0x00,0x00,0x00,0x00,0x00,0x00 },
  120.     /* 終了マーク */
  121.     { 0xff,0xff,0xff }
  122. };
  123.  
  124. static unsigned char iconARTEMIS[] =
  125. /* 56×12dot */
  126. {
  127.     0x03,0x87,0xe7,0xfe,0x00,0x00,0x00, 0x03,0x86,0x10,0x60,0x00,0x00,0x00,
  128.     0x03,0x86,0x08,0x60,0x00,0x03,0x00, 0x04,0xc6,0x08,0x60,0x00,0x03,0x00,
  129.     0x04,0xc6,0x08,0x60,0x00,0x00,0x00, 0x04,0xc6,0x08,0x61,0xc7,0xb3,0x3e,
  130.     0x08,0x66,0x10,0x63,0x26,0x4b,0x60, 0x08,0x67,0xe0,0x66,0x16,0x4b,0x60,
  131.     0x0f,0xe6,0x20,0x67,0xf6,0x4b,0x3c, 0x10,0x36,0x30,0x66,0x06,0x4b,0x06,
  132.     0x10,0x36,0x10,0x63,0x06,0x4b,0x06, 0x10,0x36,0x18,0x61,0xe6,0x4b,0x7c
  133. };
  134.  
  135. static unsigned char icon_pensel[] =
  136. /* 38×38dot */
  137. {
  138.   0xff,0xff,0xff,0xff,0xfc, 0xff,0xff,0xff,0xff,0xfc, 0xc0,0x00,0x00,0x00,0x0c,
  139.   0xc0,0x00,0x00,0x00,0x0c, 0xc0,0x00,0x00,0x00,0x0c, 0xc0,0x00,0x00,0x00,0x0c,
  140.   0xc0,0x00,0x00,0x00,0x0c, 0xc0,0x00,0x00,0x00,0x0c, 0xc0,0x00,0x00,0x00,0x0c,
  141.   0xc0,0x00,0x00,0x00,0x0c, 0xc0,0x00,0x00,0x00,0x0c, 0xc0,0x00,0x00,0x00,0x0c,
  142.   0xc0,0x00,0x00,0x00,0x0c, 0xc0,0x00,0x00,0x00,0x0c, 0xc0,0x00,0x00,0x00,0x0c,
  143.   0xc0,0x00,0x00,0x00,0x0c, 0xc0,0x00,0x00,0x00,0x0c, 0xc0,0x00,0x00,0x00,0x0c,
  144.   0xc0,0x00,0x00,0x00,0x0c, 0xc0,0x00,0x00,0x00,0x0c, 0xc0,0x00,0x00,0x00,0x0c,
  145.   0xc0,0x00,0x00,0x00,0x0c, 0xc0,0x00,0x00,0x00,0x0c, 0xc0,0x00,0x00,0x00,0x0c,
  146.   0xc0,0x00,0x00,0x00,0x0c, 0xc0,0x00,0x00,0x00,0x0c, 0xc0,0x00,0x00,0x00,0x0c,
  147.   0xc0,0x00,0x00,0x00,0x0c, 0xc0,0x00,0x00,0x00,0x0c, 0xc0,0x00,0x00,0x00,0x0c,
  148.   0xc0,0x00,0x00,0x00,0x0c, 0xc0,0x00,0x00,0x00,0x0c, 0xc0,0x00,0x00,0x00,0x0c,
  149.   0xc0,0x00,0x00,0x00,0x0c, 0xc0,0x00,0x00,0x00,0x0c, 0xc0,0x00,0x00,0x00,0x0c,
  150.   0xff,0xff,0xff,0xff,0xfc, 0xff,0xff,0xff,0xff,0xfc
  151. };
  152.  
  153. static unsigned char icon_colsel_off[] =
  154. /* 24×24dot */
  155. {
  156.     0xff,0xff,0xff, 0x80,0x00,0x01, 0x80,0x00,0x01, 0x80,0x00,0x01,
  157.     0x80,0x00,0x01, 0x80,0x00,0x01, 0x80,0x00,0x01, 0x80,0x00,0x01,
  158.     0x80,0x00,0x01, 0x80,0x00,0x01, 0x80,0x00,0x01, 0x80,0x00,0x01,
  159.     0x80,0x00,0x01, 0x80,0x00,0x01, 0x80,0x00,0x01, 0x80,0x00,0x01,
  160.     0x80,0x00,0x01, 0x80,0x00,0x01, 0x80,0x00,0x01, 0x80,0x00,0x01,
  161.     0x80,0x00,0x01, 0x80,0x00,0x01, 0x80,0x00,0x01, 0xff,0xff,0xff
  162. };
  163.  
  164. static unsigned char icon_colsel_on[] =
  165. /* 24×24dot */
  166. {
  167.     0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
  168.     0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
  169.     0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
  170.     0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
  171.     0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
  172.     0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00
  173. };
  174.  
  175. static unsigned char icon_winzoomup[] =
  176. {
  177.     0x00,0x00, 0x70,0xe0, 0x60,0x60, 0x50,0xa0, 0x09,0x00, 0x00,0x00,
  178.     0x00,0x00, 0x09,0x00, 0x50,0xa0, 0x60,0x60, 0x70,0xe0, 0x00,0x00
  179. };
  180.  
  181. static unsigned char icon_winzoomdown[] =
  182. {
  183.     0x00,0x00, 0x40,0x20, 0x29,0x40, 0x19,0x80, 0x39,0xc0, 0x00,0x00,
  184.     0x00,0x00, 0x39,0xc0, 0x19,0x80, 0x29,0x40, 0x40,0x20, 0x00,0x00
  185. };
  186.  
  187. static unsigned char icon_erasebtn[] =
  188. {
  189.     0x00,0x00, 0x00,0x00, 0x30,0xc0, 0x39,0xc0, 0x1f,0x80, 0x0f,0x00,
  190.     0x0f,0x00, 0x1f,0x80, 0x39,0xc0, 0x30,0xc0, 0x00,0x00, 0x00,0x00
  191. };
  192.  
  193. #define    ATR_UFRAME    0x000_0001
  194. #define    ATR_DFRAME    0x000_0002
  195. #define    ATR_EDGE    0x000_0004
  196. #define    ATR_ONLIGHT    0x000_0008
  197. #define    ATR_WHITE    0x000_0010
  198.  
  199.  
  200.  
  201. static void icon_setdot(int scr,char *buf,int wid,int ht,int x,int y,int col)
  202. {
  203.     unsigned int *coltbl;
  204.     coltbl = MG_getColorTable(scr);
  205.     if (scr==2)
  206.         *(short*) &buf[4+wid*y*2+x*2] = coltbl[col] & 0x7fff;
  207.     else if (scr==0)
  208.     {
  209.         char *p = buf + 4 + ((wid+7)/8) * 4 * y + x / 2;
  210.         *p = ((x&1)==0 ? (*p & 0xf0) | ( col       & 0x0f) :
  211.                          (*p & 0x0f) | ((col << 4) & 0xf0));
  212.     }
  213.     else if (scr==3)
  214.     {
  215.         char *p = buf + 4 + (wid*y+x)*3;
  216.         uint c = coltbl[col] & 0xffffff;
  217.         p[0] = c & 0xff;
  218.         p[1] = (c >> 8) & 0xff;
  219.         p[2] = (c >> 16) & 0xff;
  220.     }
  221. }
  222.  
  223. static int icon_chkbit(unsigned char *bitbuf,int wid,int ht,int x,int y)
  224. {
  225.     int bitpat,mask;
  226.     bitpat = bitbuf[ ((wid+7)/8) * y + (x >> 3) ];
  227.     mask   = 0x80U >> (x & 7);
  228.     if ((bitpat & mask) != 0 )
  229.         return 1;
  230.     else
  231.         return 0;
  232. }
  233.  
  234. static char *icon_allocbuf(int scr,int wid, int ht)
  235. {
  236.     int size = 1;
  237.     if (scr == 0)
  238.         size = 4 + ((wid+7)/8)*4*ht;
  239.     else if (scr == 2)
  240.         size = 4 + wid*ht*2;
  241.     else if (scr == 3)
  242.         size = 4 + wid*ht*3;
  243.     return TL_calloc(size,1);
  244. }
  245.  
  246. static unsigned char *makeicondat(unsigned char *bitpat,int wid,int ht,int atr)
  247. {
  248.     SCREEN scr;
  249.     char *buf;
  250.     int i,j;
  251.     int piccol;
  252.   /* 画面モード、カラー変換テーブルの取得 */
  253.     MMI_GetScreen(&scr);
  254.   /* グラフィックデータ領域の確保 */
  255.     if ((buf = icon_allocbuf(scr.mode, wid,ht)) == NULL)
  256.         return NULL;
  257.   /* パターンの大きさ、色数のパラメータ設定 */
  258.     buf[0] = wid;
  259.     buf[1] = ht;
  260.     buf[2] = 0;
  261.     buf[3] = (scr.mode == 0 ? 4 : scr.mode == 2 ? 16 : scr.mode == 3 ? 24 : 0);
  262.   /* パターンデータのビットをチェックするマクロ */
  263.     #define SETDOT(x,y,col)  icon_setdot(scr.mode, buf, wid,ht,x,y,col)
  264.     #define CHKBIT(x,y)         icon_chkbit(bitpat, wid,ht,x,y)
  265.   /* 全体を灰色(または白)に塗る */
  266.     for (i=0; i<ht; i++)
  267.         for (j=0; j<wid; j++)
  268.         {
  269.             int col;
  270.             if (atr & ATR_WHITE)
  271.                 col = WHITE;
  272.             else if (atr & ATR_ONLIGHT)
  273.                 col = DARKGRAY;
  274.             else
  275.                 col = GRAY;
  276.             SETDOT(j,i,col);
  277.         }
  278.   /* 枠を描く */
  279.     if (atr & ATR_UFRAME)
  280.     {
  281.         for (i=0; i<wid; i++)    SETDOT(i,0,LIGHT);
  282.         for (i=0; i<ht; i++)    SETDOT(0,i,LIGHT);
  283.         for (i=1; i<wid; i++)    SETDOT(i,ht-1,SHADOW);
  284.         for (i=1; i<ht; i++)    SETDOT(wid-1,i,SHADOW);
  285.     }
  286.     if (atr & ATR_DFRAME)
  287.     {
  288.         for (i=0; i<wid-1; i++)    SETDOT(i,0,SHADOW);
  289.         for (i=0; i<ht-1; i++)    SETDOT(0,i,SHADOW);
  290.         for (i=0; i<wid; i++)    SETDOT(i,ht-1,LIGHT);
  291.         for (i=0; i<ht; i++)    SETDOT(wid-1,i,LIGHT);
  292.     }
  293.     if (atr & ATR_ONLIGHT)
  294.         piccol = 13;
  295.     else
  296.         piccol = 8;
  297.   /* 絵柄を描く */
  298.     if (bitpat != NULL)
  299.     {
  300.         for (i=0; i<ht; i++)
  301.             for (j=0; j<wid; j++)
  302.             {
  303.                 if (CHKBIT(j,i))
  304.                     SETDOT(j,i,piccol);
  305.                 else if ((atr & ATR_EDGE) && j > 0 && CHKBIT(j-1,i))
  306.                     SETDOT(j,i,LIGHT);
  307.             }
  308.     }
  309.   /* 終了 */
  310.     #undef CHKBIT
  311.     #undef SETDOT
  312.     return (unsigned char*)buf;
  313. }
  314.  
  315. #define    ICN_TBLNUM    (ICN_MAXNUM+1-512)
  316.  
  317. static unsigned char *icon_table[ICN_TBLNUM];
  318.  
  319. int set_icontable(void)
  320. {
  321.     int i,datcnt;
  322.     for (i=0; i<ICN_TBLNUM; i++)
  323.         icon_table[i] = NULL;
  324.   /* ARTemis アイコン */
  325.     icon_table[ICN_ARTEMIS-512] = makeicondat(iconARTEMIS,56,12,ATR_EDGE);
  326.   /* ツールボックスアイコン */
  327.     for (datcnt=0; ; datcnt++)
  328.     {
  329.         if (toolbox_icon[datcnt][0] == 0xff)
  330.             break;
  331.         icon_table[ICN_TOOLBOX-512 + datcnt * 2] =
  332.             makeicondat(toolbox_icon[datcnt],24,24,ATR_UFRAME);
  333.         icon_table[ICN_TOOLBOX-512 + datcnt * 2 + 1] =
  334.             makeicondat(toolbox_icon[datcnt],24,24,ATR_DFRAME | ATR_ONLIGHT);
  335.     }
  336.   /* ペン選択ボタン・仮イメージ */
  337.     for (i=0; i<ICN_PENSEL_N; i++)
  338.     {
  339.         icon_table[ICN_PENSEL-512+i*2  ] =
  340.             makeicondat(NULL,38,38,ATR_WHITE);
  341.         icon_table[ICN_PENSEL-512+i*2+1] =
  342.             makeicondat(icon_pensel,38,38,ATR_WHITE);
  343.     }
  344.   /* 色選択ボタン */
  345.     icon_table[ICN_COLSEL-512] = makeicondat(icon_colsel_off,24,24,ATR_WHITE);
  346.     icon_table[ICN_COLSEL-512+1]=makeicondat(icon_colsel_on,24,24,ATR_WHITE);
  347.   /* サイズボタン */
  348.     icon_table[ICN_WINZOOMUP  -512] = makeicondat(icon_winzoomup,  12,12,0);
  349.     icon_table[ICN_WINZOOMDOWN-512] = makeicondat(icon_winzoomdown,12,12,0);
  350.   /* イレーズボタン */
  351.     icon_table[ICN_ERASEBTN-512]=makeicondat(icon_erasebtn,12,12,ATR_EDGE);
  352.   /* アイコンテーブルを設定 */
  353.     MMI_SetIconTable( icon_table, ICN_MAXNUM );
  354.     return 0;
  355.    ERROR:
  356.     return -1;
  357. }
  358.