diff --git a/Documentation/NXGraphicsSubsystem.html b/Documentation/NXGraphicsSubsystem.html new file mode 100644 index 0000000000..cfe66daaea --- /dev/null +++ b/Documentation/NXGraphicsSubsystem.html @@ -0,0 +1,2620 @@ + + +NX Graphics Subsystem + + + + +

+ + + + +
+

+ NX Graphics Subsystem +

+

Last Updated: December 5, 2008

+
+

+ + + + + +
+

Table of Contents

+
+ + + + + + +
+

+ 1.0 Introduction +

+ +

+ 2.0 NX User APIs +

+
+

+ 2.4 NX Tool Kit (NXTK) +

+

+

+

+

+ 2.5 NX Fonts Support (NXFONTS)
+

+

+

+

+ +

+ Appendix A graphics/ Directory Structure
+ Appendix B NX Configuration Options +

+

+

+

+

+ Appendix C NX Test Coverage +

+
+ + + + + +
+

1.0 Introduction

+
+ +

1.1 Overview

+

+ This document describes the tiny graphics support included in NuttX. + It includes an overview description of that graphics support, detailed + descriptions of the NuttX graphics APIs, and discussion of code organization, + and OS configuration options. +

+ +
+ + + + + +
Figure 1. + This sceen shot shows the final frame for the NuttX example at examples/nx + running on the simulated, Linux x86 platform with simulated framebuffer output to + an X window. + This picture shows to framed windows with (blank) toolbars. + Each window has displayed text as received from the NX keyboard interface + The second window has just been raised to the top of the display. + +
+ + +

1.2 Objectives

+ +

+ The objective of this development was to provide a tiny windowing system in the + spirit of X, but greatly scaled down and appropriate for most resource-limited + embedded environments. + The current NX implementation supports the general following, high-level features: +

+ + +

1.3 Organization

+ +

+ NX is organized into 6 (and perhaps someday 7 or 8) logical modules. + These logical modules also correspond to the directory organization. + That NuttX directory organization is discussed in + Appendix B of this document. + The logic modules are discussed in the following sub-paragraphs. +

+ +

+

+

+ +

1.3.1 NX Graphics Library (NXGL)

+ +

+ NXGLIB is a standalone library that contains low-level graphics utilities and + direct framebuffer rendering logic. NX is built on top NXGLIB. +

+ +

1.3.2 NX (NXSU and NXMU)

+ +

+ NX is the tiny NuttX windowing system for raw windows (i.e., simple regions of + graphics memory). + NX includes both a small-footprint, single user implementaton (NXSU) and a somewhat + larger multi-user implentation (NXMU as described below). + Both conform to the same APIs as defined in include/nuttx/nx.h and, hence, + are interchangable1. + NX can be used without NXWIDGETS and without NXTOOLKIT for raw window displays. +

+ +

+ 1NXMU and NXSU are interchangeable other than (1) certain start-up + and intialization APIs (as described below), and (2) timing. With NXSU, NX APIs + execute immediately; with NXMU, NX APIs defer and serialize the operations and, hence, + introduce different timing and potential race conditions that you would not experience + with NXSU. +

+ +

NXNULL? + At one time, I also envisoned a NULL front-end that did not support windowing + at all but, rather, simply provided the entire framebuffer memory as one dumb window. + This has the advantage that the same NX APIs can be used on the one dumb window as + for the other NX windows. + This would be in the NuttX spirit of scalability. +

+

+ However, the same end result can be obtained by using the + nx_requestbkgd() API. + It still may be possible to reduce the footprint in this usage case by developing + and even thinner NXNULL front-end. + That is a possible future development. +

+ +

1.3.3 NX Tool Kit (NXTK)

+ +

+ NXTK is a s set of C graphics tools that provide higher-level window drawing + operations. + This is the module where the framed windows and toolbar logic is implemented. + NXTK is built on top of NX and does not depend on NXWIDGETS. +

+ +

1.3.4 NX Fonts Support (NXFONTS)

+ +

+ A set of C graphics tools for present (bitmap) font images. + The font implementation is at a very low level or graphics operation, + comparable to the logic in NXGLIB. + NXFONTS does not depend on any NX module other than some utilities and types from NXGLIB. +

+ +

1.3.5 NX Widgets (NXWIDGETS)

+ +

+ I had originally planned a high level, C++, object-oriented library for + object-oriented access to graphics widgets. + However, C++ compilers are not available for some of the targets supported by NuttX. + So I have decided to implement the entire solution in C. + That decision makes the solution somewhat more difficult to work with, but supports all platforms. +

+

+ At this point, the amount of C in the implementation would make conversion to C++ a + more difficult job. + I leave the C++ widget interface to any contributor who may have an interest in such things. +

+ + + + + +
+

2.0 NX User APIs

+
+ +

2.1 NX Header Files

+ + + +

2.2 NX Graphics Library (NXGL)

+ +

+ NXGL provides many APIs, some available for use internally by NX and + others for use by applications as well. + Only those APIs intended for application usage are documented here + See include/nuttx/nxglib.h for the full set of APIs; + those APIs might be of interest if you are rendering directly into + framebuffer memory. +

+ +

2.2.1 NXGL Types

+ +

+ nxgl_mxpixel_t. + Holds one device pixel. + NXGLIB will select the smallest size for the nxgl_mxpixel_t + that just contains the pixel: byte if 16, 24, and 32 resolution + support is disabled, uint16 if 24, and 32 resolution + support is disabled, or uint32. +

+ +

+ nxgl_coord_t + A given coordinate is limited to the screen height an width. If either + of those values exceed 32,767 pixels, then the following will have to need + to change: +

+
    +typedef sint16 nxgl_coord_t;
    +
+ +

+ struct nxgl_point_s. Describes a point on the display: +

+
    +struct nxgl_point_s
    +{
    +  nxgl_coord_t x;         /* X position, range: 0 to screen width - 1 */
    +  nxgl_coord_t y;         /* Y position, range: 0 to screen height - 1 */
    +};
    +
+ +

+ struct nxgl_size_s. Describes the size of a rectangular region. +

+
    +struct nxgl_size_s
    +{
    +  nxgl_coord_t w;        /* Width in pixels */
    +  nxgl_coord_t h;        /* Height in rows */
    +};
    +
+ +

+ struct nxgl_rect_s. Describes a positioned rectangle on the display. +

+
    +struct nxgl_rect_s
    +{
    +  struct nxgl_point_s pt1; /* Upper, left-hand corner */
    +  struct nxgl_point_s pt2; /* Lower, right-hand corner */
    +};
    +
+ +

+ struct nxgl_run_s. + Describes a run, i.e., a horizontal line. Note that the start/end positions + have fractional precision. This is necessary for good joining of trapezoids + when a more complex shape is decomposed into trapezoids +

+
    +struct nxgl_run_s
    +{
    +  b16_t        x1;        /* Left X position, range: 0 to x2 */
    +  b16_t        x2;        /* Right X position, range: x1 to screen width - 1 */
    +  nxgl_coord_t y;         /* Top Y position, range: 0 to screen height - 1 */
    +};
    +
+ +

+ struct nxgl_trapezoid_s. + Describes a horizontal trapezoid on the display in terms the run at the + top of the trapezoid and the run at the bottom +

+
    +struct nxgl_trapezoid_s
    +{
    +  struct nxgl_run_s top;  /* Top run */
    +  struct nxgl_run_s bot;  /* bottom run */
    +};
    +
+ +

2.2.1 nxgl_rgb2yuv()

+

Function Prototype:

+
    +#include <nuttx/nxglib.h>
    +void nxgl_rgb2yuv(ubyte r, ubyte g, ubyte b, ubyte *y, ubyte *u, ubyte *v);
    +
+

+ Description: + Convert 8-bit RGB triplet to 8-bit YUV triplet. +

+ +

2.2.2 nxgl_yuv2rgb()

+

Function Prototype:

+
    +#include <nuttx/nxglib.h>
    +void nxgl_yuv2rgb(ubyte y, ubyte u, ubyte v, ubyte *r, ubyte *g, ubyte *b);
    +
+

+ Description: + Convert 8-bit RGB triplet to 8-bit YUV triplet. +

+ +

2.2.3 nxgl_rectcopy()

+

Function Prototype:

+
    +#include <nuttx/nxglib.h>
    +void nxgl_rectcopy(FAR struct nxgl_rect_s *dest,
    +                   FAR const struct nxgl_rect_s *src);
    +
+

+ Description: + This is essentially memcpy()for rectangles. We don't do structure + assignments because some compilers are not good at that. +

+ +

2.2.4 nxgl_rectoffset()

+

Function Prototype:

+
    +#include <nuttx/nxglib.h>
    +void nxgl_rectoffset(FAR struct nxgl_rect_s *dest,
    +                     FAR const struct nxgl_rect_s *src,
    +                     nxgl_coord_t dx, nxgl_coord_t dy);
    +
