Skip to content
Snippets Groups Projects
NXGraphicsSubsystem.html 103 KiB
Newer Older
patacongo's avatar
patacongo committed
<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 &lt;nuttx/nxglib.h&gt;
#include &lt;nuttx/nx.h&gt;
#include &lt;nuttx/nxtk.h&gt;

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 &lt;nuttx/nxglib.h&gt;
#include &lt;nuttx/nx.h&gt;
#include &lt;nuttx/nxtk.h&gt;

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 &lt;nuttx/nxglib.h&gt;
#include &lt;nuttx/nx.h&gt;
#include &lt;nuttx/nxtk.h&gt;

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 &lt;nuttx/nxglib.h&gt;
#include &lt;nuttx/nx.h&gt;
#include &lt;nuttx/nxtk.h&gt;

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.
patacongo's avatar
patacongo committed
    <dt><code>cb</code>
patacongo's avatar
patacongo committed
    <dd>Callbacks used to process toolbar events.
patacongo's avatar
patacongo committed
    <dt><code>arg</code>
patacongo's avatar
patacongo committed
    <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 &lt;nuttx/nxglib.h&gt;
#include &lt;nuttx/nx.h&gt;
#include &lt;nuttx/nxtk.h&gt;

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 &lt;nuttx/nxglib.h&gt;
#include &lt;nuttx/nx.h&gt;
#include &lt;nuttx/nxtk.h&gt;

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 &lt;nuttx/nxglib.h&gt;
#include &lt;nuttx/nx.h&gt;
#include &lt;nuttx/nxtk.h&gt;

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 &lt;nuttx/nxglib.h&gt;
#include &lt;nuttx/nx.h&gt;
#include &lt;nuttx/nxtk.h&gt;

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 &lt;nuttx/nxglib.h&gt;
#include &lt;nuttx/nx.h&gt;
#include &lt;nuttx/nxtk.h&gt;

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
{
  uint32 stride   : 2;      /* Width of one font row in bytes */
  uint32 width    : 6;      /* Width of the font in bits */
  uint32 height   : 6;      /* Height of the font in rows */
  uint32 xoffset  : 6;      /* Top, left-hand corner X-offset in pixels */
  uint32 yoffset  : 6;      /* Top, left-hand corner y-offset in pixels */
  uint32 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 */
  FAR const ubyte *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
{
  ubyte  first;             /* First bitmap character code */
  ubyte  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
{
  ubyte  mxheight;          /* Max height of one glyph in rows */
  ubyte  mxwidth;           /* Max width of any glyph in pixels */
  ubyte  mxbits;            /* Max number of bits per character code */
  ubyte  spwidth;           /* The width of a space in pixels */
};
</pre></ul>

<h3>2.5.2 <a name="nxfgetfontset"><code>nxf_getfontset()</code></a></h3>
<p><b>Function Prototype:</b></p>
<ul><pre>
#include &lt;nuttx/nxglib.h&gt;
#include &lt;nuttx/nxfonts.h&gt;

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 &lt;nuttx/nxglib.h&gt;
#include &lt;nuttx/nxfonts.h&gt;

FAR const struct nx_fontbitmap_s *nxf_getbitmap(uint16 ch);
</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 &lt;nuttx/nxglib.h&gt;
#include &lt;nuttx/nxfonts.h&gt;

int nxf_convert_2bpp(FAR ubyte *dest, uint16 height,
patacongo's avatar
patacongo committed
                     uint16 width, uint16 stride,
                     FAR const struct nx_fontbitmap_s *bm,
patacongo's avatar
patacongo committed
                     nxgl_mxpixel_t color);
int nxf_convert_4bpp(FAR ubyte *dest, uint16 height,
patacongo's avatar
patacongo committed
                     uint16 width, uint16 stride,
                     FAR const struct nx_fontbitmap_s *bm,
patacongo's avatar
patacongo committed
                     nxgl_mxpixel_t color);
int nxf_convert_8bpp(FAR ubyte *dest, uint16 height,
patacongo's avatar
patacongo committed
                     uint16 width, uint16 stride,
                     FAR const struct nx_fontbitmap_s *bm,
patacongo's avatar
patacongo committed
                     nxgl_mxpixel_t color);
int nxf_convert_16bpp(FAR uint16 *dest, uint16 height,
patacongo's avatar
patacongo committed
                      uint16 width, uint16 stride,
                      FAR const struct nx_fontbitmap_s *bm,
patacongo's avatar
patacongo committed
                      nxgl_mxpixel_t color);
int nxf_convert_24bpp(FAR uint32 *dest, uint16 height,
patacongo's avatar
patacongo committed
                      uint16 width, uint16 stride,
                      FAR const struct nx_fontbitmap_s *bm,
patacongo's avatar
patacongo committed
                      nxgl_mxpixel_t color);
int nxf_convert_32bpp(FAR uint32 *dest, uint16 height,
patacongo's avatar
patacongo committed
                      uint16 width, uint16 stride,
                      FAR const struct nx_fontbitmap_s *bm,
patacongo's avatar
patacongo committed
                      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.
patacongo's avatar
patacongo committed
    <dt><code>bm</code>
    <dd>Describes the character glyph to convert
patacongo's avatar
patacongo committed
    <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>
patacongo's avatar
patacongo committed
  <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.
patacongo's avatar
patacongo committed
</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.
      It has no concept of windows (other than the one, framebuffer  window).

    <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
  </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>

patacongo's avatar
patacongo committed
<p><b><code>examples/nx</code></b>.
patacongo's avatar
patacongo committed
  The primary test tool for debugging NX resides at <code>examples/nx</code>.
patacongo's avatar
patacongo committed
</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 &lt;NuttX-Directory&gt;/tools
./configure sim/nx
cd  &lt;NuttX-Directory&gt;
make
./nuttx
</pre></ul>
  </li>
  <li>
    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:
<ul><pre>
cd &lt;NuttX-Directory&gt;/tools
./configure sim/nx
cd  &lt;NuttX-Directory&gt;
cp &lt;NuttX-Directory&gt;/configs/sim/nx/defconfig-x11 .config
make
./nuttx
</pre></ul>
  </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.
patacongo's avatar
patacongo committed
  The following table describes the testing performed on each NX API:
</p>

patacongo's avatar
patacongo committed
<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>

patacongo's avatar
patacongo committed
<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>&lt;NuttX-Directory&gt;/.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>&lt;NuttX-Directory&gt;/.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>&lt;NuttX-Directory&gt;/.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>&lt;NuttX-Directory&gt;/.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>&lt;NuttX-Directory&gt;/.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>&lt;NuttX-Directory&gt;/.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>&lt;NuttX-Directory&gt;/.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>&lt;NuttX-Directory&gt;/.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>&lt;NuttX-Directory&gt;/.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>&lt;NuttX-Directory&gt;/.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>&lt;NuttX-Directory&gt;/.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>
  <td><br></td>
  <td align="center" bgcolor="lightgrey">NO</td>
</tr>
<tr>
  <td align="left" valign="top"><a href="#nxglrgb2yuv"><code>nx_setbgcolor()</code></a></td>
  <td><br></td>
  <td align="center" bgcolor="skyblue">YES</td>
</tr>
<tr>
  <td align="left" valign="top"><a href="#nxmove"><code>nx_move()</code></a></td>
  <td>Change to <code>CONFIG_EXAMPLES_NX_RAWWINDOWS=y</code> in the
     <code>&lt;NuttX-Directory&gt;/.config</code> file</td>
  <td align="center" bgcolor="lightgrey">NO</td>
</tr>
<tr>
  <td align="left" valign="top"><a href="#nxbitmap"><code>nx_bitmap()</code></a></td>
  <td>Change to <code>CONFIG_EXAMPLES_NX_RAWWINDOWS=y</code> in the
     <code>&lt;NuttX-Directory&gt;/.config</code> file.</td>
  <td align="center" bgcolor="skyblue">YES</td>
</tr>
<tr>
  <td align="left" valign="top"><a href="#nxkbdin"><code>nx_kbdin()</code></a></td>
  <td><br></td>
  <td align="center" bgcolor="skyblue">YES</td>
</tr>
<tr>
  <td align="left" valign="top"><a href="#nxmousein"><code>nx_mousein()</code></a></td>
  <td><br></td>
  <td align="center" bgcolor="skyblue">YES</td>
</tr>
</table></center>