NXWidgets  1.19
glyph_cmd49x43.cxx
Go to the documentation of this file.
1 /********************************************************************************************
2  * NxWidgets/nxwm/src/glyph_cmd49x43.cxx
3  *
4  * Copyright (C) 2012 Gregory Nutt. All rights reserved.
5  * Author: Gregory Nutt <gnutt@nuttx.org>
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * 1. Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  * 2. Redistributions in binary form must reproduce the above copyright
14  * notice, this list of conditions and the following disclaimer in
15  * the documentation and/or other materials provided with the
16  * distribution.
17  * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
18  * me be used to endorse or promote products derived from this software
19  * without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
28  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
29  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32  * POSSIBILITY OF SUCH DAMAGE.
33  *
34  ********************************************************************************************/
35 
36 /********************************************************************************************
37  * Included Files
38  ********************************************************************************************/
39 
40 #include <nuttx/config.h>
41 
42 #include <sys/types.h>
43 #include <stdint.h>
44 #include <stdbool.h>
45 
46 #include <nuttx/nx/nxglib.h>
47 #include <nuttx/video/fb.h>
48 #include <nuttx/video/rgbcolors.h>
49 
50 #include "crlepalettebitmap.hxx"
51 
52 #include "nxwmconfig.hxx"
53 #include "nxwmglyphs.hxx"
54 
55 /********************************************************************************************
56  * Pre-Processor Definitions
57  ********************************************************************************************/
58 
59 #define BITMAP_NROWS 43
60 #define BITMAP_NCOLUMNS 49
61 #define BITMAP_NLUTCODES 10
62 
63 #define DARK_CMD_ICON 1
64 
65 /********************************************************************************************
66  * Private Bitmap Data
67  ********************************************************************************************/
68 
69 using namespace NxWM;
70 
71 /* RGB24 (8-8-8) Colors */
72 
73 #if CONFIG_NXWIDGETS_BPP == 24 || CONFIG_NXWIDGETS_BPP == 32
74 # ifdef DARK_CMD_ICON
75 
76 static const uint32_t g_cmdNormalLut[BITMAP_NLUTCODES] =
77 {
78  0x969696, 0x545454, 0x2a2a2a, 0x818181, 0x001581, 0xab0000, 0x0015ab, 0xbd0000, /* Codes 0-7 */
79  0xbdbdbd, 0x3f3f3f /* Codes 8-9 */
80 };
81 
82 static const uint32_t g_cmdBrightLut[BITMAP_NLUTCODES] =
83 {
84  0xc8c8c8, 0x707070, 0x383838, 0xacacac, 0x001cac, 0xe40000, 0x001ce4, 0xfc0000, /* Codes 0-7 */
85  0xfcfcfc, 0x545454 /* Codes 8-9 */
86 };
87 
88 # else /* DARK_CMD_ICON */
89 
90 static const uint32_t g_cmdNormalLut[BITMAP_NLUTCODES] =
91 {
92  0xc8c8c8, 0x707070, 0x383838, 0xacacac, 0x001cac, 0xe40000, 0x001ce4, 0xfc0000, /* Codes 0-7 */
93  0xfcfcfc, 0x545454 /* Codes 8-9 */
94 };
95 
96 static const uint32_t g_cmdBrightLut[BITMAP_NLUTCODES] =
97 {
98  0xfafafa, 0x8c8c8c, 0x464646, 0xd7d7d7, 0x0023d7, 0xff0000, 0x0023ff, 0xff0000, /* Codes 0-7 */
99  0xffffff, 0x696969 /* Codes 8-9 */
100 };
101 # endif /* DARK_CMD_ICON */
102 
103 /* RGB16 (565) Colors */
104 
105 #elif CONFIG_NXWIDGETS_BPP == 16
106 # ifdef DARK_CMD_ICON
107 
108 static const uint16_t g_cmdNormalLut[BITMAP_NLUTCODES] =
109 {
110  0x94b2, 0x52aa, 0x2945, 0x8410, 0x00b0, 0xa800, 0x00b5, 0xb800, 0xbdf7, 0x39e7 /* Codes 0-9 */
111 };
112 
113 static const uint16_t g_cmdBrightLut[BITMAP_NLUTCODES] =
114 {
115  0xce59, 0x738e, 0x39c7, 0xad75, 0x00f5, 0xe000, 0x00fc, 0xf800, 0xffff, 0x52aa /* Codes 0-9 */
116 };
117 
118 # else /* DARK_CMD_ICON */
119 
120 static const uint16_t g_cmdNormalLut[BITMAP_NLUTCODES] =
121 {
122  0xce59, 0x738e, 0x39c7, 0xad75, 0x00f5, 0xe000, 0x00fc, 0xf800, 0xffff, 0x52aa /* Codes 0-9 */
123 };
124 
125 static const uint16_t g_cmdBrightLut[BITMAP_NLUTCODES] =
126 {
127  0xffdf, 0x8c71, 0x4228, 0xd6ba, 0x011a, 0xf800, 0x011f, 0xf800, 0xffff, 0x6b4d /* Codes 0-9 */
128 };
129 
130 # endif /* DARK_CMD_ICON */
131 
132 /* 8-bit color lookups. NOTE: This is really dumb! The lookup index is 8-bits and it used
133  * to lookup an 8-bit value. There is no savings in that! It would be better to just put
134  * the 8-bit color/greyscale value in the run-length encoded image and save the cost of these
135  * pointless lookups. But these pointless lookups do make the logic compatible with the
136  * 16- and 24-bit types.
137  */
138 
139 #elif CONFIG_NXWIDGETS_BPP == 8
140 # ifdef CONFIG_NXWIDGETS_GREYSCALE
141 
142 /* 8-bit Greyscale */
143 
144 # ifdef DARK_CMD_ICON
145 
146 static const uint8_t g_cmdNormalLut[BITMAP_NLUTCODES] =
147 {
148  0x96, 0x54, 0x2a, 0x81, 0x1b, 0x33, 0x1f, 0x38, 0xbd, 0x3f /* Codes 0-9 */
149 };
150 
151 static const uint8_t g_cmdBrightLut[BITMAP_NLUTCODES] =
152 {
153  0xc8, 0x70, 0x38, 0xac, 0x24, 0x44, 0x2a, 0x4b, 0xfc, 0x54 /* Codes 0-9 */
154 };
155 
156 # else /* DARK_CMD_ICON */
157 
158 static const uint8_t g_cmdNormalLut[BITMAP_NLUTCODES] =
159 {
160  0xc8, 0x70, 0x38, 0xac, 0x24, 0x44, 0x2a, 0x4b, 0xfc, 0x54 /* Codes 0-9 */
161 };
162 
163 static const uint8_t g_cmdBrightLut[BITMAP_NLUTCODES] =
164 {
165  0xfa, 0x8c, 0x46, 0xd7, 0x2d, 0x4c, 0x31, 0x4c, 0xff, 0x69 /* Codes 0-9 */
166 };
167 
168 # endif /* DARK_CMD_ICON */
169 
170 # else /* CONFIG_NXWIDGETS_GREYSCALE */
171 
172 /* RGB8 (332) Colors */
173 
174 # ifdef DARK_CMD_ICON
175 
176 static const nxgl_mxpixel_t g_cmdNormalLut[BITMAP_NLUTCODES] =
177 {
178  0x92, 0x49, 0x24, 0x92, 0x02, 0xa0, 0x02, 0xa0, 0xb6, 0x24 /* Codes 0-9 */
179 };
180 
181 static const nxgl_mxpixel_t g_cmdBrightLut[BITMAP_NLUTCODES] =
182 {
183  0xdb, 0x6d, 0x24, 0xb6, 0x02, 0xe0, 0x03, 0xe0, 0xff, 0x49 /* Codes 0-9 */
184 };
185 
186 # else /* DARK_CMD_ICON */
187 
188 static const nxgl_mxpixel_t g_cmdNormalLut[BITMAP_NLUTCODES] =
189 {
190  0xdb, 0x6d, 0x24, 0xb6, 0x02, 0xe0, 0x03, 0xe0, 0xff, 0x49 /* Codes 0-9 */
191 };
192 
193 static const nxgl_mxpixel_t g_cmdBrightLut[BITMAP_NLUTCODES] =
194 {
195  0xff, 0x92, 0x49, 0xdb, 0x07, 0xe0, 0x07, 0xe0, 0xff, 0x6d /* Codes 0-9 */
196 };
197 
198 # endif /* DARK_CMD_ICON */
199 # endif /* CONFIG_NXWIDGETS_GREYSCALE */
200 #else
201 # error Unsupported pixel format
202 #endif
203 
205 {
206  {47, 0}, { 1, 1}, { 1, 2}, /* Row 0 */
207  { 1, 0}, {46, 3}, { 1, 1}, { 1, 2}, /* Row 1 */
208  { 1, 0}, {46, 3}, { 1, 1}, { 1, 2}, /* Row 2 */
209  { 1, 0}, {31, 3}, { 6, 4}, { 2, 3}, { 6, 5}, { 1, 3}, { 1, 1}, { 1, 2}, /* Row 3 */
210  { 1, 0}, {31, 3}, { 1, 4}, { 3, 6}, { 2, 4}, { 2, 3}, { 1, 5}, { 3, 7}, /* Row 4 */
211  { 2, 5}, { 1, 3}, { 1, 1}, { 1, 2},
212  { 1, 0}, {31, 3}, { 1, 4}, { 2, 6}, { 3, 4}, { 2, 3}, { 1, 5}, { 2, 7}, /* Row 5 */
213  { 3, 5}, { 1, 3}, { 1, 1}, { 1, 2},
214  { 1, 0}, {31, 3}, { 1, 4}, { 1, 6}, { 4, 4}, { 2, 3}, { 1, 5}, { 1, 7}, /* Row 6 */
215  { 4, 5}, { 1, 3}, { 1, 1}, { 1, 2},
216  { 1, 0}, {31, 3}, { 6, 4}, { 2, 3}, { 6, 5}, { 1, 3}, { 1, 1}, { 1, 2}, /* Row 7 */
217  { 1, 0}, {31, 3}, { 6, 4}, { 2, 3}, { 6, 5}, { 1, 3}, { 1, 1}, { 1, 2}, /* Row 8 */
218  { 1, 0}, {46, 3}, { 1, 1}, { 1, 2}, /* Row 9 */
219  { 1, 0}, {46, 3}, { 1, 1}, { 1, 2}, /* Row 10 */
220  { 1, 0}, { 1, 3}, {44, 1}, { 1, 3}, { 1, 1}, { 1, 2}, /* Row 11 */
221  { 1, 0}, { 1, 3}, { 1, 1}, {43, 2}, { 1, 3}, { 1, 1}, { 1, 2}, /* Row 12 */
222  { 1, 0}, { 1, 3}, { 1, 1}, { 1, 2}, {42, 1}, { 1, 3}, { 1, 1}, { 1, 2}, /* Row 13 */
223  { 1, 0}, { 1, 3}, { 1, 1}, { 1, 2}, { 1, 1}, { 1, 8}, {40, 1}, { 1, 3}, /* Row 14 */
224  { 1, 1}, { 1, 2},
225  { 1, 0}, { 1, 3}, { 1, 1}, { 1, 2}, { 2, 1}, { 1, 8}, {39, 1}, { 1, 3}, /* Row 15 */
226  { 1, 1}, { 1, 2},
227  { 1, 0}, { 1, 3}, { 1, 1}, { 1, 2}, { 3, 1}, { 1, 8}, {38, 1}, { 1, 3}, /* Row 16 */
228  { 1, 1}, { 1, 2},
229  { 1, 0}, { 1, 3}, { 1, 1}, { 1, 2}, { 4, 1}, { 1, 8}, {37, 1}, { 1, 3}, /* Row 17 */
230  { 1, 1}, { 1, 2},
231  { 1, 0}, { 1, 3}, { 1, 1}, { 1, 2}, { 5, 1}, { 1, 8}, {36, 1}, { 1, 3}, /* Row 18 */
232  { 1, 1}, { 1, 2},
233  { 1, 0}, { 1, 3}, { 1, 1}, { 1, 2}, { 4, 1}, { 1, 8}, { 1, 9}, {36, 1}, /* Row 19 */
234  { 1, 3}, { 1, 1}, { 1, 2},
235  { 1, 0}, { 1, 3}, { 1, 1}, { 1, 2}, { 3, 1}, { 1, 8}, { 1, 9}, {37, 1}, /* Row 20 */
236  { 1, 3}, { 1, 1}, { 1, 2},
237  { 1, 0}, { 1, 3}, { 1, 1}, { 1, 2}, { 2, 1}, { 1, 8}, { 1, 9}, { 4, 1}, /* Row 21 */
238  { 9, 8}, {25, 1}, { 1, 3}, { 1, 1}, { 1, 2},
239  { 1, 0}, { 1, 3}, { 1, 1}, { 1, 2}, { 1, 1}, { 1, 8}, { 1, 9}, { 6, 1}, /* Row 22 */
240  { 9, 9}, {24, 1}, { 1, 3}, { 1, 1}, { 1, 2},
241  { 1, 0}, { 1, 3}, { 1, 1}, { 1, 2}, { 1, 1}, { 1, 9}, {40, 1}, { 1, 3}, /* Row 23 */
242  { 1, 1}, { 1, 2},
243  { 1, 0}, { 1, 3}, { 1, 1}, { 1, 2}, {42, 1}, { 1, 3}, { 1, 1}, { 1, 2}, /* Row 24 */
244  { 1, 0}, { 1, 3}, { 1, 1}, { 1, 2}, {42, 1}, { 1, 3}, { 1, 1}, { 1, 2}, /* Row 25 */
245  { 1, 0}, { 1, 3}, { 1, 1}, { 1, 2}, {42, 1}, { 1, 3}, { 1, 1}, { 1, 2}, /* Row 26 */
246  { 1, 0}, { 1, 3}, { 1, 1}, { 1, 2}, {42, 1}, { 1, 3}, { 1, 1}, { 1, 2}, /* Row 27 */
247  { 1, 0}, { 1, 3}, { 1, 1}, { 1, 2}, {42, 1}, { 1, 3}, { 1, 1}, { 1, 2}, /* Row 28 */
248  { 1, 0}, { 1, 3}, { 1, 1}, { 1, 2}, {42, 1}, { 1, 3}, { 1, 1}, { 1, 2}, /* Row 29 */
249  { 1, 0}, { 1, 3}, { 1, 1}, { 1, 2}, {42, 1}, { 1, 3}, { 1, 1}, { 1, 2}, /* Row 30 */
250  { 1, 0}, { 1, 3}, { 1, 1}, { 1, 2}, {42, 1}, { 1, 3}, { 1, 1}, { 1, 2}, /* Row 31 */
251  { 1, 0}, { 1, 3}, { 1, 1}, { 1, 2}, {42, 1}, { 1, 3}, { 1, 1}, { 1, 2}, /* Row 32 */
252  { 1, 0}, { 1, 3}, { 1, 1}, { 1, 2}, {42, 1}, { 1, 3}, { 1, 1}, { 1, 2}, /* Row 33 */
253  { 1, 0}, { 1, 3}, { 1, 1}, { 1, 2}, {42, 1}, { 1, 3}, { 1, 1}, { 1, 2}, /* Row 34 */
254  { 1, 0}, { 1, 3}, { 1, 1}, { 1, 2}, {42, 1}, { 1, 3}, { 1, 1}, { 1, 2}, /* Row 35 */
255  { 1, 0}, { 1, 3}, { 1, 1}, { 1, 2}, {42, 1}, { 1, 3}, { 1, 1}, { 1, 2}, /* Row 36 */
256  { 1, 0}, { 1, 3}, { 1, 1}, { 1, 2}, {42, 1}, { 1, 3}, { 1, 1}, { 1, 2}, /* Row 37 */
257  { 1, 0}, { 1, 3}, { 1, 1}, { 1, 2}, {42, 1}, { 1, 3}, { 1, 1}, { 1, 2}, /* Row 38 */
258  { 1, 0}, { 1, 3}, {44, 1}, { 1, 3}, { 1, 1}, { 1, 2}, /* Row 39 */
259  { 1, 0}, {46, 3}, { 1, 1}, { 1, 2}, /* Row 40 */
260  {48, 1}, { 1, 2}, /* Row 41 */
261  {49, 2} /* Row 42 */
262 };
263 
264 /********************************************************************************************
265  * Public Bitmap Structure Definitions
266  ********************************************************************************************/
267 
268 const struct NXWidgets::SRlePaletteBitmap NxWM::g_cmdBitmap =
269 {
270  CONFIG_NXWIDGETS_BPP, // bpp - Bits per pixel
271  CONFIG_NXWIDGETS_FMT, // fmt - Color format
272  BITMAP_NLUTCODES, // nlut - Number of colors in the lLook-Up Table (LUT)
273  BITMAP_NCOLUMNS, // width - Width in pixels
274  BITMAP_NROWS, // height - Height in rows
275  { // lut - Pointer to the beginning of the Look-Up Table (LUT)
276  g_cmdNormalLut, // Index 0: Unselected LUT
277  g_cmdBrightLut, // Index 1: Selected LUT
278  },
279  g_cmdRleEntries // data - Pointer to the beginning of the RLE data
280 };
static const struct NXWidgets::SRlePaletteBitmapEntry g_cmdRleEntries[]
const struct NXWidgets::SRlePaletteBitmap g_cmdBitmap
Definition: nxwmglyphs.hxx:62
static const uint32_t g_cmdBrightLut[BITMAP_NLUTCODES]
static const uint32_t g_cmdNormalLut[BITMAP_NLUTCODES]