+

+ Description: + Offset the rectangle position by the specified dx, dy values. +

+ +

2.2.5 nxgl_vectoradd()

+

Function Prototype:

+
    +#include <nuttx/nxglib.h>
    +void nxgl_vectoradd(FAR struct nxgl_point_s *dest,
    +                    FAR const struct nxgl_point_s *v1,
    +                    FAR const struct nxgl_point_s *v2);
    +
+

+ Description: + Add two 2x1 vectors and save the result to a third. +

+ +

2.2.6 nxgl_vectorsubtract()

+

Function Prototype:

+
    +#include <nuttx/nxglib.h>
    +void nxgl_vectsubtract(FAR struct nxgl_point_s *dest,
    +                       FAR const struct nxgl_point_s *v1,
    +                       FAR const struct nxgl_point_s *v2);
    +
+

+ Description: + Add subtract vector v2 from vector v1 and return the result in vector dest. +

+ +

2.2.7 nxgl_rectintersect()

+

Function Prototype:

+
    +#include <nuttx/nxglib.h>
    +void nxgl_rectintersect(FAR struct nxgl_rect_s *dest,
    +                        FAR const struct nxgl_rect_s *src1,
    +                        FAR const struct nxgl_rect_s *src2);
    +
+

+ Description: + Return the rectangle representing the intersection of the two rectangles. +

+ +

2.2.8 nxgl_rectunion()

+

Function Prototype:

+
    +#include <nuttx/nxglib.h>
    +void nxgl_rectunion(FAR struct nxgl_rect_s *dest,
    +                    FAR const struct nxgl_rect_s *src1,
    +                    FAR const struct nxgl_rect_s *src2);
    +
+

+ Description: + Given two rectanges, src1 and src2, return the larger rectangle that + contains both, dest. +

+ +

2.2.9 nxgl_nonintersecting()

+

Function Prototype:

+
    +#include <nuttx/nxglib.h>
    +nxgl_nonintersecting(FAR struct nxgl_rect_s result[4],
    +                     FAR const struct nxgl_rect_s *rect1,
    +                     FAR const struct nxgl_rect_s *rect2);
    +
+

+ Description: + Return the regions of rectangle rect1 that do not intersect with + rect2. This will four rectangles, some of which may be + degenerate (and can be picked off with nxgl_nullrect()). +

+ +

2.2.10 nxgl_rectoverlap()

+

Function Prototype:

+
    +#include <nuttx/nxglib.h>
    +boolean nxgl_rectoverlap(FAR struct nxgl_rect_s *rect1,
    +                         FAR struct nxgl_rect_s *rect2);
    +
+

+ Description: + Return TRUE if the two rectangles overlap. +

+ +

2.2.11 nxgl_rectinside()

+

Function Prototype:

+
    +#include <nuttx/nxglib.h>
    +boolean nxgl_rectinside(FAR const struct nxgl_rect_s *rect,
    +                        FAR const struct nxgl_point_s *pt);
    +
+

+ Description: + Return TRUE if the point pt lies within rect. +

+ +

2.2.12 nxgl_rectsize()

+

Function Prototype:

+
    +#include <nuttx/nxglib.h>
    +void nxgl_rectsize(FAR struct nxgl_size_s *size,
    +                   FAR const struct nxgl_rect_s *rect);
    +
+

+ Description: + Return the size of the specified rectangle. +

+ +

2.2.13 nxgl_nullrect()

+

Function Prototype:

+
    +#include <nuttx/nxglib.h>
    +boolean nxgl_nullrect(FAR const struct nxgl_rect_s *rect);
    +
+

+ Description: + Return TRUE if the area of the retangle is <= 0. +

+ +

2.2.14 nxgl_runoffset()

+

Function Prototype:

+
    +#include <nuttx/nxglib.h>
    +void nxgl_runoffset(FAR struct nxgl_run_s *dest,
    +                    FAR const struct nxgl_run_s *src,
    +                    nxgl_coord_t dx, nxgl_coord_t dy);
    +
+

+ Description: + Offset the run position by the specified dx, dy values. +

+ +

2.2.15 nxgl_runcopy()

+

Function Prototype:

+
    +#include <nuttx/nxglib.h>
    +void nxgl_runcopy(FAR struct nxgl_run_s *dest,
    +                  FAR const struct nxgl_run_s *src);
    +
+

+ Description: + This is essentially memcpy()for runs. We don't do structure assignments + because some compilers are not good at that. +

+ +

2.2.16 nxgl_trapoffset()

+

Function Prototype:

+
    +#include <nuttx/nxglib.h>
    +void nxgl_trapoffset(FAR struct nxgl_trapezoid_s *dest,
    +                     FAR const struct nxgl_trapezoid_s *src,
    +                     nxgl_coord_t dx, nxgl_coord_t dy);
    +
+

+ Description: + Offset the trapezoid position by the specified dx, dy values. +

+ +

2.2.1 nxgl_trapcopy()

+

Function Prototype:

+
    +#include <nuttx/nxglib.h>
    +void nxgl_trapcopy(FAR struct nxgl_trapezoid_s *dest,
    +                   FAR const struct nxgl_trapezoid_s *src);
    +
+

+ Description: + This is essentially memcpy()for trapezoids. We don't do structure + assignments because some compilers are not good at that. +

+ +

2.2.1 nxgl_colorcopy

+

Function Prototype:

+
    +#include <nuttx/nxglib.h>
    +nxgl_colorcopy(nxgl_mxpixel_t dest[CONFIG_NX_NPLANES],
    +               const nxgl_mxpixel_t src[CONFIG_NX_NPLANES]);
    +
+

+ Description: + This is essentially memcpy()for colors. This does very little for us + other than hide all of the conditional compilation for planar colors + in one place. +

+ +

2.3 NX

+ +

2.3.1 Pre-Processor Definitions

+ +

+ The default server message queue name used by the + nx_run() macro: +

+
    +#define NX_DEFAULT_SERVER_MQNAME "/dev/nxs"
    +
+ +

+ Mouse button bits: +

+
    +#define NX_MOUSE_NOBUTTONS    0x00
    +#define NX_MOUSE_LEFTBUTTON   0x01
    +#define NX_MOUSE_CENTERBUTTON 0x02
    +#define NX_MOUSE_RIGHTBUTTON  0x04
    +
+ +

2.3.2 NX Types

+ +

+ The interface to the NX server is managed using a opaque handle: +

+
    +typedef FAR void *NXHANDLE;
    +
+ +

+ The interface to a specific window is managed using an opaque handle: +

+
    +typedef FAR void *NXWINDOW;
    +
+ +

+ These define callbacks that must be provided to + nx_openwindow(). + In the multi-user model, these callbacks will be invoked as part of the + processing performed by + nx_eventhandler(). +

+
    +struct nx_callback_s
    +{
    +  void (*redraw)(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect,
    +                 boolean more, FAR void *arg);
    +  void (*position)(NXWINDOW hwnd, FAR const struct nxgl_size_s *size,
    +                   FAR const struct nxgl_point_s *pos,
    +                   FAR const struct nxgl_rect_s *bounds,
    +                   FAR void *arg);
    +#ifdef CONFIG_NX_MOUSE
    +  void (*mousein)(NXWINDOW hwnd, FAR const struct nxgl_point_s *pos,
    +                  ubyte buttons, FAR void *arg);
    +#endif
    +#ifdef CONFIG_NX_KBD
    +  void (*kbdin)(NXWINDOW hwnd, ubyte nch, FAR const ubyte *ch, FAR void *arg);
    +#endif
    +};
    +
+ +

2.3.3 NX Server Callbacks

+ +

2.3.3.1 redraw()

+

Callback Function Prototype:

+
    +void redraw(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect,
    +            boolean more, FAR void *arg);
    +
+

+ Description: + NX requests that the client re-draw the portion of the window within + with rectangle. +

+

+ Input Parameters: +

    +
    hwnd +
    The handle created by nx_openwindow() + or nx_requestbkgd() +
    rect +
    The rectangle that needs to be re-drawn (in window relative coordinates) +
    more +
    TRUE: More re-draw requests will follow +
    arg +
    User provided argument (see nx_openwindow()) +
+

+

+ Returned Value: None +

+ +

2.3.3.2 position()

+

Callback Function Prototype:

+
    +void position(NXWINDOW hwnd, FAR const struct nxgl_size_s *size,
    +              FAR const struct nxgl_point_s *pos,
    +              FAR const struct nxgl_rect_s *bounds,
    +              FAR void *arg);
    +
+

