NXWidgets: glyph_backspace.cxx Source File

NXWidgets 1.19

glyph_backspace.cxx
Go to the documentation of this file.
1 /****************************************************************************
2 * NxWidgets/libnxwidgets/src/glyph_backspace.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 * Portions of this package derive from Woopsi (http://woopsi.org/) and
37 * portions are original efforts. It is difficult to determine at this
38 * point what parts are original efforts and which parts derive from Woopsi.
39 * However, in any event, the work of Antony Dzeryn will be acknowledged
40 * in most NxWidget files. Thanks Antony!
41 *
42 * Copyright (c) 2007-2011, Antony Dzeryn
43 * All rights reserved.
44 *
45 * Redistribution and use in source and binary forms, with or without
46 * modification, are permitted provided that the following conditions are met:
47 *
48 * * Redistributions of source code must retain the above copyright
49 * notice, this list of conditions and the following disclaimer.
50 * * Redistributions in binary form must reproduce the above copyright
51 * notice, this list of conditions and the following disclaimer in the
52 * documentation and/or other materials provided with the distribution.
53 * * Neither the names "Woopsi", "Simian Zombie" nor the
54 * names of its contributors may be used to endorse or promote products
55 * derived from this software without specific prior written permission.
56 *
57 * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
58 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
59 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
60 * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
61 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
62 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
63 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
64 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
65 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
66 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
67 *
68 ****************************************************************************/
69
70 /****************************************************************************
71 * Included Files
72 ****************************************************************************/
73
74 #include <nuttx/config.h>
75
76 #include <sys/types.h>
77 #include <stdint.h>
78 #include <stdbool.h>
79
80 #include <nuttx/nx/nxglib.h>
81 #include <nuttx/video/fb.h>
82 #include <nuttx/video/rgbcolors.h>
83
84 #include "nxconfig.hxx"
85 #include "cbitmap.hxx"
86 #include "glyphs.hxx"
87
88 #if CONFIG_NXWIDGETS_BPP != 8 // No support for 8-bit color format
89
90 /****************************************************************************
91 * Pre-Processor Definitions
92 ****************************************************************************/
93
94 /****************************************************************************
95 * Private Bitmap Data
96 ****************************************************************************/
97
98 using namespace NXWidgets;
99
100 #if CONFIG_NXWIDGETS_BPP == 16
101 # define COLOR_FMT FB_FMT_RGB16_565
102 # define RGB16_TRANSP 0x0000
103
104 static const uint16_t g_backspaceGlyph[] =
105 {
106 RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP,
107 RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP,
108 RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED, RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP,
109 RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED, RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP,
110 RGB16_TRANSP, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED,
111 RGB16_TRANSP, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED, RGB16_DARKRED,
112 RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED, RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP,
113 RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED, RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP,
114 RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_DARKRED, RGB16_TRANSP, RGB16_TRANSP,
115 RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP, RGB16_TRANSP,
116 };
117
118 #elif CONFIG_NXWIDGETS_BPP == 24 || CONFIG_NXWIDGETS_BPP == 32
119 # define COLOR_FMT FB_FMT_RGB24
120 # define RGB24_TRANSP 0x00000000
121
122 static const uint32_t g_backspaceGlyph[] =
123 {
124 RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP,
125 RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP,
126 RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED, RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP,
127 RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED, RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP,
128 RGB24_TRANSP, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED,
129 RGB24_TRANSP, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED, RGB24_DARKRED,
130 RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED, RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP,
131 RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED, RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP,
132 RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_DARKRED, RGB24_TRANSP, RGB24_TRANSP,
133 RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP, RGB24_TRANSP,
134 };
135
136 #else
137 # warning "Other pixel depths not yet supported"
138 #endif
139
140 /****************************************************************************
141 * Public Bitmap Structure Definitions
142 ****************************************************************************/
143
144 const struct SBitmap NXWidgets::g_backspace =
145 {
146 CONFIG_NXWIDGETS_BPP, // bpp - Bits per pixel
147 COLOR_FMT, // fmt - Color format
148 8, // width - Width in pixels
149 10, // height - Height in rows
150 (8*CONFIG_NXWIDGETS_BPP + 7) / 8, // stride - Width in bytes
151 g_backspaceGlyph // data - Pointer to the beginning of pixel data
152 };
153
154 #endif // CONFIG_NXWIDGETS_BPP != 8
g_backspaceGlyph
static const uint16_t g_backspaceGlyph[]
Definition: glyph_backspace.cxx:104
glyphs.hxx
NXWidgets
Definition: cbgwindow.hxx:65
NXWidgets::g_backspace
const struct SBitmap g_backspace
Definition: glyphs.hxx:123
nxconfig.hxx
cbitmap.hxx
NXWidgets::SBitmap
Definition: cbitmap.hxx:103
NXWidgets::COLOR_FMT
COLOR_FMT
Definition: glyph_arrowdown.cxx:146
NXWidgets::CONFIG_NXWIDGETS_BPP
CONFIG_NXWIDGETS_BPP
Definition: glyph_arrowdown.cxx:146