NXWidgets: glyph_calibration24x21.cxx Source File

NXWidgets 1.19

glyph_calibration24x21.cxx
Go to the documentation of this file.
1 /********************************************************************************************
2 * NxWidgets/nxwm/src/glyph_calibration24x21.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 24
61 #define BITMAP_NLUTCODES 6
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_calibrationNormalLut[BITMAP_NLUTCODES] =
74 {
75 CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Code 0 */
76 0xfcfcfc, 0xacacac, 0xd8d8d8, 0xd8881c, 0x9c6014 /* Codes 1-5 */
77 };
78
79 static const uint32_t g_calibrationSelectedLut[BITMAP_NLUTCODES] =
80 {
81 CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Code 0 */
82 0xffffff, 0xc0c0c0, 0xe1e1e1, 0xe1a554, 0xb4874e /* Codes 1-5 */
83 };
84 /* RGB16 (565) Colors (four of the colors in this map are duplicates) */
85
86 #elif CONFIG_NXWIDGETS_BPP == 16
87
88 static const uint16_t g_calibrationNormalLut[BITMAP_NLUTCODES] =
89 {
90 CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Code 0 */
91 0xffff, 0xad75, 0xdedb, 0xdc43, 0x9b02 /* Codes 1-5 */
92 };
93
94 static const uint16_t g_calibrationSelectedLut[BITMAP_NLUTCODES] =
95 {
96 CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Code 0 */
97 0xffff, 0xc618, 0xe71c, 0xe52a, 0xb429 /* Codes 1-5 */
98 };
99
100 /* 8-bit color lookups. NOTE: This is really dumb! The lookup index is 8-bits and it used
101 * to lookup an 8-bit value. There is no savings in that! It would be better to just put
102 * the 8-bit color/greyscale value in the run-length encoded image and save the cost of these
103 * pointless lookups. But these p;ointless lookups do make the logic compatible with the
104 * 16- and 24-bit types.
105 */
106
107 #elif CONFIG_NXWIDGETS_BPP == 8
108 # ifdef CONFIG_NXWIDGETS_GREYSCALE
109
110 /* 8-bit Greyscale */
111
112 static const uint8_t g_calibrationNormalLut[BITMAP_NLUTCODES] =
113 {
114 CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Code 0 */
115 0xfc, 0xac, 0xd8, 0x93, 0x69 /* Codes 1-5 */
116 };
117
118 static const uint8_t g_calibrationSelectedLut[BITMAP_NLUTCODES] =
119 {
120 CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Code 0 */
121 0xff, 0xc0, 0xe1, 0xad, 0x8d /* Codes 1-5 */
122 };
123
124 # else /* CONFIG_NXWIDGETS_GREYSCALE */
125
126 /* RGB8 (332) Colors */
127
128 static const nxgl_mxpixel_t g_calibrationNormalLut[BITMAP_NLUTCODES] =
129 {
130 CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Code 0 */
131 0xff, 0xb6, 0xdb, 0xd0, 0x8c /* Codes 1-5 */
132 };
133
134 static const nxgl_mxpixel_t g_calibrationSelectedLut[BITMAP_NLUTCODES] =
135 {
136 CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Code 0 */
137 0xff, 0xdb, 0xff, 0xf5, 0xb1 /* Codes 1-5 */
138 };
139
140 # endif
141 #else
142 # error "Unsupport pixel format"
143 #endif
144
145 static const struct NXWidgets::SRlePaletteBitmapEntry g_calibrationRleEntries[] =
146 {
147 {11, 0}, { 1, 1}, { 1, 2}, { 6, 0}, { 1, 3}, { 1, 2}, { 3, 0}, /* Row 0 */
148 {11, 0}, { 1, 1}, { 1, 2}, { 4, 0}, { 2, 1}, { 1, 3}, { 2, 1}, { 2, 0}, /* Row 1 */
149 {11, 0}, { 1, 1}, { 1, 2}, { 2, 0}, { 2, 1}, { 2, 2}, { 1, 3}, { 1, 2}, /* Row 2 */
150 { 3, 0},
151 {11, 0}, { 1, 1}, { 1, 3}, { 2, 1}, { 2, 2}, { 2, 0}, { 1, 3}, { 4, 0}, /* Row 3 */
152 { 9, 0}, { 2, 1}, { 2, 3}, { 2, 2}, { 4, 0}, { 1, 3}, { 4, 0}, /* Row 4 */
153 { 3, 0}, { 1, 1}, { 1, 2}, { 2, 0}, { 2, 1}, { 2, 2}, { 1, 1}, { 1, 2}, /* Row 5 */
154 { 5, 0}, { 1, 1}, { 2, 3}, { 3, 0},
155 { 2, 0}, { 2, 1}, { 1, 3}, { 2, 1}, { 2, 2}, { 2, 0}, { 1, 1}, { 1, 2}, /* Row 6 */
156 { 4, 0}, { 1, 1}, { 1, 3}, { 1, 0}, { 2, 3}, { 2, 0},
157 { 3, 0}, { 1, 2}, { 1, 3}, { 2, 2}, { 4, 0}, { 1, 1}, { 1, 2}, { 4, 0}, /* Row 7 */
158 { 1, 1}, { 3, 0}, { 1, 3}, { 2, 0},
159 { 4, 0}, { 1, 3}, { 6, 0}, { 1, 1}, { 1, 2}, { 3, 0}, { 1, 1}, { 1, 3}, /* Row 8 */
160 { 3, 0}, { 2, 3}, { 1, 0},
161 { 3, 0}, { 1, 1}, { 2, 3}, { 5, 0}, { 1, 1}, { 1, 2}, { 3, 0}, { 1, 1}, /* Row 9 */
162 { 5, 0}, { 1, 3}, { 1, 0},
163 { 2, 0}, { 1, 1}, { 1, 3}, { 1, 0}, { 2, 3}, { 4, 0}, { 1, 1}, { 1, 2}, /* Row 10 */
164 { 3, 0}, { 1, 1}, { 1, 0}, { 2, 4}, { 1, 5}, { 1, 0}, { 1, 3}, { 1, 0},
165 { 2, 0}, { 1, 1}, { 3, 0}, { 1, 3}, { 4, 0}, { 1, 1}, { 1, 2}, { 3, 0}, /* Row 11 */
166 { 1, 1}, { 1, 0}, { 2, 4}, { 1, 5}, { 1, 0}, { 1, 3}, { 1, 0},
167 { 1, 0}, { 1, 1}, { 1, 3}, { 2, 4}, { 1, 5}, { 2, 3}, { 3, 0}, { 1, 1}, /* Row 12 */
168 { 1, 2}, { 2, 0}, { 9, 3},
169 { 1, 0}, { 1, 1}, { 1, 0}, { 2, 4}, { 1, 5}, { 1, 0}, { 1, 3}, { 3, 0}, /* Row 13 */
170 { 1, 1}, { 1, 2}, {11, 0},
171 { 1, 0}, { 1, 1}, { 1, 0}, { 2, 4}, { 1, 5}, { 1, 0}, { 1, 3}, { 3, 0}, /* Row 14 */
172 { 1, 1}, { 1, 2}, {11, 0},
173 { 1, 0}, { 1, 1}, { 1, 0}, { 2, 4}, { 1, 5}, { 1, 0}, { 1, 3}, { 3, 0}, /* Row 15 */
174 { 1, 1}, { 1, 2}, {11, 0},
175 { 9, 3}, { 2, 0}, { 1, 1}, { 1, 2}, {11, 0}, /* Row 16 */
176 {11, 0}, { 1, 1}, { 1, 2}, {11, 0}, /* Row 17 */
177 {10, 0}, { 1, 1}, { 2, 3}, { 1, 2}, {10, 0}, /* Row 18 */
178 { 5, 0}, { 4, 1}, { 6, 3}, { 4, 2}, { 5, 0}, /* Row 19 */
179 { 4, 0}, { 4, 1}, { 8, 3}, { 4, 2}, { 4, 0}, /* Row 20 */
180 };
181
182 /********************************************************************************************
183 * Public Bitmap Structure Definitions
184 ********************************************************************************************/
185
186 const struct NXWidgets::SRlePaletteBitmap NxWM::g_calibrationBitmap =
187 {
188 CONFIG_NXWIDGETS_BPP, // bpp - Bits per pixel
189 CONFIG_NXWIDGETS_FMT, // fmt - Color format
190 BITMAP_NLUTCODES, // nlut - Number of colors in the lLook-Up Table (LUT)
191 BITMAP_NCOLUMNS, // width - Width in pixels
192 BITMAP_NROWS, // height - Height in rows
193 { // lut - Pointer to the beginning of the Look-Up Table (LUT)
194 g_calibrationNormalLut, // Index 0: Unselected LUT
195 g_calibrationSelectedLut, // Index 1: Selected LUT
196 },
197 g_calibrationRleEntries // data - Pointer to the beginning of the RLE data
198 };
crlepalettebitmap.hxx
NxWM::g_calibrationBitmap
const struct NXWidgets::SRlePaletteBitmap g_calibrationBitmap
Definition: nxwmglyphs.hxx:61
NXWidgets::SRlePaletteBitmapEntry
Definition: crlepalettebitmap.hxx:70
g_calibrationRleEntries
static const struct NXWidgets::SRlePaletteBitmapEntry g_calibrationRleEntries[]
Definition: glyph_calibration24x21.cxx:145
NxWM::BITMAP_NLUTCODES
BITMAP_NLUTCODES
Definition: glyph_calculator24x25.cxx:181
nxwmconfig.hxx
nxwmglyphs.hxx
NxWM
Definition: capplicationwindow.hxx:66
g_calibrationNormalLut
static const uint32_t g_calibrationNormalLut[BITMAP_NLUTCODES]
Definition: glyph_calibration24x21.cxx:73
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_calibrationSelectedLut
static const uint32_t g_calibrationSelectedLut[BITMAP_NLUTCODES]
Definition: glyph_calibration24x21.cxx:79
NxWM::BITMAP_NROWS
BITMAP_NROWS
Definition: glyph_calculator24x25.cxx:181