Newer
Older
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
int nxtk_fillwindow(NXTKWINDOW hfwnd, FAR const struct nxgl_rect_s *rect,
nxgl_mxpixel_t color[CONFIG_NX_NPLANES]);
</pre></ul>
<p>
<b>Description:</b>
Fill the specified rectangle in the client window with the specified color.
</p>
<p>
<b>Input Parameters:</b>
<dl>
<dt><code>hfwnd</code>
<dd>A handle previously returned by
<a href="#nxtkopenwindow"><code>nxtk_openwindow()</code></a>.
<dt><code>rect</code>
<dd>The location within the client window to be filled
<dt><code>color</code>
<dd>The color to use in the fill
</dl>
</p>
<p>
<b>Returned Value:</b>
<code>OK</code> on success;
<code>ERROR</code> on failure with <code>errno</code> set appropriately
</p>
<h3>2.4.10 <a name="nxtkfilltrapwindow"><code>nxtk_filltrapwindow()</code></a></h3>
<p><b>Function Prototype:</b></p>
<ul><pre>
#include <nuttx/nxglib.h>
#include <nuttx/nx.h>
#include <nuttx/nxtk.h>
int nxtk_filltrapwindow(NXTKWINDOW hfwnd,
FAR const struct nxgl_trapezoid_s *trap,
nxgl_mxpixel_t color[CONFIG_NX_NPLANES]);
</pre></ul>
<p>
<b>Description:</b>
Fill the specified trapezoid in the client window with the specified color
</p>
<p>
<b>Input Parameters:</b>
<dl>
<dt><code>hfwnd</code>
<dd>A handle previously returned by
<a href="#nxtkopenwindow"><code>nxtk_openwindow()</code></a>.
<dt><code>trap</code>
<dd>The trapezoidal region to be filled.
<dt><code>color</code>
<dd>The color to use in the fill.
</dl>
</p>
<p>
<b>Returned Value:</b>
<code>OK</code> on success;
<code>ERROR</code> on failure with <code>errno</code> set appropriately
</p>
<h3>2.4.11 <a name="nxtkmovewindow"><code>nxtk_movewindow()</code></a></h3>
<p><b>Function Prototype:</b></p>
<ul><pre>
#include <nuttx/nxglib.h>
#include <nuttx/nx.h>
#include <nuttx/nxtk.h>
int nxtk_movewindow(NXTKWINDOW hfwnd, FAR const struct nxgl_rect_s *rect,
FAR const struct nxgl_point_s *offset);
</pre></ul>
<p>
<b>Description:</b>
Move a rectangular region within the client sub-window of a framed window.
</p>
<p>
<b>Input Parameters:</b>
<dl>
<dt><code>hfwnd</code>
<dd>A handle previously returned by
<a href="#nxtkopenwindow"><code>nxtk_openwindow()</code></a>
specifying the client sub-window within which the move is to be done.
<dt><code>rect</code>
<dd>Describes the rectangular region relative to the client sub-window to move.
<dt><code>offset</code>
<dd>The offset to move the region
</dl>
</p>
<p>
<b>Returned Value:</b>
<code>OK</code> on success;
<code>ERROR</code> on failure with <code>errno</code> set appropriately
</p>
<h3>2.4.12 <a name="nxtkbitmapwindow"><code>nxtk_bitmapwindow()</code></a></h3>
<p><b>Function Prototype:</b></p>
<ul><pre>
#include <nuttx/nxglib.h>
#include <nuttx/nx.h>
#include <nuttx/nxtk.h>
int nxtk_bitmapwindow(NXTKWINDOW hfwnd,
FAR const struct nxgl_rect_s *dest,
FAR const void *src[CONFIG_NX_NPLANES],
FAR const struct nxgl_point_s *origin,
unsigned int stride);
</pre></ul>
<p>
<b>Description:</b>
Copy a rectangular region of a larger image into the rectangle in the
specified client sub-window.
</p>
<p>
<b>Input Parameters:</b>
<dl>
<dt><code>hfwnd</code>
<dd>A handle previously returned by
<a href="#nxtkopenwindow"><code>nxtk_openwindow()</code></a>
specifying the client sub-window that will receive the bitmap.
<dt><code>dest</code>
<dd>Describes the rectangular region on in the client sub-window
will receive the bit map.
<dt><code>src</code>
<dd>The start of the source image(s). This is an array source
images of size <code>CONFIG_NX_NPLANES</code> (probably 1).
<dt><code>origin</code>
<dd>The origin of the upper, left-most corner of the full bitmap.
Both dest and origin are in sub-window coordinates, however, the
origin may lie outside of the sub-window display.
<dt><code>stride</code>
<dd>The width of the full source image in pixels.
</dl>
</p>
<p>
<b>Returned Value:</b>
<code>OK</code> on success;
<code>ERROR</code> on failure with <code>errno</code> set appropriately
</p>
<h3>2.4.13 <a name="nxtkopentoolbar"><code>nxtk_opentoolbar()</code></a></h3>
<p><b>Function Prototype:</b></p>
<ul><pre>
#include <nuttx/nxglib.h>
#include <nuttx/nx.h>
#include <nuttx/nxtk.h>
int nxtk_opentoolbar(NXTKWINDOW hfwnd, nxgl_coord_t height,
FAR const struct nx_callback_s *cb,
FAR void *arg);
</pre></ul>
<p>
<b>Description:</b>
Create a tool bar at the top of the specified framed window.
</p>
<p>
<b>Input Parameters:</b>
<dl>
<dt><code>hfwnd</code>
<dd>A handle previously returned by
<a href="#nxtkopenwindow"><code>nxtk_openwindow()</code></a>.
<dt><code>height</code>
<dd>The requested height of the toolbar in pixels.
<dd>Callbacks used to process toolbar events.
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
<dd>User provided value that will be returned with toolbar callbacks.
</dl>
</p>
<p>
<b>Returned Value:</b>
<code>OK</code> on success;
<code>ERROR</code> on failure with <code>errno</code> set appropriately
</p>
<h3>2.4.14 <a name="nxtkclosetoolbar"><code>nxtk_closetoolbar()</code></a></h3>
<p><b>Function Prototype:</b></p>
<ul><pre>
#include <nuttx/nxglib.h>
#include <nuttx/nx.h>
#include <nuttx/nxtk.h>
int nxtk_closetoolbar(NXTKWINDOW hfwnd);
</pre></ul>
<p>
<b>Description:</b>
Remove the tool bar at the top of the specified framed window.
</p>
<p>
<b>Input Parameters:</b>
<dl>
<dt><code>hfwnd</code>
<dd>A handle previously returned by
<a href="#nxtkopenwindow"><code>nxtk_openwindow()</code></a>.
<dt><code></code>
<dd>
</dl>
</p>
<p>
<b>Returned Value:</b>
<code>OK</code> on success;
<code>ERROR</code> on failure with <code>errno</code> set appropriately
</p>
<h3>2.4.15 <a name="nxtkfilltoolbar"><code>nxtk_filltoolbar()</code></a></h3>
<p><b>Function Prototype:</b></p>
<ul><pre>
#include <nuttx/nxglib.h>
#include <nuttx/nx.h>
#include <nuttx/nxtk.h>
int nxtk_filltoolbar(NXTKWINDOW hfwnd, FAR const struct nxgl_rect_s *rect,
nxgl_mxpixel_t color[CONFIG_NX_NPLANES]);
</pre></ul>
<p>
<b>Description:</b>
Fill the specified rectangle in the toolbar sub-window with the specified color.
</p>
<p>
<b>Input Parameters:</b>
<dl>
<dt><code>hfwnd</code>
<dd>A handle previously returned by
<a href="#nxtkopenwindow"><code>nxtk_openwindow()</code></a>.
<dt><code>rect</code>
<dd>The location within the toolbar window to be filled.
<dt><code>color</code>
<dd>The color to use in the fill.
</dl>
</p>
<p>
<b>Returned Value:</b>
<code>OK</code> on success;
<code>ERROR</code> on failure with <code>errno</code> set appropriately
</p>
<h3>2.4.16 <a name="nxtkfilltraptoolbar"><code>nxtk_filltraptoolbar()</code></a></h3>
<p><b>Function Prototype:</b></p>
<ul><pre>
#include <nuttx/nxglib.h>
#include <nuttx/nx.h>
#include <nuttx/nxtk.h>
int nxtk_filltraptoolbar(NXTKWINDOW hfwnd, FAR const struct nxgl_trapezoid_s *trap,
nxgl_mxpixel_t color[CONFIG_NX_NPLANES]);
</pre></ul>
<p>
<b>Description:</b>
Fill the specified trapezoid in the toolbar sub-window with the specified color.
</p>
<p>
<b>Input Parameters:</b>
<dl>
<dt><code>hfwnd</code>
<dd>A handle previously returned by
<a href="#nxtkopenwindow"><code>nxtk_openwindow()</code></a>.
<dt><code>trap</code>
<dd>The trapezoidal region to be filled
<dt><code>color</code>
<dd>The color to use in the fill
</dl>
</p>
<p>
<b>Returned Value:</b>
<code>OK</code> on success;
<code>ERROR</code> on failure with <code>errno</code> set appropriately
</p>
<h3>2.4.17 <a name="nxtkmovetoolbar"><code>nxtk_movetoolbar()</code></a></h3>
<p><b>Function Prototype:</b></p>
<ul><pre>
#include <nuttx/nxglib.h>
#include <nuttx/nx.h>
#include <nuttx/nxtk.h>
int nxtk_movetoolbar(NXTKWINDOW hfwnd, FAR const struct nxgl_rect_s *rect,
FAR const struct nxgl_point_s *offset);
</pre></ul>
<p>
<b>Description:</b>
Move a rectangular region within the toolbar sub-window of a framed window.
</p>
<p>
<b>Input Parameters:</b>
<dl>
<dt><code>hfwnd</code>
<dd>A handle identifying sub-window containing the toolbar within which the move is
to be done.
This handle must have previously been returned by
<a href="#nxtkopenwindow"><code>nxtk_openwindow()</code></a>.
<dt><code>rect</code>
<dd>Describes the rectangular region relative to the toolbar sub-window to move.
<dt><code>offset</code>
<dd>The offset to move the region
</dl>
</p>
<p>
<b>Returned Value:</b>
<code>OK</code> on success;
<code>ERROR</code> on failure with <code>errno</code> set appropriately
</p>
<h3>2.4.18 <a name="nxtkbitmaptoolbar"><code>nxtk_bitmaptoolbar()</code></a></h3>
<p><b>Function Prototype:</b></p>
<ul><pre>
#include <nuttx/nxglib.h>
#include <nuttx/nx.h>
#include <nuttx/nxtk.h>
int nxtk_bitmaptoolbar(NXTKWINDOW hfwnd,
FAR const struct nxgl_rect_s *dest,
FAR const void *src[CONFIG_NX_NPLANES],
FAR const struct nxgl_point_s *origin,
unsigned int stride);
</pre></ul>
<p>
<b>Description:</b>
Copy a rectangular region of a larger image into the rectangle in the
specified toolbar sub-window.
</p>
<p>
<b>Input Parameters:</b>
<dl>
<dt><code>hfwnd</code>
<dd>A handle previously returned by
<a href="#nxtkopenwindow"><code>nxtk_openwindow()</code></a>.
<dt><code>dest</code>
<dd>Describes the rectangular region on in the toolbar sub-window
will receive the bit map.
<dt><code>src</code>
<dd>The start of the source image.
<dt><code>origin</code>
<dd>The origin of the upper, left-most corner of the full bitmap.
Both dest and origin are in sub-window coordinates, however, the
origin may lie outside of the sub-window display.
<dt><code>stride</code>
<dd>The width of the full source image in bytes.
</dl>
</p>
<p>
<b>Returned Value:</b>
<code>OK</code> on success;
<code>ERROR</code> on failure with <code>errno</code> set appropriately
</p>
<h2>2.5 <a name="nxfonts2">NX Fonts Support (<code>NXFONTS</code>)</a></h2>
<h3>2.5.1 <a name="nxfontstypes"><code>NXFONTS Types()</code></a></h3>
<p>
This structures provides the metrics for one glyph:
</p>
<ul><pre>
struct nx_fontmetic_s
{
patacongo
committed
uint32_t stride : 2; /* Width of one font row in bytes */
uint32_t width : 6; /* Width of the font in bits */
uint32_t height : 6; /* Height of the font in rows */
uint32_t xoffset : 6; /* Top, left-hand corner X-offset in pixels */
uint32_t yoffset : 6; /* Top, left-hand corner y-offset in pixels */
uint32_t unused : 6;
};
</pre></ul>
<p>
This structure binds the glyph metrics to the glyph bitmap:
</p>
<ul><pre>
struct nx_fontbitmap_s
{
struct nx_fontmetic_s metric; /* Character metrics */
patacongo
committed
FAR const uint8_t *bitmap; /* Pointer to the character bitmap */
};
</pre></ul>
<p>
This structure describes one contiguous grouping of glyphs that
can be described by an array starting with encoding <code>first</code> and
extending through (<code>first</code> + <code>nchars</code> - 1).
</p>
<ul><pre>
struct nx_fontset_s
{
patacongo
committed
uint8_t first; /* First bitmap character code */
uint8_t nchars; /* Number of bitmap character codes */
FAR const struct nx_fontbitmap_s *bitmap;
};
</pre></ul>
<p>
This structure describes the overall fontset:
</p>
<ul><pre>
struct nx_font_s
{
patacongo
committed
uint8_t mxheight; /* Max height of one glyph in rows */
uint8_t mxwidth; /* Max width of any glyph in pixels */
uint8_t mxbits; /* Max number of bits per character code */
uint8_t spwidth; /* The width of a space in pixels */
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
};
</pre></ul>
<h3>2.5.2 <a name="nxfgetfontset"><code>nxf_getfontset()</code></a></h3>
<p><b>Function Prototype:</b></p>
<ul><pre>
#include <nuttx/nxglib.h>
#include <nuttx/nxfonts.h>
FAR const struct nx_font_s *nxf_getfontset(void);
</pre></ul>
<p>
<b>Description:</b>
Return information about the current font set.
</p>
<p>
<b>Input Parameters:</b> None
</p>
<p>
<b>Returned Value:</b>
An instance of <code>struct nx_font_s</code> describing the font set.
</p>
<h3>2.5.3 <a name="nxfgetbitmap"><code>nxf_getbitmap()</code></a></h3>
<p><b>Function Prototype:</b></p>
<ul><pre>
#include <nuttx/nxglib.h>
#include <nuttx/nxfonts.h>
patacongo
committed
FAR const struct nx_fontbitmap_s *nxf_getbitmap(uint16_t ch);
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
</pre></ul>
<p>
<b>Description:</b>
Return font bitmap information for the selected character encoding.
</p>
<p>
<b>Input Parameters:</b>
<ul><dl>
<dt><code></code>
<dd>
</dl></ul>
</p>
<p>
<b>Returned Value:</b>
An instance of <code>struct nx_fontbitmap_s</code> describing the glyph.
</p>
<h3>2.5.4 <a name="nxfconvertbpp"><code>nxf_convert_*bpp()</code></a></h3>
<p><b>Function Prototype:</b></p>
<ul><pre>
#include <nuttx/nxglib.h>
#include <nuttx/nxfonts.h>
patacongo
committed
int nxf_convert_2bpp(FAR uint8_t *dest, uint16_t height,
uint16_t width, uint16_t stride,
patacongo
committed
int nxf_convert_4bpp(FAR uint8_t *dest, uint16_t height,
uint16_t width, uint16_t stride,
patacongo
committed
int nxf_convert_8bpp(FAR uint8_t *dest, uint16_t height,
uint16_t width, uint16_t stride,
patacongo
committed
int nxf_convert_16bpp(FAR uint16_t *dest, uint16_t height,
uint16_t width, uint16_t stride,
patacongo
committed
int nxf_convert_24bpp(FAR uint32_t *dest, uint16_t height,
uint16_t width, uint16_t stride,
patacongo
committed
int nxf_convert_32bpp(FAR uint32_t *dest, uint16_t height,
uint16_t width, uint16_t stride,
nxgl_mxpixel_t color);
</pre></ul>
<p>
<b>Description:</b> Convert the 1BPP font to a new pixel depth.
</p>
<p>
<b>Input Parameters:</b>
<ul><dl>
<dt><code>dest</code>
<dd>The destination buffer provided by the caller.
<dt><code>height</code>
<dd>The max height of the returned char in rows.
<dt><code>width</code>
<dd>The max width of the returned char in pixels.
<dt><code>stride</code>
<dd>The width of the destination buffer in bytes.
<dt><code>bm</code>
<dd>Describes the character glyph to convert
<dt><code>color</code>
<dd>The color to use for '1' bits in the font bitmap (0 bits are transparent).
</dl></ul>
</p>
<p>
<b>Returned Value:</b>
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
<code>OK</code> on success;
<code>ERROR</code> on failure with <code>errno</code> set appropriately.
</p>
<h2>2.6 <a name="samplecode">Sample Code</a></h2>
<p><b><code>examples/nx</code></b>.
No sample code is provided in this document.
However, an example can be found in the NuttX source tree at <code>examples/nx</code>.
That code is intended to test NX.
Since it is test code, it is designed to exercise functionality and does not necessarily
represent best NX coding practices.
</p>
<p>
In its current form, the NX graphics system provides a low level of graphics and window
support.
Most of the complexity of manage redrawing and handling mouse and keyboard events must
be implemented by the NX client code.
</p>
<p><b>Building <code>examples/nx</code></b>.
Testing was performed using the Linux/Cygwin-based NuttX simulator.
Instructions are provided for building that simulation are provided in
<a href="#testcoverage">Appendix C</a> of this document.
</p>
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
<h1>Appendix A <a name="grapicsdirs"><code>graphics/</code> Directory Structure</a></h1>
</td>
</tr>
</table>
<ul>
<dl>
<dt><code>graphics/nxglib</code>
<dd>The NuttX tiny graphics library.
The directory contains generic utilities support operations on primitive graphics objects
and logic to rasterize directly into a framebuffer or through an LCD driver interface.
It has no concept of windows (other than the one, framebuffer or LCD window).
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
<dt><code>graphics/nxbe</code>
<dd>This is the <i>back-end</i> of a tiny windowing system.
It can be used with either of two front-ends to complete a windowing system (see
<code>nxmu</code> and <code>nxsu/<code> below).
It contains most of the important window management logic: clipping, window controls,
window drawing, etc.
<dt><code>graphics/nxsu</code>
<dd>This is the NX single user <i>front end</i>.
When combined with the generic <i>back-end</i> (<code>nxbe</code>), it implements a
single threaded, single user windowing system.
The files in this directory present the window APIs described in
<code>include/nuttx/nx.h</code>.
The single user front-end is selected when <code>CONFIG_NX_MULTIUSER</code> is not
defined in the NuttX configuration file.
<dt><code>graphics/nxsu</code>
<dd>This is the NX multi user <i>front end</i>.
When combined with the generic <i>back-end</i> (<code>nxbe</code>), it implements a
multi-threaded, multi-user windowing system.
The files in this directory present the window APIs described in
<code>include/nuttx/nx.h</code>.
The multi-user front end includes a graphics server that executes on its own thread;
multiple graphics clients then communicate with the server via a POSIX message
queue to serialize window operations from many threads.
The multi-user front-end is selected when <code>CONFIG_NX_MULTIUSER</code> is defined
in the NuttX configuration file.
<dt><code>graphics/nxfonts</code>
<dd>This is where the NXFONTS implementation resides.
This is a relatively low-level set of charset set/glyph management APIs.
See <code>include/nuttx/nxfonts.h</code>.
<dt><code>graphics/nxtk</code>
<dd>This is where the NXTOOLKIT implementation resides.
This toolkit is built on top of NX and works with either the single-user or
multi-user NX version.
See <code>include/nuttx/nxtk.h</code>.
<dt><code>graphics/nxwidgets</code>
<dd>At one time, I planned to put NXWIDGETS implementation here, but not anymore.
</dl>
</ul>
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
<h1>Appendix B <a name="nxconfigs">NX Configuration Options</a></h1>
</td>
</tr>
</table>
<h2>B.1 <a name="nxgenconfig">General Configuration Settings</a></h2>
<ul>
<dl>
<dt><code>CONFIG_NX</code>
Enables overall support for graphics library and NX
</dl>
</ul>
<h2>B.2 <a name="nxglconfig">NXGL Configuration Settings</a></h2>
<ul>
<dl>
<dt><code>CONFIG_NX_NPLANES</code>:
<dd>Some YUV color formats requires support for multiple planes,
one for each color component. Unless you have such special
hardware, this value should be undefined or set to 1.
<dt><code>CONFIG_NX_DISABLE_1BPP</code>, <code>CONFIG_NX_DISABLE_2BPP</code>,
<code>CONFIG_NX_DISABLE_4BPP</code>, <code>CONFIG_NX_DISABLE_8BPP</code>
<code>CONFIG_NX_DISABLE_16BPP</code>, <code>CONFIG_NX_DISABLE_24BPP</code>, and
<code>CONFIG_NX_DISABLE_32BPP</code>:
<dd>NX supports a variety of pixel depths. You can save some
memory by disabling support for unused color depths.
<dt><code>CONFIG_NX_PACKEDMSFIRST</code>:
<dd>If a pixel depth of less than 8-bits is used, then NX needs
to know if the pixels pack from the MS to LS or from LS to MS
<dt><code>CONFIG_NX_LCDDRIVER</code>:
<dd>By default, NX builds to use a framebuffer driver (see <code>include/nuttx/fb.h</code>).
If this option is defined, NX will build to use an LCD driver (see <code>include/nuttx/lcd.h</code>).
</li>
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
</dl>
</ul>
<h2>B.3 <a name="nxconfig">NX Configuration Settings</a></h2>
<ul>
<dl>
<dt><code>CONFIG_NX_MOUSE</code>:
<dd>Build in support for mouse input.
<dt><code>CONFIG_NX_KBD</code>:
<dd>Build in support of keypad/keyboard input.
</dl>
</ul>
<h2>B.4 <a name="nxmuconfig">NX Multi-User (Only) Configuration Settings</a></h2>
<ul>
<dl>
<dt><code>CONFIG_NX_MULTIUSER</code>:
<dd>Configures NX in multi-user mode.
<dt><code>CONFIG_NX_BLOCKING</code>
<dd>Open the client message queues in blocking mode. In this case,
<dt><code>nx_eventhandler()</code> will not return until a message is received and processed.
<dt><code>CONFIG_NX_MXSERVERMSGS</code> and <code>CONFIG_NX_MXCLIENTMSGS</code>
<dd>Specifies the maximum number of messages that can fit in
the message queues. No additional resources are allocated, but
this can be set to prevent flooding of the client or server with
too many messages (<code>CONFIG_PREALLOC_MQ_MSGS</code> controls how many
messages are pre-allocated).
</dl>
</ul>
<h2>B.5 <a name="nxtkconfig">NXTK Configuration Settings</a></h2>
<ul>
<dl>
<dt><code>CONFIG_NXTK_BORDERWIDTH</code>:
<dd>Specifies with with of the border (in pixels) used with
framed windows. The default is 4.
<dt><code>CONFIG_NXTK_BORDERCOLOR1</code> and <code>CONFIG_NXTK_BORDERCOLOR2</code>:
<dd>Specify the colors of the border used with framed windows.
<dt><code>CONFIG_NXTK_BORDERCOLOR2</code> is the shadow side color and so
<dd>is normally darker. The default is medium and dark grey,
respectively
<dt><code>CONFIG_NXTK_AUTORAISE</code>:
<dd>If set, a window will be raised to the top if the mouse position
is over a visible portion of the window. Default: A mouse
button must be clicked over a visible portion of the window.
</dl>
</ul>
<h2>B.6 <a name="nxfpmtsconfig">NXFONTS Configuration Settings</a></h2>
<ul>
<dl>
<dt><code>CONFIG_NXFONTS_CHARBITS</code>:
<dd>The number of bits in the character set. Current options are
only 7 and 8. The default is 7.
<dt><code>CONFIG_NXFONT_SANS</code>:
<dd>At present, there is only one font. But if there were were more,
then this option would select the sans serif font.
</dl>
</ul>
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
<h1>Appendix C <a name="testcoverage">NX Test Coverage</a></h1>
</td>
</tr>
</table>
The primary test tool for debugging NX resides at <code>examples/nx</code>.
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
</p>
<p><b>Building <code>examples/nx</code></b>.
NX testing was performed using <code>examples/nx</code> with the
Linux/Cygwin-based NuttX simulator.
Configuration files for building this test can be found in <code>configs/sim/nx</code>.
There are two alternative configurations for building the simulation:
</p>
<ol>
<li>
The default configuration using the configuration file at
<code>configs/sim/nx/defconfig</code>.
This default configuration exercises the NX logic a 8 BPP but provides no visual feedback.
In this configuration, a very simple, simulated framebuffer driver is used that is
based upon a simple region of memory posing as video memory.
That default configuration can be built as follows:
<ul><pre>
cd <NuttX-Directory>/tools
./configure sim/nx
cd <NuttX-Directory>
make
./nuttx
</pre></ul>
</li>
<li>
<p>
A preferred configuration extends the test with a simulated framebuffer driver
that uses an X window as a framebuffer.
This configuration uses the configuration file at <code>configs/sim/nx/defconfig-x11</code>.
This is a superior test configuration because the X window appears at your desktop
and you can see the NX output.
This preferred configuration can be built as follows:
</p>
<ul><pre>
cd <NuttX-Directory>/tools
./configure sim/nx
cd <NuttX-Directory>
cp <NuttX-Directory>/configs/sim/nx/defconfig-x11 .config
make
./nuttx
</pre></ul>
<p>
<i>Update:</i>
The sim target has suffered some bit-rot over the years and so the following caveats need to be added:
<ul>
<li>
The X target does not build under recent Cygwin configurations.
</li>
<li>
The X target does not build under current Ubuntu distributions;
it fails to locate the X header files.
</li>
<li>
The sim target itself is broken under 64-bit Linux.
This is because the sim target is based upon some assembly language setjmp/longjmp logic that only works on 32-bit systems.
<p><small><b>NOTE</b>: There is a workaround in this case; you can build for 32-bit execution on a 64-bit machine by adding <code>-m3</code> to the <code>CFLAGS</code> and <code>-m32 -m elf_i38</code> to the <code>LDFLAGS</code>.</small></p>
</li>
</ol>
<p>
Why isn't this configuration the default? Because not all systems the use NX support X.
</p>
<p><b>Test Coverage</b>.
At present, <code>examples/nx</code>t only exercises a subset of NX;
the remainder is essentially untested.
The following table describes the testing performed on each NX API:
</p>
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
<center><h2>Table C.1: <a name="nxglibcoverage">NXGLIB API Test Coverage</a></h2></center>
<center><table border="1" width="80%">
<tr>
<th width="40%">Function</th>
<th width="60%">Special Setup/Notes</th>
<th width="5%">Verified</th></tr>
</tr>
<tr>
<td align="left" valign="top"><a href="#nxglrgb2yuv"><code>nxgl_rgb2yuv()</code></a></td>
<td><br></td>
<td align="center" bgcolor="lightgrey">NO</td>
</tr>
<tr>
<td align="left" valign="top"><a href="#nxglyuv2rgb"><code>nxgl_yuv2rgb()</code></a></td>
<td><br></td>
<td align="center" bgcolor="lightgrey">NO</td>
</tr>
<tr>
<td align="left" valign="top"><a href="#nxglrectcopy"><code>nxgl_rectcopy()</code></a></td>
<td><br></td>
<td align="center" bgcolor="skyblue">YES</td>
</tr>
<tr>
<td align="left" valign="top"><a href="#nxglrectoffset"><code>nxgl_rectoffset()</code></a></td>
<td><br></td>
<td align="center" bgcolor="skyblue">YES</td>
</tr>
<tr>
<td align="left" valign="top"><a href="#nxglvectoradd"><code>nxgl_vectoradd()</code></a></td>
<td><br></td>
<td align="center" bgcolor="skyblue">YES</td>
</tr>
<tr>
<td align="left" valign="top"><a href="#nxglvectorsubtract"><code>nxgl_vectorsubtract()</code></a></td>
<td><br></td>
<td align="center" bgcolor="skyblue">YES</td>
</tr>
<tr>
<td align="left" valign="top"><a href="#nxglrectintersect"><code>nxgl_rectintersect()</code></a></td>
<td><br></td>
<td align="center" bgcolor="skyblue">YES</td>
</tr>
<tr>
<td align="left" valign="top"><a href="#nxglrectunion"><code>nxgl_rectunion()</code></a></td>
<td><br></td>
<td align="center" bgcolor="skyblue">YES</td>
</tr>
<tr>
<td align="left" valign="top"><a href="#nxglnonintersecting"><code>nxgl_nonintersecting()</code></a></td>
<td><br></td>
<td align="center" bgcolor="skyblue">YES</td>
</tr>
<tr>
<td align="left" valign="top"><a href="#nxglrectoverlap"><code>nxgl_rectoverlap()</code></a></td>
<td><br></td>
<td align="center" bgcolor="skyblue">YES</td>
</tr>
<tr>
<td align="left" valign="top"><a href="#nxglrectinside"><code>nxgl_rectinside()</code></a></td>
<td><br></td>
<td align="center" bgcolor="skyblue">YES</td>
</tr>
<tr>
<td align="left" valign="top"><a href="#nxglrectsize"><code>nxgl_rectsize()</code></a></td>
<td><br></td>
<td align="center" bgcolor="skyblue">YES</td>
</tr>
<tr>
<td align="left" valign="top"><a href="#nxglnullrect"><code>nxgl_nullrect()</code></a></td>
<td><br></td>
<td align="center" bgcolor="skyblue">YES</td>
</tr>
<tr>
<td align="left" valign="top"><a href="#nxglrunoffset"><code>nxgl_runoffset()</code></a></td>
<td><br></td>
<td align="center" bgcolor="lightgrey">NO</td>
</tr>
<tr>
<td align="left" valign="top"><a href="#nxglruncopy"><code>nxgl_runcopy()</code></a></td>
<td><br></td>
<td align="center" bgcolor="lightgrey">NO</td>
</tr>
<tr>
<td align="left" valign="top"><a href="#nxgltrapoffset"><code>nxgl_trapoffset()</code></a></td>
<td><br></td>
<td align="center" bgcolor="lightgrey">NO</td>
</tr>
<tr>
<td align="left" valign="top"><a href="#nxgltrapcopy"><code>nxgl_trapcopy()</code></a></td>
<td><br></td>
<td align="center" bgcolor="lightgrey">NO</td>
</tr>
<tr>
<td align="left" valign="top"><a href="#nxglcolorcopy"><code>nxgl_colorcopy</code></a></td>
<td><br></td>
<td align="center" bgcolor="skyblue">YES</td>
</tr>
</table></center>
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
<center><h2>Table C.2: <a name="nxcbcoverage">NX Server Callbacks Test Coverage</a></h2></center>
<center><table border="1" width="80%">
<tr>
<th width="40%">Function</th>
<th width="60%">Special Setup/Notes</th>
<th width="5%">Verified</th></tr>
</tr>
<tr>
<td align="left" valign="top"><a href="#nxcbredraw"><code>redraw()</code></a></td>
<td><br></td>
<td align="center" bgcolor="skyblue">YES</td>
</tr>
<tr>
<td align="left" valign="top"><a href="#nxcbposition"><code>position()</code></a></td>
<td><br></td>
<td align="center" bgcolor="skyblue">YES</td>
</tr>
<tr>
<td align="left" valign="top"><a href="#nxcbmousein"><code>mousein()</code></a></td>
<td><br></td>
<td align="center" bgcolor="skyblue">YES</td>
</tr>
<tr>
<td align="left" valign="top"><a href="#nxcbkbdin"><code>kbdin()</code></a></td>
<td><br></td>
<td align="center" bgcolor="skyblue">YES</td>
</tr>
</table></center>
<center><h2>Table C.3: <a name="nxcoverage">NX API Test Coverage</a></h2></center>
<center><table border="1" width="80%">
<tr>
<th width="40%">Function</th>
<th width="60%">Special Setup/Notes</th>
<th width="5%">Verified</th></tr>
</tr>
<tr>
<td align="left" valign="top"><a href="#nxruninstance"><code>nx_runinstance()</code></a></td>
<td>Change to <code>CONFIG_NX_MULTIUSER=y</code> in the
<code><NuttX-Directory>/.config</code> file </td>
<td align="center" bgcolor="skyblue">YES</td>
</tr>
<tr>
<td align="left" valign="top"><a href="#nxconnectinstance"><code>nx_connectinstance()</code></a></td>
<td>Change to <code>CONFIG_NX_MULTIUSER=y</code> in the
<code><NuttX-Directory>/.config</code> file </td>
<td align="center" bgcolor="skyblue">YES</td>
</tr>
<tr>
<td align="left" valign="top"><a href="#nxopen"><code>nx_open()</code></a></td>
<td><br></td>
<td align="center" bgcolor="skyblue">YES</td>
</tr>
<tr>
<td align="left" valign="top"><a href="#nxdisconnect"><code>nx_disconnect()</code></a></td>
<td>Change to <code>CONFIG_NX_MULTIUSER=y</code> in the
<code><NuttX-Directory>/.config</code> file </td>
<td align="center" bgcolor="skyblue">YES</td>
</tr>
<tr>
<td align="left" valign="top"><a href="#nxclose"><code>nx_close()</code></a></td>
<td><br></td>
<td align="center" bgcolor="skyblue">YES</td>
</tr>
<tr>
<td align="left" valign="top"><a href="#nxeventhandler"><code>nx_eventhandler()</code></a></td>
<td>Change to <code>CONFIG_NX_MULTIUSER=y</code> in the
<code><NuttX-Directory>/.config</code> file</td>
<td align="center" bgcolor="skyblue">YES</td>
</tr>
<tr>
<td align="left" valign="top"><a href="#nxeventnotify"><code>nx_eventnotify()</code></a></td>
<td>This is not used in the current version of <code>examples/nx</code>,
was tested in a previous version)</td>
<td align="center" bgcolor="lightgrey">NO</td>
</tr>
<tr>
<td align="left" valign="top"><a href="#nxopenwindow"><code>nx_openwindow()</code></a></td>
<td>Change to <code>CONFIG_EXAMPLES_NX_RAWWINDOWS=y</code> in the
<code><NuttX-Directory>/.config</code> file</td>
</td>
<td align="center" bgcolor="skyblue">YES</td>
</tr>
<tr>
<td align="left" valign="top"><a href="#nxclosewindow"><code>nx_closewindow()</code></a></td>
<td>Change to <code>CONFIG_EXAMPLES_NX_RAWWINDOWS=y</code> in the
<code><NuttX-Directory>/.config</code> file</td>
<td align="center" bgcolor="skyblue">YES</td>
</tr>
<tr>
<td align="left" valign="top"><a href="#nxrequestbkgd"><code>nx_requestbkgd()</code></a></td>
<td><br></td>
<td align="center" bgcolor="lightgrey">NO</td>
</tr>
<tr>
<td align="left" valign="top"><a href="#nxreleasebkgd"><code>nx_releasebkgd()</code></a></td>
<td><br></td>
<td align="center" bgcolor="lightgrey">NO</td>
</tr>
<tr>
<td align="left" valign="top"><a href="#nxgetposition"><code>nx_getposition()</code></a></td>
<td><br></td>
<td align="center" bgcolor="lightgrey">NO</td>
</tr>
<tr>
<td align="left" valign="top"><a href="#nxsetposition"><code>nx_setposition()</code></a></td>
<td>Change to <code>CONFIG_EXAMPLES_NX_RAWWINDOWS=y</code> in the
<code><NuttX-Directory>/.config</code> file</td>
<td align="center" bgcolor="skyblue">YES</td>
</tr>
<tr>
<td align="left" valign="top"><a href="#nxsetsize"><code>nx_setsize()</code></a></td>
<td>Change to <code>CONFIG_EXAMPLES_NX_RAWWINDOWS=y</code> in the
<code><NuttX-Directory>/.config</code> file</td>
<td align="center" bgcolor="skyblue">YES</td>
</tr>
<tr>
<td align="left" valign="top"><a href="#nxraise"><code>nx_raise()</code></a></td>
<td>Change to <code>CONFIG_EXAMPLES_NX_RAWWINDOWS=y</code> in the
<code><NuttX-Directory>/.config</code> file</td>
<td align="center" bgcolor="skyblue">YES</td>
</tr>
<tr>
<td align="left" valign="top"><a href="#nxlower"><code>nx_lower()</code></a></td>
<td>Change to <code>CONFIG_EXAMPLES_NX_RAWWINDOWS=y</code> in the
<code><NuttX-Directory>/.config</code> file</td>
<td align="center" bgcolor="skyblue">YES</td>
</tr>
<tr>
<td align="left" valign="top"><a href="#nxfill"><code>nx_fill()</code></a></td>
<td>Change to <code>CONFIG_EXAMPLES_NX_RAWWINDOWS=y</code> in the
<code><NuttX-Directory>/.config</code> file</td>
<td align="center" bgcolor="skyblue">YES</td>
</tr>
<tr>
<td align="left" valign="top"><a href="#nxfilltrapezoid"><code>nx_filltrapezoid()</code></a></td>