summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2015-04-05 16:53:51 -0600
committerGregory Nutt <gnutt@nuttx.org>2015-04-05 16:53:51 -0600
commitec42edd81103a59e86de6ffc4395440dc90bb4ee (patch)
tree5ba06374d0938b86b30231fdab05f6bceecc0912
parent55a5cab48f8c7694856296096ed2dec568e12ba7 (diff)
downloadpx4-nuttx-ec42edd81103a59e86de6ffc4395440dc90bb4ee.tar.gz
px4-nuttx-ec42edd81103a59e86de6ffc4395440dc90bb4ee.tar.bz2
px4-nuttx-ec42edd81103a59e86de6ffc4395440dc90bb4ee.zip
drawline/drawLine should not take a boolean to select non lines caps or capping at both ends. drawline/drawLine also needs to be able to put a line cap on one one end of a line
-rw-r--r--NxWidgets/libnxwidgets/include/cbgwindow.hxx4
-rw-r--r--NxWidgets/libnxwidgets/include/cgraphicsport.hxx4
-rw-r--r--NxWidgets/libnxwidgets/include/cnxtkwindow.hxx4
-rw-r--r--NxWidgets/libnxwidgets/include/cnxtoolbar.hxx4
-rw-r--r--NxWidgets/libnxwidgets/include/cnxwindow.hxx4
-rw-r--r--NxWidgets/libnxwidgets/include/inxwindow.hxx12
-rw-r--r--NxWidgets/libnxwidgets/src/cbgwindow.cxx6
-rw-r--r--NxWidgets/libnxwidgets/src/cgraphicsport.cxx6
-rw-r--r--NxWidgets/libnxwidgets/src/cnxtkwindow.cxx6
-rw-r--r--NxWidgets/libnxwidgets/src/cnxtoolbar.cxx6
-rw-r--r--NxWidgets/libnxwidgets/src/cnxwindow.cxx6
-rw-r--r--apps/examples/nxlines/nxlines_bkgd.c6
-rw-r--r--nuttx/Documentation/NXGraphicsSubsystem.html45
-rw-r--r--nuttx/include/nuttx/nx/nx.h34
-rw-r--r--nuttx/include/nuttx/nx/nxtk.h8
-rw-r--r--nuttx/libnx/nx/nx_drawcircle.c12
-rw-r--r--nuttx/libnx/nx/nx_drawline.c17
-rw-r--r--nuttx/libnx/nxtk/nxtk_drawcircletoolbar.c11
-rw-r--r--nuttx/libnx/nxtk/nxtk_drawcirclewindow.c11
-rw-r--r--nuttx/libnx/nxtk/nxtk_drawlinetoolbar.c17
-rw-r--r--nuttx/libnx/nxtk/nxtk_drawlinewindow.c17
21 files changed, 138 insertions, 102 deletions
diff --git a/NxWidgets/libnxwidgets/include/cbgwindow.hxx b/NxWidgets/libnxwidgets/include/cbgwindow.hxx
index 8a63633bd..41184e43e 100644
--- a/NxWidgets/libnxwidgets/include/cbgwindow.hxx
+++ b/NxWidgets/libnxwidgets/include/cbgwindow.hxx
@@ -285,7 +285,7 @@ namespace NXWidgets
* @param vector - Describes the line to be drawn
* @param width - The width of the line
* @param color - The color to use to fill the line
- * @param capped - Draw a circular cap both ends of the line to support
+ * @param caps - Draw a circular cap on the ends of the line to support
* better line joins
*
* @return True on success; false on failure.
@@ -293,7 +293,7 @@ namespace NXWidgets
bool drawLine(FAR struct nxgl_vector_s *vector,
nxgl_coord_t width, nxgl_mxpixel_t color,
- bool capped);
+ enum ELineCaps caps);
/**
* Draw a filled circle at the specified position, size, and color.
diff --git a/NxWidgets/libnxwidgets/include/cgraphicsport.hxx b/NxWidgets/libnxwidgets/include/cgraphicsport.hxx
index 4d529c94d..df250f478 100644
--- a/NxWidgets/libnxwidgets/include/cgraphicsport.hxx
+++ b/NxWidgets/libnxwidgets/include/cgraphicsport.hxx
@@ -242,13 +242,13 @@ namespace NXWidgets
* @param x2 The x coordinate of the end point of the line.
* @param y2 The y coordinate of the end point of the line.
* @param color The color of the line.
- * @param capped Draw a circular cap both ends of the line to support
+ * @param caps Draw a circular cap on the ends of the line to support
* better line joins
*/
void drawLine(nxgl_coord_t x1, nxgl_coord_t y1,
nxgl_coord_t x2, nxgl_coord_t y2,
- nxgl_mxpixel_t color, bool capped);
+ nxgl_mxpixel_t color, enum INxWindow::ELineCaps caps);
/**
* Draw a filled rectangle of the specified start position, end position,
diff --git a/NxWidgets/libnxwidgets/include/cnxtkwindow.hxx b/NxWidgets/libnxwidgets/include/cnxtkwindow.hxx
index 1ac801b95..bf0af4ad0 100644
--- a/NxWidgets/libnxwidgets/include/cnxtkwindow.hxx
+++ b/NxWidgets/libnxwidgets/include/cnxtkwindow.hxx
@@ -306,7 +306,7 @@ namespace NXWidgets
* @param vector - Describes the line to be drawn
* @param width - The width of the line
* @param color - The color to use to fill the line
- * @param capped - Draw a circular cap both ends of the line to support
+ * @param caps - Draw a circular cap on the ends of the line to support
* better line joins
*
* @return True on success; false on failure.
@@ -314,7 +314,7 @@ namespace NXWidgets
bool drawLine(FAR struct nxgl_vector_s *vector,
nxgl_coord_t width, nxgl_mxpixel_t color,
- bool capped);
+ enum ELineCaps caps);
/**
* Draw a filled circle at the specified position, size, and color.
diff --git a/NxWidgets/libnxwidgets/include/cnxtoolbar.hxx b/NxWidgets/libnxwidgets/include/cnxtoolbar.hxx
index c7107678e..6d16bad3e 100644
--- a/NxWidgets/libnxwidgets/include/cnxtoolbar.hxx
+++ b/NxWidgets/libnxwidgets/include/cnxtoolbar.hxx
@@ -275,7 +275,7 @@ namespace NXWidgets
* @param vector - Describes the line to be drawn
* @param width - The width of the line
* @param color - The color to use to fill the line
- * @param capped - Draw a circular cap both ends of the line to suppor
+ * @param caps - Draw a circular cap on the ends of the line to suppor
* better line joins
*
* @return True on success; false on failure.
@@ -283,7 +283,7 @@ namespace NXWidgets
bool drawLine(FAR struct nxgl_vector_s *vector,
nxgl_coord_t width, nxgl_mxpixel_t color,
- bool capped);
+ enum ELineCaps caps);
/**
* Draw a filled circle at the specified position, size, and color.
diff --git a/NxWidgets/libnxwidgets/include/cnxwindow.hxx b/NxWidgets/libnxwidgets/include/cnxwindow.hxx
index 21a077954..092c38c32 100644
--- a/NxWidgets/libnxwidgets/include/cnxwindow.hxx
+++ b/NxWidgets/libnxwidgets/include/cnxwindow.hxx
@@ -279,7 +279,7 @@ namespace NXWidgets
* @param vector - Describes the line to be drawn
* @param width - The width of the line
* @param color - The color to use to fill the line
- * @param capped - Draw a circular cap both ends of the line to support
+ * @param caps - Draw a circular cap on the ends of the line to support
* better line joins
*
* @return True on success; false on failure.
@@ -287,7 +287,7 @@ namespace NXWidgets
bool drawLine(FAR struct nxgl_vector_s *vector,
nxgl_coord_t width, nxgl_mxpixel_t color,
- bool capped);
+ enum ELineCaps caps);
/**
* Draw a filled circle at the specified position, size, and color.
diff --git a/NxWidgets/libnxwidgets/include/inxwindow.hxx b/NxWidgets/libnxwidgets/include/inxwindow.hxx
index 23b99fe90..95de31cd8 100644
--- a/NxWidgets/libnxwidgets/include/inxwindow.hxx
+++ b/NxWidgets/libnxwidgets/include/inxwindow.hxx
@@ -83,6 +83,14 @@ namespace NXWidgets
class INxWindow
{
public:
+ enum ELineCaps
+ {
+ LINECAP_NONE = NX_LINECAP_NONE, // No line caps
+ LINECAP_PT1 = NX_LINECAP_PT1, // Line cap on pt1 of the vector only
+ LINECAP_PT2 = NX_LINECAP_PT2, // Line cap on pt2 of the vector only
+ LINECAP_BOTH = NX_LINECAP_BOTH // Line cap on both ends of the vector only
+ };
+
/**
* A virtual destructor is required in order to override the INxWindow
* destructor. We do this because if we delete INxWindow, we want the
@@ -249,7 +257,7 @@ namespace NXWidgets
* @param vector - Describes the line to be drawn
* @param width - The width of the line
* @param color - The color to use to fill the line
- * @param capped - Draw a circular cap both ends of the line to support
+ * @param caps - Draw a circular cap on the ends of the line to support
* better line joins
*
* @return True on success; false on failure.
@@ -257,7 +265,7 @@ namespace NXWidgets
virtual bool drawLine(FAR struct nxgl_vector_s *vector,
nxgl_coord_t width, nxgl_mxpixel_t color,
- bool capped) = 0;
+ enum ELineCaps caps) = 0;
/**
* Draw a filled circle at the specified position, size, and color.
diff --git a/NxWidgets/libnxwidgets/src/cbgwindow.cxx b/NxWidgets/libnxwidgets/src/cbgwindow.cxx
index 979cb3aeb..6c849aacf 100644
--- a/NxWidgets/libnxwidgets/src/cbgwindow.cxx
+++ b/NxWidgets/libnxwidgets/src/cbgwindow.cxx
@@ -308,7 +308,7 @@ bool CBgWindow::fillTrapezoid(FAR const struct nxgl_rect_s *pClip,
* @param vector - Describes the line to be drawn
* @param width - The width of the line
* @param color - The color to use to fill the line
- * @param capped - Draw a circular cap both ends of the line to support
+ * @param caps - Draw a circular cap on the ends of the line to support
* better line joins
*
* @return True on success; false on failure.
@@ -316,11 +316,11 @@ bool CBgWindow::fillTrapezoid(FAR const struct nxgl_rect_s *pClip,
bool CBgWindow::drawLine(FAR struct nxgl_vector_s *vector,
nxgl_coord_t width, nxgl_mxpixel_t color,
- bool capped)
+ enum ELineCaps caps)
{
// Draw a line with the specified color
- return nx_drawline(m_hWindow, vector, width, &color, capped) == OK;
+ return nx_drawline(m_hWindow, vector, width, &color, (uint8_t)caps) == OK;
}
/**
diff --git a/NxWidgets/libnxwidgets/src/cgraphicsport.cxx b/NxWidgets/libnxwidgets/src/cgraphicsport.cxx
index d3fcdd3b5..62e3a6eb0 100644
--- a/NxWidgets/libnxwidgets/src/cgraphicsport.cxx
+++ b/NxWidgets/libnxwidgets/src/cgraphicsport.cxx
@@ -246,13 +246,13 @@ void CGraphicsPort::drawVertLine(nxgl_coord_t x, nxgl_coord_t y,
* @param x2 - The x coordinate of the end point of the line.
* @param y2 - The y coordinate of the end point of the line.
* @param color - The color of the line.
- * @param capped - Draw a circular cap both ends of the line to support
+ * @param caps - Draw a circular cap one the ends of the line to support
* - better line joins
*/
void CGraphicsPort::drawLine(nxgl_coord_t x1, nxgl_coord_t y1,
nxgl_coord_t x2, nxgl_coord_t y2,
- nxgl_mxpixel_t color, bool capped)
+ nxgl_mxpixel_t color, enum INxWindow::ELineCaps caps)
{
struct nxgl_vector_s vector;
@@ -261,7 +261,7 @@ void CGraphicsPort::drawLine(nxgl_coord_t x1, nxgl_coord_t y1,
vector.pt2.x = x2;
vector.pt2.y = y2;
- if (!m_pNxWnd->drawLine(&vector, 1, color, capped))
+ if (!m_pNxWnd->drawLine(&vector, 1, color, caps))
{
gdbg("INxWindow::drawLine failed\n");
}
diff --git a/NxWidgets/libnxwidgets/src/cnxtkwindow.cxx b/NxWidgets/libnxwidgets/src/cnxtkwindow.cxx
index 14e07dbbb..fecedbb5a 100644
--- a/NxWidgets/libnxwidgets/src/cnxtkwindow.cxx
+++ b/NxWidgets/libnxwidgets/src/cnxtkwindow.cxx
@@ -442,7 +442,7 @@ bool CNxTkWindow::fillTrapezoid(FAR const struct nxgl_rect_s *pClip,
* @param vector - Describes the line to be drawn
* @param width - The width of the line
* @param color - The color to use to fill the line
- * @param capped - Draw a circular cap both ends of the line to support
+ * @param caps - Draw a circular cap on both ends of the line to support
* better line joins
*
* @return True on success; false on failure.
@@ -450,11 +450,11 @@ bool CNxTkWindow::fillTrapezoid(FAR const struct nxgl_rect_s *pClip,
bool CNxTkWindow::drawLine(FAR struct nxgl_vector_s *vector,
nxgl_coord_t width, nxgl_mxpixel_t color,
- bool capped)
+ enum ELineCaps caps)
{
// Draw a line with the specified color
- return nxtk_drawlinewindow(m_hNxTkWindow, vector, width, &color, capped) == OK;
+ return nxtk_drawlinewindow(m_hNxTkWindow, vector, width, &color, (uint8_t)caps) == OK;
}
/**
diff --git a/NxWidgets/libnxwidgets/src/cnxtoolbar.cxx b/NxWidgets/libnxwidgets/src/cnxtoolbar.cxx
index 01b72e32f..3c4e22a32 100644
--- a/NxWidgets/libnxwidgets/src/cnxtoolbar.cxx
+++ b/NxWidgets/libnxwidgets/src/cnxtoolbar.cxx
@@ -313,7 +313,7 @@ bool CNxToolbar::fillTrapezoid(FAR const struct nxgl_rect_s *pClip,
* @param vector - Describes the line to be drawn
* @param width - The width of the line
* @param color - The color to use to fill the line
- * @param capped - Draw a circular cap both ends of the line to support
+ * @param caps - Draw a circular cap on the ends of the line to support
* better line joins
*
* @return True on success; false on failure.
@@ -321,11 +321,11 @@ bool CNxToolbar::fillTrapezoid(FAR const struct nxgl_rect_s *pClip,
bool CNxToolbar::drawLine(FAR struct nxgl_vector_s *vector,
nxgl_coord_t width, nxgl_mxpixel_t color,
- bool capped)
+ enum ELineCaps caps)
{
// Draw a line with the specified color
- return nxtk_drawlinetoolbar(m_hNxTkWindow, vector, width, &color, capped) == OK;
+ return nxtk_drawlinetoolbar(m_hNxTkWindow, vector, width, &color, (uint8_t)caps) == OK;
}
/**
diff --git a/NxWidgets/libnxwidgets/src/cnxwindow.cxx b/NxWidgets/libnxwidgets/src/cnxwindow.cxx
index c600ecd1b..ba558bac0 100644
--- a/NxWidgets/libnxwidgets/src/cnxwindow.cxx
+++ b/NxWidgets/libnxwidgets/src/cnxwindow.cxx
@@ -286,7 +286,7 @@ bool CNxWindow::fillTrapezoid(FAR const struct nxgl_rect_s *pClip,
* @param vector - Describes the line to be drawn
* @param width - The width of the line
* @param color - The color to use to fill the line
- * @param capped - Draw a circular cap both ends of the line to support
+ * @param caps - Draw a circular cap on the ends of the line to support
* better line joins
*
* @return True on success; false on failure.
@@ -294,11 +294,11 @@ bool CNxWindow::fillTrapezoid(FAR const struct nxgl_rect_s *pClip,
bool CNxWindow::drawLine(FAR struct nxgl_vector_s *vector,
nxgl_coord_t width, nxgl_mxpixel_t color,
- bool capped)
+ enum ELineCaps caps)
{
// Draw a line with the specified color
- return nx_drawline(m_hNxWindow, vector, width, &color, capped) == OK;
+ return nx_drawline(m_hNxWindow, vector, width, &color, (uint8_t)caps) == OK;
}
/**
diff --git a/apps/examples/nxlines/nxlines_bkgd.c b/apps/examples/nxlines/nxlines_bkgd.c
index 42cd98451..c40331e46 100644
--- a/apps/examples/nxlines/nxlines_bkgd.c
+++ b/apps/examples/nxlines/nxlines_bkgd.c
@@ -294,7 +294,8 @@ void nxlines_test(NXWINDOW hwnd)
color[0] = CONFIG_EXAMPLES_NXLINES_CIRCLECOLOR;
ret = nx_drawline((NXWINDOW)hwnd, &previous,
- CONFIG_EXAMPLES_NXLINES_LINEWIDTH, color, false);
+ CONFIG_EXAMPLES_NXLINES_LINEWIDTH, color,
+ NX_LINECAP_NONE);
if (ret < 0)
{
printf("nxlines_test: nx_drawline failed clearing: %d\n", ret);
@@ -304,7 +305,8 @@ void nxlines_test(NXWINDOW hwnd)
color[0] = CONFIG_EXAMPLES_NXLINES_LINECOLOR;
ret = nx_drawline((NXWINDOW)hwnd, &vector,
- CONFIG_EXAMPLES_NXLINES_LINEWIDTH, color, false);
+ CONFIG_EXAMPLES_NXLINES_LINEWIDTH, color,
+ NX_LINECAP_NONE);
if (ret < 0)
{
printf("nxlines_test: nx_drawline failed clearing: %d\n", ret);
diff --git a/nuttx/Documentation/NXGraphicsSubsystem.html b/nuttx/Documentation/NXGraphicsSubsystem.html
index d13a115b5..dd866bd67 100644
--- a/nuttx/Documentation/NXGraphicsSubsystem.html
+++ b/nuttx/Documentation/NXGraphicsSubsystem.html
@@ -1760,7 +1760,7 @@ int nx_filltrapezoid(NXWINDOW hwnd, FAR const struct nxgl_rect_s *clip,
int nx_drawline(NXWINDOW hwnd, FAR struct nxgl_vector_s *vector,
nxgl_coord_t width, nxgl_mxpixel_t color[CONFIG_NX_NPLANES],
- bool capped);
+ uint8_t caps);
</pre></ul>
<p>
<b>Description:</b>
@@ -1781,8 +1781,17 @@ int nx_drawline(NXWINDOW hwnd, FAR struct nxgl_vector_s *vector,
<dd>The width of the line
<dt><code>color</code>
<dd>The color to use to fill the line
- <dt><code>capped</code>
- <dd>Draw a circular cap both ends of the line to support better line joins
+ <dt><code>caps</code>
+ <dd>Draw a circular cap on the ends of the line to support better line joins.
+ One of:
+<ul><pre>
+/* Line caps */
+
+#define NX_LINECAP_NONE 0x00, /* No line caps */
+#define NX_LINECAP_PT1 0x01 /* Line cap on pt1 on of the vector only */
+#define NX_LINECAP_PT2 0x02 /* Line cap on pt2 on of the vector only */
+#define NX_LINECAP_BOTH 0x03 /* Line cap on both ends of the vector only */
+</pre></ul>
</dl></ul>
</p>
<p>
@@ -2389,7 +2398,7 @@ int nxtk_filltrapwindow(NXTKWINDOW hfwnd,
int nxtk_drawlinewindow(NXTKWINDOW hfwnd, FAR struct nxgl_vector_s *vector,
nxgl_coord_t width, nxgl_mxpixel_t color[CONFIG_NX_NPLANES],
- bool capped);
+ uint8_t caps);
</pre></ul>
<p>
<b>Description:</b>
@@ -2410,8 +2419,17 @@ int nxtk_drawlinewindow(NXTKWINDOW hfwnd, FAR struct nxgl_vector_s *vector,
<dd>The width of the line
<dt><code>color</code>
<dd>The color to use to fill the line
- <dt><code>capped</code>
- <dd>Draw a circular cap both ends of the line to support better line joins
+ <dt><code>caps</code>
+ <dd>Draw a circular cap on the ends of the line to support better line joins.
+ One of:
+<ul><pre>
+/* Line caps */
+
+#define NX_LINECAP_NONE 0x00, /* No line caps */
+#define NX_LINECAP_PT1 0x01 /* Line cap on pt1 on of the vector only */
+#define NX_LINECAP_PT2 0x02 /* Line cap on pt2 on of the vector only */
+#define NX_LINECAP_BOTH 0x03 /* Line cap on both ends of the vector only */
+</pre></ul>
</dl></ul>
</p>
<p>
@@ -2745,7 +2763,7 @@ int nxtk_filltraptoolbar(NXTKWINDOW hfwnd, FAR const struct nxgl_trapezoid_s *tr
int nxtk_drawlinetoolbar(NXTKWINDOW hfwnd, FAR struct nxgl_vector_s *vector,
nxgl_coord_t width, nxgl_mxpixel_t color[CONFIG_NX_NPLANES],
- capped);
+ uint8_t caps);
</pre></ul>
<p>
@@ -2766,8 +2784,17 @@ int nxtk_drawlinetoolbar(NXTKWINDOW hfwnd, FAR struct nxgl_vector_s *vector,
<dd>The width of the line
<dt><code>color</code>
<dd>The color to use to fill the line
- <dt><code>capped</code>
- <dd>Draw a circular cap both ends of the line to support better line joins
+ <dt><code>caps</code>
+ <dd>Draw a circular cap on the ends of the line to support better line joins.
+ One of:
+<ul><pre>
+/* Line caps */
+
+#define NX_LINECAP_NONE 0x00, /* No line caps */
+#define NX_LINECAP_PT1 0x01 /* Line cap on pt1 on of the vector only */
+#define NX_LINECAP_PT2 0x02 /* Line cap on pt2 on of the vector only */
+#define NX_LINECAP_BOTH 0x03 /* Line cap on both ends of the vector only */
+</pre></ul>
</dl></ul>
</p>
<p>
diff --git a/nuttx/include/nuttx/nx/nx.h b/nuttx/include/nuttx/nx/nx.h
index 6f8077f61..75890b846 100644
--- a/nuttx/include/nuttx/nx/nx.h
+++ b/nuttx/include/nuttx/nx/nx.h
@@ -50,6 +50,17 @@
/****************************************************************************
* Pre-Processor Definitions
****************************************************************************/
+/* Configuration ************************************************************/
+
+#ifndef CONFIG_NX_NPLANES
+# define CONFIG_NX_NPLANES 1 /* Max number of color planes supported */
+#endif
+
+/* Check if the underlying graphic device supports read operations */
+
+#if !defined(CONFIG_NX_WRITEONLY) && defined(CONFIG_NX_LCDDRIVER) && defined(CONFIG_LCD_NOGETRUN)
+# define CONFIG_NX_WRITEONLY 1
+#endif
/* Default server MQ name used by nx_run() macro */
@@ -62,21 +73,16 @@
#define NX_MOUSE_CENTERBUTTON 0x02
#define NX_MOUSE_RIGHTBUTTON 0x04
+/* Line caps */
+
+#define NX_LINECAP_NONE 0x00 /* No line caps */
+#define NX_LINECAP_PT1 0x01 /* Line cap on pt1 of the vector only */
+#define NX_LINECAP_PT2 0x02 /* Line cap on pt2 of the vector only */
+#define NX_LINECAP_BOTH 0x03 /* Line cap on both ends of the vector only */
+
/****************************************************************************
* Public Types
****************************************************************************/
-/* Configuration ************************************************************/
-
-#ifndef CONFIG_NX_NPLANES
-# define CONFIG_NX_NPLANES 1 /* Max number of color planes supported */
-#endif
-
-/* Check if the underlying graphic device supports read operations */
-
-#if !defined(CONFIG_NX_WRITEONLY) && defined(CONFIG_NX_LCDDRIVER) && defined(CONFIG_LCD_NOGETRUN)
-# define CONFIG_NX_WRITEONLY 1
-#endif
-
/* Handles ******************************************************************/
/* The interface to the NX server is managed using a opaque handle: */
@@ -776,7 +782,7 @@ int nx_filltrapezoid(NXWINDOW hwnd, FAR const struct nxgl_rect_s *clip,
* vector - Describes the line to be drawn
* width - The width of the line
* color - The color to use to fill the line
- * capped - Draw a circular cap both ends of the line to support better
+ * caps - Draw a circular on the both ends of the line to support better
* line joins
*
* Return:
@@ -786,7 +792,7 @@ int nx_filltrapezoid(NXWINDOW hwnd, FAR const struct nxgl_rect_s *clip,
int nx_drawline(NXWINDOW hwnd, FAR struct nxgl_vector_s *vector,
nxgl_coord_t width, nxgl_mxpixel_t color[CONFIG_NX_NPLANES],
- bool capped);
+ uint8_t caps);
/****************************************************************************
* Name: nx_drawcircle
diff --git a/nuttx/include/nuttx/nx/nxtk.h b/nuttx/include/nuttx/nx/nxtk.h
index 7b7d76212..d478d8c1a 100644
--- a/nuttx/include/nuttx/nx/nxtk.h
+++ b/nuttx/include/nuttx/nx/nxtk.h
@@ -354,7 +354,7 @@ EXTERN int nxtk_filltrapwindow(NXTKWINDOW hfwnd,
* vector - Describes the line to be drawn
* width - The width of the line
* color - The color to use to fill the line
- * capped - Draw a circular cap both ends of the line to support better
+ * caps - Draw a circular cap the ends of the line to support better
* line joins
*
* Return:
@@ -366,7 +366,7 @@ EXTERN int nxtk_drawlinewindow(NXTKWINDOW hfwnd,
FAR struct nxgl_vector_s *vector,
nxgl_coord_t width,
nxgl_mxpixel_t color[CONFIG_NX_NPLANES],
- bool capped);
+ uint8_t caps);
/****************************************************************************
* Name: nxtk_drawcirclewindow
@@ -601,7 +601,7 @@ EXTERN int nxtk_filltraptoolbar(NXTKWINDOW hfwnd, FAR const struct nxgl_trapezoi
* vector - Describes the line to be drawn
* width - The width of the line
* color - The color to use to fill the line
- * capped - Draw a circular cap both ends of the line to support better
+ * caps - Draw a circular cap on the ends of the line to support better
* line joins
*
* Return:
@@ -613,7 +613,7 @@ EXTERN int nxtk_drawlinetoolbar(NXTKWINDOW hfwnd,
FAR struct nxgl_vector_s *vector,
nxgl_coord_t width,
nxgl_mxpixel_t color[CONFIG_NX_NPLANES],
- bool capped);
+ uint8_t caps);
/****************************************************************************
* Name: nxtk_drawcircletoolbar
diff --git a/nuttx/libnx/nx/nx_drawcircle.c b/nuttx/libnx/nx/nx_drawcircle.c
index ab2c85ea9..c06413b45 100644
--- a/nuttx/libnx/nx/nx_drawcircle.c
+++ b/nuttx/libnx/nx/nx_drawcircle.c
@@ -113,7 +113,6 @@ int nx_drawcircle(NXWINDOW hwnd, FAR const struct nxgl_point_s *center,
{
struct nxgl_point_s pts[NCIRCLE_POINTS];
FAR struct nxgl_vector_s vector;
- bool capped;
int i;
int ret;
@@ -123,7 +122,6 @@ int nx_drawcircle(NXWINDOW hwnd, FAR const struct nxgl_point_s *center,
/* Draw each pair of points as a vector */
- capped = false;
for (i = POINT_0p0; i < POINT_337p5; i++)
{
/* Draw one line segment */
@@ -133,17 +131,11 @@ int nx_drawcircle(NXWINDOW hwnd, FAR const struct nxgl_point_s *center,
vector.pt2.x = pts[i+1].x;
vector.pt2.y = pts[i+1].y;
- ret = nx_drawline(hwnd, &vector, width, color, capped);
+ ret = nx_drawline(hwnd, &vector, width, color, NX_LINECAP_PT1);
if (ret != OK)
{
return ret;
}
-
- /* Every other line segment needs to have a circular line caps to join
- * cleanly with the surround lines segments without line caps.
- */
-
- capped = !capped;
}
/* The final, closing vector is a special case */
@@ -152,5 +144,5 @@ int nx_drawcircle(NXWINDOW hwnd, FAR const struct nxgl_point_s *center,
vector.pt1.y = pts[POINT_337p5].y;
vector.pt2.x = pts[POINT_0p0].x;
vector.pt2.y = pts[POINT_0p0].y;
- return nx_drawline(hwnd, &vector, width, color, capped);
+ return nx_drawline(hwnd, &vector, width, color, NX_LINECAP_PT1);
}
diff --git a/nuttx/libnx/nx/nx_drawline.c b/nuttx/libnx/nx/nx_drawline.c
index 162dd1538..49046be94 100644
--- a/nuttx/libnx/nx/nx_drawline.c
+++ b/nuttx/libnx/nx/nx_drawline.c
@@ -83,7 +83,7 @@
* vector - Describes the line to be drawn
* width - The width of the line
* color - The color to use to fill the line
- * capped - Draw a circular cap both ends of the line to support better
+ * caps - Draw a circular cap on the ends of the line to support better
* line joins
*
* Return:
@@ -93,7 +93,7 @@
int nx_drawline(NXWINDOW hwnd, FAR struct nxgl_vector_s *vector,
nxgl_coord_t width, nxgl_mxpixel_t color[CONFIG_NX_NPLANES],
- bool capped)
+ uint8_t caps)
{
struct nxgl_trapezoid_s trap[3];
struct nxgl_rect_s rect;
@@ -153,17 +153,22 @@ int nx_drawline(NXWINDOW hwnd, FAR struct nxgl_vector_s *vector,
/* Draw circular caps at each end of the line to support better line joins */
- if (capped && width >= 3)
+ if (caps != NX_LINECAP_NONE && width >= 3)
{
nxgl_coord_t radius = width >> 1;
/* Draw a circle at pt1 */
- ret = nx_fillcircle(hwnd, &vector->pt1, radius, color);
- if (ret == OK)
+ ret = OK;
+ if ((caps & NX_LINECAP_PT1) != 0)
{
- /* Draw a circle at pt2 */
+ ret = nx_fillcircle(hwnd, &vector->pt1, radius, color);
+ }
+
+ /* Draw a circle at pt2 */
+ if (ret == OK && (caps & NX_LINECAP_PT2) != 0)
+ {
ret = nx_fillcircle(hwnd, &vector->pt2, radius, color);
}
}
diff --git a/nuttx/libnx/nxtk/nxtk_drawcircletoolbar.c b/nuttx/libnx/nxtk/nxtk_drawcircletoolbar.c
index 390e0e5b5..37998b70f 100644
--- a/nuttx/libnx/nxtk/nxtk_drawcircletoolbar.c
+++ b/nuttx/libnx/nxtk/nxtk_drawcircletoolbar.c
@@ -113,7 +113,6 @@ int nxtk_drawcircletoolbar(NXTKWINDOW hfwnd, FAR const struct nxgl_point_s *cent
{
struct nxgl_point_s pts[NCIRCLE_POINTS];
FAR struct nxgl_vector_s vector;
- bool capped;
int i;
int ret;
@@ -132,17 +131,11 @@ int nxtk_drawcircletoolbar(NXTKWINDOW hfwnd, FAR const struct nxgl_point_s *cent
vector.pt2.x = pts[i+1].x;
vector.pt2.y = pts[i+1].y;
- ret = nxtk_drawlinetoolbar(hfwnd, &vector, width, color, capped);
+ ret = nxtk_drawlinetoolbar(hfwnd, &vector, width, color, NX_LINECAP_PT1);
if (ret != OK)
{
return ret;
}
-
- /* Every other line segment needs to have a circular line caps to join
- * cleanly with the surround lines segments without line caps.
- */
-
- capped = !capped;
}
/* The final, closing vector is a special case */
@@ -151,5 +144,5 @@ int nxtk_drawcircletoolbar(NXTKWINDOW hfwnd, FAR const struct nxgl_point_s *cent
vector.pt1.y = pts[POINT_337p5].y;
vector.pt2.x = pts[POINT_0p0].x;
vector.pt2.y = pts[POINT_0p0].y;
- return nxtk_drawlinetoolbar(hfwnd, &vector, width, color, capped);
+ return nxtk_drawlinetoolbar(hfwnd, &vector, width, color, NX_LINECAP_PT1);
}
diff --git a/nuttx/libnx/nxtk/nxtk_drawcirclewindow.c b/nuttx/libnx/nxtk/nxtk_drawcirclewindow.c
index dadf4f41f..3f6cdd288 100644
--- a/nuttx/libnx/nxtk/nxtk_drawcirclewindow.c
+++ b/nuttx/libnx/nxtk/nxtk_drawcirclewindow.c
@@ -113,7 +113,6 @@ int nxtk_drawcirclewindow(NXTKWINDOW hfwnd, FAR const struct nxgl_point_s *cente
{
struct nxgl_point_s pts[NCIRCLE_POINTS];
FAR struct nxgl_vector_s vector;
- bool capped;
int i;
int ret;
@@ -132,17 +131,11 @@ int nxtk_drawcirclewindow(NXTKWINDOW hfwnd, FAR const struct nxgl_point_s *cente
vector.pt2.x = pts[i+1].x;
vector.pt2.y = pts[i+1].y;
- ret = nxtk_drawlinewindow(hfwnd, &vector, width, color, capped);
+ ret = nxtk_drawlinewindow(hfwnd, &vector, width, color, NX_LINECAP_PT1);
if (ret != OK)
{
return ret;
}
-
- /* Every other line segment needs to have a circular line caps to join
- * cleanly with the surround lines segments without line caps.
- */
-
- capped = !capped;
}
/* The final, closing vector is a special case */
@@ -151,5 +144,5 @@ int nxtk_drawcirclewindow(NXTKWINDOW hfwnd, FAR const struct nxgl_point_s *cente
vector.pt1.y = pts[POINT_337p5].y;
vector.pt2.x = pts[POINT_0p0].x;
vector.pt2.y = pts[POINT_0p0].y;
- return nxtk_drawlinewindow(hfwnd, &vector, width, color, capped);
+ return nxtk_drawlinewindow(hfwnd, &vector, width, color, NX_LINECAP_PT1);
}
diff --git a/nuttx/libnx/nxtk/nxtk_drawlinetoolbar.c b/nuttx/libnx/nxtk/nxtk_drawlinetoolbar.c
index 61cef31d3..bd7744725 100644
--- a/nuttx/libnx/nxtk/nxtk_drawlinetoolbar.c
+++ b/nuttx/libnx/nxtk/nxtk_drawlinetoolbar.c
@@ -85,7 +85,7 @@
* vector - Describes the line to be drawn
* width - The width of the line
* color - The color to use to fill the line
- * capped - Draw a circular cap both ends of the line to support better
+ * caps - Draw a circular cap on the ends of the line to support better
* line joins
*
* Return:
@@ -95,7 +95,7 @@
int nxtk_drawlinetoolbar(NXTKWINDOW hfwnd, FAR struct nxgl_vector_s *vector,
nxgl_coord_t width, nxgl_mxpixel_t color[CONFIG_NX_NPLANES],
- bool capped)
+ uint8_t caps)
{
struct nxgl_trapezoid_s trap[3];
@@ -156,17 +156,22 @@ int nxtk_drawlinetoolbar(NXTKWINDOW hfwnd, FAR struct nxgl_vector_s *vector,
/* Draw circular caps at each end of the line to support better line joins */
- if (capped && width >= 3)
+ if (caps != NX_LINECAP_NONE && width >= 3)
{
nxgl_coord_t radius = width >> 1;
/* Draw a circle at pt1 */
- ret = nxtk_fillcircletoolbar(hfwnd, &vector->pt1, radius, color);
- if (ret == OK)
+ ret = OK;
+ if ((caps & NX_LINECAP_PT1) != 0)
{
- /* Draw a circle at pt2 */
+ ret = nxtk_fillcircletoolbar(hfwnd, &vector->pt1, radius, color);
+ }
+
+ /* Draw a circle at pt2 */
+ if (ret == OK && (caps & NX_LINECAP_PT2) != 0)
+ {
ret = nxtk_fillcircletoolbar(hfwnd, &vector->pt2, radius, color);
}
}
diff --git a/nuttx/libnx/nxtk/nxtk_drawlinewindow.c b/nuttx/libnx/nxtk/nxtk_drawlinewindow.c
index 584ff457c..4c4dd49d0 100644
--- a/nuttx/libnx/nxtk/nxtk_drawlinewindow.c
+++ b/nuttx/libnx/nxtk/nxtk_drawlinewindow.c
@@ -84,7 +84,7 @@
* vector - Describes the line to be drawn
* width - The width of the line
* color - The color to use to fill the line
- * capped - Draw a circular cap both ends of the line to support better
+ * caps - Draw a circular cap on the ends of the line to support better
* line joins
*
* Return:
@@ -94,7 +94,7 @@
int nxtk_drawlinewindow(NXTKWINDOW hfwnd, FAR struct nxgl_vector_s *vector,
nxgl_coord_t width, nxgl_mxpixel_t color[CONFIG_NX_NPLANES],
- bool capped)
+ bool caps)
{
struct nxgl_trapezoid_s trap[3];
@@ -155,17 +155,22 @@ int nxtk_drawlinewindow(NXTKWINDOW hfwnd, FAR struct nxgl_vector_s *vector,
/* Draw circular caps at each end of the line to support better line joins */
- if (capped && width >= 3)
+ if (caps != NX_LINECAP_NONE && width >= 3)
{
nxgl_coord_t radius = width >> 1;
/* Draw a circle at pt1 */
- ret = nxtk_fillcirclewindow(hfwnd, &vector->pt1, radius, color);
- if (ret == OK)
+ ret = OK;
+ if ((caps & NX_LINECAP_PT1) != 0)
{
- /* Draw a circle at pt2 */
+ ret = nxtk_fillcirclewindow(hfwnd, &vector->pt1, radius, color);
+ }
+
+ /* Draw a circle at pt2 */
+ if (ret == OK && (caps & NX_LINECAP_PT2) != 0)
+ {
ret = nxtk_fillcirclewindow(hfwnd, &vector->pt2, radius, color);
}
}