+ Description: + The size or position of the window has changed (or the window was + just created with zero size. +

+

+ Input Parameters: +

    +
    hwnd +
    The handle created by nx_openwindow() + or nx_requestbkgd() +
    size +
    The size of the window +
    pos +
    The position of the upper left hand corner of the window on + the overall display +
    bounds +
    The bounding rectangle that the describes the entire display +
    arg +
    User provided argument (see nx_openwindow()) +
+

+

+ Returned Value: None +

+ +

2.3.3.3 mousein()

+

Callback Function Prototype:

+
    +#ifdef CONFIG_NX_MOUSE
    +void mousein(NXWINDOW hwnd, FAR const struct nxgl_point_s *pos,
    +             ubyte buttons, FAR void *arg);
    +#endif
    +
+

+ Description: + New mouse data is available for the window +

+

+ Input Parameters: +

+

+

+ Returned Value: None +

+ +

2.3.3.4 kbdin()

+

Callback Function Prototype:

+
    +#ifdef CONFIG_NX_KBD
    +void (*kbdin)(NXWINDOW hwnd, ubyte nch, FAR const ubyte *ch, FAR void *arg);
    +#endif
    +
+

+ Description: + New keyboard/keypad data is available for the window. +

+

+ Input Parameters: +

+

+

+ Returned Value: NOne +

+ +

2.3.4 nx_runinstance() (and nx_run() macro)

+

Function Prototype:

+
    +#include <nuttx/nxglib.h>
    +#include <nuttx/nx.h>
    +
    +#ifdef CONFIG_NX_MULTIUSER
    +int nx_runinstance(FAR const char *mqname, FAR struct fb_vtable_s *fb);
    +#define nx_run(fb) nx_runinstance(NX_DEFAULT_SERVER_MQNAME, fb)
    +#endif
    +
+

+ Description: + This is the server entry point. It does not return; the calling thread + is dedicated to supporting NX server. +

+

+ NOTE that multiple instances of the NX server may run at the same time, + with different callback and message queue names. nx_run() is simply + a macro that can be used when only one server instance is required. In + that case, a default server name is used. +

+

+ Multiple user mode only! +

+

+ Input Parameters: +

    +
    mqname +
    + - The name for the server incoming message queue +
    fb +
    Vtable "object" of the framebuffer "driver" to use +
+

+

+ Returned Value: + This function usually does not return. If it does return, it will + return ERROR and errno will be set appropriately. +

+ +

2.3.5 nx_connectinstance() (and nx_connect() macro)

+

Function Prototype:

+
    +#include <nuttx/nxglib.h>
    +#include <nuttx/nx.h>
    +
    +#ifdef CONFIG_NX_MULTIUSER
    +NXHANDLE nx_connectinstance(FAR const char *svrmqname);
    +#define nx_connect(cb) nx_connectinstance(NX_DEFAULT_SERVER_MQNAME)
    +#endif
    +
+

+ Description: + Open a connection from a client to the NX server. One one client + connection is normally needed per thread as each connection can host + multiple windows. +

+

+ NOTES: +

+
    +
  • + This function returns before the connection is fully instantiated. + it is necessary to wait for the connection event before using the + returned handle. +
  • +
  • + Multiple instances of the NX server may run at the same time, + each with different message queue names. +
  • +
  • + nx_connect() is simply a macro that can be used when only one + server instance is required. In that case, a default server name + is used. +
  • +
+

+ Multiple user mode only! +

+

+ Input Parameters: +

    +
    svrmqname +
    The name for the server incoming message queue +
+

+

+ Returned Value: +

+
    + Success: A non-NULL handle used with subsequent NX accesses
    + Failure: NULL is returned and errno is set appropriately. +
+ +

2.3.6 nx_open()

+

Function Prototype:

+
    +#include <nuttx/nxglib.h>
    +#include <nuttx/nx.h>
    +
    +#ifndef CONFIG_NX_MULTIUSER
    +NXHANDLE nx_open(FAR struct fb_vtable_s *fb);
    +#endif
    +
+

+ Description: + Create, initialize and return an NX handle for use in subsequent + NX API calls. nx_open() is the single user equivalent of + nx_connect() plus + nx_run(). +

+

+ Single user mode only! +

+

+ Input Parameters: +

    +
    fb +
    Vtable "object" of the framebuffer "driver" to use +
    cb +
    Callbacks used to process received NX server messages +
+

+

+ Returned Value: +

+
    + Success: A non-NULL handle used with subsequent NX accesses
    + Failure: NULL is returned and errno is set appropriately. +
+ +

2.3.7 nx_disconnect()

+

Function Prototype:

+
    +#include <nuttx/nxglib.h>
    +#include <nuttx/nx.h>
    +
    +#ifdef CONFIG_NX_MULTIUSER
    +void nx_disconnect(NXHANDLE handle);
    +#endif
    +
+

+ Description: + Disconnect a client from the NX server and/or free resources reserved + by nx_connect()/nx_connectinstance(). + nx_disconnect() is muliti-user equivalent of + nx_close(). +

+

+ Multiple user mode only! +

+

+ Input Parameters: +

+

+

+ Returned Value: None. +

+ +

2.3.8 nx_close()

+

Function Prototype:

+
    +#include <nuttx/nxglib.h>
    +#include <nuttx/nx.h>
    +
    +#ifndef CONFIG_NX_MULTIUSER
    +void nx_close(NXHANDLE handle);
    +#endif
    +
+

+ Description: + Close the single user NX interface. nx_close is single-user equivalent + of nx_disconnect(). +

+

+ Single user mode only! +

+

+ Input Parameters: +

    +
    handle +
    The handle returned by nx_open(). +
+

+

+ Returned Value: None +

+ +

2.3.9 nx_eventhandler()

+

Function Prototype:

+
    +#include <nuttx/nxglib.h>
    +#include <nuttx/nx.h>
    +
    +#ifdef CONFIG_NX_MULTIUSER
    +int nx_eventhandler(NXHANDLE handle);
    +#else
    +#  define nx_eventhandler(handle) (OK)
    +#endif
    +
+

+ Description: + The client code must call this function periodically to process + incoming messages from the server. If CONFIG_NX_BLOCKING is defined, + then this function not return until a server message is received. +

+

+ When CONFIG_NX_BLOCKING is not defined, the client must exercise + caution in the looping to assure that it does not eat up all of + the CPU bandwidth calling nx_eventhandler repeatedly. + nx_eventnotify() + may be called to get a signal event whenever a new incoming server + event is avaiable. +

+

+ Input Parameters: +

+

+

+ Returned Value: +

+
    +
  • + OK: No errors occurred. If CONFIG_NX_BLOCKING is defined, + then one or more server messages were processed. +
  • +
  • + ERROR: An error occurred and errno has been set appropriately. + Of particular interest, it will return errno == EHOSTDOWN when the + server is disconnected. After that event, the handle can no longer be used. +
  • +
+ +

2.3.10 nx_eventnotify()

+

Function Prototype:

+
    +#include <nuttx/nxglib.h>
    +#include <nuttx/nx.h>
    +
    +#if defined(CONFIG_NX_MULTIUSER) && !defined(CONFIG_DISABLE_SIGNALS)
    +int nx_eventnotify(NXHANDLE handle, int signo);
    +#else
    +#  define nx_eventnotify(handle, signo) (OK)
    +#endif
    +
+

+ Description: + Rather than calling nx_eventhandler() periodically, + the client may register to receive a signal when a server event is available. + The client can then call nv_eventhandler() only when + incoming events are available. +

+

+ The underlying implementation used mq_notifiy() and, as a result, + the client must observe the rules for using mq_notifiy(): +

    +
  • + Only one event is signaled. Upon receipt of the signal, if the client + wishes further notifications, it must call nx_eventnotify() again. +
  • +
  • + The signal will only be issued when the message queue transitions from empty to + not empty. +
  • +
+

+

+ Input Parameters: +

+

+

+ Returned Value: + OK on success; + ERROR on failure with errno set appropriately +

+ +

2.3.11 nx_openwindow()

+

Function Prototype:

+
    +#include <nuttx/nxglib.h>
    +#include <nuttx/nx.h>
    +
    +NXWINDOW nx_openwindow(NXHANDLE handle,
    +                       FAR const struct nx_callback_s *cb,
    +                       FAR void *arg);
    +
+

+ Description: Create a new window. +

+

+ Input Parameters: +

    +
    handle +
    The handle returned by nx_connect() + or nx_open(). +
    cb +
    Callbacks used to process window events +
    arg +
    User provided value that will be returned with NX callbacks. +
+

+

+ Returned Value: +

+
    + Success: A non-NULL handle used with subsequent NX accesses
    + Failure: NULL is returned and errno is set appropriately. +
+ +

2.3.12 nx_closewindow()

+

Function Prototype:

+
    +#include <nuttx/nxglib.h>
    +#include <nuttx/nx.h>
    +
    +int nx_closewindow(NXWINDOW hwnd);
    +
+

+ Description: + Destroy a window created by nx_openwindow() window. +

+

+ Input Parameters: +

    +
    hwnd +
    The handle returned by nx_openwindow() + that identifies the window to be destroyed. + This handle must not have been one returned by + nx_requestbkgd(). +
+

+

+ Returned Value: + OK on success; + ERROR on failure with errno set appropriately +

+ +

2.3.13 nx_requestbkgd()

+

Function Prototype:

+
    +#include <nuttx/nxglib.h>
    +#include <nuttx/nx.h>
    +
    +int nx_requestbkgd(NXHANDLE handle,
    +                   FAR const struct nx_callback_s *cb,
    +                   FAR void *arg);
    +
+

+ Description: + NX normally controls a separate window called the background window. + It repaints the window as necessary using only a solid color fill. The + background window always represents the entire screen and is always + below other windows. It is useful for an application to control the + background window in the following conditions: +

+
    +
  • + If you want to implement a windowless solution. The single screen + can be used to creat a truly simple graphic environment. In this + case, you should probably also de-select CONFIG_NX_MULTIUSER as well. +
  • +
  • + When you want more on the background than a solid color. For + example, if you want an image in the background, or animations in the + background, or live video, etc. +
  • +
+

+ This API only requests the handle of the background window. That + handle will be returned asynchronously in a subsequent position and + redraw callbacks. +

+

+ Cautions: +

+
    +
  • + The following should never be called using the background window. + They are guaranteed to cause severe crashes: + nx_setposition(), + nx_setsize(), + nx_raise(), or + nx_lower(). +
  • +
  • + Neither nx_requestbkgd() nor + nx_releasebkgd () should be called more than once. + Multiple instances of the background window are not supported. +
  • +
+

+

+ Input Parameters: +

    +
    handle +
    The handle returned by nx_connect() + or nx_open(). +
    cb +
    Callbacks to use for processing background window events +
    arg +
    User provided argument (see nx_openwindow()) +
+

+

+ Returned Value: + OK on success; + ERROR on failure with errno set appropriately +

+ +

2.3.14 nx_releasebkgd()

+

Function Prototype:

+
    +#include <nuttx/nxglib.h>
    +#include <nuttx/nx.h>
    +
    +int nx_releasebkgd(NXWINDOW hwnd);
    +
+

+ Description: + Release the background window previously acquired using + nx_requestbkgd() + and return control of the background to NX. +

+

+ Input Parameters: +

+

+

+ Returned Value: + OK on success; + ERROR on failure with errno set appropriately +

+ +

2.3.15 nx_getposition()

+

Function Prototype:

+
    +#include <nuttx/nxglib.h>
    +#include <nuttx/nx.h>
    +
    +int nx_getposition(NXWINDOW hwnd);
    +
+

+ Description: + Request the position and size information for the selected window. The + values will be return asynchronously through the client callback function + pointer. +

+

+ Input Parameters: +

+

+

+ Returned Value: + OK on success; + ERROR on failure with errno set appropriately +

+ +

2.3.16 nx_setposition()

+

Function Prototype:

+
    +#include <nuttx/nxglib.h>
    +#include <nuttx/nx.h>
    +
    +int nx_setposition(NXWINDOW hwnd, FAR struct nxgl_point_s *pos);
    +
+

+ Description: + Set the position and size for the selected window. +

+

+ Input Parameters: +

    +
    hwnd +
    The handle returned by nx_openwindow(). + This handle must not have been created by + nx_requestbkgd(). +
    pos +
    The new position of the window +
+

+

+ Returned Value: + OK on success; + ERROR on failure with errno set appropriately +

+ +

2.3.17 nx_setsize()

+

Function Prototype:

+
    +#include <nuttx/nxglib.h>
    +#include <nuttx/nx.h>
    +
    +int nx_setsize(NXWINDOW hwnd, FAR struct nxgl_size_s *size);
    +
+

+ Description: Set the size of the selected window. +

+

+ Input Parameters: +

    +
    hwnd +
    The handle returned by nx_openwindow(). + This handle must not have been created by + nx_requestbkgd(). +
    size +
    The new size of the window (in pixels). +
+

+

+ Returned Value: + OK on success; + ERROR on failure with errno set appropriately +

+ +

2.3.18 nx_raise()

+

Function Prototype:

+
    +#include <nuttx/nxglib.h>
    +#include <nuttx/nx.h>
    +
    +int nx_raise(NXWINDOW hwnd);
    +
+

+ Description: Bring the specified window to the top of the display. +

+

+ Input Parameters: +

+

+

+ Returned Value: + OK on success; + ERROR on failure with errno set appropriately +

+ +

2.3.19 nx_lower()

+

Function Prototype:

+
    +#include <nuttx/nxglib.h>
    +#include <nuttx/nx.h>
    +
    +int nx_lower(NXWINDOW hwnd);
    +
+

+ Description: Lower the specified window to the bottom of the display. +

+

+ Input Parameters: +

+

+

+ Returned Value: + OK on success; + ERROR on failure with errno set appropriately +

+ +

2.3.20 nx_fill()

+

Function Prototype:

+
    +#include <nuttx/nxglib.h>
    +#include <nuttx/nx.h>
    +
    +int nx_fill(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect,
    +                   nxgl_mxpixel_t color[CONFIG_NX_NPLANES]);
    +
+

+ Description: + Fill the specified rectangle in the window with the specified color. +

+

+ Input Parameters: +

+

+

+ Returned Value: + OK on success; + ERROR on failure with errno set appropriately +

+ +

2.3.21 nx_filltrapezoid()

+

Function Prototype:

+
    +#include <nuttx/nxglib.h>
    +#include <nuttx/nx.h>
    +
    +int nx_filltrapezoid(NXWINDOW hwnd, FAR const struct nxgl_rect_s *clip,
    +                            FAR const struct nxgl_trapezoid_s *trap,
    +                            nxgl_mxpixel_t color[CONFIG_NX_NPLANES]);
    +
+

+ Description: + Fill the specified trapezoidal region in the window with the specified color. +

+

+ Input Parameters: +

    +
    hwnd +
    The handle returned by nx_openwindow() + or nx_requestbkgd() +
    clip +
    Clipping rectangle relative to window (may be null) +
    trap +
    The trapezoidal region to be filled +
    color +
    The color to use in the fill +
+

+

+ Returned Value: + OK on success; + ERROR on failure with errno set appropriately +

+ +

2.3.22 nx_setbgcolor()

+

Function Prototype:

+
    +#include <nuttx/nxglib.h>
    +#include <nuttx/nx.h>
    +
    +int nx_setbgcolor(NXHANDLE handle,
    +                  nxgl_mxpixel_t color[CONFIG_NX_NPLANES]);
    +
+

+ Description: Set the color of the background. +

+

+ Input Parameters: +

+

+

+ Returned Value: + OK on success; + ERROR on failure with errno set appropriately +

+ +

2.3.23 nx_move()

+

Function Prototype:

+
    +#include <nuttx/nxglib.h>
    +#include <nuttx/nx.h>
    +
    +int nx_move(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect,
    +                   FAR const struct nxgl_point_s *offset);
    +
+

+ Description: Move a rectangular region within the window. +

+

+ Input Parameters: +

    +
    hwnd +
    The handle returned by nx_openwindow() + or nx_requestbkgd() that specifies + the window within which the move is to be done +
    rect +
    Describes the (source) rectangular region to move +
    offset +
    The offset to move the region +
+

+

+ Returned Value: + OK on success; + ERROR on failure with errno set appropriately +

+ +

2.3.24 nx_bitmap()

+

Function Prototype:

+
    +#include <nuttx/nxglib.h>
    +#include <nuttx/nx.h>
    +
    +int nx_bitmap(NXWINDOW hwnd, FAR const struct nxgl_rect_s *dest,
    +                     FAR const void *src[CONFIG_NX_NPLANES],
    +                     FAR const struct nxgl_point_s *origin,
    +                     unsigned int stride);
    +
+

+ Description: + Copy a rectangular region of a larger image into the rectangle in the + specified window. +

+

+ Input Parameters: +

    +
    hwnd +
    The handle returned by nx_openwindow() + or nx_requestbkgd() that specifies the + window that will receive the bitmap image. +
    dest +
    Describes the rectangular on the display that will receive the the bit map. +
    src +
    The start of the source image. This is an array source images of size + CONFIG_NX_NPLANES (probably 1). +
    origin +
    The origin of the upper, left-most corner of the full bitmap. + Both dest and origin are in window coordinates, however, the origin + may lie outside of the display. +
    stride +
    The width of the full source image in bytes. +
+

+

+ Returned Value: + OK on success; + ERROR on failure with errno set appropriately +

+ +

2.3.25 nx_kbdin()

+

Function Prototype:

+
    +#include <nuttx/nxglib.h>
    +#include <nuttx/nx.h>
    +
    +#ifdef CONFIG_NX_KBD
    +int nx_kbdchin(NXHANDLE handle, ubyte ch);
    +int nx_kbdin(NXHANDLE handle, ubyte nch, FAR const ubyte *ch);
    +#endif
    +
+

+ Description: + Used by a thread or interrupt handler that manages some kind of keypad + hardware to report text information to the NX server. That text + data will be routed by the NX server to the appropriate window client. +

+

+ Returned Value: + OK on success; + ERROR on failure with errno set appropriately +

+ +

2.3.26 nx_mousein()

+

Function Prototype:

+
    +#include <nuttx/nxglib.h>
    +#include <nuttx/nx.h>
    +
    +#ifdef CONFIG_NX_MOUSE
    +int nx_mousein(NXHANDLE handle, nxgl_coord_t x, nxgl_coord_t y, ubyte buttons);
    +#endif
    +
+

+ Description: + Used by a thread or interrupt handler that manages some kind of pointing + hardware to report new positional data to the NX server. That positional + data will be routed by the NX server to the appropriate window client. +

+

+ Input Parameters: +

    +
    +
    +
+

+

+ Returned Value: + OK on success; + ERROR on failure with errno set appropriately +

+ +

2.4 NX Tool Kit (NXTK)

+ +

2.4.1 NXTK Types()

+ +

+ This is the handle that can be used to access the window data region. +

+
    +typedef FAR void *NXTKWINDOW;
    +
+ +

2.4.2 nxtk_openwindow()

+

Function Prototype:

+
    +#include <nuttx/nxglib.h>
    +#include <nuttx/nx.h>
    +#include <nuttx/nxtk.h>
    +
    +NXTKWINDOW nxtk_openwindow(NXHANDLE handle,
    +                           FAR const struct nx_callback_s *cb,
    +                           FAR void *arg);
    +
+

+ Description: Create a new, framed window. +

+

+ Input Parameters: +

+
handle +
The handle returned by nx_connect() + or nx_open(). +
cb +
Callbacks used to process window events +
arg +
User provided argument (see nx_openwindow()) +
+

+

+ Returned Value: +

+
    + Success: A non-NULL handle used with subsequent NXTK window accesses
    + Failure: NULL is returned and errno is set appropriately. +
+ +

2.4.3 nxtk_closewindow()

+

Function Prototype:

+
    +#include <nuttx/nxglib.h>
    +#include <nuttx/nx.h>
    +#include <nuttx/nxtk.h>
    +
    +int nxtk_closewindow(NXTKWINDOW hfwnd);
    +
+

+ Description: + Close the window opened by nxtk_openwindow(). +

+

+ Input Parameters: +

+
hfwnd +
A handle previously returned by + nxtk_openwindow(). +
+

+

+ Returned Value: + OK on success; + ERROR on failure with errno set appropriately +

+ +

2.4.4 nxtk_getposition()

+

Function Prototype:

+
    +#include <nuttx/nxglib.h>
    +#include <nuttx/nx.h>
    +#include <nuttx/nxtk.h>
    +
    +int nxtk_getposition(NXTKWINDOW hfwnd);
    +
+

+ Description: + Request the position and size information for the selected framed window. + The size/position for the client window and toolbar will be return + asynchronously through the client callback function pointer. +

+

+ Input Parameters: +

+
hfwnd +
A handle previously returned by + nxtk_openwindow(). +
+

+

+ Returned Value: + OK on success; + ERROR on failure with errno set appropriately +

+ +

2.4.5 nxtk_setposition()

+

Function Prototype:

+
    +#include <nuttx/nxglib.h>
    +#include <nuttx/nx.h>
    +#include <nuttx/nxtk.h>
    +
    +int nxtk_setposition(NXTKWINDOW hfwnd, FAR struct nxgl_point_s *pos);
    +
+

+ Description: + Set the position for the selected client window. This position does not + include the offsets for the borders nor for any toolbar. Those offsets + will be added in to set the full window position. +

+

+ Input Parameters: +

+
hfwnd +
A handle previously returned by + nxtk_openwindow(). +
pos +
The new position of the client sub-window +
+

+

+ Returned Value: + OK on success; + ERROR on failure with errno set appropriately +

+ +

2.4.6 nxtk_setsize()

+

Function Prototype:

+
    +#include <nuttx/nxglib.h>
    +#include <nuttx/nx.h>
    +#include <nuttx/nxtk.h>
    +
    +int nxtk_setsize(NXTKWINDOW hfwnd, FAR struct nxgl_size_s *size);
    +
+

+ Description: + Set the size for the selected client window. This size does not + include the sizes of the borders nor for any toolbar. Those sizes + will be added in to set the full window size. +

+

+ Input Parameters: +

+
hfwnd +
A handle previously returned by + nxtk_openwindow(). +
size +
The new size of the client sub-window. +
+

+

+ Returned Value: + OK on success; + ERROR on failure with errno set appropriately +

+ +

2.4.7 nxtk_raise()

+

Function Prototype:

+
    +#include <nuttx/nxglib.h>
    +#include <nuttx/nx.h>
    +#include <nuttx/nxtk.h>
    +
    +int nxtk_raise(NXTKWINDOW hfwnd);
    +
+

+ Description: + Bring the window containing the specified client sub-window to the top + of the display. +

+

+ Input Parameters: +

+
hfwnd +
A handle previously returned by + nxtk_openwindow() + specifying the window to be raised. +
+
+
+

+

+ Returned Value: + OK on success; + ERROR on failure with errno set appropriately +

+ +

2.4.8 nxtk_lower()

+

Function Prototype:

+
    +#include <nuttx/nxglib.h>
    +#include <nuttx/nx.h>
    +#include <nuttx/nxtk.h>
    +
    +int nxtk_lower(NXTKWINDOW hfwnd);
    +
+

+ Description: + Lower the window containing the specified client sub-window to the + bottom of the display. +

+

+ Input Parameters: +

+
hfwnd +
A handle previously returned by + nxtk_openwindow() + specifying the window to be lowered. +
+
+
+

+

+ Returned Value: + OK on success; + ERROR on failure with errno set appropriately +

+ +

2.4.9 nxtk_fillwindow()

+

Function Prototype:

+
    +#include <nuttx/nxglib.h>
    +#include <nuttx/nx.h>
    +#include <nuttx/nxtk.h>
    +
    +int nxtk_fillwindow(NXTKWINDOW hfwnd, FAR const struct nxgl_rect_s *rect,
    +                    nxgl_mxpixel_t color[CONFIG_NX_NPLANES]);
    +
+

+ Description: + Fill the specified rectangle in the client window with the specified color. +

+

+ Input Parameters: +

+
hfwnd +
A handle previously returned by + nxtk_openwindow(). +
rect +
The location within the client window to be filled +
color +
The color to use in the fill +
+

+

+ Returned Value: + OK on success; + ERROR on failure with errno set appropriately +

+ +

2.4.10 nxtk_filltrapwindow()

+

Function Prototype:

+
    +#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]);
    +
+

+ Description: + Fill the specified trapezoid in the client window with the specified color +

+

+ Input Parameters: +

+
hfwnd +
A handle previously returned by + nxtk_openwindow(). +
trap +
The trapezoidal region to be filled. +
color +
The color to use in the fill. +
+

+

+ Returned Value: + OK on success; + ERROR on failure with errno set appropriately +

+ +

2.4.11 nxtk_movewindow()

+

Function Prototype:

+
    +#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);
    +
+

+ Description: + Move a rectangular region within the client sub-window of a framed window. +

+

+ Input Parameters: +

+
hfwnd +
A handle previously returned by + nxtk_openwindow() + specifying the client sub-window within which the move is to be done. +
rect +
Describes the rectangular region relative to the client sub-window to move. +
offset +
The offset to move the region +
+

+

+ Returned Value: + OK on success; + ERROR on failure with errno set appropriately +

+ +

2.4.12 nxtk_bitmapwindow()

+

Function Prototype:

+
    +#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);
    +
+

+ Description: + Copy a rectangular region of a larger image into the rectangle in the + specified client sub-window. +

+

+ Input Parameters: +

+
hfwnd +
A handle previously returned by + nxtk_openwindow() + specifying the client sub-window that will receive the bitmap. +
dest +
Describes the rectangular region on in the client sub-window + will receive the bit map. +
src +
The start of the source image(s). This is an array source + images of size CONFIG_NX_NPLANES (probably 1). +
origin +
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. +
stride +
The width of the full source image in pixels. +
+

+

+ Returned Value: + OK on success; + ERROR on failure with errno set appropriately +

+ +

2.4.13 nxtk_opentoolbar()

+

Function Prototype:

+
    +#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);
    +
+

+ Description: + Create a tool bar at the top of the specified framed window. +

+

+ Input Parameters: +

+
hfwnd +
A handle previously returned by + nxtk_openwindow(). +
height +
The requested height of the toolbar in pixels. +
+
Callbacks used to process toolbar events. +
+
User provided value that will be returned with toolbar callbacks. +
+

+

+ Returned Value: + OK on success; + ERROR on failure with errno set appropriately +

+ +

2.4.14 nxtk_closetoolbar()

+

Function Prototype:

+
    +#include <nuttx/nxglib.h>
    +#include <nuttx/nx.h>
    +#include <nuttx/nxtk.h>
    +
    +int nxtk_closetoolbar(NXTKWINDOW hfwnd);
    +
+

+ Description: + Remove the tool bar at the top of the specified framed window. +

+

+ Input Parameters: +

+
hfwnd +
A handle previously returned by + nxtk_openwindow(). +
+
+
+

+

+ Returned Value: + OK on success; + ERROR on failure with errno set appropriately +

+ +

2.4.15 nxtk_filltoolbar()

+

Function Prototype:

+
    +#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]);
    +
+

+ Description: + Fill the specified rectangle in the toolbar sub-window with the specified color. +

+

+ Input Parameters: +

+
hfwnd +
A handle previously returned by + nxtk_openwindow(). +
rect +
The location within the toolbar window to be filled. +
color +
The color to use in the fill. +
+

+

+ Returned Value: + OK on success; + ERROR on failure with errno set appropriately +

+ +

2.4.16 nxtk_filltraptoolbar()

+

Function Prototype:

+
    +#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]);
    +
+

+ Description: + Fill the specified trapezoid in the toolbar sub-window with the specified color. +

+

+ Input Parameters: +

+
hfwnd +
A handle previously returned by + nxtk_openwindow(). +
trap +
The trapezoidal region to be filled +
color +
The color to use in the fill +
+

+

+ Returned Value: + OK on success; + ERROR on failure with errno set appropriately +

+ +

2.4.17 nxtk_movetoolbar()

+

Function Prototype:

+
    +#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);
    +
+

+ Description: + Move a rectangular region within the toolbar sub-window of a framed window. +

+

+ Input Parameters: +

+
hfwnd +
A handle identifying sub-window containing the toolbar within which the move is + to be done. + This handle must have previously been returned by + nxtk_openwindow(). +
rect +
Describes the rectangular region relative to the toolbar sub-window to move. +
offset +
The offset to move the region +
+

+

+ Returned Value: + OK on success; + ERROR on failure with errno set appropriately +

+ +

2.4.18 nxtk_bitmaptoolbar()

+

Function Prototype:

+
    +#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);
    +
+

+ Description: + Copy a rectangular region of a larger image into the rectangle in the + specified toolbar sub-window. +

+

+ Input Parameters: +

+
hfwnd +
A handle previously returned by + nxtk_openwindow(). +
dest +
Describes the rectangular region on in the toolbar sub-window + will receive the bit map. +
src +
The start of the source image. +
origin +
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. +
stride +
The width of the full source image in bytes. +
+

+

+ Returned Value: + OK on success; + ERROR on failure with errno set appropriately +

+ +

2.5 NX Fonts Support (NXFONTS)

+ +

2.5.1 NXFONTS Types()

+

+ This structures provides the metrics for one glyph: +

+
    +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;
    +};
    +
