comparison window/button.cc @ 0:223b71206888

Initial import
author thib
date Fri, 01 Aug 2008 16:32:45 +0000
parents
children b753afeb3f34
comparison
equal deleted inserted replaced
-1:000000000000 0:223b71206888
1 /*
2 * Copyright (c) 2004-2006 Kazunori "jagarl" Ueno
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. The name of the author may not be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28 /* r,g,b の基本色で number (0:left 1:right 2:up 3:down)の矢印のビットマップを作成する
29 ** width/heightのどちらかを-1にすると、それにあわせてスケール
30 */
31 extern char* create_button(int number, int& width, int& height, int r, int g, int b);
32 extern char* create_box(int& width, int& height, int r, int g, int b);
33
34 // ボタンのbitmap
35 // ランレングスで簡易圧縮
36 static int buttonleft_cnt = 990;
37 static char buttonleft[991] = {
38 0x00,0x10,0x04,0x7e,0x39,0x00,0x22,0x04,0x7f,0x59,0x00,0x1e,0x04,0x81,0x79,0x00,
39 0x1a,0x04,0x83,0x99,0x00,0x17,0x04,0x84,0xb9,0x00,0x14,0x04,0x85,0xc9,0x00,0x11,
40 0x04,0x87,0xd9,0xf8,0x04,0x88,0xe9,0xd8,0x04,0x89,0xf9,0xc8,0x04,0x89,0x01,0x10,
41 0xa8,0x04,0x10,0x02,0x7a,0x01,0x11,0x88,0xfc,0x02,0x7e,0x01,0x10,0x78,0xdc,0x02,
42 0x83,0xd9,0x68,0xdc,0x02,0x85,0xd9,0x48,0xdc,0x02,0x87,0xd9,0x38,0xcc,0x02,0x89,
43 0xc9,0x28,0xcc,0x02,0x11,0x03,0x69,0x02,0x11,0xb9,0x28,0xbc,0xea,0x03,0x70,0xea,
44 0xc9,0x18,0xbc,0xca,0x03,0x75,0xca,0xb9,0x18,0xac,0xca,0x03,0x77,0xca,0xa9,0x18,
45 0xac,0xba,0x03,0x79,0xba,0xb9,0x9c,0xba,0x03,0x7b,0xaa,0xb9,0x9c,0xaa,0x03,0x7c,
46 0xba,0xa9,0x9c,0xaa,0x03,0x7d,0xaa,0xa9,0x9c,0x9a,0x03,0x7e,0xba,0x99,0x9c,0x9a,
47 0x03,0x4e,0x39,0x03,0x2e,0xaa,0x99,0x9c,0x9a,0x03,0x4c,0x69,0x03,0x2d,0xaa,0x99,
48 0x9c,0x9a,0x03,0x49,0xb9,0x03,0x2b,0xaa,0x99,0x9c,0x8a,0x03,0x48,0xe9,0x03,0x2a,
49 0xaa,0x99,0x9c,0x8a,0x03,0x45,0x01,0x13,0x03,0x28,0xaa,0x99,0x9c,0x8a,0x03,0x43,
50 0x01,0x16,0x03,0x27,0xaa,0x99,0x9c,0x8a,0x03,0x40,0x01,0x1b,0x03,0x25,0xaa,0x99,
51 0x9c,0x8a,0x03,0x3e,0x01,0x1b,0x3a,0x03,0x24,0xaa,0x99,0x9c,0x8a,0x03,0x3b,0x01,
52 0x1b,0x8a,0x03,0x22,0xaa,0x99,0x9c,0x8a,0x03,0x39,0x01,0x1b,0x1d,0xaa,0x03,0x21,
53 0xaa,0x99,0x9c,0x8a,0x03,0x37,0x01,0x1a,0x4d,0xaa,0x03,0x21,0xaa,0x99,0x9c,0x8a,
54 0x03,0x34,0x01,0x1b,0x6d,0xaa,0x03,0x21,0xaa,0x99,0x9c,0x8a,0x03,0x32,0x01,0x1a,
55 0x9d,0xaa,0x03,0x21,0xaa,0x99,0x9c,0x8a,0x03,0x2f,0x01,0x1b,0xbd,0xaa,0x03,0x21,
56 0xaa,0x99,0x9c,0x8a,0x03,0x2d,0x01,0x1b,0xdd,0xaa,0x03,0x21,0xaa,0x99,0x9c,0x8a,
57 0x03,0x2a,0x01,0x1b,0x05,0x10,0xaa,0x03,0x21,0xaa,0x99,0x9c,0x8a,0x03,0x28,0x01,
58 0x1b,0x05,0x12,0xaa,0x03,0x21,0xaa,0x99,0x9c,0x8a,0x03,0x25,0x01,0x1b,0x05,0x15,
59 0xaa,0x03,0x21,0xaa,0x99,0x9c,0x8a,0x03,0x23,0x01,0x1b,0x05,0x17,0xaa,0x03,0x21,
60 0xaa,0x99,0x9c,0x8a,0x03,0x20,0x01,0x1b,0x05,0x1a,0xaa,0x03,0x21,0xaa,0x99,0x9c,
61 0x8a,0x03,0x1e,0x01,0x1b,0x05,0x1c,0xaa,0x03,0x21,0xaa,0x99,0x9c,0x8a,0x03,0x1c,
62 0x01,0x1a,0x05,0x1f,0xaa,0x03,0x21,0xaa,0x99,0x9c,0x8a,0x03,0x19,0x01,0x1b,0x05,
63 0x21,0xaa,0x03,0x21,0xaa,0x99,0x9c,0x8a,0x03,0x17,0x01,0x1a,0x05,0x24,0xaa,0x03,
64 0x21,0xaa,0x99,0x9c,0x8a,0x03,0x14,0x01,0x1b,0x05,0x26,0xaa,0x03,0x21,0xaa,0x99,
65 0x9c,0x8a,0x03,0x12,0x01,0x1b,0x05,0x28,0xaa,0x03,0x21,0xaa,0x99,0x9c,0x8a,0xfb,
66 0x01,0x1b,0x05,0x2b,0xaa,0x03,0x21,0xaa,0x99,0x9c,0x8a,0xdb,0x01,0x1b,0x05,0x2d,
67 0xaa,0x03,0x21,0xaa,0x99,0x9c,0x8a,0xcb,0x01,0x19,0x05,0x30,0xaa,0x03,0x21,0xaa,
68 0x99,0x9c,0x8a,0xcb,0x01,0x17,0x05,0x32,0xaa,0x03,0x21,0xaa,0x99,0x9c,0x8a,0xcb,
69 0x01,0x14,0x4a,0x05,0x31,0xaa,0x03,0x21,0xaa,0x99,0x9c,0x8a,0xcb,0x01,0x12,0x9a,
70 0x05,0x2e,0xaa,0x03,0x21,0xaa,0x99,0x9c,0x8a,0xcb,0xf9,0xea,0x05,0x2c,0xaa,0x03,
71 0x21,0xaa,0x99,0x9c,0x8a,0xfb,0xa9,0x02,0x13,0x05,0x29,0xaa,0x03,0x21,0xaa,0x99,
72 0x9c,0x8a,0x03,0x12,0x69,0x02,0x16,0x05,0x27,0xaa,0x03,0x21,0xaa,0x99,0x9c,0x8a,
73 0x03,0x16,0x19,0x02,0x19,0x05,0x25,0xaa,0x03,0x21,0xaa,0x99,0x9c,0x8a,0x03,0x18,
74 0x02,0x1b,0x05,0x22,0xaa,0x03,0x21,0xaa,0x99,0x9c,0x8a,0x03,0x1b,0x02,0x1a,0x05,
75 0x20,0xaa,0x03,0x21,0xaa,0x99,0x9c,0x8a,0x03,0x1d,0x02,0x1b,0x05,0x1d,0xaa,0x03,
76 0x21,0xaa,0x99,0x9c,0x8a,0x03,0x20,0x02,0x1a,0x05,0x1b,0xaa,0x03,0x21,0xaa,0x99,
77 0x9c,0x8a,0x03,0x22,0x02,0x1a,0x05,0x19,0xaa,0x03,0x21,0xaa,0x99,0x9c,0x8a,0x03,
78 0x24,0x02,0x1b,0x05,0x16,0xaa,0x03,0x21,0xaa,0x99,0x9c,0x8a,0x03,0x27,0x02,0x1a,
79 0x05,0x14,0xaa,0x03,0x21,0xaa,0x99,0x9c,0x8a,0x03,0x29,0x02,0x1b,0x05,0x11,0xaa,
80 0x03,0x21,0xaa,0x99,0x9c,0x8a,0x03,0x2c,0x02,0x1a,0xfd,0xaa,0x03,0x21,0xaa,0x99,
81 0x9c,0x8a,0x03,0x2e,0x02,0x1b,0xcd,0xaa,0x03,0x21,0xaa,0x99,0x9c,0x8a,0x03,0x31,
82 0x02,0x1a,0xad,0xaa,0x03,0x21,0xaa,0x99,0x9c,0x8a,0x03,0x33,0x02,0x1a,0x8d,0xaa,
83 0x03,0x21,0xaa,0x99,0x9c,0x8a,0x03,0x35,0x02,0x1b,0x5d,0xaa,0x03,0x21,0xaa,0x99,
84 0x9c,0x8a,0x03,0x38,0x02,0x1a,0x3d,0xaa,0x03,0x21,0xaa,0x99,0x9c,0x8a,0x03,0x3a,
85 0x02,0x25,0x03,0x21,0xaa,0x99,0x9c,0x8a,0x03,0x3d,0x02,0x22,0x03,0x21,0xaa,0x99,
86 0x9c,0x8a,0x03,0x3f,0x02,0x20,0x03,0x21,0xaa,0x99,0x9c,0x8a,0x03,0x41,0x02,0x1e,
87 0x03,0x21,0xaa,0x99,0x9c,0x8a,0x03,0x44,0x02,0x1b,0x03,0x21,0xaa,0x99,0x9c,0x8a,
88 0x03,0x46,0x02,0x19,0x03,0x21,0xaa,0x99,0x9c,0x9a,0x03,0x48,0x02,0x16,0x03,0x21,
89 0xaa,0x99,0x9c,0x9a,0x03,0x4a,0x02,0x14,0x03,0x21,0xaa,0x99,0x9c,0x9a,0x03,0x4d,
90 0x02,0x10,0x03,0x22,0xaa,0x99,0x9c,0x9a,0x03,0x4f,0xca,0x03,0x24,0xaa,0x99,0x9c,
91 0x9a,0x03,0x51,0x8a,0x03,0x25,0xba,0x99,0x9c,0xaa,0x03,0x53,0x3a,0x03,0x27,0xaa,
92 0xa9,0x9c,0xaa,0x03,0x7c,0xba,0xa9,0x9c,0xba,0x03,0x7b,0xba,0xa9,0x9c,0xca,0x03,
93 0x79,0xba,0xb9,0xac,0xca,0x03,0x77,0xca,0xb9,0xbc,0xda,0x03,0x73,0xea,0xa9,0x28,
94 0xac,0x02,0x10,0x03,0x6d,0x02,0x10,0xb9,0x28,0xac,0x02,0x8c,0xb9,0x38,0xbc,0x02,
95 0x8a,0xc9,0x38,0xcc,0x02,0x89,0xc9,0x48,0xcc,0x02,0x86,0xd9,0x58,0xdc,0x02,0x84,
96 0xe9,0x68,0xdc,0x02,0x82,0xe9,0x78,0xfc,0x02,0x7d,0x01,0x10,0x98,0x04,0x10,0x02,
97 0x78,0x01,0x12,0xb8,0xfc,0x01,0x8a,0xb8,0xfc,0x01,0x89,0xd8,0xec,0x01,0x88,0xf8,
98 0xdc,0x01,0x86,0x00,0x13,0xbc,0x01,0x85,0x00,0x15,0xac,0x01,0x84,0x00,0x17,0x9c,
99 0x01,0x82,0x00,0x1b,0x7c,0x01,0x7f,0x00,0x1f,0x6c,0x01,0x7d,0x00,0x13,
100 0xff};
101 static int buttonright_cnt = 978;
102 static char buttonright[979] = {
103 0x00,0x13,0x04,0x81,0x00,0x21,0x04,0x84,0x00,0x1e,0x04,0x88,0x00,0x19,0x04,0x8c,
104 0x00,0x17,0x04,0x8f,0x00,0x14,0x04,0x91,0x00,0x11,0x04,0x94,0xf8,0x04,0x96,0xd8,
105 0x04,0x98,0xb8,0x04,0x9a,0xa8,0x04,0x11,0x02,0x7a,0x04,0x10,0x88,0xfc,0x02,0x7f,
106 0xfc,0x68,0xec,0x02,0x83,0xdc,0x68,0xdc,0x02,0x85,0xdc,0x48,0xdc,0x02,0x87,0xcc,
107 0x48,0xcc,0x02,0x89,0xcc,0x28,0xcc,0x02,0x11,0x03,0x11,0x02,0x11,0x03,0x47,0x02,
108 0x11,0xbc,0x28,0xbc,0xea,0x03,0x71,0xea,0xbc,0x18,0xbc,0xca,0x03,0x75,0xca,0x04,
109 0x16,0xca,0x03,0x77,0xca,0x04,0x15,0xba,0x03,0x79,0xba,0x04,0x14,0xba,0x03,0x7b,
110 0xba,0x99,0xac,0xaa,0x03,0x7d,0xaa,0x99,0xac,0xaa,0x03,0x7d,0xaa,0x99,0x9c,0xaa,
111 0x03,0x7f,0x9a,0x99,0x9c,0xaa,0x03,0x7f,0x9a,0x99,0x9c,0xaa,0x03,0x2c,0x4a,0x03,
112 0x4f,0x9a,0x99,0x9c,0xaa,0x03,0x2b,0x8a,0x03,0x4c,0x9a,0x99,0x9c,0x9a,0x03,0x2a,
113 0x29,0xba,0x03,0x4a,0x8a,0x99,0x9c,0x9a,0x03,0x29,0x39,0xda,0x03,0x48,0x8a,0x99,
114 0x9c,0x9a,0x03,0x27,0x59,0x02,0x10,0x03,0x45,0x8a,0x99,0x9c,0x9a,0x03,0x26,0x69,
115 0x02,0x12,0x03,0x43,0x8a,0x99,0x9c,0x9a,0x03,0x24,0x89,0x02,0x15,0x03,0x40,0x8a,
116 0x99,0x9c,0x9a,0x03,0x23,0x99,0x02,0x17,0x03,0x3e,0x8a,0x99,0x9c,0x9a,0x03,0x23,
117 0x99,0x02,0x1a,0x03,0x3b,0x8a,0x99,0x9c,0x9a,0x03,0x23,0x99,0x1d,0x02,0x1b,0x03,
118 0x39,0x8a,0x99,0x9c,0x9a,0x03,0x23,0x99,0x3d,0x02,0x1c,0x03,0x36,0x8a,0x99,0x9c,
119 0x9a,0x03,0x23,0x99,0x6d,0x02,0x1c,0x03,0x33,0x8a,0x99,0x9c,0x9a,0x03,0x23,0x99,
120 0x8d,0x02,0x1c,0x03,0x31,0x8a,0x99,0x9c,0x9a,0x03,0x23,0x99,0xbd,0x02,0x1c,0x03,
121 0x2e,0x8a,0x99,0x9c,0x9a,0x03,0x23,0x99,0xed,0x02,0x1b,0x03,0x2c,0x8a,0x99,0x9c,
122 0x9a,0x03,0x23,0x99,0x05,0x10,0x02,0x1c,0x03,0x29,0x8a,0x99,0x9c,0x9a,0x03,0x23,
123 0x99,0x05,0x13,0x02,0x1b,0x03,0x27,0x8a,0x99,0x9c,0x9a,0x03,0x23,0x99,0x05,0x15,
124 0x02,0x1c,0x03,0x24,0x8a,0x99,0x9c,0x9a,0x03,0x23,0x99,0x05,0x18,0x02,0x1b,0x03,
125 0x22,0x8a,0x99,0x9c,0x9a,0x03,0x23,0x99,0x05,0x1a,0x02,0x1c,0x03,0x1f,0x8a,0x99,
126 0x9c,0x9a,0x03,0x23,0x99,0x05,0x1d,0x02,0x1c,0x03,0x1c,0x8a,0x99,0x9c,0x9a,0x03,
127 0x23,0x99,0x05,0x1f,0x02,0x1c,0x03,0x1a,0x8a,0x99,0x9c,0x9a,0x03,0x23,0x99,0x05,
128 0x22,0x02,0x1c,0x03,0x17,0x8a,0x99,0x9c,0x9a,0x03,0x23,0x99,0x05,0x25,0x02,0x1a,
129 0x03,0x16,0x8a,0x99,0x9c,0x9a,0x03,0x23,0x99,0x05,0x27,0x02,0x18,0x03,0x16,0x8a,
130 0x99,0x9c,0x9a,0x03,0x23,0x99,0x05,0x2a,0x02,0x15,0x03,0x16,0x8a,0x99,0x9c,0x9a,
131 0x03,0x23,0x99,0x05,0x2c,0x02,0x13,0x03,0x16,0x8a,0x99,0x9c,0x9a,0x03,0x23,0x99,
132 0x05,0x2f,0x02,0x10,0x03,0x16,0x8a,0x99,0x9c,0x9a,0x03,0x23,0x99,0x05,0x31,0xea,
133 0x03,0x16,0x8a,0x99,0x9c,0x9a,0x03,0x23,0x99,0x05,0x30,0xfa,0x03,0x16,0x8a,0x99,
134 0x9c,0x9a,0x03,0x23,0x99,0x05,0x2e,0x02,0x11,0x03,0x16,0x8a,0x99,0x9c,0x9a,0x03,
135 0x23,0x99,0x05,0x2b,0x02,0x14,0x03,0x16,0x8a,0x99,0x9c,0x9a,0x03,0x23,0x99,0x05,
136 0x29,0x02,0x16,0x03,0x16,0x8a,0x99,0x9c,0x9a,0x03,0x23,0x99,0x05,0x27,0x02,0x17,
137 0x03,0x17,0x8a,0x99,0x9c,0x9a,0x03,0x23,0x99,0x05,0x24,0x02,0x1a,0x03,0x17,0x8a,
138 0x99,0x9c,0x9a,0x03,0x23,0x99,0x05,0x22,0x02,0x1a,0x03,0x19,0x8a,0x99,0x9c,0x9a,
139 0x03,0x23,0x99,0x05,0x1f,0x02,0x1b,0x03,0x1b,0x8a,0x99,0x9c,0x9a,0x03,0x23,0x99,
140 0x05,0x1d,0x02,0x1a,0x03,0x1e,0x8a,0x99,0x9c,0x9a,0x03,0x23,0x99,0x05,0x1b,0x02,
141 0x1a,0x03,0x20,0x8a,0x99,0x9c,0x9a,0x03,0x23,0x99,0x05,0x18,0x02,0x1b,0x03,0x22,
142 0x8a,0x99,0x9c,0x9a,0x03,0x23,0x99,0x05,0x16,0x02,0x1a,0x03,0x25,0x8a,0x99,0x9c,
143 0x9a,0x03,0x23,0x99,0x05,0x13,0x02,0x1b,0x03,0x27,0x8a,0x99,0x9c,0x9a,0x03,0x23,
144 0x99,0x05,0x11,0x02,0x1a,0x03,0x2a,0x8a,0x99,0x9c,0x9a,0x03,0x23,0x99,0xed,0x02,
145 0x1b,0x03,0x2c,0x8a,0x99,0x9c,0x9a,0x03,0x23,0x99,0xcd,0x02,0x1a,0x03,0x2f,0x8a,
146 0x99,0x9c,0x9a,0x03,0x23,0x99,0xad,0x02,0x1a,0x03,0x31,0x8a,0x99,0x9c,0x9a,0x03,
147 0x23,0x99,0x7d,0x02,0x1b,0x03,0x33,0x8a,0x99,0x9c,0x9a,0x03,0x23,0x99,0x5d,0x02,
148 0x1a,0x03,0x36,0x8a,0x99,0x9c,0x9a,0x03,0x23,0x99,0x2d,0x02,0x1b,0x03,0x38,0x8a,
149 0x99,0x9c,0x9a,0x03,0x23,0x99,0x02,0x1a,0x03,0x3b,0x8a,0x99,0x9c,0x9a,0x03,0x23,
150 0x99,0x02,0x18,0x03,0x3d,0x8a,0x99,0x9c,0x9a,0x03,0x23,0x99,0x02,0x16,0x03,0x3f,
151 0x8a,0x99,0x9c,0x9a,0x03,0x23,0x99,0x02,0x13,0x03,0x42,0x8a,0x99,0x9c,0x9a,0x03,
152 0x23,0x99,0x02,0x11,0x03,0x44,0x8a,0x99,0x9c,0x9a,0x03,0x23,0x99,0xea,0x03,0x47,
153 0x8a,0x99,0x9c,0xaa,0x03,0x22,0x99,0xca,0x03,0x48,0x9a,0x99,0x9c,0xaa,0x03,0x22,
154 0x99,0x9a,0x03,0x4b,0x9a,0x99,0x9c,0xaa,0x03,0x22,0x99,0x7a,0x03,0x4d,0x9a,0x99,
155 0x9c,0xaa,0x03,0x24,0x79,0x5a,0x03,0x4f,0x9a,0x99,0x9c,0xaa,0x03,0x26,0x59,0x2a,
156 0x03,0x51,0xaa,0x01,0x13,0xaa,0x03,0x27,0x39,0x03,0x53,0xaa,0x01,0x13,0xaa,0x03,
157 0x7c,0xba,0x01,0x13,0xba,0x03,0x7b,0xba,0x01,0x14,0xba,0x03,0x79,0xca,0x01,0x14,
158 0xca,0x03,0x77,0xba,0xb9,0x18,0xa9,0xea,0x03,0x73,0xda,0xb9,0x18,0xb9,0x02,0x10,
159 0x03,0x6d,0x02,0x10,0xa9,0x28,0xc9,0x02,0x8b,0xb9,0x38,0xb9,0x02,0x8b,0xb9,0x38,
160 0xc9,0x02,0x89,0xb9,0x48,0xe9,0x02,0x86,0xc9,0x58,0xe9,0x02,0x84,0xd9,0x68,0xe9,
161 0x02,0x82,0xd9,0x88,0x01,0x10,0x02,0x7d,0xe9,0x98,0x01,0x13,0x02,0x78,0x01,0x10,
162 0xa8,0x01,0x99,0xc8,0x01,0x97,0xe8,0x01,0x95,0x00,0x10,0x01,0x93,0x00,0x13,0x01,
163 0x90,0x00,0x15,0x01,0x8e,0x00,0x18,0x01,0x8a,0x00,0x1d,0x01,0x86,0x00,0x20,0x01,
164 0x83,0xe8,
165 0xff};
166 static int buttonup_cnt = 1288;
167 static char buttonup[1289] = {
168 0x00,0x10,0x04,0x4c,0x00,0x20,0x04,0x52,0x00,0x1a,0x04,0x56,0x00,0x17,0x04,0x59,
169 0x00,0x14,0x04,0x5b,0x00,0x12,0x04,0x5e,0xe8,0x04,0x61,0xd8,0x04,0x62,0xb8,0x04,
170 0x64,0x98,0x04,0x10,0x02,0x45,0x04,0x10,0x88,0xfc,0x02,0x48,0x04,0x10,0x78,0xdc,
171 0x02,0x4c,0xfc,0x58,0xdc,0x02,0x4f,0xdc,0x48,0xdc,0x02,0x51,0xdc,0x38,0xcc,0x02,
172 0x53,0xcc,0x38,0xbc,0x02,0x55,0x04,0x18,0x02,0x57,0x04,0x17,0x02,0x10,0x03,0x35,
173 0x02,0x12,0x04,0x16,0xda,0x03,0x3e,0xea,0x04,0x15,0xba,0x03,0x42,0xca,0x04,0x14,
174 0xba,0x03,0x44,0xca,0x99,0xac,0xaa,0x03,0x46,0xba,0x99,0xac,0x9a,0x03,0x48,0xaa,
175 0x99,0xac,0x8a,0x03,0x49,0xaa,0x99,0xac,0x8a,0x03,0x4a,0x9a,0x99,0xac,0x8a,0x03,
176 0x4a,0x9a,0x99,0xac,0x7a,0x03,0x4c,0x8a,0x99,0xac,0x7a,0x03,0x4c,0x8a,0x99,0xac,
177 0x7a,0x03,0x4c,0x8a,0x99,0xac,0x6a,0x03,0x25,0x59,0x03,0x23,0x8a,0x99,0xac,0x6a,
178 0x03,0x24,0x69,0x03,0x23,0x8a,0x99,0xac,0x6a,0x03,0x24,0x69,0x03,0x23,0x8a,0x99,
179 0xac,0x6a,0x03,0x23,0x89,0x03,0x22,0x8a,0x99,0xac,0x6a,0x03,0x23,0x89,0x03,0x22,
180 0x8a,0x99,0xac,0x6a,0x03,0x23,0x89,0x03,0x22,0x8a,0x99,0xac,0x6a,0x03,0x22,0xa9,
181 0x03,0x21,0x8a,0x99,0xac,0x6a,0x03,0x22,0xa9,0x03,0x21,0x8a,0x99,0xac,0x6a,0x03,
182 0x21,0xb9,0x03,0x21,0x8a,0x99,0xac,0x6a,0x03,0x21,0xb9,0x03,0x21,0x8a,0x99,0xac,
183 0x6a,0x03,0x21,0xc9,0x03,0x20,0x8a,0x99,0xac,0x6a,0x03,0x20,0xd9,0x03,0x20,0x8a,
184 0x99,0xac,0x6a,0x03,0x20,0xb9,0x3a,0x03,0x1f,0x8a,0x99,0xac,0x6a,0x03,0x1f,0xb9,
185 0x4a,0x03,0x1f,0x8a,0x99,0xac,0x6a,0x03,0x1f,0xb9,0x4a,0x03,0x1f,0x8a,0x99,0xac,
186 0x6a,0x03,0x1f,0xa9,0x6a,0x03,0x1e,0x8a,0x99,0xac,0x6a,0x03,0x1e,0xb9,0x6a,0x03,
187 0x1e,0x8a,0x99,0xac,0x6a,0x03,0x1e,0xb9,0x7a,0x03,0x1d,0x8a,0x99,0xac,0x6a,0x03,
188 0x1d,0xb9,0x8a,0x03,0x1d,0x8a,0x99,0xac,0x6a,0x03,0x1d,0xb9,0x8a,0x03,0x1d,0x8a,
189 0x99,0xac,0x6a,0x03,0x1d,0xa9,0xaa,0x03,0x1c,0x8a,0x99,0xac,0x6a,0x03,0x1c,0xb9,
190 0xaa,0x03,0x1c,0x8a,0x99,0xac,0x6a,0x03,0x1c,0xb9,0xba,0x03,0x1b,0x8a,0x99,0xac,
191 0x6a,0x03,0x1b,0xb9,0x1d,0xba,0x03,0x1b,0x8a,0x99,0xac,0x6a,0x03,0x1b,0xb9,0x2d,
192 0xba,0x03,0x1a,0x8a,0x99,0xac,0x6a,0x03,0x1b,0xa9,0x3d,0xba,0x03,0x1a,0x8a,0x99,
193 0xac,0x6a,0x03,0x1a,0xb9,0x3d,0xba,0x03,0x1a,0x8a,0x99,0xac,0x6a,0x03,0x1a,0xb9,
194 0x4d,0xba,0x03,0x19,0x8a,0x99,0xac,0x6a,0x03,0x19,0xb9,0x5d,0xba,0x03,0x19,0x8a,
195 0x99,0xac,0x6a,0x03,0x19,0xb9,0x6d,0xba,0x03,0x18,0x8a,0x99,0xac,0x6a,0x03,0x18,
196 0xb9,0x7d,0xba,0x03,0x18,0x8a,0x99,0xac,0x6a,0x03,0x18,0xb9,0x7d,0xba,0x03,0x18,
197 0x8a,0x99,0xac,0x6a,0x03,0x18,0xb9,0x8d,0xba,0x03,0x17,0x8a,0x99,0xac,0x6a,0x03,
198 0x17,0xb9,0x9d,0xba,0x03,0x17,0x8a,0x99,0xac,0x6a,0x03,0x17,0xb9,0xad,0xba,0x03,
199 0x16,0x8a,0x99,0xac,0x6a,0x03,0x16,0xb9,0xbd,0xba,0x03,0x16,0x8a,0x99,0xac,0x6a,
200 0x03,0x16,0xb9,0xcd,0xaa,0x03,0x16,0x8a,0x99,0xac,0x6a,0x03,0x16,0xb9,0xcd,0xba,
201 0x03,0x15,0x8a,0x99,0xac,0x6a,0x03,0x15,0xb9,0xdd,0xba,0x03,0x15,0x8a,0x99,0xac,
202 0x6a,0x03,0x15,0xb9,0xed,0xba,0x03,0x14,0x8a,0x99,0xac,0x6a,0x03,0x14,0xb9,0xfd,
203 0xba,0x03,0x14,0x8a,0x99,0xac,0x6a,0x03,0x14,0xb9,0x05,0x10,0xba,0x03,0x13,0x8a,
204 0x99,0xac,0x6a,0x03,0x14,0xa9,0x05,0x11,0xba,0x03,0x13,0x8a,0x99,0xac,0x6a,0x03,
205 0x13,0xb9,0x05,0x11,0xba,0x03,0x13,0x8a,0x99,0xac,0x6a,0x03,0x13,0xb9,0x05,0x12,
206 0xba,0x03,0x12,0x8a,0x99,0xac,0x6a,0x03,0x12,0xb9,0x05,0x13,0xba,0x03,0x12,0x8a,
207 0x99,0xac,0x6a,0x03,0x12,0xb9,0x05,0x14,0xba,0x03,0x11,0x8a,0x99,0xac,0x6a,0x03,
208 0x12,0xa9,0x05,0x15,0xba,0x03,0x11,0x8a,0x99,0xac,0x6a,0x03,0x11,0xb9,0x05,0x16,
209 0xaa,0x03,0x11,0x8a,0x99,0xac,0x6a,0x03,0x11,0xb9,0x05,0x16,0xba,0x03,0x10,0x8a,
210 0x99,0xac,0x6a,0x03,0x10,0xb9,0x05,0x17,0xba,0x03,0x10,0x8a,0x99,0xac,0x6a,0x03,
211 0x10,0xb9,0x05,0x18,0xba,0xfb,0x8a,0x99,0xac,0x6a,0xfb,0xb9,0x05,0x19,0xba,0xfb,
212 0x8a,0x99,0xac,0x6a,0xfb,0xb9,0x05,0x1a,0xba,0xeb,0x8a,0x99,0xac,0x6a,0xfb,0xb9,
213 0x05,0x1a,0xba,0xeb,0x8a,0x99,0xac,0x6a,0xeb,0xb9,0x05,0x1b,0xba,0xeb,0x8a,0x99,
214 0xac,0x6a,0xeb,0xb9,0x05,0x1c,0xba,0xdb,0x8a,0x99,0xac,0x6a,0xdb,0xb9,0x05,0x1d,
215 0xba,0xdb,0x8a,0x99,0xac,0x6a,0xdb,0xb9,0x05,0x1e,0xba,0xcb,0x8a,0x99,0xac,0x6a,
216 0xdb,0xb9,0x05,0x1e,0xba,0xcb,0x8a,0x99,0xac,0x6a,0xcb,0xb9,0x05,0x1f,0xba,0xcb,
217 0x8a,0x99,0xac,0x6a,0xcb,0xb9,0x05,0x20,0xba,0xbb,0x8a,0x99,0xac,0x6a,0xbb,0xb9,
218 0x05,0x21,0xba,0xbb,0x8a,0x99,0xac,0x6a,0xbb,0xb9,0x05,0x22,0xba,0xab,0x8a,0x99,
219 0xac,0x6a,0xbb,0xb9,0x05,0x22,0xba,0xab,0x8a,0x99,0xac,0x6a,0xab,0xb9,0x05,0x24,
220 0xaa,0xab,0x8a,0x99,0xac,0x6a,0xab,0xb9,0x05,0x24,0xba,0x9b,0x8a,0x99,0xac,0x6a,
221 0x9b,0xb9,0x05,0x25,0xba,0x9b,0x8a,0x99,0xac,0x6a,0x9b,0xb9,0x05,0x26,0xba,0x8b,
222 0x8a,0x99,0xac,0x6a,0x9b,0xa9,0x05,0x27,0xba,0x8b,0x8a,0x99,0xac,0x6a,0xab,0x99,
223 0x05,0x28,0xba,0x7b,0x8a,0x99,0xac,0x6a,0xab,0x99,0x05,0x28,0xba,0x7b,0x8a,0x99,
224 0xac,0x6a,0xbb,0x79,0x05,0x29,0xba,0x7b,0x8a,0x99,0xac,0x6a,0xcb,0x69,0x02,0x35,
225 0x6b,0x8a,0x99,0xac,0x6a,0xcb,0x59,0x02,0x36,0x6b,0x8a,0x99,0xac,0x6a,0xdb,0x49,
226 0x02,0x36,0x6b,0x8a,0x99,0xac,0x6a,0xeb,0x39,0x02,0x35,0x7b,0x8a,0x99,0xac,0x6a,
227 0xeb,0x29,0x02,0x36,0x7b,0x8a,0x99,0xac,0x6a,0xfb,0x19,0x02,0x35,0x8b,0x8a,0x99,
228 0xac,0x6a,0x03,0x10,0x02,0x35,0x8b,0x8a,0x99,0xac,0x6a,0x03,0x10,0x02,0x34,0x9b,
229 0x8a,0x99,0xac,0x6a,0x03,0x11,0x02,0x33,0x9b,0x8a,0x99,0xac,0x6a,0x03,0x12,0x02,
230 0x31,0xab,0x8a,0x99,0xac,0x6a,0x03,0x4d,0x8a,0x99,0xac,0x6a,0x03,0x4d,0x8a,0x99,
231 0xac,0x6a,0x03,0x4d,0x8a,0x99,0xac,0x6a,0x03,0x4d,0x8a,0x99,0xac,0x6a,0x03,0x4d,
232 0x8a,0x99,0xac,0x6a,0x03,0x4d,0x8a,0x99,0xac,0x6a,0x03,0x4d,0x8a,0x99,0xac,0x6a,
233 0x03,0x4d,0x8a,0x99,0xac,0x6a,0x03,0x4d,0x8a,0x99,0xac,0x6a,0x03,0x4d,0x8a,0x99,
234 0xac,0x6a,0x03,0x4d,0x8a,0x99,0xac,0x6a,0x03,0x4d,0x8a,0x99,0xac,0x6a,0x03,0x4d,
235 0x8a,0x99,0xac,0x6a,0x03,0x4d,0x8a,0x99,0xac,0x6a,0x03,0x4d,0x8a,0x99,0xac,0x6a,
236 0x03,0x4d,0x8a,0x99,0xac,0x6a,0x03,0x4d,0x8a,0x99,0xac,0x6a,0x03,0x4d,0x8a,0x99,
237 0xac,0x6a,0x03,0x4d,0x8a,0x99,0xac,0x6a,0x03,0x4d,0x8a,0x99,0xac,0x6a,0x03,0x4d,
238 0x8a,0x99,0xac,0x6a,0x03,0x4d,0x8a,0x99,0xac,0x7a,0x03,0x4c,0x8a,0x99,0xac,0x7a,
239 0x03,0x4c,0x8a,0x99,0xac,0x7a,0x03,0x4b,0x9a,0x99,0xac,0x8a,0x03,0x4a,0x9a,0x99,
240 0xac,0x8a,0x03,0x4a,0x9a,0x99,0xac,0x8a,0x03,0x49,0xaa,0x99,0xac,0x9a,0x03,0x48,
241 0x9a,0xa9,0xac,0xaa,0x03,0x46,0xaa,0x01,0x15,0xaa,0x03,0x44,0xba,0x01,0x15,0xba,
242 0x03,0x41,0xca,0x01,0x17,0xda,0x03,0x3c,0xea,0xb9,0x18,0xb9,0x02,0x10,0x03,0x35,
243 0x02,0x12,0xa9,0x28,0xb9,0x02,0x56,0xb9,0x38,0xb9,0x02,0x54,0xc9,0x38,0xc9,0x02,
244 0x52,0xc9,0x58,0xc9,0x02,0x51,0xc9,0x58,0xd9,0x02,0x4e,0xd9,0x78,0xe9,0x02,0x4b,
245 0xe9,0x78,0xf9,0x02,0x49,0xe9,0x98,0x01,0x11,0x02,0x43,0x01,0x10,0xb8,0x01,0x12,
246 0x02,0x3e,0x01,0x13,0xc8,0x01,0x61,0xe8,0x01,0x5f,0x00,0x10,0x01,0x5d,0x00,0x12,
247 0x01,0x5b,0x00,0x14,0x01,0x58,0x00,0x18,0x01,0x55,0x00,0x1b,0x01,0x51,0x00,0x1f,
248 0x01,0x4d,0x00,0x22,0x01,0x49,0x00,0x13,
249 0xff};
250 static int buttondown_cnt = 1445;
251 static char buttondown[1446] = {
252 0x1e,0x00,0x12,0x04,0x45,0x59,0x00,0x11,0x1e,0xf8,0x04,0x48,0x89,0xe8,0x1e,0xd8,
253 0x04,0x4a,0xa9,0xc8,0x1e,0xb8,0x04,0x4c,0xb9,0xb8,0x1e,0xa8,0x04,0x4d,0xc9,0xa8,
254 0x1e,0x88,0x04,0x4f,0xe9,0x88,0x1e,0x78,0x04,0x50,0xf9,0x78,0x1e,0x68,0x04,0x51,
255 0x01,0x10,0x68,0x1e,0x68,0x04,0x51,0x01,0x11,0x58,0x1e,0x58,0x04,0x12,0x02,0x40,
256 0x01,0x11,0x58,0x1e,0x48,0x04,0x10,0x02,0x46,0xf9,0x48,0x1e,0x38,0xec,0x02,0x4b,
257 0xe9,0x38,0x1e,0x38,0xdc,0x02,0x4d,0xd9,0x38,0x1e,0x28,0xdc,0x02,0x4f,0xd9,0x28,
258 0x1e,0x28,0xcc,0x02,0x51,0xc9,0x28,0x1e,0x18,0xcc,0x02,0x53,0xc9,0x18,0x1e,0x18,
259 0xbc,0x02,0x55,0xb9,0x18,0x1e,0x18,0xbc,0x02,0x56,0xa9,0x18,0x1e,0x18,0xac,0xfa,
260 0x03,0x39,0xfa,0xb9,0x1e,0xbc,0xca,0x03,0x3f,0xca,0xb9,0x1e,0xac,0xba,0x03,0x42,
261 0xca,0xa9,0x1e,0xac,0xaa,0x03,0x45,0xaa,0xa9,0x1e,0x9c,0xaa,0x03,0x47,0x9a,0xa9,
262 0x1e,0x9c,0x9a,0x03,0x48,0xaa,0x99,0x1e,0x9c,0x9a,0x03,0x49,0x9a,0x99,0x1e,0x9c,
263 0x8a,0x03,0x4a,0x9a,0x99,0x1e,0x9c,0x8a,0x03,0x4b,0x8a,0x99,0x1e,0x9c,0x8a,0x03,
264 0x4b,0x8a,0x99,0x1e,0x9c,0x7a,0x03,0x4c,0x8a,0x99,0x1e,0x9c,0x7a,0x03,0x4c,0x8a,
265 0x99,0x1e,0x9c,0x7a,0x03,0x4d,0x7a,0x99,0x1e,0x9c,0x7a,0x03,0x4d,0x7a,0x99,0x1e,
266 0x9c,0x7a,0x03,0x4d,0x7a,0x99,0x1e,0x9c,0x7a,0x03,0x4d,0x7a,0x99,0x1e,0x9c,0x7a,
267 0x03,0x4d,0x7a,0x99,0x1e,0x9c,0x7a,0x03,0x4d,0x7a,0x99,0x1e,0x9c,0x7a,0x03,0x4d,
268 0x7a,0x99,0x1e,0x9c,0x7a,0x03,0x4d,0x7a,0x99,0x1e,0x9c,0x7a,0x03,0x4d,0x7a,0x99,
269 0x1e,0x9c,0x7a,0x03,0x4d,0x7a,0x99,0x1e,0x9c,0x7a,0x03,0x4d,0x7a,0x99,0x1e,0x9c,
270 0x7a,0x03,0x4d,0x7a,0x99,0x1e,0x9c,0x7a,0x03,0x4d,0x7a,0x99,0x1e,0x9c,0x7a,0x03,
271 0x4d,0x7a,0x99,0x1e,0x9c,0x7a,0x03,0x4d,0x7a,0x99,0x1e,0x9c,0x7a,0x03,0x4d,0x7a,
272 0x99,0x1e,0x9c,0x7a,0x03,0x4d,0x7a,0x99,0x1e,0x9c,0x7a,0x03,0x4d,0x7a,0x99,0x1e,
273 0x9c,0x7a,0x03,0x4d,0x7a,0x99,0x1e,0x9c,0x7a,0x03,0x4d,0x7a,0x99,0x1e,0x9c,0x7a,
274 0x03,0x4d,0x7a,0x99,0x1e,0x9c,0x7a,0x03,0x4d,0x7a,0x99,0x1e,0x9c,0x7a,0x03,0x11,
275 0x01,0x32,0xab,0x7a,0x99,0x1e,0x9c,0x7a,0x03,0x10,0x01,0x33,0xab,0x7a,0x99,0x1e,
276 0x9c,0x7a,0xfb,0x01,0x35,0x9b,0x7a,0x99,0x1e,0x9c,0x7a,0xfb,0x01,0x35,0x9b,0x7a,
277 0x99,0x1e,0x9c,0x7a,0xeb,0x01,0x37,0x8b,0x7a,0x99,0x1e,0x9c,0x7a,0xdb,0x01,0x38,
278 0x8b,0x7a,0x99,0x1e,0x9c,0x7a,0xdb,0x01,0x39,0x7b,0x7a,0x99,0x1e,0x9c,0x7a,0xcb,
279 0x01,0x3a,0x7b,0x7a,0x99,0x1e,0x9c,0x7a,0xbb,0x01,0x3b,0x7b,0x7a,0x99,0x1e,0x9c,
280 0x7a,0xbb,0x89,0x05,0x28,0xba,0x7b,0x7a,0x99,0x1e,0x9c,0x7a,0xab,0x99,0x05,0x28,
281 0xaa,0x8b,0x7a,0x99,0x1e,0x9c,0x7a,0x9b,0xa9,0x05,0x27,0xba,0x8b,0x7a,0x99,0x1e,
282 0x9c,0x7a,0x9b,0xb9,0x05,0x26,0xba,0x8b,0x7a,0x99,0x1e,0x9c,0x7a,0x9b,0xb9,0x05,
283 0x25,0xba,0x9b,0x7a,0x99,0x1e,0x9c,0x7a,0x9b,0xc9,0x05,0x24,0xba,0x9b,0x7a,0x99,
284 0x1e,0x9c,0x7a,0xab,0xb9,0x05,0x23,0xba,0xab,0x7a,0x99,0x1e,0x9c,0x7a,0xab,0xb9,
285 0x05,0x23,0xba,0xab,0x7a,0x99,0x1e,0x9c,0x7a,0xbb,0xb9,0x05,0x22,0xba,0xab,0x7a,
286 0x99,0x1e,0x9c,0x7a,0xbb,0xb9,0x05,0x21,0xba,0xbb,0x7a,0x99,0x1e,0x9c,0x7a,0xcb,
287 0xa9,0x05,0x21,0xba,0xbb,0x7a,0x99,0x1e,0x9c,0x7a,0xcb,0xb9,0x05,0x1f,0xba,0xcb,
288 0x7a,0x99,0x1e,0x9c,0x7a,0xcb,0xb9,0x05,0x1f,0xba,0xcb,0x7a,0x99,0x1e,0x9c,0x7a,
289 0xdb,0xb9,0x05,0x1e,0xba,0xcb,0x7a,0x99,0x1e,0x9c,0x7a,0xdb,0xb9,0x05,0x1d,0xba,
290 0xdb,0x7a,0x99,0x1e,0x9c,0x7a,0xeb,0xa9,0x05,0x1d,0xba,0xdb,0x7a,0x99,0x1e,0x9c,
291 0x7a,0xeb,0xb9,0x05,0x1b,0xba,0xeb,0x7a,0x99,0x1e,0x9c,0x7a,0xeb,0xb9,0x05,0x1b,
292 0xba,0xeb,0x7a,0x99,0x1e,0x9c,0x7a,0xfb,0xb9,0x05,0x1a,0xaa,0xfb,0x7a,0x99,0x1e,
293 0x9c,0x7a,0xfb,0xb9,0x05,0x19,0xba,0xfb,0x7a,0x99,0x1e,0x9c,0x7a,0x03,0x10,0xa9,
294 0x05,0x19,0xba,0xfb,0x7a,0x99,0x1e,0x9c,0x7a,0x03,0x10,0xb9,0x05,0x17,0xba,0x03,
295 0x10,0x7a,0x99,0x1e,0x9c,0x7a,0x03,0x10,0xb9,0x05,0x17,0xba,0x03,0x10,0x7a,0x99,
296 0x1e,0x9c,0x7a,0x03,0x11,0xb9,0x05,0x15,0xba,0x03,0x11,0x7a,0x99,0x1e,0x9c,0x7a,
297 0x03,0x11,0xb9,0x05,0x15,0xba,0x03,0x11,0x7a,0x99,0x1e,0x9c,0x7a,0x03,0x12,0xa9,
298 0x05,0x15,0xba,0x03,0x11,0x7a,0x99,0x1e,0x9c,0x7a,0x03,0x12,0xb9,0x05,0x13,0xba,
299 0x03,0x12,0x7a,0x99,0x1e,0x9c,0x7a,0x03,0x12,0xb9,0x05,0x13,0xba,0x03,0x12,0x7a,
300 0x99,0x1e,0x9c,0x7a,0x03,0x13,0xb9,0x05,0x11,0xba,0x03,0x13,0x7a,0x99,0x1e,0x9c,
301 0x7a,0x03,0x13,0xb9,0x05,0x11,0xba,0x03,0x13,0x7a,0x99,0x1e,0x9c,0x7a,0x03,0x13,
302 0xb9,0x05,0x11,0xaa,0x03,0x14,0x7a,0x99,0x1e,0x9c,0x7a,0x03,0x14,0xb9,0xfd,0xba,
303 0x03,0x14,0x7a,0x99,0x1e,0x9c,0x7a,0x03,0x14,0xb9,0xfd,0xba,0x03,0x14,0x7a,0x99,
304 0x1e,0x9c,0x7a,0x03,0x15,0xa9,0xed,0xba,0x03,0x15,0x7a,0x99,0x1e,0x9c,0x7a,0x03,
305 0x15,0xb9,0xdd,0xba,0x03,0x15,0x7a,0x99,0x1e,0x9c,0x7a,0x03,0x15,0xb9,0xcd,0xba,
306 0x03,0x16,0x7a,0x99,0x1e,0x9c,0x7a,0x03,0x16,0xb9,0xbd,0xba,0x03,0x16,0x7a,0x99,
307 0x1e,0x9c,0x7a,0x03,0x16,0xb9,0xbd,0xba,0x03,0x16,0x7a,0x99,0x1e,0x9c,0x7a,0x03,
308 0x17,0xa9,0xad,0xba,0x03,0x17,0x7a,0x99,0x1e,0x9c,0x7a,0x03,0x17,0xb9,0x9d,0xba,
309 0x03,0x17,0x7a,0x99,0x1e,0x9c,0x7a,0x03,0x17,0xb9,0x8d,0xba,0x03,0x18,0x7a,0x99,
310 0x1e,0x9c,0x7a,0x03,0x18,0xb9,0x7d,0xba,0x03,0x18,0x7a,0x99,0x1e,0x9c,0x7a,0x03,
311 0x18,0xb9,0x7d,0xba,0x03,0x18,0x7a,0x99,0x1e,0x9c,0x7a,0x03,0x18,0xb9,0x6d,0xba,
312 0x03,0x19,0x7a,0x99,0x1e,0x9c,0x7a,0x03,0x18,0xc9,0x5d,0xba,0x03,0x19,0x7a,0x99,
313 0x1e,0x9c,0x7a,0x03,0x19,0xb9,0x4d,0xba,0x03,0x1a,0x7a,0x99,0x1e,0x9c,0x7a,0x03,
314 0x19,0xc9,0x3d,0xba,0x03,0x1a,0x7a,0x99,0x1e,0x9c,0x7a,0x03,0x1a,0xb9,0x3d,0xaa,
315 0x03,0x1b,0x7a,0x99,0x1e,0x9c,0x7a,0x03,0x1a,0xb9,0x2d,0xba,0x03,0x1b,0x7a,0x99,
316 0x1e,0x9c,0x7a,0x03,0x1b,0xb9,0x1d,0xba,0x03,0x1b,0x7a,0x99,0x1e,0x9c,0x7a,0x03,
317 0x1b,0xb9,0xba,0x03,0x1c,0x7a,0x99,0x1e,0x9c,0x7a,0x03,0x1c,0xa9,0xba,0x03,0x1c,
318 0x7a,0x99,0x1e,0x9c,0x7a,0x03,0x1c,0x99,0xba,0x03,0x1d,0x7a,0x99,0x1e,0x9c,0x7a,
319 0x03,0x1c,0x99,0xba,0x03,0x1d,0x7a,0x99,0x1e,0x9c,0x7a,0x03,0x1d,0x89,0xba,0x03,
320 0x1d,0x7a,0x99,0x1e,0x9c,0x7a,0x03,0x1d,0x89,0xaa,0x03,0x1e,0x7a,0x99,0x1e,0x9c,
321 0x7a,0x03,0x1e,0x69,0xba,0x03,0x1e,0x7a,0x99,0x1e,0x9c,0x7a,0x03,0x1e,0x59,0xba,
322 0x03,0x1f,0x7a,0x99,0x1e,0x9c,0x7a,0x03,0x1e,0x59,0xba,0x03,0x1f,0x7a,0x99,0x1e,
323 0x9c,0x7a,0x03,0x1f,0x39,0xca,0x03,0x1f,0x7a,0x99,0x1e,0x9c,0x7a,0x03,0x1f,0x39,
324 0xba,0x03,0x20,0x7a,0x99,0x1e,0x9c,0x7a,0x03,0x20,0x29,0xba,0x03,0x20,0x7a,0x99,
325 0x1e,0x9c,0x7a,0x03,0x20,0x19,0xba,0x03,0x21,0x7a,0x99,0x1e,0x9c,0x7a,0x03,0x4d,
326 0x7a,0x99,0x1e,0x9c,0x7a,0x03,0x4d,0x7a,0x99,0x1e,0xac,0x6a,0x03,0x4d,0x7a,0x99,
327 0x1e,0xac,0x6a,0x03,0x4d,0x7a,0x99,0x1e,0xac,0x6a,0x03,0x4d,0x7a,0x99,0x1e,0xac,
328 0x6a,0x03,0x4d,0x7a,0x99,0x1e,0xac,0x6a,0x03,0x4d,0x7a,0x99,0x1e,0xac,0x6a,0x03,
329 0x4d,0x7a,0x99,0x1e,0xac,0x6a,0x03,0x4d,0x7a,0x99,0x1e,0xac,0x6a,0x03,0x4d,0x7a,
330 0x99,0x1e,0xac,0x6a,0x03,0x4d,0x7a,0x99,0x1e,0xac,0x6a,0x03,0x4c,0x8a,0x99,0x1e,
331 0xac,0x7a,0x03,0x4b,0x8a,0x99,0x1e,0xac,0x7a,0x03,0x4b,0x8a,0x99,0x1e,0xac,0x7a,
332 0x03,0x4a,0x9a,0x99,0x1e,0xac,0x7a,0x03,0x4a,0x9a,0x99,0x1e,0xac,0x8a,0x03,0x48,
333 0xaa,0x99,0x1e,0xac,0x9a,0x03,0x47,0xaa,0x99,0x1e,0xac,0xaa,0x03,0x45,0xba,0x99,
334 0x1e,0xac,0xba,0x03,0x43,0xca,0x99,0x1e,0xac,0xca,0x03,0x40,0xda,0xa9,0x1e,0xbc,
335 0xea,0x03,0x3a,0x02,0x10,0xa9,0x1e,0xbc,0x02,0x57,0xb9,0x1e,0x18,0xbc,0x02,0x56,
336 0xb9,0x1e,0x18,0xcc,0x02,0x54,0xc9,0x1e,0x28,0xcc,0x02,0x52,0xc9,0x18,0x1e,0x28,
337 0xdc,0x02,0x50,0xd9,0x18,0x1e,0x38,0xdc,0x02,0x4e,0xd9,0x28,0x1e,0x38,0xfc,0x02,
338 0x4a,0xf9,0x28,0x1e,0x48,0xfc,0x02,0x46,0x01,0x11,0x38,0x1e,0x58,0xec,0x01,0x56,
339 0x48,0x1e,0x68,0xdc,0x01,0x55,0x58,0x1e,0x78,0xcc,0x01,0x55,0x58,0x1e,0x78,0xcc,
340 0x01,0x53,0x78,0x1e,0x98,0xac,0x01,0x52,0x88,0x1e,0xa8,0x9c,0x01,0x51,0x98,0x1e,
341 0xb8,0x8c,0x01,0x4f,0xb8,0x1e,0xd8,0x6c,0x01,0x4d,0xd8,0x1e,0xf8,0x4c,0x01,0x4a,
342 0x00,0x10,0x1e,0x00,0x6d,
343 0xff};
344
345 static char* extract_button(int number, int& width, int& height) {
346 int size;
347 char* data;
348
349 switch(number) {
350 case 0: data = buttonleft; size = buttonleft_cnt; width = 164; height = 110; break;
351 case 1: data = buttonright; size = buttonright_cnt; width = 164; height = 110; break;
352 case 2: data = buttonup; size = buttonup_cnt; width = 110; height = 164; break;
353 case 3: data = buttondown; size = buttondown_cnt; width = 110; height = 164; break;
354 default: return 0;
355 }
356
357 char* out = new char[width*height];
358 int outc = 0;
359 int i;
360 // ランレングスの展開
361 for (i=0; i<size; i++) {
362 int c = *(unsigned char*)(data+i);
363 int s = 0;
364 if (c == 0xff) break;
365 if (c&0x08) {
366 s = c>>4;
367 c &= 7;
368 } else {
369 i++;
370 s = *(unsigned char*)(data + i);
371 }
372 int j; for (j=0; j<s; j++) out[outc++] = c;
373 }
374 return out;
375 }
376
377 // R,G,B の指定色を基底色に、明るさを変えた色を RGB -> HLS -> RGB 変換で作成する
378 struct ButtonColor {
379 int rs[8];
380 int gs[8];
381 int bs[8];
382 int as[8];
383 int* c_min, *c_mid, *c_max; // rgb->hls->rgb変換用。r,g,b を高い順にmax,mid,minに割り当てる
384 bool is_gray;
385 int hc, hd, l, s; // h,l,s 系。h 要素は上の c_min|mid|maxにも入る
386 ButtonColor(int _r, int _g, int _b);
387 void SetBrightness1(int n, int c1);
388 void SetBrightness(int c1, int c2, int c3, int c4, int c5);
389 };
390 ButtonColor::ButtonColor(int r, int g, int b) {
391 is_gray = false;
392 if (r == g && r == b) {
393 is_gray = true;
394 l = r;
395 return;
396 }
397 *rs = r; *bs = b; *gs = g;
398
399 // r,g,b の昇順にmax,mid,minをrs,gs,bsに割り当てる
400 if (r > g) {
401 if (r > b) { // r = max
402 c_max = rs;
403 if (b > g) { // r>b>g
404 c_mid = bs;
405 c_min = gs;
406 } else { // r>g>b
407 c_mid = gs;
408 c_min = bs;
409 }
410 } else { // b>r>g
411 c_max = bs;
412 c_mid = rs;
413 c_min = gs;
414 }
415 } else if (g > b) { // g = max
416 c_max = gs;
417 if (r > b) { // g > r > b
418 c_mid = rs;
419 c_min = bs;
420 } else { // g > b > r
421 c_mid = bs;
422 c_min = rs;
423 }
424 } else { // b > g > r
425 c_max = bs;
426 c_mid = gs;
427 c_min = rs;
428 }
429 int min = *c_min;
430 int mid = *c_mid;
431 int max = *c_max;
432 l = (max+min)/2;
433 hd = max-min;
434 hc = mid - min;
435 if (l < 128) s = (hd*255)/(max+min);
436 else s = (hd*255) / (510-(max+min));
437 }
438 void ButtonColor::SetBrightness1(int n, int c1) {
439 if (n < 1 || n > 7) return;
440 as[n] = 255;
441 if (is_gray) {
442 rs[n] = c1 * l / 256;
443 gs[n] = c1 * l / 256;
444 bs[n] = c1 * l / 256;
445 return;
446 }
447 int m1, m2;
448
449 int light = (l * c1 * 2) / 256;
450 if (light > 255) light = 255;
451
452 if (light < 128) m2 = light*(255+s)/255;
453 else m2 = light+s-(light*s/255);
454 m1 = light*2 - m2;
455
456 c_max[n] = m2;
457 c_mid[n] = (hc*m2 + (hd-hc)*m1) / hd;
458 c_min[n] = m1;
459
460 return;
461 }
462 void ButtonColor::SetBrightness(int c1, int c2, int c3, int c4, int c5) {
463 rs[0] = bs[0] = gs[0] = as[0] = 0;
464 SetBrightness1(1, c1);
465 SetBrightness1(2, c2);
466 SetBrightness1(3, c3);
467 SetBrightness1(4, c4);
468 SetBrightness1(5, c5);
469 }
470
471 #include"rect.h"
472 #include<string.h>
473
474 static void draw_button(char* rdata, int width, int height, char* bdata, int bwidth, int bheight, const ButtonColor& color) {
475 const int* rs = color.rs;
476 const int* gs = color.gs;
477 const int* bs = color.bs;
478 const int* as = color.as;
479
480 struct ScaleData {int r,g,b,a,c;};
481 ScaleData* data = new ScaleData[width*height];
482 memset(data, 0, sizeof(ScaleData)*width*height);
483
484 int bx,by;
485 int x=0, y=0;
486 int x2 = 0, y2 = 0;
487 int xadd = width*65536/bwidth;
488 int yadd = height*65536/bheight;
489
490 // 元のビットマップに着色しながら縮小する
491 for (by=0; by<bheight; by++) {
492 ScaleData* d = data + y*width;
493 char* s = bdata + by*bwidth;
494 x = 0; x2 = 0;
495 for (bx=0; bx<bwidth; bx++) {
496 int c = *s++;
497 d[x].r += rs[c];
498 d[x].g += gs[c];
499 d[x].b += bs[c];
500 d[x].a += as[c];
501 d[x].c++;
502 x2 += xadd;
503 x += x2>>16;
504 x2 &= 0xffff;
505 }
506
507 y2 += yadd;
508 y += y2>>16;
509 y2 &= 0xffff;
510 }
511
512 for (y=0; y<height; y++) {
513 ScaleData* d = data + y*width;
514 char* rd = rdata + y*width*4;
515 for (x=0; x<width; x++) {
516 if (d->c == 0) *(int*)rd = 0;
517 else *(int*)rd = (int(d->b / d->c)&0xff)| ((int(d->g / d->c)&0xff)<<8)| ((int(d->r / d->c)&0xff)<<16)| ((int(d->a / d->c)&0xff)<<24);
518 rd += 4;
519 d++;
520 }
521 }
522 delete[] data;
523 return;
524 }
525 char* create_button(int number, int& width, int& height, int r, int g, int b) {
526 int bwidth, bheight;
527 char* bdata = extract_button(number, bwidth, bheight);
528 if (bdata == 0) return 0;
529 // 拡大率に合わせてwidth,heightをセット
530 if (width == -1 && height == -1) width = bwidth, height = bheight;
531 else if (width == -1) width = bwidth * height / bheight;
532 else if (height == -1) height = bheight * width / bwidth;
533 if (width > bwidth) width = bwidth;
534 if (height > bheight) height = bheight;
535
536 // 色を設定する
537 ButtonColor color(r,g,b);
538 // 描画
539 char* rdata = (char*)malloc(width*height*4*3);
540 color.SetBrightness(0x60, 0xa0, 0xc0, 0xe0, 0xe0);
541 draw_button(rdata, width, height, bdata, bwidth, bheight, color);
542 color.SetBrightness(0x60, 0xa0, 0xe0, 0xe0, 0xe0);
543 draw_button(rdata+width*height*4, width, height, bdata, bwidth, bheight, color);
544 color.SetBrightness(0xe0, 0xc0, 0xa0, 0x60, 0xa0);
545 draw_button(rdata+width*height*8, width, height, bdata, bwidth, bheight, color);
546 return rdata;
547 }
548
549 static void drawbox(char* buf, const Rect& region, int width, int r, int g, int b, int a) {
550 buf += region.ty*width*4 + region.lx*4;
551 int i,j;
552 int h = region.height();
553 int w = region.width();
554 int col = (b&0xff) | ((g&0xff)<<8)| ((r&0xff)<<16)| ((a&0xff)<<24);
555 for (i=0; i<h; i++) {
556 char* c = buf;
557 for (j=0; j<w; j++) {
558 *(int*)c = col;
559 c += 4;
560 }
561 buf += width*4;
562 }
563 return;
564 }
565 static void draw_box(char* buf, int width, int height, int kage_w1, int kage_w2, const ButtonColor& color) {
566 const int* rs = color.rs;
567 const int* gs = color.gs;
568 const int* bs = color.bs;
569 const int* as = color.as;
570 // まず、豆腐を書く
571 drawbox(buf, Rect(0,0,width,height), width, rs[3],gs[3],bs[3],as[3]);
572 // 影
573 if (height > 2) {
574 drawbox(buf, Rect(0,0,width,kage_w1), width, rs[4], gs[4], bs[4],as[4]);
575 drawbox(buf, Rect(0,height-kage_w1,width,height), width, rs[1], gs[1], bs[1],as[1]);
576 }
577 if (width > 2) {
578 drawbox(buf, Rect(0,0,kage_w1, height), width, rs[4], gs[4], bs[4],as[4]);
579 drawbox(buf, Rect(width-kage_w1,0,width,height), width, rs[1], gs[1], bs[1],as[1]);
580 }
581 if (height > 4) {
582 drawbox(buf, Rect(kage_w2, height-kage_w2, width-kage_w1, height-kage_w1), width, rs[2], gs[2], bs[2], as[2]);
583 }
584 if (width > 4) {
585 drawbox(buf, Rect(width-kage_w2, kage_w2, width-kage_w1, height-kage_w1), width, rs[2], gs[2], bs[2], as[2]);
586 }
587 }
588 char* create_box(int& width, int& height, int r, int g, int b) {
589 ButtonColor color(r,g,b);
590 // scale のカーソル
591 if (width == -1 && height == -1) width = 32, height = 48;
592 else if (width == -1) width = height*3/2;
593 else if (height == -1) height = width * 3/2;
594 int kage_w1 = (width<height ? width : height)/14;
595 int kage_w2 = (width<height ? width : height)*2/14;
596 if (kage_w1 <= 0) kage_w1 = 1;
597 if (kage_w2 <= 1) kage_w2 = 2;
598
599 char* buf = (char*)malloc(width*height*4*3);
600 // 描画
601 color.SetBrightness(0x60, 0xa0, 0xc0, 0xe0, 0xe0);
602 draw_box(buf, width, height, kage_w1, kage_w2, color);
603 color.SetBrightness(0x60, 0xa0, 0xe0, 0xe0, 0xe0);
604 draw_box(buf+width*height*4, width, height, kage_w1, kage_w2, color);
605 color.SetBrightness(0xe0, 0xc0, 0xa0, 0x60, 0xa0);
606 draw_box(buf+width*height*8, width, height, kage_w1, kage_w2, color);
607 return buf;
608 }
609
610 #if 0
611 #include<stdio.h>
612 #include <png.h>
613
614 void create_png(FILE* stream,int width, int height, char* data) {
615 png_structp png_ptr;
616 png_infop info_ptr;
617
618 /* create struct */
619 png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
620 if (png_ptr == NULL) return;
621
622 /* initialize information */
623 info_ptr = png_create_info_struct(png_ptr);
624 if (info_ptr == NULL) {
625 png_destroy_write_struct(&png_ptr, (png_infop*)NULL);
626 return;
627 }
628
629 if (setjmp(png_jmpbuf(png_ptr))) {
630 /* error occured !! */
631 png_destroy_write_struct(&png_ptr,&info_ptr);
632 return;
633 }
634
635 /* initialize I/O (for stream) */
636 png_init_io(png_ptr, stream);
637
638 /* initialize headers */
639 png_set_IHDR(png_ptr, info_ptr,
640 width, height, 8 /* bit_dept */,
641 PNG_COLOR_TYPE_RGB_ALPHA,
642 PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
643 /* create text information */
644 png_text info_text[3];
645 info_text[0].key = "Title";
646 info_text[0].text= "file";
647 info_text[0].compression = PNG_TEXT_COMPRESSION_NONE;
648 info_text[1].key = "Author";
649 info_text[1].text="";
650 info_text[1].compression = PNG_TEXT_COMPRESSION_NONE;
651 info_text[2].key = "Description";
652 info_text[2].text= "";
653 info_text[2].compression = PNG_TEXT_COMPRESSION_NONE;
654 png_set_text(png_ptr, info_ptr, info_text, 3);
655
656 /* write information */
657 png_write_info(png_ptr, info_ptr);
658
659 /* write body */
660 /* rgba image ; input/output is 32bpp.*/
661 char* row = new char[width*4];
662 int i; for (i=0; i<height; i++) {
663 char* row_ptr = row;
664 int j; for (j=0; j<width; j++) {
665 row_ptr[0] = data[2];
666 row_ptr[1] = data[1];
667 row_ptr[2] = data[0];
668 row_ptr[3] = data[3];
669 row_ptr += 4; data += 4;
670 }
671 png_write_rows(png_ptr, (png_byte**)&row, 1);
672 }
673 png_write_end(png_ptr, info_ptr);
674 png_destroy_write_struct(&png_ptr, &info_ptr);
675 return;
676 }
677 int main(void) {
678 int w=128,h=-1;
679 char* c = create_button(2, w,h,0x20,0x60,0xc0);
680 // char* c = create_box(w,h,0xff,0xff,0xff);
681 int i;
682 FILE* f=fopen("bt.png","wb");
683 if(f==0)return 0;
684 create_png(f,w,h*3,c);
685 for (i=0;i<w*h;i++) {
686 printf("%08x,",*(int*)(c+i*4));
687 if ( (i&7)==7) printf("\n");
688 }
689 return 0;
690 }
691
692 #endif