NXWidgets: glyph_stop21x21.cxx Source File

NXWidgets 1.19

glyph_stop21x21.cxx
Go to the documentation of this file.
1 /********************************************************************************************
2 * NxWidgets/nxwm/src/glyph_stop21x21.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 21
60 #define BITMAP_NCOLUMNS 21
61 #define BITMAP_NLUTCODES 11
62
63 /********************************************************************************************
64 * Private Bitmap Data
65 ********************************************************************************************/
66
67 using namespace NxWM;
68
69 /* RGB24 (8-8-8) Colors */
70
71 #if CONFIG_NXWIDGETS_BPP == 24 || CONFIG_NXWIDGETS_BPP == 32
72
73 static const uint32_t g_stopNormalLut[BITMAP_NLUTCODES] =
74 {
75 0xd8d8d8, 0xfc6c6c, 0xfcb4b4, 0xd80000, 0xfc0000, 0x902424, 0xfcfcfc, 0xd8fcfc, /* Codes 0-7 */
76 0xb40000, 0xb40024, 0xfcd8d8 /* Codes 8-10 */
77 };
78
79 static const uint32_t g_stopBrightLut[BITMAP_NLUTCODES] =
80 {
81 0xe1e1e1, 0xfc9090, 0xfcc6c6, 0xe13f3f, 0xfc3f3f, 0xab5a5a, 0xfcfcfc, 0xe1fcfc, /* Codes 0-7 */
82 0xc63f3f, 0xc63f5a, 0xfce1e1 /* Codes 8-10 */
83 };
84
85 /* RGB16 (565) Colors (four of the colors in this map are duplicates) */
86
87 #elif CONFIG_NXWIDGETS_BPP == 16
88
89 static const uint16_t g_stopNormalLut[BITMAP_NLUTCODES] =
90 {
91 0xdedb, 0xfb6d, 0xfdb6, 0xd800, 0xf800, 0x9124, 0xffff, 0xdfff, 0xb000, 0xb004, /* Codes 0-9 */
92 0xfedb /* Codes 10-10 */
93 };
94
95 static const uint16_t g_stopBrightLut[BITMAP_NLUTCODES] =
96 {
97 0xe71c, 0xfc92, 0xfe38, 0xe1e7, 0xf9e7, 0xaacb, 0xffff, 0xe7ff, 0xc1e7, 0xc1eb, /* Codes 0-9 */
98 0xff1c /* Codes 10-10 */
99 };
100
101 /* 8-bit color lookups. NOTE: This is really dumb! The lookup index is 8-bits and it used
102 * to lookup an 8-bit value. There is no savings in that! It would be better to just put
103 * the 8-bit color/greyscale value in the run-length encoded image and save the cost of these
104 * pointless lookups. But these p;ointless lookups do make the logic compatible with the
105 * 16- and 24-bit types.
106 */
107
108 #elif CONFIG_NXWIDGETS_BPP == 8
109 # ifdef CONFIG_NXWIDGETS_GREYSCALE
110
111 /* 8-bit Greyscale */
112
113 static const uint8_t g_stopNormalLut[BITMAP_NLUTCODES] =
114 {
115 0xd8, 0x97, 0xc9, 0x40, 0x4b, 0x44, 0xfc, 0xf1, 0x35, 0x39, 0xe2 /* Codes 0-10 */
116 };
117
118 static const uint8_t g_stopBrightLut[BITMAP_NLUTCODES] =
119 {
120 0xe1, 0xb0, 0xd6, 0x6f, 0x77, 0x72, 0xfc, 0xf3, 0x67, 0x6a, 0xe9 /* Codes 0-10 */
121 };
122
123 # else /* CONFIG_NXWIDGETS_GREYSCALE */
124
125 /* RGB8 (332) Colors */
126
127 static const nxgl_mxpixel_t g_stopNormalLut[BITMAP_NLUTCODES] =
128 {
129 0xdb, 0xed, 0xf6, 0xc0, 0xe0, 0x84, 0xff, 0xdf, 0xa0, 0xa0, 0xfb /* Codes 0-10 */
130 };
131
132 static const uint8_t g_stopBrightLut[BITMAP_NLUTCODES] =
133 {
134 0xff, 0xf2, 0xfb, 0xe4, 0xe4, 0xa9, 0xff, 0xff, 0xc4, 0xc5, 0xff /* Codes 0-10 */
135 };
136
137 # endif
138 #else
139 # error "Unsupport pixel format"
140 #endif
141
142 static const struct NXWidgets::SRlePaletteBitmapEntry g_stopRleEntries[] =
143 {
144 { 1, 0}, { 1, 1}, { 17, 2}, { 1, 1}, { 1, 2}, /* Row 0 */
145 { 1, 1}, { 4, 3}, { 6, 4}, { 9, 3}, { 1, 1}, /* Row 1 */
146 { 1, 2}, { 2, 3}, { 9, 4}, { 8, 3}, { 1, 5}, /* Row 2 */
147 { 1, 2}, { 1, 3}, { 1, 4}, { 2, 6}, { 1, 7}, { 7, 4}, { 2, 3}, { 2, 6}, /* Row 3 */
148 { 1, 7}, { 2, 3}, { 1, 5},
149 { 1, 2}, { 1, 3}, { 1, 4}, { 3, 6}, { 1, 7}, { 5, 4}, { 2, 3}, { 3, 6}, /* Row 4 */
150 { 1, 7}, { 2, 3}, { 1, 5},
151 { 1, 2}, { 3, 4}, { 3, 6}, { 1, 7}, { 4, 4}, { 1, 3}, { 3, 6}, { 1, 7}, /* Row 5 */
152 { 3, 3}, { 1, 5},
153 { 1, 2}, { 4, 4}, { 3, 6}, { 1, 7}, { 2, 4}, { 1, 3}, { 3, 6}, { 1, 7}, /* Row 6 */
154 { 4, 3}, { 1, 5},
155 { 1, 2}, { 5, 4}, { 3, 6}, { 1, 7}, { 1, 3}, { 3, 6}, { 1, 7}, { 4, 3}, /* Row 7 */
156 { 1, 8}, { 1, 5},
157 { 1, 2}, { 6, 4}, { 6, 6}, { 1, 7}, { 5, 3}, { 1, 8}, { 1, 5}, /* Row 8 */
158 { 1, 2}, { 1, 3}, { 4, 4}, { 2, 3}, { 2, 6}, { 3, 7}, { 6, 3}, { 1, 8}, /* Row 9 */
159 { 1, 5},
160 { 1, 2}, { 2, 3}, { 1, 4}, { 4, 3}, { 2, 6}, { 3, 7}, { 5, 3}, { 2, 8}, /* Row 10 */
161 { 1, 5},
162 { 1, 2}, { 7, 3}, { 4, 6}, { 1, 7}, { 5, 3}, { 2, 8}, { 1, 5}, /* Row 11 */
163 { 1, 2}, { 6, 3}, { 6, 6}, { 1, 7}, { 3, 3}, { 3, 8}, { 1, 5}, /* Row 12 */
164 { 1, 2}, { 5, 3}, { 2, 6}, { 2, 7}, { 1, 3}, { 2, 6}, { 2, 7}, { 1, 3}, /* Row 13 */
165 { 4, 8}, { 1, 5},
166 { 1, 2}, { 4, 3}, { 3, 6}, { 1, 7}, { 3, 3}, { 3, 6}, { 1, 7}, { 4, 8}, /* Row 14 */
167 { 1, 5},
168 { 1, 2}, { 3, 3}, { 3, 6}, { 1, 7}, { 5, 3}, { 3, 6}, { 1, 7}, { 3, 8}, /* Row 15 */
169 { 1, 5},
170 { 1, 2}, { 2, 3}, { 3, 6}, { 1, 7}, { 4, 3}, { 3, 8}, { 3, 6}, { 1, 7}, /* Row 16 */
171 { 2, 8}, { 1, 5},
172 { 1, 2}, { 2, 3}, { 3, 7}, { 3, 3}, { 6, 8}, { 3, 7}, { 2, 8}, { 1, 5}, /* Row 17 */
173 { 1, 2}, { 6, 3}, { 2, 8}, { 1, 9}, { 10, 8}, { 1, 5}, /* Row 18 */
174 { 1, 1}, { 1, 3}, { 10, 8}, { 1, 9}, { 8, 8}, /* Row 19 */
175 { 1, 10}, { 1, 1}, { 17, 5}, { 1, 8}, { 1, 1}, /* Row 20 */
176 };
177
178 /********************************************************************************************
179 * Public Bitmap Structure Definitions
180 ********************************************************************************************/
181
182 const struct NXWidgets::SRlePaletteBitmap NxWM::g_stopBitmap =
183 {
184 CONFIG_NXWIDGETS_BPP, // bpp - Bits per pixel
185 CONFIG_NXWIDGETS_FMT, // fmt - Color format
186 BITMAP_NLUTCODES, // nlut - Number of colors in the lLook-Up Table (LUT)
187 BITMAP_NCOLUMNS, // width - Width in pixels
188 BITMAP_NROWS, // height - Height in rows
189 { // lut - Pointer to the beginning of the Look-Up Table (LUT)
190 g_stopNormalLut, // Index 0: Unselected LUT
191 g_stopBrightLut, // Index 1: Selected LUT
192 },
193 g_stopRleEntries // data - Pointer to the beginning of the RLE data
194 };
crlepalettebitmap.hxx
NXWidgets::SRlePaletteBitmapEntry
Definition: crlepalettebitmap.hxx:70
NxWM::g_stopBitmap
const struct NXWidgets::SRlePaletteBitmap g_stopBitmap
Definition: nxwmglyphs.hxx:73
g_stopRleEntries
static const struct NXWidgets::SRlePaletteBitmapEntry g_stopRleEntries[]
Definition: glyph_stop21x21.cxx:142
NxWM::BITMAP_NLUTCODES
BITMAP_NLUTCODES
Definition: glyph_calculator24x25.cxx:181
nxwmconfig.hxx
nxwmglyphs.hxx
NxWM
Definition: capplicationwindow.hxx:66
g_stopBrightLut
static const uint32_t g_stopBrightLut[BITMAP_NLUTCODES]
Definition: glyph_stop21x21.cxx:79
NxWM::CONFIG_NXWIDGETS_BPP
CONFIG_NXWIDGETS_BPP
Definition: glyph_calculator24x25.cxx:181
NxWM::BITMAP_NCOLUMNS
BITMAP_NCOLUMNS
Definition: glyph_calculator24x25.cxx:181
NXWidgets::SRlePaletteBitmap
Definition: crlepalettebitmap.hxx:80
NxWM::CONFIG_NXWIDGETS_FMT
CONFIG_NXWIDGETS_FMT
Definition: glyph_calculator24x25.cxx:181
g_stopNormalLut
static const uint32_t g_stopNormalLut[BITMAP_NLUTCODES]
Definition: glyph_stop21x21.cxx:73
NxWM::BITMAP_NROWS
BITMAP_NROWS
Definition: glyph_calculator24x25.cxx:181