+ +

+ This structure binds the glyph metrics to the glyph bitmap: +

+
    +struct nx_fontbitmap_s
    +{
    +  struct nx_fontmetic_s metric; /* Character metrics */
    +  FAR const ubyte *bitmap;      /* Pointer to the character bitmap */
    +};
    +
+ +

+ This structure describes one contiguous grouping of glyphs that + can be described by an array starting with encoding first and + extending through (first + nchars - 1). +

+
    +struct nx_fontset_s
    +{
    +  ubyte  first;             /* First bitmap character code */
    +  ubyte  nchars;            /* Number of bitmap character codes */
    +  FAR const struct nx_fontbitmap_s *bitmap;
    +};
    +
+ +

+ This structure describes the overall fontset: +

+
    +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 */
    +};
    +
+ +

2.5.2 nxf_getfontset()

+

Function Prototype:

+
    +#include <nuttx/nxglib.h>
    +#include <nuttx/nxfonts.h>
    +
    +FAR const struct nx_font_s *nxf_getfontset(void);
    +
+

+ Description: + Return information about the current font set. +

+

+ Input Parameters: None +

+

+ Returned Value: + An instance of struct nx_font_s describing the font set. +

+ +

2.5.3 nxf_getbitmap()

+

Function Prototype:

+
    +#include <nuttx/nxglib.h>
    +#include <nuttx/nxfonts.h>
    +
    +FAR const struct nx_fontbitmap_s *nxf_getbitmap(uint16 ch);
    +
