summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-08-24 17:00:51 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-08-24 17:00:51 +0000
commit67d6e613acb5129a2ca4a66ddf9cc6577933bc37 (patch)
treeaf72d8bd42567dc63ea75f7361bfc20133f3bbb6
parentb2273926830dcc8a4369bd41f2941f5ce22b3d3a (diff)
downloadpx4-nuttx-67d6e613acb5129a2ca4a66ddf9cc6577933bc37.tar.gz
px4-nuttx-67d6e613acb5129a2ca4a66ddf9cc6577933bc37.tar.bz2
px4-nuttx-67d6e613acb5129a2ca4a66ddf9cc6577933bc37.zip
Add a test of the circle rendering logic
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3911 42af7a65-404d-4744-a932-0658087f49c3
-rwxr-xr-xapps/ChangeLog.txt2
-rw-r--r--apps/examples/README.txt17
-rw-r--r--apps/examples/nxlines/nxlines.h28
-rw-r--r--apps/examples/nxlines/nxlines_bkgd.c145
-rw-r--r--nuttx/ChangeLog3
-rw-r--r--nuttx/Documentation/NXGraphicsSubsystem.html16
-rw-r--r--nuttx/TODO17
-rw-r--r--nuttx/configs/sim/nx/defconfig13
-rw-r--r--nuttx/configs/stm3210e-eval/nsh2/defconfig16
-rw-r--r--nuttx/configs/stm3210e-eval/nxlines/defconfig16
-rw-r--r--nuttx/configs/stm3210e-eval/nxtext/defconfig16
-rw-r--r--nuttx/graphics/nxglib/nxglib_circlepts.c2
-rw-r--r--nuttx/graphics/nxglib/nxglib_circletraps.c18
-rw-r--r--nuttx/graphics/nxmu/nx_drawcircle.c2
-rw-r--r--nuttx/graphics/nxmu/nx_fillcircle.c2
-rw-r--r--nuttx/graphics/nxsu/nx_drawcircle.c2
-rw-r--r--nuttx/graphics/nxsu/nx_fillcircle.c2
-rw-r--r--nuttx/graphics/nxtk/nxtk_drawcircletoolbar.c2
-rw-r--r--nuttx/graphics/nxtk/nxtk_drawcirclewindow.c2
-rw-r--r--nuttx/graphics/nxtk/nxtk_fillcircletoolbar.c2
-rw-r--r--nuttx/graphics/nxtk/nxtk_fillcirclewindow.c2
-rw-r--r--nuttx/include/nuttx/nx/nx.h4
-rw-r--r--nuttx/include/nuttx/nx/nxglib.h4
-rw-r--r--nuttx/include/nuttx/nx/nxtk.h8
24 files changed, 247 insertions, 94 deletions
diff --git a/apps/ChangeLog.txt b/apps/ChangeLog.txt
index 41c26a13b..ffdc1e0f3 100755
--- a/apps/ChangeLog.txt
+++ b/apps/ChangeLog.txt
@@ -98,3 +98,5 @@
6.9 2011-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr>
+ * apps/examples/nxlines: Extend the line drawing text to include drawing
+ of circles.
diff --git a/apps/examples/README.txt b/apps/examples/README.txt
index b155a3ab2..8bd704ccf 100644
--- a/apps/examples/README.txt
+++ b/apps/examples/README.txt
@@ -424,8 +424,21 @@ examplex/nxlines
depends on CONFIG_EXAMPLES_NXLINES_BPP.
CONFIG_EXAMPLES_NXLINES_LINEWIDTH - Selects the width of the lines in
pixels (default: 16)
- CONFIG_EXAMPLES_NXLINES_LINECOLOR -- The color of the lines drawn in the
- background window. Default depends on CONFIG_EXAMPLES_NXLINES_BPP.
+ CONFIG_EXAMPLES_NXLINES_LINECOLOR -- The color of the central lines drawn
+ in the background window. Default depends on CONFIG_EXAMPLES_NXLINES_BPP
+ (there really is no meaningful default).
+ CONFIG_EXAMPLES_NXLINES_BORDERWIDTH -- The width of the circular border
+ drawn in the background window. (default: 4).
+ CONFIG_EXAMPLES_NXLINES_BORDERCOLOR -- The color of the circular border
+ drawn in the background window. Default depends on CONFIG_EXAMPLES_NXLINES_BPP
+ (there really is no meaningful default).
+ CONFIG_EXAMPLES_NXLINES_CIRCLECOLOR -- The color of the circular region
+ filled in the background window. Default depends on CONFIG_EXAMPLES_NXLINES_BPP
+ (there really is no meaningful default).
+ CONFIG_EXAMPLES_NXLINES_BORDERCOLOR -- The color of the lines drawn in the
+ background window. Default depends on CONFIG_EXAMPLES_NXLINES_BPP (there
+ really is no meaningful default).
+
CONFIG_EXAMPLES_NXLINES_BPP -- Pixels per pixel to use. Valid options
include 2, 4, 8, 16, 24, and 32. Default is 16.
CONFIG_EXAMPLES_NXLINES_EXTERNINIT - The driver for the graphics device on
diff --git a/apps/examples/nxlines/nxlines.h b/apps/examples/nxlines/nxlines.h
index 59ca282d0..fb91f23a3 100644
--- a/apps/examples/nxlines/nxlines.h
+++ b/apps/examples/nxlines/nxlines.h
@@ -75,7 +75,7 @@
# define CONFIG_EXAMPLES_NXLINES_BGCOLOR RGB16_DARKGREEN
# else
# define CONFIG_EXAMPLES_NXLINES_BGCOLOR RGB8_DARKGREEN
-# endif
+# endif
#endif
#ifndef CONFIG_EXAMPLES_NXLINES_LINEWIDTH
@@ -89,7 +89,31 @@
# define CONFIG_EXAMPLES_NXLINES_LINECOLOR RGB16_YELLOW
# else
# define CONFIG_EXAMPLES_NXLINES_LINECOLOR RGB8_YELLOW
-# endif
+# endif
+#endif
+
+#ifndef CONFIG_EXAMPLES_NXLINES_BORDERWIDTH
+# define CONFIG_EXAMPLES_NXLINES_BORDERWIDTH 16
+#endif
+
+#ifndef CONFIG_EXAMPLES_NXLINES_BORDERCOLOR
+# if CONFIG_EXAMPLES_NXLINES_BPP == 24 || CONFIG_EXAMPLES_NXLINES_BPP == 32
+# define CONFIG_EXAMPLES_NXLINES_BORDERCOLOR RGB24_YELLOW
+# elif CONFIG_EXAMPLES_NXLINES_BPP == 16
+# define CONFIG_EXAMPLES_NXLINES_BORDERCOLOR RGB16_YELLOW
+# else
+# define CONFIG_EXAMPLES_NXLINES_BORDERCOLOR RGB8_YELLOW
+# endif
+#endif
+
+#ifndef CONFIG_EXAMPLES_NXLINES_CIRCLECOLOR
+# if CONFIG_EXAMPLES_NXLINES_BPP == 24 || CONFIG_EXAMPLES_NXLINES_BPP == 32
+# define CONFIG_EXAMPLES_NXLINES_CIRCLECOLOR RGB24_BEIGE
+# elif CONFIG_EXAMPLES_NXLINES_BPP == 16
+# define CONFIG_EXAMPLES_NXLINES_CIRCLECOLOR RGB16_BEIGE
+# else
+# define CONFIG_EXAMPLES_NXLINES_CIRCLECOLOR RGB8_YELLOW
+# endif
#endif
/* Debug ********************************************************************/
diff --git a/apps/examples/nxlines/nxlines_bkgd.c b/apps/examples/nxlines/nxlines_bkgd.c
index 80808b1da..c9cbc921d 100644
--- a/apps/examples/nxlines/nxlines_bkgd.c
+++ b/apps/examples/nxlines/nxlines_bkgd.c
@@ -201,84 +201,135 @@ static void nxlines_kbdin(NXWINDOW hwnd, uint8_t nch, FAR const uint8_t *ch,
void nxlines_test(NXWINDOW hwnd)
{
+ struct nxgl_point_s center;
struct nxgl_vector_s vector;
struct nxgl_vector_s previous;
nxgl_mxpixel_t color[CONFIG_NX_NPLANES];
- nxgl_coord_t xcenter;
- nxgl_coord_t ycenter;
+ nxgl_coord_t maxradius;
nxgl_coord_t radius;
nxgl_coord_t halfx;
nxgl_coord_t halfy;
b16_t angle;
int ret;
- /* Get the radius and center of the circle */
+ /* Get the maximum radius and center of the circle */
- radius = MIN(g_nxlines.yres, g_nxlines.xres) >> 1;
- xcenter = g_nxlines.xres >> 1;
- ycenter = g_nxlines.yres >> 1;
+ maxradius = MIN(g_nxlines.yres, g_nxlines.xres) >> 1;
+ center.x = g_nxlines.xres >> 1;
+ center.y = g_nxlines.yres >> 1;
+
+ /* Draw a circular background */
+
+ radius = maxradius - ((CONFIG_EXAMPLES_NXLINES_BORDERWIDTH+1)/2);
+ color[0] = CONFIG_EXAMPLES_NXLINES_CIRCLECOLOR;
+ ret = nx_fillcircle((NXWINDOW)hwnd, &center, radius, color);
+ if (ret < 0)
+ {
+ message("nxlines_test: nx_fillcircle failed: %d\n", ret);
+ }
+
+ /* Draw the circular border */
+
+ color[0] = CONFIG_EXAMPLES_NXLINES_BORDERCOLOR;
+ ret = nx_drawcircle((NXWINDOW)hwnd, &center, radius,
+ CONFIG_EXAMPLES_NXLINES_BORDERWIDTH, color);
+ if (ret < 0)
+ {
+ message("nxlines_test: nx_fillcircle failed: %d\n", ret);
+ }
+
+ /* Back off the radius to account for the thickness of border line
+ * and with a big fudge factor that will (hopefully) prevent the corners
+ * of the lines from overwriting the border. This is overly complicated
+ * here because we don't assume anything about the screen resolution or
+ * the borderwidth or the line thickness (and there are certainly some
+ * smarter ways to do this).
+ */
+
+ if (maxradius > (CONFIG_EXAMPLES_NXLINES_BORDERWIDTH + 80))
+ {
+ radius = maxradius - (CONFIG_EXAMPLES_NXLINES_BORDERWIDTH + 40);
+ }
+ else if (maxradius > (CONFIG_EXAMPLES_NXLINES_BORDERWIDTH + 60))
+ {
+ radius = maxradius - (CONFIG_EXAMPLES_NXLINES_BORDERWIDTH + 30);
+ }
+ else if (maxradius > (CONFIG_EXAMPLES_NXLINES_BORDERWIDTH + 40))
+ {
+ radius = maxradius - (CONFIG_EXAMPLES_NXLINES_BORDERWIDTH + 20);
+ }
+ else if (maxradius > (CONFIG_EXAMPLES_NXLINES_BORDERWIDTH + 20))
+ {
+ radius = maxradius - (CONFIG_EXAMPLES_NXLINES_BORDERWIDTH + 10);
+ }
+ else
+ {
+ radius = maxradius - CONFIG_EXAMPLES_NXLINES_BORDERWIDTH;
+ }
+
+ /* The loop, showing the line in various orientations */
angle = 0;
- previous.pt1.x = xcenter;
- previous.pt1.y = ycenter;
- previous.pt2.x = xcenter;
- previous.pt2.y = ycenter;
+ previous.pt1.x = center.x;
+ previous.pt1.y = center.y;
+ previous.pt2.x = center.x;
+ previous.pt2.y = center.y;
for (;;)
{
- /* Determine the position of the line on this pass */
+ /* Determine the position of the line on this pass */
- halfx = b16toi(b16muli(b16sin(angle), radius));
- halfy = b16toi(b16muli(b16cos(angle), radius));
+ halfx = b16toi(b16muli(b16sin(angle), radius));
+ halfy = b16toi(b16muli(b16cos(angle), radius));
- vector.pt1.x = xcenter + halfx;
- vector.pt1.y = ycenter + halfy;
- vector.pt2.x = xcenter - halfx;
- vector.pt2.y = ycenter - halfy;
+ vector.pt1.x = center.x + halfx;
+ vector.pt1.y = center.y + halfy;
+ vector.pt2.x = center.x - halfx;
+ vector.pt2.y = center.y - halfy;
- message("Angle: %08x vector: (%d,%d)->(%d,%d)\n",
- angle, vector.pt1.x, vector.pt1.y, vector.pt2.x, vector.pt2.y);
+ message("Angle: %08x vector: (%d,%d)->(%d,%d)\n",
+ angle, vector.pt1.x, vector.pt1.y, vector.pt2.x, vector.pt2.y);
- /* Clear the previous line */
+ /* Clear the previous line by overwriting it with the circle color */
- color[0] = CONFIG_EXAMPLES_NXLINES_BGCOLOR;
- ret = nx_drawline((NXWINDOW)hwnd, &previous, CONFIG_EXAMPLES_NXLINES_LINEWIDTH, color);
- if (ret < 0)
- {
- message("nxlines_test: nx_drawline failed clearing: %d\n", ret);
- }
+ color[0] = CONFIG_EXAMPLES_NXLINES_CIRCLECOLOR;
+ ret = nx_drawline((NXWINDOW)hwnd, &previous, CONFIG_EXAMPLES_NXLINES_LINEWIDTH, color);
+ if (ret < 0)
+ {
+ message("nxlines_test: nx_drawline failed clearing: %d\n", ret);
+ }
- /* Draw the new line */
+ /* Draw the new line */
- color[0] = CONFIG_EXAMPLES_NXLINES_LINECOLOR;
- ret = nx_drawline((NXWINDOW)hwnd, &vector, CONFIG_EXAMPLES_NXLINES_LINEWIDTH, color);
- if (ret < 0)
- {
- message("nxlines_test: nx_drawline failed clearing: %d\n", ret);
- }
+ color[0] = CONFIG_EXAMPLES_NXLINES_LINECOLOR;
+ ret = nx_drawline((NXWINDOW)hwnd, &vector, CONFIG_EXAMPLES_NXLINES_LINEWIDTH, color);
+ if (ret < 0)
+ {
+ message("nxlines_test: nx_drawline failed clearing: %d\n", ret);
+ }
- /* Set up for the next time through the loop then sleep for a bit. */
+ /* Set up for the next time through the loop then sleep for a bit. */
- angle += b16PI / 16; /* 32 angular positions in full circle */
+ angle += b16PI / 16; /* 32 angular positions in full circle */
- /* Check if we have gone all the way around */
+ /* Check if we have gone all the way around */
- if (angle > (31 * (2 * b16PI) / 32))
- {
+ if (angle > (31 * (2 * b16PI) / 32))
+ {
#ifdef CONFIG_EXAMPLES_NXLINES_BUILTIN
- /* If this example was built as an NSH add-on, then exit after we
- * have gone all the way around once.
- */
+ /* If this example was built as an NSH add-on, then exit after we
+ * have gone all the way around once.
+ */
- return;
+ return;
#else
- /* Wrap back to zero and continue with the test */
+ /* Wrap back to zero and continue with the test */
- angle = 0;
+ angle = 0;
#endif
- }
+ }
- memcpy(&previous, &vector, sizeof(struct nxgl_vector_s));
- usleep(500*1000);
+ memcpy(&previous, &vector, sizeof(struct nxgl_vector_s));
+ usleep(500*1000);
}
}
diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog
index 1e2c2732a..c4350e244 100644
--- a/nuttx/ChangeLog
+++ b/nuttx/ChangeLog
@@ -2019,5 +2019,6 @@
* arch/arm/src/kinetis/kinetis_sdhc.c: SDHC driver for Kinetis parts.
Initially check-in is just a crude port of the STM32 SDIO driver.
Much more is needed.
-
+ * graphics/, include/nuttx/nx: Add new NX interfaces for drawing
+ circles -- both circular outlines and filled circles.
diff --git a/nuttx/Documentation/NXGraphicsSubsystem.html b/nuttx/Documentation/NXGraphicsSubsystem.html
index 9b8c84c34..121301030 100644
--- a/nuttx/Documentation/NXGraphicsSubsystem.html
+++ b/nuttx/Documentation/NXGraphicsSubsystem.html
@@ -817,7 +817,7 @@ int nxgl_splitline(FAR struct nxgl_vector_s *vector, FAR struct nxgl_trapezoid_s
<h3>2.2.20 <a name="nxglcirclepts"><code>nxgl_circlepts</code></a></h3>
<ul><pre>
#include &lt;nuttx/nx/nxglib.h&gt;
-void nxgl_circlepts(FAR struct nxgl_point_s *center, nxgl_coord_t radius,
+void nxgl_circlepts(FAR const struct nxgl_point_s *center, nxgl_coord_t radius,
FAR struct nxgl_point_s *circle);
</pre></ul>
<p>
@@ -843,7 +843,7 @@ void nxgl_circlepts(FAR struct nxgl_point_s *center, nxgl_coord_t radius,
<h3>2.2.21 <a name="nxglcircletraps"><code>nxgl_circletraps</code></a></h3>
<ul><pre>
#include &lt;nuttx/nx/nxglib.h&gt;
-oid nxgl_circletraps(FAR struct nxgl_point_s *center, nxgl_coord_t radius,
+oid nxgl_circletraps(FAR const struct nxgl_point_s *center, nxgl_coord_t radius,
FAR struct nxgl_trapezoid_s *circle);
</pre></ul>
<p>
@@ -1750,7 +1750,7 @@ int nx_drawline(NXWINDOW hwnd, FAR struct nxgl_vector_s *vector,
#include &lt;nuttx/nx/nxglib.h&gt;
#include &lt;nuttx/nx/nx.h&gt;
-int nx_drawcircle(NXWINDOW hwnd, FAR struct nxgl_point_s *center,
+int nx_drawcircle(NXWINDOW hwnd, FAR const struct nxgl_point_s *center,
nxgl_coord_t radius, nxgl_coord_t width,
nxgl_mxpixel_t color[CONFIG_NX_NPLANES]);
</pre></ul>
@@ -1786,7 +1786,7 @@ int nx_drawcircle(NXWINDOW hwnd, FAR struct nxgl_point_s *center,
#include &lt;nuttx/nx/nxglib.h&gt;
#include &lt;nuttx/nx/nx.h&gt;
-int nx_fillcircle(NXWINDOW hwnd, FAR struct nxgl_point_s *center,
+int nx_fillcircle(NXWINDOW hwnd, FAR const struct nxgl_point_s *center,
nxgl_coord_t radius, nxgl_mxpixel_t color[CONFIG_NX_NPLANES]);
</pre></ul>
<p>
@@ -2336,7 +2336,7 @@ int nxtk_drawlinewindow(NXTKWINDOW hfwnd, FAR struct nxgl_vector_s *vector,
#include &lt;nuttx/nx/nxglib.h&gt;
#include &lt;nuttx/nx/nxtk.h&gt;
-int nxtk_drawcirclewindow(NXTKWINDOW hfwnd, FAR struct nxgl_point_s *center,
+int nxtk_drawcirclewindow(NXTKWINDOW hfwnd, FAR const struct nxgl_point_s *center,
nxgl_coord_t radius, nxgl_coord_t width,
nxgl_mxpixel_t color[CONFIG_NX_NPLANES]);
</pre></ul>
@@ -2372,7 +2372,7 @@ int nxtk_drawcirclewindow(NXTKWINDOW hfwnd, FAR struct nxgl_point_s *center,
#include &lt;nuttx/nx/nxglib.h&gt;
#include &lt;nuttx/nx/nxtk.h&gt;
-int nxtk_fillcirclewindow(NXWINDOW hfwnd, FAR struct nxgl_point_s *center,
+int nxtk_fillcirclewindow(NXWINDOW hfwnd, FAR const struct nxgl_point_s *center,
nxgl_coord_t radius, nxgl_mxpixel_t color[CONFIG_NX_NPLANES]);
</pre></ul>
<p>
@@ -2648,7 +2648,7 @@ int nxtk_drawlinetoolbar(NXTKWINDOW hfwnd, FAR struct nxgl_vector_s *vector,
#include &lt;nuttx/nx/nxglib.h&gt;
#include &lt;nuttx/nx/nxtk.h&gt;
-int nxtk_drawcircletoolbar(NXTKWINDOW hfwnd, FAR struct nxgl_point_s *center,
+int nxtk_drawcircletoolbar(NXTKWINDOW hfwnd, FAR const struct nxgl_point_s *center,
nxgl_coord_t radius, nxgl_coord_t width,
nxgl_mxpixel_t color[CONFIG_NX_NPLANES]);
</pre></ul>
@@ -2684,7 +2684,7 @@ int nxtk_drawcircletoolbar(NXTKWINDOW hfwnd, FAR struct nxgl_point_s *center,
#include &lt;nuttx/nx/nxglib.h&gt;
#include &lt;nuttx/nx/nxtk.h&gt;
-int nxtk_fillcircletoolbar(NXWINDOW hfwnd, FAR struct nxgl_point_s *center,
+int nxtk_fillcircletoolbar(NXWINDOW hfwnd, FAR const struct nxgl_point_s *center,
nxgl_coord_t radius, nxgl_mxpixel_t color[CONFIG_NX_NPLANES]);
</pre></ul>
<p>
diff --git a/nuttx/TODO b/nuttx/TODO
index 1c868f9b1..acab46733 100644
--- a/nuttx/TODO
+++ b/nuttx/TODO
@@ -1348,3 +1348,20 @@ o Other Applications & Tests (apps/examples/)
the artifact is larger.
Status: Open
Priority: Medium.
+
+ Description: examples/nxlines. There is an error in the line rendering
+ on the 24th step (270 degrees). At that point, the
+ calculated position is just a bit from being horizontal.
+ Using configuration configs/stm3210e-eval/nxlines, I see:
+
+ sin: ffff0000 cos: ffffffed radius: 76 halfx: -76 halfy: -1
+
+ And the resulting almost horizontal line:
+
+ vector: (44,159)->(196,161)
+
+ is rendered incorrectly every time around. Looks like logic
+ in nxgl_splitlines malfunctioned.
+
+ Status: Open
+ Priority: Medium/High \ No newline at end of file
diff --git a/nuttx/configs/sim/nx/defconfig b/nuttx/configs/sim/nx/defconfig
index 9859e74c5..3dfd3e820 100644
--- a/nuttx/configs/sim/nx/defconfig
+++ b/nuttx/configs/sim/nx/defconfig
@@ -537,8 +537,17 @@ CONFIG_EXAMPLES_NX_NOTIFYSIGNO=4
# depends on CONFIG_EXAMPLES_NXLINES_BPP.
# CONFIG_EXAMPLES_NXLINES_LINEWIDTH - Selects the width of the lines in
# pixels (default: 16)
-# CONFIG_EXAMPLES_NXLINES_LINECOLOR -- The color of the lines drawn in the
-# background window. Default depends on CONFIG_EXAMPLES_NXLINES_BPP.
+# CONFIG_EXAMPLES_NXLINES_LINECOLOR -- The color of the central lines drawn
+# in the background window. Default depends on CONFIG_EXAMPLES_NXLINES_BPP
+# (there really is no meaningful default).
+# CONFIG_EXAMPLES_NXLINES_BORDERWIDTH -- The width of the circular border
+# drawn in the background window. (default: 4).
+# CONFIG_EXAMPLES_NXLINES_BORDERCOLOR -- The color of the circular border
+# drawn in the background window. Default depends on CONFIG_EXAMPLES_NXLINES_BPP
+# (there really is no meaningful default).
+# CONFIG_EXAMPLES_NXLINES_CIRCLECOLOR -- The color of the circular region
+# filled in the background window. Default depends on CONFIG_EXAMPLES_NXLINES_BPP
+# (there really is no meaningful default).
# CONFIG_EXAMPLES_NXLINES_BPP -- Pixels per pixel to use. Valid options
# include 2, 4, 8, 16, 24, and 32. Default is 16.
# CONFIG_EXAMPLES_NXLINES_EXTERNINIT - The driver for the graphics device on
diff --git a/nuttx/configs/stm3210e-eval/nsh2/defconfig b/nuttx/configs/stm3210e-eval/nsh2/defconfig
index 987127cfd..d49669886 100644
--- a/nuttx/configs/stm3210e-eval/nsh2/defconfig
+++ b/nuttx/configs/stm3210e-eval/nsh2/defconfig
@@ -1145,8 +1145,17 @@ CONFIG_EXAMPLES_NXIMAGE_EXTERNINIT=n
# depends on CONFIG_EXAMPLES_NXLINES_BPP.
# CONFIG_EXAMPLES_NXLINES_LINEWIDTH - Selects the width of the lines in
# pixels (default: 16)
-# CONFIG_EXAMPLES_NXLINES_LINECOLOR -- The color of the lines drawn in the
-# background window. Default depends on CONFIG_EXAMPLES_NXLINES_BPP.
+# CONFIG_EXAMPLES_NXLINES_LINECOLOR -- The color of the central lines drawn
+# in the background window. Default depends on CONFIG_EXAMPLES_NXLINES_BPP
+# (there really is no meaningful default).
+# CONFIG_EXAMPLES_NXLINES_BORDERWIDTH -- The width of the circular border
+# drawn in the background window. (default: 4).
+# CONFIG_EXAMPLES_NXLINES_BORDERCOLOR -- The color of the circular border
+# drawn in the background window. Default depends on CONFIG_EXAMPLES_NXLINES_BPP
+# (there really is no meaningful default).
+# CONFIG_EXAMPLES_NXLINES_CIRCLECOLOR -- The color of the circular region
+# filled in the background window. Default depends on CONFIG_EXAMPLES_NXLINES_BPP
+# (there really is no meaningful default).
# CONFIG_EXAMPLES_NXLINES_BPP -- Pixels per pixel to use. Valid options
# include 2, 4, 8, 16, 24, and 32. Default is 16.
# CONFIG_EXAMPLES_NXLINES_EXTERNINIT - The driver for the graphics device on
@@ -1161,6 +1170,9 @@ CONFIG_EXAMPLES_NXLINES_DEVNO=0
CONFIG_EXAMPLES_NXLINES_BGCOLOR=0x0320
CONFIG_EXAMPLES_NXLINES_LINEWIDTH=16
CONFIG_EXAMPLES_NXLINES_LINECOLOR=0xffe0
+CONFIG_EXAMPLES_NXLINES_BORDERWIDTH=4
+CONFIG_EXAMPLES_NXLINES_BORDERCOLOR=0xffe0
+CONFIG_EXAMPLES_NXLINES_CIRCLECOLOR=0xf7bb
CONFIG_EXAMPLES_NXLINES_BPP=16
CONFIG_EXAMPLES_NXLINES_EXTERNINIT=n
diff --git a/nuttx/configs/stm3210e-eval/nxlines/defconfig b/nuttx/configs/stm3210e-eval/nxlines/defconfig
index af7c1b7d0..6a9ea3979 100644
--- a/nuttx/configs/stm3210e-eval/nxlines/defconfig
+++ b/nuttx/configs/stm3210e-eval/nxlines/defconfig
@@ -1156,8 +1156,17 @@ CONFIG_EXAMPLES_NXIMAGE_EXTERNINIT=n
# depends on CONFIG_EXAMPLES_NXLINES_BPP.
# CONFIG_EXAMPLES_NXLINES_LINEWIDTH - Selects the width of the lines in
# pixels (default: 16)
-# CONFIG_EXAMPLES_NXLINES_LINECOLOR -- The color of the lines drawn in the
-# background window. Default depends on CONFIG_EXAMPLES_NXLINES_BPP.
+# CONFIG_EXAMPLES_NXLINES_LINECOLOR -- The color of the central lines drawn
+# in the background window. Default depends on CONFIG_EXAMPLES_NXLINES_BPP
+# (there really is no meaningful default).
+# CONFIG_EXAMPLES_NXLINES_BORDERWIDTH -- The width of the circular border
+# drawn in the background window. (default: 4).
+# CONFIG_EXAMPLES_NXLINES_BORDERCOLOR -- The color of the circular border
+# drawn in the background window. Default depends on CONFIG_EXAMPLES_NXLINES_BPP
+# (there really is no meaningful default).
+# CONFIG_EXAMPLES_NXLINES_CIRCLECOLOR -- The color of the circular region
+# filled in the background window. Default depends on CONFIG_EXAMPLES_NXLINES_BPP
+# (there really is no meaningful default).
# CONFIG_EXAMPLES_NXLINES_BPP -- Pixels per pixel to use. Valid options
# include 2, 4, 8, 16, 24, and 32. Default is 16.
# CONFIG_EXAMPLES_NXLINES_EXTERNINIT - The driver for the graphics device on
@@ -1172,6 +1181,9 @@ CONFIG_EXAMPLES_NXLINES_DEVNO=0
CONFIG_EXAMPLES_NXLINES_BGCOLOR=0x0320
CONFIG_EXAMPLES_NXLINES_LINEWIDTH=16
CONFIG_EXAMPLES_NXLINES_LINECOLOR=0xffe0
+CONFIG_EXAMPLES_NXLINES_BORDERWIDTH=4
+CONFIG_EXAMPLES_NXLINES_BORDERCOLOR=0xffe0
+CONFIG_EXAMPLES_NXLINES_CIRCLECOLOR=0xf7bb
CONFIG_EXAMPLES_NXLINES_BPP=16
CONFIG_EXAMPLES_NXLINES_EXTERNINIT=n
diff --git a/nuttx/configs/stm3210e-eval/nxtext/defconfig b/nuttx/configs/stm3210e-eval/nxtext/defconfig
index dc66b0fa8..d48637a1b 100644
--- a/nuttx/configs/stm3210e-eval/nxtext/defconfig
+++ b/nuttx/configs/stm3210e-eval/nxtext/defconfig
@@ -1156,8 +1156,17 @@ CONFIG_EXAMPLES_NXIMAGE_EXTERNINIT=n
# depends on CONFIG_EXAMPLES_NXLINES_BPP.
# CONFIG_EXAMPLES_NXLINES_LINEWIDTH - Selects the width of the lines in
# pixels (default: 16)
-# CONFIG_EXAMPLES_NXLINES_LINECOLOR -- The color of the lines drawn in the
-# background window. Default depends on CONFIG_EXAMPLES_NXLINES_BPP.
+# CONFIG_EXAMPLES_NXLINES_LINECOLOR -- The color of the central lines drawn
+# in the background window. Default depends on CONFIG_EXAMPLES_NXLINES_BPP
+# (there really is no meaningful default).
+# CONFIG_EXAMPLES_NXLINES_BORDERWIDTH -- The width of the circular border
+# drawn in the background window. (default: 4).
+# CONFIG_EXAMPLES_NXLINES_BORDERCOLOR -- The color of the circular border
+# drawn in the background window. Default depends on CONFIG_EXAMPLES_NXLINES_BPP
+# (there really is no meaningful default).
+# CONFIG_EXAMPLES_NXLINES_CIRCLECOLOR -- The color of the circular region
+# filled in the background window. Default depends on CONFIG_EXAMPLES_NXLINES_BPP
+# (there really is no meaningful default).
# CONFIG_EXAMPLES_NXLINES_BPP -- Pixels per pixel to use. Valid options
# include 2, 4, 8, 16, 24, and 32. Default is 16.
# CONFIG_EXAMPLES_NXLINES_EXTERNINIT - The driver for the graphics device on
@@ -1172,6 +1181,9 @@ CONFIG_EXAMPLES_NXLINES_DEVNO=0
CONFIG_EXAMPLES_NXLINES_BGCOLOR=0x0320
CONFIG_EXAMPLES_NXLINES_LINEWIDTH=16
CONFIG_EXAMPLES_NXLINES_LINECOLOR=0xffe0
+CONFIG_EXAMPLES_NXLINES_BORDERWIDTH=4
+CONFIG_EXAMPLES_NXLINES_BORDERCOLOR=0xffe0
+CONFIG_EXAMPLES_NXLINES_CIRCLECOLOR=0xf7bb
CONFIG_EXAMPLES_NXLINES_BPP=16
CONFIG_EXAMPLES_NXLINES_EXTERNINIT=n
diff --git a/nuttx/graphics/nxglib/nxglib_circlepts.c b/nuttx/graphics/nxglib/nxglib_circlepts.c
index 46ebe3291..a6d59280d 100644
--- a/nuttx/graphics/nxglib/nxglib_circlepts.c
+++ b/nuttx/graphics/nxglib/nxglib_circlepts.c
@@ -116,7 +116,7 @@
*
****************************************************************************/
-void nxgl_circlepts(FAR struct nxgl_point_s *center, nxgl_coord_t radius,
+void nxgl_circlepts(FAR const struct nxgl_point_s *center, nxgl_coord_t radius,
FAR struct nxgl_point_s *circle)
{
nxgl_coord_t xoffs;
diff --git a/nuttx/graphics/nxglib/nxglib_circletraps.c b/nuttx/graphics/nxglib/nxglib_circletraps.c
index 9c9a93cec..7c2cd1d7b 100644
--- a/nuttx/graphics/nxglib/nxglib_circletraps.c
+++ b/nuttx/graphics/nxglib/nxglib_circletraps.c
@@ -95,7 +95,7 @@
*
****************************************************************************/
-void nxgl_circletraps(FAR struct nxgl_point_s *center, nxgl_coord_t radius,
+void nxgl_circletraps(FAR const struct nxgl_point_s *center, nxgl_coord_t radius,
FAR struct nxgl_trapezoid_s *circle)
{
nxgl_coord_t xoffs;
@@ -103,11 +103,11 @@ void nxgl_circletraps(FAR struct nxgl_point_s *center, nxgl_coord_t radius,
circle[0].top.x1 = itob16(center->x);
circle[0].top.x2 = circle[0].top.x1;
- circle[0].top.y = center->y + radius;
+ circle[0].top.y = center->y - radius;
circle[7].bot.x1 = circle[0].top.x1;
circle[7].bot.x2 = circle[0].top.x1;
- circle[7].bot.y = center->y - radius;
+ circle[7].bot.y = center->y + radius;
circle[3].bot.x1 = itob16(center->x - radius);
circle[3].bot.x2 = itob16(center->x + radius);
@@ -124,7 +124,7 @@ void nxgl_circletraps(FAR struct nxgl_point_s *center, nxgl_coord_t radius,
circle[2].bot.x1 = itob16(center->x - xoffs);
circle[2].bot.x2 = itob16(center->x + xoffs);
- circle[2].bot.y = center->y + yoffs;
+ circle[2].bot.y = center->y - yoffs;
circle[3].top.x1 = circle[2].bot.x1;
circle[3].top.x2 = circle[2].bot.x2;
@@ -132,7 +132,7 @@ void nxgl_circletraps(FAR struct nxgl_point_s *center, nxgl_coord_t radius,
circle[4].bot.x1 = circle[2].bot.x1;
circle[4].bot.x2 = circle[2].bot.x2;
- circle[4].bot.y = center->y - yoffs;
+ circle[4].bot.y = center->y + yoffs;
circle[5].top.x1 = circle[4].bot.x1;
circle[5].top.x2 = circle[4].bot.x2;
@@ -140,7 +140,7 @@ void nxgl_circletraps(FAR struct nxgl_point_s *center, nxgl_coord_t radius,
circle[0].bot.x1 = itob16(center->x - yoffs);
circle[0].bot.x2 = itob16(center->x + yoffs);
- circle[0].bot.y = center->y + xoffs;
+ circle[0].bot.y = center->y - xoffs;
circle[1].top.x1 = circle[0].bot.x1;
circle[1].top.x2 = circle[0].bot.x2;
@@ -148,7 +148,7 @@ void nxgl_circletraps(FAR struct nxgl_point_s *center, nxgl_coord_t radius,
circle[6].bot.x1 = circle[1].top.x1;
circle[6].bot.x2 = circle[1].top.x2;
- circle[6].bot.y = center->y - xoffs;
+ circle[6].bot.y = center->y + xoffs;
circle[7].top.x1 = circle[6].bot.x1;
circle[7].top.x2 = circle[6].bot.x2;
@@ -160,7 +160,7 @@ void nxgl_circletraps(FAR struct nxgl_point_s *center, nxgl_coord_t radius,
circle[1].bot.x1 = itob16(center->x - xoffs);
circle[1].bot.x2 = itob16(center->x + xoffs);
- circle[1].bot.y = center->y + xoffs;
+ circle[1].bot.y = center->y - xoffs;
circle[2].top.x1 = circle[1].bot.x1;
circle[2].top.x2 = circle[1].bot.x2;
@@ -168,7 +168,7 @@ void nxgl_circletraps(FAR struct nxgl_point_s *center, nxgl_coord_t radius,
circle[5].bot.x1 = circle[1].bot.x1;
circle[5].bot.x2 = circle[1].bot.x2;
- circle[5].bot.y = center->y - xoffs;
+ circle[5].bot.y = center->y + xoffs;
circle[6].top.x1 = circle[5].bot.x1;
circle[6].top.x2 = circle[5].bot.x2;
diff --git a/nuttx/graphics/nxmu/nx_drawcircle.c b/nuttx/graphics/nxmu/nx_drawcircle.c
index 5403ee9ef..5a0780e1a 100644
--- a/nuttx/graphics/nxmu/nx_drawcircle.c
+++ b/nuttx/graphics/nxmu/nx_drawcircle.c
@@ -107,7 +107,7 @@
*
****************************************************************************/
-int nx_drawcircle(NXWINDOW hwnd, FAR struct nxgl_point_s *center,
+int nx_drawcircle(NXWINDOW hwnd, FAR const struct nxgl_point_s *center,
nxgl_coord_t radius, nxgl_coord_t width,
nxgl_mxpixel_t color[CONFIG_NX_NPLANES])
{
diff --git a/nuttx/graphics/nxmu/nx_fillcircle.c b/nuttx/graphics/nxmu/nx_fillcircle.c
index dc4115782..bfc1dc9e3 100644
--- a/nuttx/graphics/nxmu/nx_fillcircle.c
+++ b/nuttx/graphics/nxmu/nx_fillcircle.c
@@ -89,7 +89,7 @@
*
****************************************************************************/
-int nx_fillcircle(NXWINDOW hwnd, FAR struct nxgl_point_s *center,
+int nx_fillcircle(NXWINDOW hwnd, FAR const struct nxgl_point_s *center,
nxgl_coord_t radius, nxgl_mxpixel_t color[CONFIG_NX_NPLANES])
{
FAR struct nxgl_trapezoid_s traps[NCIRCLE_TRAPS];
diff --git a/nuttx/graphics/nxsu/nx_drawcircle.c b/nuttx/graphics/nxsu/nx_drawcircle.c
index 741886bc8..8d5c12454 100644
--- a/nuttx/graphics/nxsu/nx_drawcircle.c
+++ b/nuttx/graphics/nxsu/nx_drawcircle.c
@@ -107,7 +107,7 @@
*
****************************************************************************/
-int nx_drawcircle(NXWINDOW hwnd, FAR struct nxgl_point_s *center,
+int nx_drawcircle(NXWINDOW hwnd, FAR const struct nxgl_point_s *center,
nxgl_coord_t radius, nxgl_coord_t width,
nxgl_mxpixel_t color[CONFIG_NX_NPLANES])
{
diff --git a/nuttx/graphics/nxsu/nx_fillcircle.c b/nuttx/graphics/nxsu/nx_fillcircle.c
index 9a89c332e..12c47f80a 100644
--- a/nuttx/graphics/nxsu/nx_fillcircle.c
+++ b/nuttx/graphics/nxsu/nx_fillcircle.c
@@ -89,7 +89,7 @@
*
****************************************************************************/
-int nx_fillcircle(NXWINDOW hwnd, FAR struct nxgl_point_s *center,
+int nx_fillcircle(NXWINDOW hwnd, FAR const struct nxgl_point_s *center,
nxgl_coord_t radius, nxgl_mxpixel_t color[CONFIG_NX_NPLANES])
{
FAR struct nxgl_trapezoid_s traps[NCIRCLE_TRAPS];
diff --git a/nuttx/graphics/nxtk/nxtk_drawcircletoolbar.c b/nuttx/graphics/nxtk/nxtk_drawcircletoolbar.c
index 558b3413b..e9d9ca8ff 100644
--- a/nuttx/graphics/nxtk/nxtk_drawcircletoolbar.c
+++ b/nuttx/graphics/nxtk/nxtk_drawcircletoolbar.c
@@ -107,7 +107,7 @@
*
****************************************************************************/
-int nxtk_drawcircletoolbar(NXTKWINDOW hfwnd, FAR struct nxgl_point_s *center,
+int nxtk_drawcircletoolbar(NXTKWINDOW hfwnd, FAR const struct nxgl_point_s *center,
nxgl_coord_t radius, nxgl_coord_t width,
nxgl_mxpixel_t color[CONFIG_NX_NPLANES])
{
diff --git a/nuttx/graphics/nxtk/nxtk_drawcirclewindow.c b/nuttx/graphics/nxtk/nxtk_drawcirclewindow.c
index d4bd79a30..f70c1c351 100644
--- a/nuttx/graphics/nxtk/nxtk_drawcirclewindow.c
+++ b/nuttx/graphics/nxtk/nxtk_drawcirclewindow.c
@@ -107,7 +107,7 @@
*
****************************************************************************/
-int nxtk_drawcirclewindow(NXTKWINDOW hfwnd, FAR struct nxgl_point_s *center,
+int nxtk_drawcirclewindow(NXTKWINDOW hfwnd, FAR const struct nxgl_point_s *center,
nxgl_coord_t radius, nxgl_coord_t width,
nxgl_mxpixel_t color[CONFIG_NX_NPLANES])
{
diff --git a/nuttx/graphics/nxtk/nxtk_fillcircletoolbar.c b/nuttx/graphics/nxtk/nxtk_fillcircletoolbar.c
index d2e7e5ecb..d0bb09edd 100644
--- a/nuttx/graphics/nxtk/nxtk_fillcircletoolbar.c
+++ b/nuttx/graphics/nxtk/nxtk_fillcircletoolbar.c
@@ -89,7 +89,7 @@
*
****************************************************************************/
-int nxtk_fillcircletoolbar(NXWINDOW hfwnd, FAR struct nxgl_point_s *center,
+int nxtk_fillcircletoolbar(NXWINDOW hfwnd, FAR const struct nxgl_point_s *center,
nxgl_coord_t radius,
nxgl_mxpixel_t color[CONFIG_NX_NPLANES])
{
diff --git a/nuttx/graphics/nxtk/nxtk_fillcirclewindow.c b/nuttx/graphics/nxtk/nxtk_fillcirclewindow.c
index 4fc7fef64..34c945865 100644
--- a/nuttx/graphics/nxtk/nxtk_fillcirclewindow.c
+++ b/nuttx/graphics/nxtk/nxtk_fillcirclewindow.c
@@ -89,7 +89,7 @@
*
****************************************************************************/
-int nxtk_fillcirclewindow(NXWINDOW hfwnd, FAR struct nxgl_point_s *center,
+int nxtk_fillcirclewindow(NXWINDOW hfwnd, FAR const struct nxgl_point_s *center,
nxgl_coord_t radius,
nxgl_mxpixel_t color[CONFIG_NX_NPLANES])
{
diff --git a/nuttx/include/nuttx/nx/nx.h b/nuttx/include/nuttx/nx/nx.h
index 6912d5552..1c705e5aa 100644
--- a/nuttx/include/nuttx/nx/nx.h
+++ b/nuttx/include/nuttx/nx/nx.h
@@ -651,7 +651,7 @@ EXTERN int nx_drawline(NXWINDOW hwnd, FAR struct nxgl_vector_s *vector,
*
****************************************************************************/
-EXTERN int nx_drawcircle(NXWINDOW hwnd, FAR struct nxgl_point_s *center,
+EXTERN int nx_drawcircle(NXWINDOW hwnd, FAR const struct nxgl_point_s *center,
nxgl_coord_t radius, nxgl_coord_t width,
nxgl_mxpixel_t color[CONFIG_NX_NPLANES]);
@@ -672,7 +672,7 @@ EXTERN int nx_drawcircle(NXWINDOW hwnd, FAR struct nxgl_point_s *center,
*
****************************************************************************/
-EXTERN int nx_fillcircle(NXWINDOW hwnd, FAR struct nxgl_point_s *center,
+EXTERN int nx_fillcircle(NXWINDOW hwnd, FAR const struct nxgl_point_s *center,
nxgl_coord_t radius,
nxgl_mxpixel_t color[CONFIG_NX_NPLANES]);
diff --git a/nuttx/include/nuttx/nx/nxglib.h b/nuttx/include/nuttx/nx/nxglib.h
index 06c9eb383..95b33772b 100644
--- a/nuttx/include/nuttx/nx/nxglib.h
+++ b/nuttx/include/nuttx/nx/nxglib.h
@@ -650,7 +650,7 @@ EXTERN int nxgl_splitline(FAR struct nxgl_vector_s *vector,
*
****************************************************************************/
-EXTERN void nxgl_circlepts(FAR struct nxgl_point_s *center,
+EXTERN void nxgl_circlepts(FAR const struct nxgl_point_s *center,
nxgl_coord_t radius,
FAR struct nxgl_point_s *circle);
@@ -672,7 +672,7 @@ EXTERN void nxgl_circlepts(FAR struct nxgl_point_s *center,
*
****************************************************************************/
-EXTERN void nxgl_circletraps(FAR struct nxgl_point_s *center,
+EXTERN void nxgl_circletraps(FAR const struct nxgl_point_s *center,
nxgl_coord_t radius,
FAR struct nxgl_trapezoid_s *circle);
diff --git a/nuttx/include/nuttx/nx/nxtk.h b/nuttx/include/nuttx/nx/nxtk.h
index 6a288c37a..0e066359a 100644
--- a/nuttx/include/nuttx/nx/nxtk.h
+++ b/nuttx/include/nuttx/nx/nxtk.h
@@ -283,7 +283,7 @@ EXTERN int nxtk_drawlinewindow(NXTKWINDOW hfwnd,
****************************************************************************/
EXTERN int nxtk_drawcirclewindow(NXTKWINDOW hfwnd,
- FAR struct nxgl_point_s *center,
+ FAR const struct nxgl_point_s *center,
nxgl_coord_t radius, nxgl_coord_t width,
nxgl_mxpixel_t color[CONFIG_NX_NPLANES]);
@@ -305,7 +305,7 @@ EXTERN int nxtk_drawcirclewindow(NXTKWINDOW hfwnd,
****************************************************************************/
EXTERN int nxtk_fillcirclewindow(NXWINDOW hfwnd,
- FAR struct nxgl_point_s *center,
+ FAR const struct nxgl_point_s *center,
nxgl_coord_t radius,
nxgl_mxpixel_t color[CONFIG_NX_NPLANES]);
@@ -478,7 +478,7 @@ EXTERN int nxtk_drawlinetoolbar(NXTKWINDOW hfwnd,
****************************************************************************/
EXTERN int nxtk_drawcircletoolbar(NXTKWINDOW hfwnd,
- FAR struct nxgl_point_s *center,
+ FAR const struct nxgl_point_s *center,
nxgl_coord_t radius, nxgl_coord_t width,
nxgl_mxpixel_t color[CONFIG_NX_NPLANES]);
@@ -500,7 +500,7 @@ EXTERN int nxtk_drawcircletoolbar(NXTKWINDOW hfwnd,
****************************************************************************/
EXTERN int nxtk_fillcircletoolbar(NXWINDOW hfwnd,
- FAR struct nxgl_point_s *center,
+ FAR const struct nxgl_point_s *center,
nxgl_coord_t radius,
nxgl_mxpixel_t color[CONFIG_NX_NPLANES]);