NXWidgets  1.19
glyph_minimize21x21.cxx
Go to the documentation of this file.
1 /********************************************************************************************
2  * NxWidgets/nxwm/src/glyph_minimize21x21.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 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_minimizeNormalLut[BITMAP_NLUTCODES] =
74 {
75  0x2448b4, 0x486cd8, 0x0024b4, 0x0024d8, 0x242490, 0x0000b4, 0xfcfcfc, 0xd8fcfc /* Codes 0-7 */
76 };
77 
78 static const uint32_t g_minimizeBrightLut[BITMAP_NLUTCODES] =
79 {
80  0x5a75c6, 0x7590e1, 0x3f5ac6, 0x3f5ae1, 0x5a5aab, 0x3f3fc6, 0xfcfcfc, 0xe1fcfc /* Codes 0-7 */
81 };
82 
83 /* RGB16 (565) Colors (four of the colors in this map are duplicates) */
84 
85 #elif CONFIG_NXWIDGETS_BPP == 16
86 
87 static const uint16_t g_minimizeNormalLut[BITMAP_NLUTCODES] =
88 {
89  0x2256, 0x4b7b, 0x0136, 0x013b, 0x2132, 0x0016, 0xffff, 0xdfff /* Codes 0-7 */
90 };
91 
92 static const uint16_t g_minimizeBrightLut[BITMAP_NLUTCODES] =
93 {
94  0x5bb8, 0x749c, 0x3ad8, 0x3adc, 0x5ad5, 0x39f8, 0xffff, 0xe7ff /* Codes 0-7 */
95 };
96 
97 /* 8-bit color lookups. NOTE: This is really dumb! The lookup index is 8-bits and it used
98  * to lookup an 8-bit value. There is no savings in that! It would be better to just put
99  * the 8-bit color/greyscale value in the run-length encoded image and save the cost of these
100  * pointless lookups. But these p;ointless lookups do make the logic compatible with the
101  * 16- and 24-bit types.
102  */
103 
104 #elif CONFIG_NXWIDGETS_BPP == 8
105 # ifdef CONFIG_NXWIDGETS_GREYSCALE
106 
107 /* 8-bit Greyscale */
108 
109 static const uint8_t g_minimizeNormalLut[BITMAP_NLUTCODES] =
110 {
111  0x49, 0x6d, 0x29, 0x2d, 0x30, 0x14, 0xfc, 0xf1 /* Codes 0-7 */
112 };
113 
114 static const uint8_t g_minimizeBrightLut[BITMAP_NLUTCODES] =
115 {
116  0x76, 0x91, 0x5e, 0x61, 0x63, 0x4e, 0xfc, 0xf3 /* Codes 0-7 */
117 };
118 
119 # else /* CONFIG_NXWIDGETS_GREYSCALE */
120 
121 /* RGB8 (332) Colors */
122 
123 static const nxgl_mxpixel_t g_minimizeNormalLut[BITMAP_NLUTCODES] =
124 {
125  0x2a, 0x4f, 0x06, 0x07, 0x26, 0x02, 0xff, 0xdf /* Codes 0-7 */
126 };
127 
128 static const uint8_t g_minimizeBrightLut[BITMAP_NLUTCODES] =
129 {
130  0x4f, 0x73, 0x2b, 0x2b, 0x4a, 0x27, 0xff, 0xff /* Codes 0-7 */
131 };
132 
133 # endif
134 #else
135 # error "Unsupport pixel format"
136 #endif
137 
139 {
140  { 1, 0}, { 20, 1}, /* Row 0 */
141  { 1, 1}, { 5, 2}, { 5, 3}, { 8, 2}, { 1, 4}, { 1, 0}, /* Row 1 */
142  { 1, 1}, { 3, 2}, { 8, 3}, { 8, 2}, { 1, 4}, /* Row 2 */
143  { 1, 1}, { 2, 2}, { 10, 3}, { 7, 2}, { 1, 4}, /* Row 3 */
144  { 1, 1}, { 1, 2}, { 10, 3}, { 8, 2}, { 1, 4}, /* Row 4 */
145  { 1, 1}, { 1, 2}, { 9, 3}, { 9, 2}, { 1, 4}, /* Row 5 */
146  { 1, 1}, { 9, 3}, { 9, 2}, { 1, 5}, { 1, 4}, /* Row 6 */
147  { 1, 1}, { 8, 3}, { 10, 2}, { 1, 5}, { 1, 4}, /* Row 7 */
148  { 1, 1}, { 7, 3}, { 11, 2}, { 1, 5}, { 1, 4}, /* Row 8 */
149  { 1, 1}, { 1, 2}, { 4, 3}, { 12, 2}, { 2, 5}, { 1, 4}, /* Row 9 */
150  { 1, 1}, { 2, 2}, { 1, 3}, { 14, 2}, { 2, 5}, { 1, 4}, /* Row 10 */
151  { 1, 1}, { 16, 2}, { 3, 5}, { 1, 4}, /* Row 11 */
152  { 1, 1}, { 15, 2}, { 4, 5}, { 1, 4}, /* Row 12 */
153  { 1, 1}, { 13, 2}, { 6, 5}, { 1, 4}, /* Row 13 */
154  { 1, 1}, { 11, 2}, { 8, 5}, { 1, 4}, /* Row 14 */
155  { 1, 1}, { 8, 2}, { 11, 5}, { 1, 4}, /* Row 15 */
156  { 1, 1}, { 4, 2}, { 15, 5}, { 1, 4}, /* Row 16 */
157  { 1, 1}, { 2, 2}, { 14, 6}, { 1, 7}, { 2, 5}, { 1, 4}, /* Row 17 */
158  { 1, 1}, { 1, 2}, { 1, 5}, { 15, 7}, { 2, 5}, { 1, 4}, /* Row 18 */
159  { 1, 1}, { 19, 5}, { 1, 0}, /* Row 19 */
160  { 1, 1}, { 1, 0}, { 17, 4}, { 1, 0}, { 1, 1}, /* Row 20 */
161 };
162 
163 /********************************************************************************************
164  * Public Bitmap Structure Definitions
165  ********************************************************************************************/
166 
168 {
169  CONFIG_NXWIDGETS_BPP, // bpp - Bits per pixel
170  CONFIG_NXWIDGETS_FMT, // fmt - Color format
171  BITMAP_NLUTCODES, // nlut - Number of colors in the lLook-Up Table (LUT)
172  BITMAP_NCOLUMNS, // width - Width in pixels
173  BITMAP_NROWS, // height - Height in rows
174  { // lut - Pointer to the beginning of the Look-Up Table (LUT)
175  g_minimizeNormalLut, // Index 0: Unselected LUT
176  g_minimizeBrightLut, // Index 1: Selected LUT
177  },
178  g_minimizeRleEntries // data - Pointer to the beginning of the RLE data
179 };
static const struct NXWidgets::SRlePaletteBitmapEntry g_minimizeRleEntries[]
const struct NXWidgets::SRlePaletteBitmap g_minimizeBitmap
Definition: nxwmglyphs.hxx:71
static const uint32_t g_minimizeBrightLut[BITMAP_NLUTCODES]
static const uint32_t g_minimizeNormalLut[BITMAP_NLUTCODES]