+

+ Description: + Return font bitmap information for the selected character encoding. +

+

+ Input Parameters: +

    +
    +
    +
+

+

+ Returned Value: + An instance of struct nx_fontbitmap_s describing the glyph. +

+ +

2.5.4 nxf_convert_*bpp()

+

Function Prototype:

+
    +#include <nuttx/nxglib.h>
    +#include <nuttx/nxfonts.h>
    +
    +int nxf_convert_2bpp(FAR ubyte *dest, uint16 height,
    +                     uint16 width, uint16 stride, uint16 ch,
    +                     nxgl_mxpixel_t color);
    +int nxf_convert_4bpp(FAR ubyte *dest, uint16 height,
    +                     uint16 width, uint16 stride, uint16 ch,
    +                     nxgl_mxpixel_t color);
    +int nxf_convert_8bpp(FAR ubyte *dest, uint16 height,
    +                     uint16 width, uint16 stride, uint16 ch,
    +                     nxgl_mxpixel_t color);
    +int nxf_convert_16bpp(FAR uint16 *dest, uint16 height,
    +                      uint16 width, uint16 stride, uint16 ch,
    +                      nxgl_mxpixel_t color);
    +int nxf_convert_24bpp(FAR uint32 *dest, uint16 height,
    +                      uint16 width, uint16 stride, uint16 ch,
    +                      nxgl_mxpixel_t color);
    +int nxf_convert_32bpp(FAR uint32 *dest, uint16 height,
    +                      uint16 width, uint16 stride, uint16 ch,
    +                      nxgl_mxpixel_t color);
    +
