NXWidgets  1.19
glyph_mediaplayer44x50.cxx
Go to the documentation of this file.
1 /********************************************************************************************
2  * NxWidgets/nxwm/src/glyph_mediaplayer44x50.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 44
61 #define BITMAP_NLUTCODES 5
62 
63 #define DARK_MEDIAPLAYER_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_MEDIAPLAYER_ICON
75 
76 static const uint32_t g_mediaplayerNormalLut[BITMAP_NLUTCODES] =
77 {
78  CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Code 0 */
79  0x002199, 0xbdbdbd, 0x4e8199, 0x276099 /* Codes 1-4 */
80 };
81 
82 static const uint32_t g_mediaplayerBrightLut[BITMAP_NLUTCODES] =
83 {
84  CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Code 0 */
85  0x002ccc, 0xfcfcfc, 0x68accc, 0x3480cc /* Codes 1-4 */
86 };
87 
88 # else /* DARK_MEDIAPLAYER_ICON */
89 
90 static const uint32_t g_mediaplayerNormalLut[BITMAP_NLUTCODES] =
91 {
92  CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Code 0 */
93  0x002ccc, 0xfcfcfc, 0x68accc, 0x3480cc /* Codes 1-4 */
94 };
95 
96 static const uint32_t g_mediaplayerBrightLut[BITMAP_NLUTCODES] =
97 {
98  CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Code 0 */
99  0x0037ff, 0xffffff, 0x82d7ff, 0x41a0ff /* Codes 1-4 */
100 };
101 # endif /* DARK_MEDIAPLAYER_ICON */
102 
103 /* RGB16 (565) Colors */
104 
105 #elif CONFIG_NXWIDGETS_BPP == 16
106 # ifdef DARK_MEDIAPLAYER_ICON
107 
108 static const uint16_t g_mediaplayerNormalLut[BITMAP_NLUTCODES] =
109 {
110  CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Code 0 */
111  0x0113, 0xbdf7, 0x4c13, 0x2313 /* Codes 1-4 */
112 };
113 
114 static const uint16_t g_mediaplayerBrightLut[BITMAP_NLUTCODES] =
115 {
116  CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Code 0 */
117  0x0179, 0xffff, 0x6d79, 0x3419 /* Codes 1-4 */
118 };
119 
120 # else /* DARK_MEDIAPLAYER_ICON */
121 
122 static const uint16_t g_mediaplayerNormalLut[BITMAP_NLUTCODES] =
123 {
124  CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Code 0 */
125  0x0179, 0xffff, 0x6d79, 0x3419 /* Codes 1-4 */
126 };
127 
128 static const uint16_t g_mediaplayerBrightLut[BITMAP_NLUTCODES] =
129 {
130  CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Code 0 */
131  0x01bf, 0xffff, 0x86bf, 0x451f /* Codes 1-4 */
132 };
133 
134 # endif /* DARK_MEDIAPLAYER_ICON */
135 
136 /* 8-bit color lookups. NOTE: This is really dumb! The lookup index is 8-bits and it used
137  * to lookup an 8-bit value. There is no savings in that! It would be better to just put
138  * the 8-bit color/greyscale value in the run-length encoded image and save the cost of these
139  * pointless lookups. But these pointless lookups do make the logic compatible with the
140  * 16- and 24-bit types.
141  */
142 
143 #elif CONFIG_NXWIDGETS_BPP == 8
144 # ifdef CONFIG_NXWIDGETS_GREYSCALE
145 
146 /* 8-bit Greyscale */
147 
148 # ifdef DARK_MEDIAPLAYER_ICON
149 
150 static const uint8_t g_mediaplayerNormalLut[BITMAP_NLUTCODES] =
151 {
152  CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Code 0 */
153  0x24, 0xbd, 0x74, 0x55 /* Codes 1-4 */
154 };
155 
156 static const uint8_t g_mediaplayerBrightLut[BITMAP_NLUTCODES] =
157 {
158  CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Code 0 */
159  0x31, 0xfc, 0x9b, 0x71 /* Codes 1-4 */
160 };
161 
162 # else /* DARK_MEDIAPLAYER_ICON */
163 
164 static const uint8_t g_mediaplayerNormalLut[BITMAP_NLUTCODES] =
165 {
166  CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Code 0 */
167  0x31, 0xfc, 0x9b, 0x71 /* Codes 1-4 */
168 };
169 
170 static const uint8_t g_mediaplayerBrightLut[BITMAP_NLUTCODES] =
171 {
172  CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Code 0 */
173  0x3d, 0xff, 0xc2, 0x8e /* Codes 1-4 */
174 };
175 
176 # endif /* DARK_MEDIAPLAYER_ICON */
177 
178 # else /* CONFIG_NXWIDGETS_GREYSCALE */
179 
180 /* RGB8 (332) Colors */
181 
182 # ifdef DARK_MEDIAPLAYER_ICON
183 
184 static const nxgl_mxpixel_t g_mediaplayerNormalLut[BITMAP_NLUTCODES] =
185 {
186  CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Code 0 */
187  0x06, 0xb6, 0x52, 0x2e, /* Codes 1-4 */
188 };
189 
190 static const nxgl_mxpixel_t g_mediaplayerBrightLut[BITMAP_NLUTCODES] =
191 {
192  CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Code 0 */
193  0x07, 0xff, 0x77, 0x33, /* Codes 1-4 */
194 };
195 
196 # else /* DARK_MEDIAPLAYER_ICON */
197 
198 static const nxgl_mxpixel_t g_mediaplayerNormalLut[BITMAP_NLUTCODES] =
199 {
200  CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Code 0 */
201  0x07, 0xff, 0x77, 0x33, /* Codes 1-4 */
202 };
203 
204 static const nxgl_mxpixel_t g_mediaplayerBrightLut[BITMAP_NLUTCODES] =
205 {
206  CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Code 0 */
207  0x07, 0xff, 0x9b, 0x57, /* Codes 1-4 */
208 };
209 
210 # endif /* DARK_MEDIAPLAYER_ICON */
211 # endif /* CONFIG_NXWIDGETS_GREYSCALE */
212 #else
213 # error Unsupported pixel format
214 #endif
215 
217 {
218  {44, 0}, /* Row 0 */
219  {44, 0}, /* Row 1 */
220  {38, 0}, { 6, 1}, /* Row 2 */
221  {34, 0}, {10, 1}, /* Row 3 */
222  {30, 0}, {14, 1}, /* Row 4 */
223  {26, 0}, {18, 1}, /* Row 5 */
224  {22, 0}, {17, 1}, { 2, 2}, { 3, 1}, /* Row 6 */
225  {22, 0}, {13, 1}, { 6, 2}, { 3, 1}, /* Row 7 */
226  {18, 0}, {12, 1}, {11, 2}, { 3, 1}, /* Row 8 */
227  {14, 0}, {12, 1}, {15, 2}, { 3, 1}, /* Row 9 */
228  {14, 0}, { 9, 1}, {18, 2}, { 3, 1}, /* Row 10 */
229  {14, 0}, { 4, 1}, {23, 2}, { 3, 1}, /* Row 11 */
230  {14, 0}, { 3, 1}, {21, 2}, { 1, 1}, { 2, 2}, { 3, 1}, /* Row 12 */
231  {14, 0}, { 3, 1}, {17, 2}, { 5, 1}, { 2, 2}, { 3, 1}, /* Row 13 */
232  {14, 0}, { 3, 1}, {13, 2}, { 9, 1}, { 2, 2}, { 3, 1}, /* Row 14 */
233  {14, 0}, { 3, 1}, { 9, 2}, {13, 1}, { 2, 2}, { 3, 1}, /* Row 15 */
234  {14, 0}, { 3, 1}, { 5, 2}, {17, 1}, { 2, 2}, { 3, 1}, /* Row 16 */
235  {14, 0}, { 3, 1}, { 2, 2}, {13, 1}, { 4, 0}, { 3, 1}, { 2, 2}, { 3, 1}, /* Row 17 */
236  {14, 0}, { 3, 1}, { 2, 2}, { 9, 1}, { 8, 0}, { 3, 1}, { 2, 2}, { 3, 1}, /* Row 18 */
237  {14, 0}, { 3, 1}, { 2, 2}, { 6, 1}, {11, 0}, { 3, 1}, { 2, 2}, { 3, 1}, /* Row 19 */
238  {14, 0}, { 3, 1}, { 2, 2}, { 3, 1}, {14, 0}, { 3, 1}, { 2, 2}, { 3, 1}, /* Row 20 */
239  {14, 0}, { 3, 1}, { 2, 2}, { 3, 1}, {14, 0}, { 3, 1}, { 2, 2}, { 3, 1}, /* Row 21 */
240  {14, 0}, { 3, 1}, { 2, 2}, { 3, 1}, {14, 0}, { 3, 1}, { 2, 2}, { 3, 1}, /* Row 22 */
241  {14, 0}, { 3, 1}, { 2, 2}, { 3, 1}, {14, 0}, { 3, 1}, { 2, 2}, { 3, 1}, /* Row 23 */
242  {14, 0}, { 3, 1}, { 2, 2}, { 3, 1}, {14, 0}, { 3, 1}, { 2, 2}, { 3, 1}, /* Row 24 */
243  {14, 0}, { 3, 1}, { 2, 2}, { 3, 1}, {14, 0}, { 3, 1}, { 2, 2}, { 3, 1}, /* Row 25 */
244  {14, 0}, { 3, 1}, { 2, 2}, { 3, 1}, {14, 0}, { 3, 1}, { 2, 2}, { 3, 1}, /* Row 26 */
245  {14, 0}, { 3, 1}, { 2, 2}, { 3, 1}, { 9, 0}, { 1, 3}, { 2, 4}, { 1, 3}, /* Row 27 */
246  { 1, 0}, { 3, 1}, { 2, 2}, { 3, 1},
247  {14, 0}, { 3, 1}, { 2, 2}, { 3, 1}, { 6, 0}, { 2, 3}, { 9, 1}, { 2, 2}, /* Row 28 */
248  { 3, 1},
249  {14, 0}, { 3, 1}, { 2, 2}, { 3, 1}, { 5, 0}, { 1, 4}, {11, 1}, { 2, 2}, /* Row 29 */
250  { 3, 1},
251  {14, 0}, { 3, 1}, { 2, 2}, { 3, 1}, { 5, 0}, { 7, 1}, { 1, 4}, { 4, 1}, /* Row 30 */
252  { 2, 2}, { 3, 1},
253  { 9, 0}, { 1, 3}, { 2, 4}, { 1, 3}, { 1, 0}, { 3, 1}, { 2, 2}, { 3, 1}, /* Row 31 */
254  { 4, 0}, { 3, 1}, { 1, 4}, { 1, 1}, { 5, 2}, { 2, 4}, { 1, 1}, { 2, 2},
255  { 3, 1},
256  { 6, 0}, { 2, 4}, { 9, 1}, { 2, 2}, { 3, 1}, { 3, 0}, { 1, 4}, { 2, 1}, /* Row 32 */
257  { 2, 4}, {11, 2}, { 3, 1},
258  { 5, 0}, { 1, 4}, {11, 1}, { 2, 2}, { 3, 1}, { 3, 0}, { 3, 1}, {13, 2}, /* Row 33 */
259  { 3, 1},
260  { 5, 0}, {12, 1}, { 2, 2}, { 3, 1}, { 3, 0}, { 3, 1}, {13, 2}, { 3, 1}, /* Row 34 */
261  { 4, 0}, { 3, 1}, { 1, 4}, { 1, 1}, { 5, 2}, { 3, 1}, { 2, 2}, { 3, 1}, /* Row 35 */
262  { 2, 0}, { 1, 3}, { 2, 1}, {14, 2}, { 3, 1},
263  { 3, 0}, { 1, 4}, { 2, 1}, { 2, 3}, {11, 2}, { 3, 1}, { 2, 0}, { 1, 4}, /* Row 36 */
264  { 2, 1}, {14, 2}, { 3, 1},
265  { 3, 0}, { 3, 1}, {13, 2}, { 3, 1}, { 3, 0}, { 3, 1}, {13, 2}, { 3, 1}, /* Row 37 */
266  { 2, 0}, { 1, 3}, { 2, 1}, {14, 2}, { 3, 1}, { 3, 0}, { 3, 1}, {13, 2}, /* Row 38 */
267  { 3, 1},
268  { 2, 0}, { 1, 3}, { 2, 1}, {14, 2}, { 3, 1}, { 3, 0}, { 3, 1}, {12, 2}, /* Row 39 */
269  { 1, 4}, { 3, 1},
270  { 2, 0}, { 1, 4}, { 2, 1}, {14, 2}, { 3, 1}, { 4, 0}, { 4, 1}, {10, 2}, /* Row 40 */
271  { 3, 1}, { 1, 3},
272  { 3, 0}, { 3, 1}, {13, 2}, { 3, 1}, { 4, 0}, { 1, 3}, { 5, 1}, { 1, 4}, /* Row 41 */
273  { 5, 2}, { 1, 4}, { 4, 1}, { 1, 0},
274  { 3, 0}, { 3, 1}, {13, 2}, { 3, 1}, { 5, 0}, { 1, 3}, {14, 1}, { 2, 0}, /* Row 42 */
275  { 3, 0}, { 3, 1}, {12, 2}, { 1, 4}, { 2, 1}, { 1, 3}, { 6, 0}, {12, 1}, /* Row 43 */
276  { 1, 4}, { 3, 0},
277  { 4, 0}, { 4, 1}, {10, 2}, { 3, 1}, { 1, 4}, { 9, 0}, { 1, 4}, { 7, 1}, /* Row 44 */
278  { 1, 3}, { 4, 0},
279  { 4, 0}, { 1, 3}, { 5, 1}, { 1, 4}, { 5, 2}, { 1, 4}, { 4, 1}, {23, 0}, /* Row 45 */
280  { 5, 0}, { 1, 3}, {13, 1}, {25, 0}, /* Row 46 */
281  { 7, 0}, {11, 1}, {26, 0}, /* Row 47 */
282  { 9, 0}, { 1, 3}, { 4, 1}, { 2, 4}, {28, 0}, /* Row 48 */
283  {44, 0} /* Row 49 */
284 };
285 
286 /********************************************************************************************
287  * Public Bitmap Structure Definitions
288  ********************************************************************************************/
289 
291 {
292  CONFIG_NXWIDGETS_BPP, // bpp - Bits per pixel
293  CONFIG_NXWIDGETS_FMT, // fmt - Color format
294  BITMAP_NLUTCODES, // nlut - Number of colors in the lLook-Up Table (LUT)
295  BITMAP_NCOLUMNS, // width - Width in pixels
296  BITMAP_NROWS, // height - Height in rows
297  { // lut - Pointer to the beginning of the Look-Up Table (LUT)
298  g_mediaplayerNormalLut, // Index 0: Unselected LUT
299  g_mediaplayerBrightLut, // Index 1: Selected LUT
300  },
301  g_mediaplayerRleEntries // data - Pointer to the beginning of the RLE data
302 };
const struct NXWidgets::SRlePaletteBitmap g_mediaplayerBitmap
Definition: nxwmglyphs.hxx:64
static const struct NXWidgets::SRlePaletteBitmapEntry g_mediaplayerRleEntries[]
static const uint32_t g_mediaplayerNormalLut[BITMAP_NLUTCODES]
static const uint32_t g_mediaplayerBrightLut[BITMAP_NLUTCODES]