NXWidgets: glyph_cmd25x22.cxx Source File

NXWidgets 1.19

glyph_cmd25x22.cxx
Go to the documentation of this file.
1 /********************************************************************************************
2 * NxWidgets/nxwm/src/glyph_cmd24x22.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 22
60 #define BITMAP_NCOLUMNS 25
61 #define BITMAP_NLUTCODES 8
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_cmdNormalLut[BITMAP_NLUTCODES] =
74 {
75 0x909090, 0x000000, 0xb4fcfc, 0xb4d8fc, 0x6cb4fc, 0x6c6c6c, 0xfcfcfc, 0x484848
76 };
77
78 static const uint32_t g_cmdBrightLut[BITMAP_NLUTCODES] =
79 {
80 0xababab, 0x3f3f3f, 0xc6fcfc, 0xc6e1fc, 0x90c6fc, 0x909090, 0xfcfcfc, 0x757575
81 };
82 /* RGB16 (565) Colors (four of the colors in this map are duplicates) */
83
84 #elif CONFIG_NXWIDGETS_BPP == 16
85
86 static const uint16_t g_cmdNormalLut[BITMAP_NLUTCODES] =
87 {
88 0x9492, 0x0000, 0xb7ff, 0xb6df, 0x6dbf, 0x6b6d, 0xffff, 0x4a49
89 };
90
91 static const uint16_t g_cmdBrightLut[BITMAP_NLUTCODES] =
92 {
93 0xad55, 0x39e7, 0xc7ff, 0xc71f, 0x963f, 0x9492, 0xffff, 0x73ae
94 };
95
96 /* 8-bit color lookups. NOTE: This is really dumb! The lookup index is 8-bits and it used
97 * to lookup an 8-bit value. There is no savings in that! It would be better to just put
98 * the 8-bit color/greyscale value in the run-length encoded image and save the cost of these
99 * pointless lookups. But these p;ointless lookups do make the logic compatible with the
100 * 16- and 24-bit types.
101 */
102
103 #elif CONFIG_NXWIDGETS_BPP == 8
104 # ifdef CONFIG_NXWIDGETS_GREYSCALE
105
106 /* 8-bit Greyscale */
107
108 static const uint8_t g_cmdNormalLut[BITMAP_NLUTCODES] =
109 {
110 0x90, 0x00, 0xe6, 0xd1, 0xa6, 0x6c, 0xfc, 0x48
111 };
112
113 static const uint8_t g_cmdBrightLut[BITMAP_NLUTCODES] =
114 {
115 0xab, 0x3f, 0xeb, 0xdc, 0xbc, 0x90, 0xfc, 0x75
116 };
117
118 # else /* CONFIG_NXWIDGETS_GREYSCALE */
119
120 /* RGB8 (332) Colors */
121
122 static const nxgl_mxpixel_t g_cmdNormalLut[BITMAP_NLUTCODES] =
123 {
124 0x92, 0x00, 0xbf, 0xbb, 0x77, 0x6d, 0xff, 0x49
125 };
126
127 static const nxgl_mxpixel_t g_cmdBrightLut[BITMAP_NLUTCODES] =
128 {
129 0xb6, 0x24, 0xdf, 0xdf, 0x9b, 0x92, 0xff, 0x6d
130 };
131
132 # endif
133 #else
134 # error "Unsupport pixel format"
135 #endif
136
137 static const struct NXWidgets::SRlePaletteBitmapEntry g_cmdRleEntries[] =
138 {
139 { 24, 0}, { 1, 1}, /* Row 0 */
140 { 24, 0}, { 1, 1}, /* Row 1 */
141 { 2, 0}, { 1, 2}, { 13, 3}, { 7, 4}, { 1, 0}, { 1, 1}, /* Row 2 */
142 { 2, 0}, { 3, 3}, { 18, 4}, { 1, 0}, { 1, 1}, /* Row 3 */
143 { 2, 0}, { 3, 3}, { 18, 4}, { 1, 0}, { 1, 1}, /* Row 4 */
144 { 24, 0}, { 1, 1}, /* Row 5 */
145 { 1, 0}, { 22, 1}, { 1, 0}, { 1, 1}, /* Row 6 */
146 { 1, 0}, { 1, 1}, { 21, 5}, { 1, 0}, { 1, 1}, /* Row 7 */
147 { 1, 0}, { 1, 1}, { 21, 5}, { 1, 0}, { 1, 1}, /* Row 8 */
148 { 1, 0}, { 1, 1}, { 2, 5}, { 1, 6}, { 18, 5}, { 1, 0}, { 1, 1}, /* Row 9 */
149 { 1, 0}, { 1, 1}, { 3, 5}, { 1, 6}, { 17, 5}, { 1, 0}, { 1, 1}, /* Row 10 */
150 { 1, 0}, { 1, 1}, { 4, 5}, { 1, 6}, { 16, 5}, { 1, 0}, { 1, 1}, /* Row 11 */
151 { 1, 0}, { 1, 1}, { 5, 5}, { 1, 6}, { 15, 5}, { 1, 0}, { 1, 1}, /* Row 12 */
152 { 1, 0}, { 1, 1}, { 6, 5}, { 1, 6}, { 14, 5}, { 1, 0}, { 1, 1}, /* Row 13 */
153 { 1, 0}, { 1, 1}, { 5, 5}, { 1, 6}, { 1, 7}, { 14, 5}, { 1, 0}, { 1, 1}, /* Row 14 */
154 { 1, 0}, { 1, 1}, { 4, 5}, { 1, 6}, { 1, 7}, { 15, 5}, { 1, 0}, { 1, 1}, /* Row 15 */
155 { 1, 0}, { 1, 1}, { 3, 5}, { 1, 6}, { 1, 7}, { 4, 5}, { 9, 6}, { 3, 5}, /* Row 16 */
156 { 1, 0}, { 1, 1},
157 { 1, 0}, { 1, 1}, { 2, 5}, { 1, 6}, { 1, 7}, { 6, 5}, { 9, 7}, { 2, 5}, /* Row 17 */
158 { 1, 0}, { 1, 1},
159 { 1, 0}, { 1, 1}, { 2, 5}, { 1, 7}, { 18, 5}, { 1, 0}, { 1, 1}, /* Row 18 */
160 { 1, 0}, { 1, 1}, { 21, 5}, { 1, 0}, { 1, 1}, /* Row 19 */
161 { 24, 0}, { 1, 1}, /* Row 20 */
162 { 25, 1}, /* Row 21 */
163 };
164
165 /********************************************************************************************
166 * Public Bitmap Structure Definitions
167 ********************************************************************************************/
168
169 const struct NXWidgets::SRlePaletteBitmap NxWM::g_cmdBitmap =
170 {
171 CONFIG_NXWIDGETS_BPP, // bpp - Bits per pixel
172 CONFIG_NXWIDGETS_FMT, // fmt - Color format
173 BITMAP_NLUTCODES, // nlut - Number of colors in the lLook-Up Table (LUT)
174 BITMAP_NCOLUMNS, // width - Width in pixels
175 BITMAP_NROWS, // height - Height in rows
176 { // lut - Pointer to the beginning of the Look-Up Table (LUT)
177 g_cmdNormalLut, // Index 0: Unselected LUT
178 g_cmdBrightLut, // Index 1: Selected LUT
179 },
180 g_cmdRleEntries // data - Pointer to the beginning of the RLE data
181 };
crlepalettebitmap.hxx
NXWidgets::SRlePaletteBitmapEntry
Definition: crlepalettebitmap.hxx:70
g_cmdBrightLut
static const uint32_t g_cmdBrightLut[BITMAP_NLUTCODES]
Definition: glyph_cmd25x22.cxx:78
g_cmdNormalLut
static const uint32_t g_cmdNormalLut[BITMAP_NLUTCODES]
Definition: glyph_cmd25x22.cxx:73
NxWM::BITMAP_NLUTCODES
BITMAP_NLUTCODES
Definition: glyph_calculator24x25.cxx:181
nxwmconfig.hxx
nxwmglyphs.hxx
NxWM
Definition: capplicationwindow.hxx:66
NxWM::g_cmdBitmap
const struct NXWidgets::SRlePaletteBitmap g_cmdBitmap
Definition: nxwmglyphs.hxx:62
NxWM::CONFIG_NXWIDGETS_BPP
CONFIG_NXWIDGETS_BPP
Definition: glyph_calculator24x25.cxx:181
NxWM::BITMAP_NCOLUMNS
BITMAP_NCOLUMNS
Definition: glyph_calculator24x25.cxx:181
g_cmdRleEntries
static const struct NXWidgets::SRlePaletteBitmapEntry g_cmdRleEntries[]
Definition: glyph_cmd25x22.cxx:137
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