+

+ Description: Convert the 1BPP font to a new pixel depth. +

+

+ Input Parameters: +

    +
    dest +
    The destination buffer provided by the caller. +
    height +
    The max height of the returned char in rows. +
    width +
    The max width of the returned char in pixels. +
    stride +
    The width of the destination buffer in bytes. +
    ch +
    The character code to convert. +
    color +
    The color to use for '1' bits in the font bitmap (0 bits are transparent). +
+

+

+ Returned Value: + On Success, these functions returns the actual width of the font in bytes. + on failed, a negated errno is retured. +

+ + + + + +
+

Appendix A graphics/ Directory Structure

+
+ +
    +
    +
    graphics/nxglib +
    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). + +
    graphics/nxbe +
    This is the back-end of a tiny windowing system. + It can be used with either of two front-ends to complete a windowing system (see + nxmu and nxsu/ below). + It contains most of the important window management logic: clipping, window controls, + window drawing, etc. + +
    graphics/nxsu +
    This is the NX single user front end. + When combined with the generic back-end (nxbe), it implements a + single threaded, single user windowing system. + The files in this directory present the window APIs described in + include/nuttx/nx.h. + The single user front-end is selected when CONFIG_NX_MULTIUSER is not + defined in the NuttX configuration file. + +
    graphics/nxsu +
    This is the NX multi user front end. + When combined with the generic back-end (nxbe), it implements a + multi-threaded, multi-user windowing system. + The files in this directory present the window APIs described in + include/nuttx/nx.h. + 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 CONFIG_NX_MULTIUSER is defined + in the NuttX configuration file. + +
    graphics/nxfonts +
    This is where the NXFONTS implementation resides. + This is a relatively low-level set of charset set/glyph management APIs. + See include/nuttx/nxfonts.h. + +
    graphics/nxtk +
    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 include/nuttx/nxtk.h. + +
    graphics/nxwidgets +
    At one time, I planned to put NXWIDGETS implementation here, but not anymore. +
    +
+ + + + + +
+

Appendix B NX Configuration Options

+
+ +

B.1 General Configuration Settings

+ +
    +
    +
    CONFIG_NX + Enables overall support for graphics library and NX +
    +
+ +

B.2 NXGL Configuration Settings

+ +
    +
    +
    CONFIG_NX_NPLANES: +
    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. +
    CONFIG_NX_DISABLE_1BPP, CONFIG_NX_DISABLE_2BPP, + CONFIG_NX_DISABLE_4BPP, CONFIG_NX_DISABLE_8BPP + CONFIG_NX_DISABLE_16BPP, CONFIG_NX_DISABLE_24BPP, and + CONFIG_NX_DISABLE_32BPP: +
    NX supports a variety of pixel depths. You can save some + memory by disabling support for unused color depths. +
    CONFIG_NX_PACKEDMSFIRST: +
    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 +
    +
+ +

B.3 NX Configuration Settings

