NXWidgets  1.19
glyph_mediagrip60x30.cxx
Go to the documentation of this file.
1 /********************************************************************************************
2  * NxWidgets/nxwm/src/mediagrip60x30.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 30
60 #define BITMAP_NCOLUMNS 60
61 #define BITMAP_NLUTCODES 4
62 
63 #define MEDIA_GRIP_DARK_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 MEDIA_GRIP_DARK_ICON
75 
76 static const uint32_t g_gripNormalLut[BITMAP_NLUTCODES] =
77 {
78  CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Code 0 */
79  0x3663ab, 0x002199, 0xbdbdbd /* Codes 0-3 */
80 };
81 
82 static const uint32_t g_gripBrightLut[BITMAP_NLUTCODES] =
83 {
84  CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Code 0 */
85  0x4884e4, 0x002ccc, 0xfcfcfc /* Codes 0-3 */
86 };
87 
88 # else /* MEDIA_GRIP_DARK_ICON */
89 
90 static const uint32_t g_gripNormalLut[BITMAP_NLUTCODES] =
91 {
92  CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Code 0 */
93  0x4884e4, 0x002ccc, 0xfcfcfc /* Codes 0-3 */
94 };
95 
96 static const uint32_t g_gripBrightLut[BITMAP_NLUTCODES] =
97 {
98  CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Code 0 */
99  0x5aa5ff, 0x0037ff, 0xffffff /* Codes 0-3 */
100 };
101 # endif /* MEDIA_GRIP_DARK_ICON */
102 
103 /* RGB16 (565) Colors */
104 
105 #elif CONFIG_NXWIDGETS_BPP == 16
106 # ifdef MEDIA_GRIP_DARK_ICON
107 
108 static const uint16_t g_gripNormalLut[BITMAP_NLUTCODES] =
109 {
110  CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Code 0 */
111  0x3315, 0x0113, 0xbdf7 /* Codes 0-3 */
112 };
113 
114 static const uint16_t g_gripBrightLut[BITMAP_NLUTCODES] =
115 {
116  CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Code 0 */
117  0x4c3c, 0x0179, 0xffff /* Codes 0-3 */
118 };
119 
120 # else /* MEDIA_GRIP_DARK_ICON */
121 
122 static const uint16_t g_gripNormalLut[BITMAP_NLUTCODES] =
123 {
124  CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Code 0 */
125  0x4c3c, 0x0179, 0xffff /* Codes 0-3 */
126 };
127 
128 static const uint16_t g_gripBrightLut[BITMAP_NLUTCODES] =
129 {
130  CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Code 0 */
131  0x5d3f, 0x01bf, 0xffff /* Codes 0-3 */
132 };
133 
134 # endif /* MEDIA_GRIP_DARK_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 MEDIA_GRIP_DARK_ICON
149 
150 static const uint8_t g_gripNormalLut[BITMAP_NLUTCODES] =
151 {
152  CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Code 0 */
153  0x5d, 0x24, 0xbd /* Codes 0-3 */
154 };
155 
156 static const uint8_t g_gripBrightLut[BITMAP_NLUTCODES] =
157 {
158  CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Code 0 */
159  0x7d, 0x31, 0xfc /* Codes 0-3 */
160 };
161 
162 # else /* MEDIA_GRIP_DARK_ICON */
163 
164 static const uint8_t g_gripNormalLut[BITMAP_NLUTCODES] =
165 {
166  CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Code 0 */
167  0x7d, 0x31, 0xfc /* Codes 0-3 */
168 };
169 
170 static const uint8_t g_gripBrightLut[BITMAP_NLUTCODES] =
171 {
172  CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Code 0 */
173  0x98, 0x3d, 0xff /* Codes 0-3 */
174 };
175 
176 # endif /* MEDIA_GRIP_DARK_ICON */
177 
178 # else /* CONFIG_NXWIDGETS_GREYSCALE */
179 
180 /* RGB8 (332) Colors */
181 
182 # ifdef MEDIA_GRIP_DARK_ICON
183 
184 static const nxgl_mxpixel_t g_gripNormalLut[BITMAP_NLUTCODES] =
185 {
186  CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Code 0 */
187  0x2e, 0x06, 0xb6 /* Codes 0-3 */
188 };
189 
190 static const nxgl_mxpixel_t g_gripBrightLut[BITMAP_NLUTCODES] =
191 {
192  CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Code 0 */
193  0x53, 0x07, 0xff /* Codes 0-3 */
194 };
195 
196 # else /* MEDIA_GRIP_DARK_ICON */
197 
198 static const nxgl_mxpixel_t g_gripNormalLut[BITMAP_NLUTCODES] =
199 {
200  CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Code 0 */
201  0x53, 0x07, 0xff /* Codes 0-3 */
202 };
203 
204 static const nxgl_mxpixel_t g_gripBrightLut[BITMAP_NLUTCODES] =
205 {
206  CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Code 0 */
207  0x57, 0x07, 0xff /* Codes 0-3 */
208 };
209 
210 # endif /* MEDIA_GRIP_DARK_ICON */
211 # endif /* CONFIG_NXWIDGETS_GREYSCALE */
212 #else
213 # error Unsupported pixel format
214 #endif
215 
217 {
218  { 1, 0}, { 1, 1}, {56, 2}, { 1, 1}, { 1, 0}, /* Row 0 */
219  { 1, 1}, {58, 2}, { 1, 1}, /* Row 1 */
220  {60, 2}, /* Row 2 */
221  {60, 2}, /* Row 3 */
222  {60, 2}, /* Row 4 */
223  {60, 2}, /* Row 5 */
224  {42, 2}, { 1, 1}, { 4, 3}, { 1, 1}, {12, 2}, /* Row 6 */
225  {42, 2}, { 6, 3}, {12, 2}, /* Row 7 */
226  {42, 2}, { 6, 3}, {12, 2}, /* Row 8 */
227  {42, 2}, { 6, 3}, {12, 2}, /* Row 9 */
228  {42, 2}, { 6, 3}, {12, 2}, /* Row 10 */
229  {42, 2}, { 6, 3}, {12, 2}, /* Row 11 */
230  { 6, 2}, { 1, 1}, {16, 3}, { 1, 1}, {12, 2}, { 1, 1}, {16, 3}, { 1, 1}, /* Row 12 */
231  { 6, 2},
232  { 6, 2}, {18, 3}, {12, 2}, {18, 3}, { 6, 2}, /* Row 13 */
233  { 6, 2}, {18, 3}, {12, 2}, {18, 3}, { 6, 2}, /* Row 14 */
234  { 6, 2}, {18, 3}, {12, 2}, {18, 3}, { 6, 2}, /* Row 15 */
235  { 6, 2}, {18, 3}, {12, 2}, {18, 3}, { 6, 2}, /* Row 16 */
236  { 6, 2}, { 1, 1}, {16, 3}, { 1, 1}, {12, 2}, { 1, 1}, {16, 3}, { 1, 1}, /* Row 17 */
237  { 6, 2},
238  {42, 2}, { 6, 3}, {12, 2}, /* Row 18 */
239  {42, 2}, { 6, 3}, {12, 2}, /* Row 19 */
240  {42, 2}, { 6, 3}, {12, 2}, /* Row 20 */
241  {42, 2}, { 6, 3}, {12, 2}, /* Row 21 */
242  {42, 2}, { 6, 3}, {12, 2}, /* Row 22 */
243  {42, 2}, { 1, 1}, { 4, 3}, { 1, 1}, {12, 2}, /* Row 23 */
244  {60, 2}, /* Row 24 */
245  {60, 2}, /* Row 25 */
246  {60, 2}, /* Row 26 */
247  {60, 2}, /* Row 27 */
248  { 1, 1}, {58, 2}, { 1, 1}, /* Row 28 */
249  { 1, 0}, { 1, 1}, {56, 2}, { 1, 1}, { 1, 0} /* Row 29 */
250 };
251 
252 /********************************************************************************************
253  * Public Bitmap Structure Definitions
254  ********************************************************************************************/
255 
257 {
258  CONFIG_NXWIDGETS_BPP, // bpp - Bits per pixel
259  CONFIG_NXWIDGETS_FMT, // fmt - Color format
260  BITMAP_NLUTCODES, // nlut - Number of colors in the lLook-Up Table (LUT)
261  BITMAP_NCOLUMNS, // width - Width in pixels
262  BITMAP_NROWS, // height - Height in rows
263  { // lut - Pointer to the beginning of the Look-Up Table (LUT)
264  g_gripNormalLut, // Index 0: Unselected LUT
265  g_gripBrightLut, // Index 1: Selected LUT
266  },
267  g_gripRleEntries // data - Pointer to the beginning of the RLE data
268 };
const struct NXWidgets::SRlePaletteBitmap g_mplayerVolBitmap
Definition: nxwmglyphs.hxx:69
static const struct NXWidgets::SRlePaletteBitmapEntry g_gripRleEntries[]
static const uint32_t g_gripBrightLut[BITMAP_NLUTCODES]
static const uint32_t g_gripNormalLut[BITMAP_NLUTCODES]