NXWidgets: glyph_play48x48.cxx Source File

NXWidgets 1.19

glyph_play48x48.cxx
Go to the documentation of this file.
1 /********************************************************************************************
2 * NxWidgets/nxwm/src/glyph_play24x24.cxx
3 *
4 * Copyright (C) 2014 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 48
60 #define BITMAP_NCOLUMNS 48
61 #define BITMAP_NLUTCODES 7
62
63 #define DARK_PLAY_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_PLAY_ICON
75
76 static const uint32_t g_playNormalLut[BITMAP_NLUTCODES] =
77 {
78 0x00a200, 0x00bd00, CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Codes 0-2 */
79 0x008400, 0x006600, 0x004e00, 0x003600 /* Codes 3-6 */
80 };
81
82 static const uint32_t g_playBrightLut[BITMAP_NLUTCODES] =
83 {
84 0x00d800, 0x00fc00, CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Codes 0-2 */
85 0x00b000, 0x008800, 0x006800, 0x004800 /* Codes 3-6 */
86 };
87
88 # else /* DARK_PLAY_ICON */
89
90 static const uint32_t g_playNormalLut[BITMAP_NLUTCODES] =
91 {
92 0x00d800, 0x00fc00, CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Codes 0-2 */
93 0x00b000, 0x008800, 0x006800, 0x004800 /* Codes 3-6 */
94 };
95
96 static const uint32_t g_playBrightLut[BITMAP_NLUTCODES] =
97 {
98 0x00ff00, 0x00ff00, CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Codes 0-2 */
99 0x00dc00, 0x00aa00, 0x008200, 0x005a00 /* Codes 3-6 */
100 };
101
102 # endif /* DARK_PLAY_ICON */
103
104 /* RGB16 (565) Colors */
105
106 #elif CONFIG_NXWIDGETS_BPP == 16
107 # ifdef DARK_PLAY_ICON
108
109 static const uint16_t g_playNormalLut[BITMAP_NLUTCODES] =
110 {
111 0x0500, 0x05e0, CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Codes 0-2 */
112 0x0420, 0x0320, 0x0260, 0x01a0 /* Codes 3-6 */
113 };
114
115 static const uint16_t g_playBrightLut[BITMAP_NLUTCODES] =
116 {
117 0x06c0, 0x07e0, CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Codes 0-2 */
118 0x0580, 0x0440, 0x0340, 0x0240 /* Codes 3-6 */
119 };
120
121 # else /* DARK_PLAY_ICON */
122
123 static const uint16_t g_playNormalLut[BITMAP_NLUTCODES] =
124 {
125 0x06c0, 0x07e0, CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Codes 0-2 */
126 0x0580, 0x0440, 0x0340, 0x0240 /* Codes 3-6 */
127 };
128
129 static const uint16_t g_playBrightLut[BITMAP_NLUTCODES] =
130 {
131 0x07e0, 0x07e0, CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Codes 0-2 */
132 0x06e0, 0x0540, 0x0400, 0x02c0 /* Codes 3-6 */
133 };
134
135 # endif /* DARK_PLAY_ICON */
136
137 /* 8-bit color lookups. NOTE: This is really dumb! The lookup index is 8-bits and it used
138 * to lookup an 8-bit value. There is no savings in that! It would be better to just put
139 * the 8-bit color/greyscale value in the run-length encoded image and save the cost of these
140 * pointless lookups. But these pointless lookups do make the logic compatible with the
141 * 16- and 24-bit types.
142 */
143
144 #elif CONFIG_NXWIDGETS_BPP == 8
145 # ifdef CONFIG_NXWIDGETS_GREYSCALE
146
147 /* 8-bit Greyscale */
148
149 # ifdef DARK_PLAY_ICON
150
151 static const uint8_t g_playNormalLut[BITMAP_NLUTCODES] =
152 {
153 0x5f, 0x6e, CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Codes 0-2 */
154 0x4d, 0x3b, 0x2d, 0x1f /* Codes 3-6 */
155 };
156
157 static const uint8_t g_playBrightLut[BITMAP_NLUTCODES] =
158 {
159 0x7e, 0x93, CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Codes 0-2 */
160 0x67, 0x4f, 0x3d, 0x2a /* Codes 3-6 */
161 };
162
163 # else /* DARK_PLAY_ICON */
164
165 static const uint8_t g_playNormalLut[BITMAP_NLUTCODES] =
166 {
167 0x7e, 0x93, CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Codes 0-2 */
168 0x67, 0x4f, 0x3d, 0x2a /* Codes 3-6 */
169 };
170
171 static const uint8_t g_playBrightLut[BITMAP_NLUTCODES] =
172 {
173 0x95, 0x95, CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Codes 0-2 */
174 0x81, 0x63, 0x4c, 0x34 /* Codes 3-6 */
175 };
176
177 # endif /* DARK_PLAY_ICON */
178 # else /* CONFIG_NXWIDGETS_GREYSCALE */
179
180 /* RGB8 (332) Colors */
181
182 # ifdef DARK_PLAY_ICON
183
184 static const nxgl_mxpixel_t g_playNormalLut[BITMAP_NLUTCODES] =
185 {
186 0x14, 0x14, CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Codes 0-2 */
187 0x10, 0x0c, 0x08, 0x04 /* Codes 3-6 */
188 };
189
190 static const nxgl_mxpixel_t g_playBrightLut[BITMAP_NLUTCODES] =
191 {
192 0x18, 0x1c, CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Codes 0-2 */
193 0x14, 0x10, 0x0c, 0x08 /* Codes 3-6 */
194 };
195
196 # else /* DARK_PLAY_ICON */
197
198 static const nxgl_mxpixel_t g_playNormalLut[BITMAP_NLUTCODES] =
199 {
200 0x18, 0x1c, CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Codes 0-2 */
201 0x14, 0x10, 0x0c, 0x08 /* Codes 3-6 */
202 };
203
204 static const nxgl_mxpixel_t g_playBrightLut[BITMAP_NLUTCODES] =
205 {
206 0x1c, 0x1c, CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Codes 0-2 */
207 0x18, 0x14, 0x10, 0x08 /* Codes 3-6 */
208 };
209
210 # endif /* DARK_PLAY_ICON */
211 # endif /* CONFIG_NXWIDGETS_GREYSCALE */
212 #else
213 # error "Unsupport pixel format"
214 #endif
215
216 static const struct NXWidgets::SRlePaletteBitmapEntry g_playRleEntries[] =
217 {
218 { 1, 0}, { 2, 1}, { 45, 2}, /* Row 0 */
219 { 2, 3}, { 1, 0}, { 2, 1}, { 43, 2}, /* Row 1 */
220 { 4, 3}, { 1, 0}, { 2, 1}, { 41, 2}, /* Row 2 */
221 { 6, 3}, { 1, 0}, { 2, 1}, { 39, 2}, /* Row 3 */
222 { 8, 3}, { 1, 0}, { 2, 1}, { 37, 2}, /* Row 4 */
223 { 10, 3}, { 1, 0}, { 2, 1}, { 35, 2}, /* Row 5 */
224 { 12, 3}, { 1, 0}, { 2, 1}, { 33, 2}, /* Row 6 */
225 { 14, 3}, { 1, 0}, { 2, 1}, { 31, 2}, /* Row 7 */
226 { 16, 3}, { 1, 0}, { 2, 1}, { 29, 2}, /* Row 8 */
227 { 18, 3}, { 1, 0}, { 2, 1}, { 27, 2}, /* Row 9 */
228 { 20, 3}, { 1, 0}, { 2, 1}, { 25, 2}, /* Row 10 */
229 { 22, 3}, { 1, 0}, { 2, 1}, { 23, 2}, /* Row 11 */
230 { 24, 3}, { 1, 0}, { 2, 1}, { 21, 2}, /* Row 12 */
231 { 26, 3}, { 1, 0}, { 2, 1}, { 19, 2}, /* Row 13 */
232 { 28, 3}, { 1, 0}, { 2, 1}, { 17, 2}, /* Row 14 */
233 { 30, 3}, { 1, 0}, { 2, 1}, { 15, 2}, /* Row 15 */
234 { 32, 3}, { 1, 0}, { 2, 1}, { 13, 2}, /* Row 16 */
235 { 34, 3}, { 1, 0}, { 2, 1}, { 11, 2}, /* Row 17 */
236 { 36, 3}, { 1, 0}, { 2, 1}, { 9, 2}, /* Row 18 */
237 { 38, 3}, { 1, 0}, { 2, 1}, { 7, 2}, /* Row 19 */
238 { 40, 3}, { 1, 0}, { 2, 1}, { 5, 2}, /* Row 20 */
239 { 42, 3}, { 1, 0}, { 2, 1}, { 3, 2}, /* Row 21 */
240 { 44, 3}, { 1, 0}, { 2, 1}, { 1, 2}, /* Row 22 */
241 { 46, 3}, { 1, 0}, { 1, 1}, /* Row 23 */
242 { 46, 4}, { 1, 5}, { 1, 6}, /* Row 24 */
243 { 44, 4}, { 1, 5}, { 2, 6}, { 1, 2}, /* Row 25 */
244 { 42, 4}, { 3, 6}, { 3, 2}, /* Row 26 */
245 { 40, 4}, { 1, 5}, { 2, 6}, { 5, 2}, /* Row 27 */
246 { 38, 4}, { 3, 6}, { 7, 2}, /* Row 28 */
247 { 36, 4}, { 1, 5}, { 2, 6}, { 9, 2}, /* Row 29 */
248 { 34, 4}, { 3, 6}, { 11, 2}, /* Row 30 */
249 { 32, 4}, { 1, 5}, { 2, 6}, { 13, 2}, /* Row 31 */
250 { 30, 4}, { 3, 6}, { 15, 2}, /* Row 32 */
251 { 28, 4}, { 1, 5}, { 2, 6}, { 17, 2}, /* Row 33 */
252 { 26, 4}, { 3, 6}, { 19, 2}, /* Row 34 */
253 { 24, 4}, { 1, 5}, { 2, 6}, { 21, 2}, /* Row 35 */
254 { 22, 4}, { 3, 6}, { 23, 2}, /* Row 36 */
255 { 20, 4}, { 1, 5}, { 2, 6}, { 25, 2}, /* Row 37 */
256 { 18, 4}, { 3, 6}, { 27, 2}, /* Row 38 */
257 { 16, 4}, { 1, 5}, { 2, 6}, { 29, 2}, /* Row 39 */
258 { 14, 4}, { 3, 6}, { 31, 2}, /* Row 40 */
259 { 12, 4}, { 1, 5}, { 2, 6}, { 33, 2}, /* Row 41 */
260 { 10, 4}, { 3, 6}, { 35, 2}, /* Row 42 */
261 { 8, 4}, { 1, 5}, { 2, 6}, { 37, 2}, /* Row 43 */
262 { 6, 4}, { 3, 6}, { 39, 2}, /* Row 44 */
263 { 4, 4}, { 1, 5}, { 2, 6}, { 41, 2}, /* Row 45 */
264 { 2, 4}, { 3, 6}, { 43, 2}, /* Row 46 */
265 { 1, 5}, { 2, 6}, { 45, 2}, /* Row 47 */
266 };
267
268 /********************************************************************************************
269 * Public Bitmap Structure Definitions
270 ********************************************************************************************/
271
272 const struct NXWidgets::SRlePaletteBitmap NxWM::g_playBitmap =
273 {
274 CONFIG_NXWIDGETS_BPP, // bpp - Bits per pixel
275 CONFIG_NXWIDGETS_FMT, // fmt - Color format
276 BITMAP_NLUTCODES, // nlut - Number of colors in the lLook-Up Table (LUT)
277 BITMAP_NCOLUMNS, // width - Width in pixels
278 BITMAP_NROWS, // height - Height in rows
279 { // lut - Pointer to the beginning of the Look-Up Table (LUT)
280 g_playNormalLut, // Index 0: Unselected LUT
281 g_playBrightLut, // Index 1: Selected LUT
282 },
283 g_playRleEntries // data - Pointer to the beginning of the RLE data
284 };
crlepalettebitmap.hxx
NXWidgets::SRlePaletteBitmapEntry
Definition: crlepalettebitmap.hxx:70
g_playNormalLut
static const uint32_t g_playNormalLut[BITMAP_NLUTCODES]
Definition: glyph_play48x48.cxx:76
NxWM::BITMAP_NLUTCODES
BITMAP_NLUTCODES
Definition: glyph_calculator24x25.cxx:181
g_playRleEntries
static const struct NXWidgets::SRlePaletteBitmapEntry g_playRleEntries[]
Definition: glyph_play48x48.cxx:216
nxwmconfig.hxx
NxWM::g_playBitmap
const struct NXWidgets::SRlePaletteBitmap g_playBitmap
Definition: nxwmglyphs.hxx:72
nxwmglyphs.hxx
NxWM
Definition: capplicationwindow.hxx:66
NxWM::CONFIG_NXWIDGETS_BPP
CONFIG_NXWIDGETS_BPP
Definition: glyph_calculator24x25.cxx:181
NxWM::BITMAP_NCOLUMNS
BITMAP_NCOLUMNS
Definition: glyph_calculator24x25.cxx:181
g_playBrightLut
static const uint32_t g_playBrightLut[BITMAP_NLUTCODES]
Definition: glyph_play48x48.cxx:82
NXWidgets::SRlePaletteBitmap
Definition: crlepalettebitmap.hxx:80
NxWM::CONFIG_NXWIDGETS_FMT
CONFIG_NXWIDGETS_FMT
Definition: glyph_calculator24x25.cxx:181
NxWM::BITMAP_NROWS
BITMAP_NROWS
Definition: glyph_calculator24x25.cxx:181