+ +
    +
    +
    CONFIG_NX_MOUSE: +
    Build in support for mouse input. +
    CONFIG_NX_KBD: +
    Build in support of keypad/keyboard input. +
    +
+ +

B.4 NX Multi-User (Only) Configuration Settings

+ +
    +
    +
    CONFIG_NX_MULTIUSER: +
    Configures NX in multi-user mode. +
    CONFIG_NX_BLOCKING +
    Open the client message queues in blocking mode. In this case, +
    nx_eventhandler() will not return until a message is received and processed. +
    CONFIG_NX_MXSERVERMSGS and CONFIG_NX_MXCLIENTMSGS +
    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 (CONFIG_PREALLOC_MQ_MSGS controls how many + messages are pre-allocated). +
    +
+ +

B.5 NXTK Configuration Settings

+ +
    +
    +
    CONFIG_NXTK_BORDERWIDTH: +
    Specifies with with of the border (in pixels) used with + framed windows. The default is 4. +
    CONFIG_NXTK_BORDERCOLOR1 and CONFIG_NXTK_BORDERCOLOR2: +
    Specify the colors of the border used with framed windows. +
    CONFIG_NXTK_BORDERCOLOR2 is the shadow side color and so +
    is normally darker. The default is medium and dark grey, + respectively +
    CONFIG_NXTK_AUTORAISE: +
    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. +
    +
+ +

B.6 NXFONTS Configuration Settings

+ +
    +
    +
    CONFIG_NXFONTS_CHARBITS: +
    The number of bits in the character set. Current options are + only 7 and 8. The default is 7. +
    CONFIG_NXFONT_SANS: +
    At present, there is only one font. But if there were were more, + then this option would select the sans serif font. +
    +
+ + + + + +
+

Appendix C NX Test Coverage

+
+ +

+ The primary test tool for debugging NX resides at examples/nx. + At present, that test only exercises a subset of NX; the remainder is essentially + untested. + The following table describes the testing performed on each NX API: +

+ +

Table C.1: NX Test Coverage

+ +
+ +
To be provided
+ + + + diff --git a/Documentation/NXOrganization.gif b/Documentation/NXOrganization.gif new file mode 100644 index 0000000000..6bae8e5529 Binary files /dev/null and b/Documentation/NXOrganization.gif differ diff --git a/Documentation/NuttX.html b/Documentation/NuttX.html index e333675e9a..4481149fa7 100644 --- a/Documentation/NuttX.html +++ b/Documentation/NuttX.html @@ -497,7 +497,11 @@

-

  • Graphics library and tiny windowing system under development.
  • +
  • + NX: A graphics library, tiny windowing system and tiny font support. + Documented in the NX Graphics Subsystem + manual. +
  • @@ -574,8 +578,8 @@ Using a variety of technologies, NuttX can scale from the very tiny to the moderate-size system. I have executed NuttX with some simple applications in as little as 32Kb total memory (code and data). - On the other hand, I often run richly featured NuttX builds that require - memory up to 100Kb. + On the other hand, typical, richly featured NuttX builds require more like 64Kb + (and if all of the features are used, this can push 100Kb).

    @@ -1373,6 +1377,10 @@ buildroot-0.1.3 2008-xx-xx <spudmonkey@racsa.co.cr> NuttShell (NSH) + + + NX Graphics Subsystem + Change Log diff --git a/Documentation/NuttxPortingGuide.html b/Documentation/NuttxPortingGuide.html index e40a8d4e2b..b47cd99ded 100644 --- a/Documentation/NuttxPortingGuide.html +++ b/Documentation/NuttxPortingGuide.html @@ -1,99 +1,114 @@ - -NuttX Porting Manual +NuttX Porting Guide

    -

    Under Construction

    + + + + +
    +

    + NuttX RTOS Porting Guide +

    +

    Last Updated: December 5, 2008

    +


    -
    -

    -

    NuttX Operating System
    - Porting Guide

    -

    -

    by

    -

    Gregory Nutt

    -

    Last Update: December 5, 2008

    -
    -

    Table of Contents

    -
  • 1.0 Introduction
  • -
  • 2.0 Directory Structure
  • + + + + +
    +

    Table of Contents

    +
    + -
  • 3.0 Configuring and Building
  • - -
  • 4.0 Architecture APIs
  • - -
  • 5.0 NuttX File System
  • -
  • Appendix A: NuttX Configuration Settings
  • -
  • Appendix B: Trademarks
  • -
    -

    1.0 Introduction

    + + + + + +
    +

    1.0 Introduction

    +

    Overview This document provides and overview of the NuttX build and configuration @@ -104,10 +119,13 @@ See also arch/README.txt and configs/README.txt.

    -

    General Philosophy. - -


    -

    2.0 Directory Structure

    + + + + +
    +

    2.0 Directory Structure

    +

    Directory Structure. @@ -868,8 +886,14 @@ tools/ Use of this Makefile to build NuttX is described below.

    -
    -

    3.0 Configuring and Building

    + + + + +
    +

    3.0 Configuring and Building

    +
    +

    3.1 Configuring NuttX

    Manual Configuration. @@ -948,7 +972,13 @@ The system can be re-made subsequently by just typing make.

  • Creating make dependencies. -

    4.0 Architecture APIs

    + + + + +
    +

    4.0 Architecture APIs

    +

    The file include/nuttx/arch.h identifies by prototype all of the APIs that must @@ -1285,28 +1315,76 @@ The system can be re-made subsequently by just typing make.

    4.1.16 up_disable_irq()

    -

    Prototype: void up_disable_irq(int irq);

    +

    Prototype:

    +
      +#ifndef CONFIG_ARCH_NOINTC
      +  void up_disable_irq(int irq);
      +#endf
      +

    Description. Disable the IRQ specified by 'irq' + On many architectures, there are three levels of interrupt enabling: (1) + at the global level, (2) at the level of the interrupt controller, + and (3) at the device level. In order to receive interrupts, they + must be enabled at all three levels. +

    +

    + This function implements enabling of the device specified by 'irq' + at the interrupt controller level if supported by the architecture + (irqsave() supports the global level, the device level is hardware + specific). +

    + If the architecture does not support up_disable_irq, + CONFIG_ARCH_NOINTC should be defined in the NuttX configuration file. + Since this API cannot be supported on all architectures, it should be + avoided in common implementations where possible.

    4.1.17 up_enable_irq()

    -

    Prototype: void up_enable_irq(int irq);

    +

    Prototype:

    +
      +#ifndef CONFIG_ARCH_NOINTC
      +  void up_enable_irq(int irq);
      +#endf
      +

    Description. - Enable the IRQ specified by 'irq' + This function implements disabling of the device specified by 'irq' + at the interrupt controller level if supported by the architecture + (irqrestore() supports the global level, the device level is hardware + specific). +

    +

    + If the architecture does not support up_disable_irq, + CONFIG_ARCH_NOINTC should be defined in the NuttX configuration file. + Since this API cannot be supported on all architectures, it should be + avoided in common implementations where possible.

    -

    4.1.18 up_putc()

    +

    4.1.18 up_prioritize_irq()

    +

    Prototype:

    +
      +#ifdef CONFIG_ARCH_IRQPRIO
      +  void up_enable_irq(int irq);
      +#endf
      +
    +

    Description. + Set the priority of an IRQ. +

    +

    + If the architecture supports up_enable_irq, + CONFIG_ARCH_IRQPRIO should be defined in the NuttX configuration file. + Since this API cannot be supported on all architectures, it should be + avoided in common implementations where possible. +

    + +

    4.1.19 up_putc()

    Prototype: int up_putc(int ch);

    Description. This is a debug interface exported by the architecture-specific logic. Output one character on the console -

    - This API is NOT required if CONFIG_HEAP_BASE - is defined.

    4.2 APIs Exported by NuttX to Architecture-Specific Logic

    @@ -1345,7 +1423,13 @@ The system can be re-made subsequently by just typing make. the appropriate, registered handling logic.

    -

    5.0 NuttX File System

    + + + + +
    +

    5.0 NuttX File System

    +

    Overview. NuttX includes an optional, scalable file system. @@ -1395,7 +1479,13 @@ The system can be re-made subsequently by just typing make. from the very tiny platform to the moderate platform.

    -

    Appendix A: NuttX Configuration Settings

    + + + + +
    +

    Appendix A: NuttX Configuration Settings

    +

    The following variables are recognized by the build (you may @@ -1977,7 +2067,13 @@ The system can be re-made subsequently by just typing make.

  • -

    Appendix B: Trademarks

    + + + + +
    +

    Appendix B: Trademarks

    +
  • ARM, ARM7 ARM7TDMI, ARM9, ARM926EJS are trademarks of Advanced RISC Machines, Limited.
  • Cygwin is a trademark of Red Hat, Incorporated.
  • diff --git a/graphics/README.txt b/graphics/README.txt index ded6f531cf..44127a53c0 100644 --- a/graphics/README.txt +++ b/graphics/README.txt @@ -26,7 +26,7 @@ at the present, but here is the longer term roadmap: are more-or-less interchangable. NX can be used without NXWIDGETS and without NXTOOLKIT for raw access to window memory. NXGLIB - Low level graphics utilities and direct framebuffer rendering logic. - NX is build on NXGLIB. + NX is built on top of NXGLIB. Related Header Files ^^^^^^^^^^^^^^^^^^^^ diff --git a/include/nuttx/arch.h b/include/nuttx/arch.h index b5e33d739d..b4e17f658f 100644 --- a/include/nuttx/arch.h +++ b/include/nuttx/arch.h @@ -386,7 +386,7 @@ EXTERN boolean up_interrupt_context(void); * * This function implements enabling of the device specified by 'irq' * at the interrupt controller level if supported by the architecture - * (irqsave() supports the global level, the device level is hardware + * (irqrestore() supports the global level, the device level is hardware * specific). * * Since this API is not supported on all architectures, it should be diff --git a/include/nuttx/nx.h b/include/nuttx/nx.h index 13866f2f55..cb5ac07e32 100644 --- a/include/nuttx/nx.h +++ b/include/nuttx/nx.h @@ -99,7 +99,7 @@ struct nx_callback_s * Input Parameters: * hwnd - Window handle * rect - The rectangle that needs to be re-drawn (in window relative - * coordinates + * coordinates) * more - TRUE: More re-draw requests will follow * arg - User provided argument (see nx_openwindow, nx_constructwindow) * @@ -122,7 +122,7 @@ struct nx_callback_s * hwnd - Window handle * size - The size of the window * pos - The position of the upper left hand corner of the window on - * the overalll display + * the overall display * bounds - The bounding rectangle that the describes the entire * display * arg - User provided argument (see nx_openwindow, nx_constructwindow) @@ -141,7 +141,7 @@ struct nx_callback_s * Name: mousein * * Descripton: - * New mouse data is available for the window + * New mouse data is available for the window. * * Input Parameters: * hwnd - Window handle @@ -346,7 +346,7 @@ EXTERN void nx_close(NXHANDLE handle); * * Return: * OK: No errors occurred. If CONFIG_NX_BLOCKING is defined, then - * one or more server message was processed. + * one or more server messages were processed. * ERROR: An error occurred and errno has been set appropriately. Of * particular interest, it will return errno == EHOSTDOWN when the * server is disconnected. After that event, the handle can no @@ -376,9 +376,7 @@ EXTERN int nx_eventhandler(NXHANDLE handle); * handle - the handle returned by nx_connect * * Return: - * OK: No errors occurred. If CONFIG_NX_BLOCKING is defined, then - * one or more server message was processed. - * ERROR: An error occurred and errno has been set appropriately + * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ @@ -452,7 +450,7 @@ EXTERN int nx_closewindow(NXWINDOW hwnd); * * nx_setposition, nx_setsize, nx_raise, nx_lower. * - * - Neither nx_opengbwindow or nx_closebgwindow should be called more than + * - Neither nx_requestbkgd or nx_releasebkgd should be called more than * once. Multiple instances of the background window are not supported. * * Input Parameters: @@ -555,7 +553,7 @@ EXTERN int nx_setsize(NXWINDOW hwnd, FAR struct nxgl_size_s *size); EXTERN int nx_raise(NXWINDOW hwnd); /**************************************************************************** - * Name: nx_raise + * Name: nx_lower * * Description: * Lower the specified window to the bottom of the display. @@ -664,7 +662,7 @@ EXTERN int nx_move(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect, * origin - The origin of the upper, left-most corner of the full bitmap. * Both dest and origin are in window coordinates, however, origin * may lie outside of the display. - * stride - The width of the full source image in pixels. + * stride - The width of the full source image in bytes. * * Return: * OK on success; ERROR on failure with errno set appropriately diff --git a/include/nuttx/nxfonts.h b/include/nuttx/nxfonts.h index 25e7e0b122..4b9a0e3ed9 100644 --- a/include/nuttx/nxfonts.h +++ b/include/nuttx/nxfonts.h @@ -64,7 +64,7 @@ struct nx_fontmetic_s uint32 unused : 6; }; -/* This structure bings the glyph metrics to the glyph bitmap */ +/* This structure binds the glyph metrics to the glyph bitmap */ struct nx_fontbitmap_s { @@ -117,7 +117,7 @@ extern "C" { * Return information about the current font set * * Input Parameters: - * None + * An instance of struct nx_font_s describing the font set. * ****************************************************************************/ @@ -132,6 +132,9 @@ EXTERN FAR const struct nx_font_s *nxf_getfontset(void); * Input Parameters: * ch - character code * + * Returned Value: + * An instance of struct nx_fontbitmap_s describing the glyph. + * ****************************************************************************/ EXTERN FAR const struct nx_fontbitmap_s *nxf_getbitmap(uint16 ch); diff --git a/include/nuttx/nxglib.h b/include/nuttx/nxglib.h index 56739592e4..89585cf509 100644 --- a/include/nuttx/nxglib.h +++ b/include/nuttx/nxglib.h @@ -101,7 +101,7 @@ struct nxgl_point_s nxgl_coord_t y; /* Y position, range: 0 to screen height - 1 */ }; -/* Describes the size of a rectangulare region */ +/* Describes the size of a rectangular region */ struct nxgl_size_s { @@ -109,7 +109,7 @@ struct nxgl_size_s nxgl_coord_t h; /* Height in rows */ }; -/* Describes a rectangle on the display */ +/* Describes a positioned rectangle on the display */ struct nxgl_rect_s { @@ -329,7 +329,7 @@ EXTERN void nxgl_copyrectangle_32bpp(FAR struct fb_planeinfo_s *pinfo, * * Description: * This is essentially memcpy for rectangles. We don't do structure - * assignements because some compilers are not good at that. + * assignments because some compilers are not good at that. * ****************************************************************************/ @@ -402,7 +402,7 @@ EXTERN void nxgl_rectunion(FAR struct nxgl_rect_s *dest, * * Description: * Return the regions of rectangle rect 1 that do not intersect with - * rect2. This may be up to founr rectangles some of which may be + * rect2. This will be four rectangles ,some of which may be * degenerate (and can be picked off with nxgl_nullrect) * ****************************************************************************/ diff --git a/include/nuttx/nxtk.h b/include/nuttx/nxtk.h index d9466b9dce..8d2f08c6a5 100644 --- a/include/nuttx/nxtk.h +++ b/include/nuttx/nxtk.h @@ -225,7 +225,7 @@ EXTERN int nxtk_fillwindow(NXTKWINDOW hfwnd, FAR const struct nxgl_rect_s *rect, * Name: nxtk_filltrapwindow * * Description: - * Fill the specified rectangle in the client window with the specified color + * Fill the specified trapezoid in the client window with the specified color * * Input Parameters: * hfwnd - The window handle returned by nxtk_openwindow @@ -298,8 +298,8 @@ EXTERN int nxtk_bitmapwindow(NXTKWINDOW hfwnd, * Create a tool bar at the top of the specified framed window * * Input Parameters: - * hfwnd - The handle returned by nxtk_openwindow - * height - The request height of the toolbar in pixels + * hfwnd - The handle returned by nxtk_openwindow + * height - The requested height of the toolbar in pixels * cb - Callbacks used to process toolbar events * arg - User provided value that will be returned with toolbar callbacks. * @@ -316,7 +316,7 @@ EXTERN int nxtk_opentoolbar(NXTKWINDOW hfwnd, nxgl_coord_t height, * Name: nxtk_closetoolbar * * Description: - * Create a tool bar at the top of the specified framed window + * Remove the tool bar at the top of the specified framed window * * Input Parameters: * hfwnd - The handle returned by nxtk_openwindow @@ -332,7 +332,7 @@ EXTERN int nxtk_closetoolbar(NXTKWINDOW hfwnd); * Name: nxtk_filltoolbar * * Description: - * Fill the specified rectangle in the client window with the specified color + * Fill the specified rectangle in the toolbar sub-window with the specified color * * Input Parameters: * hfwnd - The handle returned by nxtk_openwindow @@ -351,7 +351,7 @@ EXTERN int nxtk_filltoolbar(NXTKWINDOW hfwnd, FAR const struct nxgl_rect_s *rect * Name: nxtk_filltraptoolbar * * Description: - * Fill the specified rectangle in the toolbar with the specified color + * Fill the specified trapezoid in the toolbar sub-window with the specified color * * Input Parameters: * hfwnd - The handle returned by nxtk_openwindow @@ -403,7 +403,7 @@ EXTERN int nxtk_movetoolbar(NXTKWINDOW hfwnd, FAR const struct nxgl_rect_s *rect * origin - 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. - * stride - The width of the full source image in pixels. + * stride - The width of the full source image in bytes. * * Return: * OK on success; ERROR on failure with errno set appropriately