Add a 'capped' boolean parameter to all drawline/drawLine functions/methods. The idea is that this will produce better joining between lines

This commit is contained in:
Gregory Nutt 2015-04-05 08:50:01 -06:00
parent fca4c51420
commit ae03d56700
10 changed files with 69 additions and 38 deletions

View File

@ -12,7 +12,7 @@
<h1><big><font color="#3c34ec"> <h1><big><font color="#3c34ec">
<i>NX Graphics Subsystem</i> <i>NX Graphics Subsystem</i>
</font></big></h1> </font></big></h1>
<p>Last Updated: December 28, 2013</p> <p>Last Updated: April 5, 2015</p>
</td> </td>
</tr> </tr>
</table> </table>
@ -1759,7 +1759,8 @@ int nx_filltrapezoid(NXWINDOW hwnd, FAR const struct nxgl_rect_s *clip,
#include &lt;nuttx/nx/nx.h&gt; #include &lt;nuttx/nx/nx.h&gt;
int nx_drawline(NXWINDOW hwnd, FAR struct nxgl_vector_s *vector, int nx_drawline(NXWINDOW hwnd, FAR struct nxgl_vector_s *vector,
nxgl_coord_t width, nxgl_mxpixel_t color[CONFIG_NX_NPLANES]); nxgl_coord_t width, nxgl_mxpixel_t color[CONFIG_NX_NPLANES],
bool capped);
</pre></ul> </pre></ul>
<p> <p>
<b>Description:</b> <b>Description:</b>
@ -1780,6 +1781,8 @@ int nx_drawline(NXWINDOW hwnd, FAR struct nxgl_vector_s *vector,
<dd>The width of the line <dd>The width of the line
<dt><code>color</code> <dt><code>color</code>
<dd>The color to use to fill the line <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
</dl></ul> </dl></ul>
</p> </p>
<p> <p>
@ -2385,7 +2388,8 @@ int nxtk_filltrapwindow(NXTKWINDOW hfwnd,
#include &lt;nuttx/nx/nxtk.h&gt; #include &lt;nuttx/nx/nxtk.h&gt;
int nxtk_drawlinewindow(NXTKWINDOW hfwnd, FAR struct nxgl_vector_s *vector, int nxtk_drawlinewindow(NXTKWINDOW hfwnd, FAR struct nxgl_vector_s *vector,
nxgl_coord_t width, nxgl_mxpixel_t color[CONFIG_NX_NPLANES]); nxgl_coord_t width, nxgl_mxpixel_t color[CONFIG_NX_NPLANES],
bool capped);
</pre></ul> </pre></ul>
<p> <p>
<b>Description:</b> <b>Description:</b>
@ -2406,6 +2410,8 @@ int nxtk_drawlinewindow(NXTKWINDOW hfwnd, FAR struct nxgl_vector_s *vector,
<dd>The width of the line <dd>The width of the line
<dt><code>color</code> <dt><code>color</code>
<dd>The color to use to fill the line <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
</dl></ul> </dl></ul>
</p> </p>
<p> <p>
@ -2738,7 +2744,8 @@ int nxtk_filltraptoolbar(NXTKWINDOW hfwnd, FAR const struct nxgl_trapezoid_s *tr
#include &lt;nuttx/nx/nxtk.h&gt; #include &lt;nuttx/nx/nxtk.h&gt;
int nxtk_drawlinetoolbar(NXTKWINDOW hfwnd, FAR struct nxgl_vector_s *vector, int nxtk_drawlinetoolbar(NXTKWINDOW hfwnd, FAR struct nxgl_vector_s *vector,
nxgl_coord_t width, nxgl_mxpixel_t color[CONFIG_NX_NPLANES]); nxgl_coord_t width, nxgl_mxpixel_t color[CONFIG_NX_NPLANES],
capped);
</pre></ul> </pre></ul>
<p> <p>
@ -2759,6 +2766,8 @@ int nxtk_drawlinetoolbar(NXTKWINDOW hfwnd, FAR struct nxgl_vector_s *vector,
<dd>The width of the line <dd>The width of the line
<dt><code>color</code> <dt><code>color</code>
<dd>The color to use to fill the line <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
</dl></ul> </dl></ul>
</p> </p>
<p> <p>

32
TODO
View File

@ -880,20 +880,24 @@ o Network (net/, drivers/net)
should be eliminated). This applies to almost all Ethernet should be eliminated). This applies to almost all Ethernet
drivers: drivers:
ARCHITECTURE CONFIG_NET_NOINTS ARCHITECTURE CONFIG_NET_NOINTS? ADDRESS FILTER SUPPORT?
C5471 NO C5471 NO NO
STM32 YES << STM32 YES YES
TIVA/LM3S NO TIVA ----------------------- ------
TIVA/TM4C YES << LM3S NO NO
eZ80 NO TM4C YES YES
LPC17xx YES << eZ80 NO NO
DMxxx NIC NO LPC17xx YES (could be issues) YES (not tested)
PIC32 NO DMxxx NIC NO NO
RGMP NO PIC32 NO NO
SAM3/4 YES << RGMP ??? ???
SAMA5D3 NO SAM3/4 YES YES
SAMA5D4 YES << SAMA5D ----------------------- ------
SIM N/A << Doesn't support interrupts EMACA NO YES (not tested)
EMACB YES YES
GMAC NO YES (not tested)
SAMV7 YES YES
SIM N/A (No interrupts) NO
The general outline of how this might be done is included in The general outline of how this might be done is included in
drivers/net/skeleton.c drivers/net/skeleton.c

View File

@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* include/nuttx/nx/nx.h * include/nuttx/nx/nx.h
* *
* Copyright (C) 2008-2011 Gregory Nutt. All rights reserved. * Copyright (C) 2008-2011, 2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -776,6 +776,8 @@ int nx_filltrapezoid(NXWINDOW hwnd, FAR const struct nxgl_rect_s *clip,
* vector - Describes the line to be drawn * vector - Describes the line to be drawn
* width - The width of the line * width - The width of the line
* color - The color to use to fill the line * color - The color to use to fill the line
* capped - Draw a circular cap both ends of the line to support better
* line joins
* *
* Return: * Return:
* OK on success; ERROR on failure with errno set appropriately * OK on success; ERROR on failure with errno set appropriately
@ -783,7 +785,8 @@ int nx_filltrapezoid(NXWINDOW hwnd, FAR const struct nxgl_rect_s *clip,
****************************************************************************/ ****************************************************************************/
int nx_drawline(NXWINDOW hwnd, FAR struct nxgl_vector_s *vector, int nx_drawline(NXWINDOW hwnd, FAR struct nxgl_vector_s *vector,
nxgl_coord_t width, nxgl_mxpixel_t color[CONFIG_NX_NPLANES]); nxgl_coord_t width, nxgl_mxpixel_t color[CONFIG_NX_NPLANES],
bool capped);
/**************************************************************************** /****************************************************************************
* Name: nx_drawcircle * Name: nx_drawcircle

View File

@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* include/nuttx/nx/nxtk.h * include/nuttx/nx/nxtk.h
* *
* Copyright (C) 2008-2012 Gregory Nutt. All rights reserved. * Copyright (C) 2008-2012, 2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -354,6 +354,8 @@ EXTERN int nxtk_filltrapwindow(NXTKWINDOW hfwnd,
* vector - Describes the line to be drawn * vector - Describes the line to be drawn
* width - The width of the line * width - The width of the line
* color - The color to use to fill the line * color - The color to use to fill the line
* capped - Draw a circular cap both ends of the line to support better
* line joins
* *
* Return: * Return:
* OK on success; ERROR on failure with errno set appropriately * OK on success; ERROR on failure with errno set appropriately
@ -363,7 +365,8 @@ EXTERN int nxtk_filltrapwindow(NXTKWINDOW hfwnd,
EXTERN int nxtk_drawlinewindow(NXTKWINDOW hfwnd, EXTERN int nxtk_drawlinewindow(NXTKWINDOW hfwnd,
FAR struct nxgl_vector_s *vector, FAR struct nxgl_vector_s *vector,
nxgl_coord_t width, nxgl_coord_t width,
nxgl_mxpixel_t color[CONFIG_NX_NPLANES]); nxgl_mxpixel_t color[CONFIG_NX_NPLANES],
bool capped);
/**************************************************************************** /****************************************************************************
* Name: nxtk_drawcirclewindow * Name: nxtk_drawcirclewindow
@ -598,6 +601,8 @@ EXTERN int nxtk_filltraptoolbar(NXTKWINDOW hfwnd, FAR const struct nxgl_trapezoi
* vector - Describes the line to be drawn * vector - Describes the line to be drawn
* width - The width of the line * width - The width of the line
* color - The color to use to fill the line * color - The color to use to fill the line
* capped - Draw a circular cap both ends of the line to support better
* line joins
* *
* Return: * Return:
* OK on success; ERROR on failure with errno set appropriately * OK on success; ERROR on failure with errno set appropriately
@ -607,7 +612,8 @@ EXTERN int nxtk_filltraptoolbar(NXTKWINDOW hfwnd, FAR const struct nxgl_trapezoi
EXTERN int nxtk_drawlinetoolbar(NXTKWINDOW hfwnd, EXTERN int nxtk_drawlinetoolbar(NXTKWINDOW hfwnd,
FAR struct nxgl_vector_s *vector, FAR struct nxgl_vector_s *vector,
nxgl_coord_t width, nxgl_coord_t width,
nxgl_mxpixel_t color[CONFIG_NX_NPLANES]); nxgl_mxpixel_t color[CONFIG_NX_NPLANES],
bool capped);
/**************************************************************************** /****************************************************************************
* Name: nxtk_drawcircletoolbar * Name: nxtk_drawcircletoolbar

View File

@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* libnx/nx/nx_drawcircle.c * libnx/nx/nx_drawcircle.c
* *
* Copyright (C) 2011, 2013 Gregory Nutt. All rights reserved. * Copyright (C) 2011, 2013, 2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -128,7 +128,7 @@ int nx_drawcircle(NXWINDOW hwnd, FAR const struct nxgl_point_s *center,
vector.pt1.y = pts[i].y; vector.pt1.y = pts[i].y;
vector.pt2.x = pts[i+1].x; vector.pt2.x = pts[i+1].x;
vector.pt2.y = pts[i+1].y; vector.pt2.y = pts[i+1].y;
ret = nx_drawline(hwnd, &vector, width, color); ret = nx_drawline(hwnd, &vector, width, color, true);
if (ret != OK) if (ret != OK)
{ {
return ret; return ret;
@ -141,5 +141,5 @@ int nx_drawcircle(NXWINDOW hwnd, FAR const struct nxgl_point_s *center,
vector.pt1.y = pts[POINT_337p5].y; vector.pt1.y = pts[POINT_337p5].y;
vector.pt2.x = pts[POINT_0p0].x; vector.pt2.x = pts[POINT_0p0].x;
vector.pt2.y = pts[POINT_0p0].y; vector.pt2.y = pts[POINT_0p0].y;
return nx_drawline(hwnd, &vector, width, color); return nx_drawline(hwnd, &vector, width, color, true);
} }

View File

@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* libnx/nx/nx_drawline.c * libnx/nx/nx_drawline.c
* *
* Copyright (C) 2011 Gregory Nutt. All rights reserved. * Copyright (C) 2011, 2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -83,6 +83,8 @@
* vector - Describes the line to be drawn * vector - Describes the line to be drawn
* width - The width of the line * width - The width of the line
* color - The color to use to fill the line * color - The color to use to fill the line
* capped - Draw a circular cap both ends of the line to support better
* line joins
* *
* Return: * Return:
* OK on success; ERROR on failure with errno set appropriately * OK on success; ERROR on failure with errno set appropriately
@ -90,7 +92,8 @@
****************************************************************************/ ****************************************************************************/
int nx_drawline(NXWINDOW hwnd, FAR struct nxgl_vector_s *vector, int nx_drawline(NXWINDOW hwnd, FAR struct nxgl_vector_s *vector,
nxgl_coord_t width, nxgl_mxpixel_t color[CONFIG_NX_NPLANES]) nxgl_coord_t width, nxgl_mxpixel_t color[CONFIG_NX_NPLANES],
bool capped)
{ {
struct nxgl_trapezoid_s trap[3]; struct nxgl_trapezoid_s trap[3];
struct nxgl_rect_s rect; struct nxgl_rect_s rect;

View File

@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* libnx/nxtk/nxtk_drawcircletoolbar.c * libnx/nxtk/nxtk_drawcircletoolbar.c
* *
* Copyright (C) 2011 Gregory Nutt. All rights reserved. * Copyright (C) 2011, 2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -128,7 +128,7 @@ int nxtk_drawcircletoolbar(NXTKWINDOW hfwnd, FAR const struct nxgl_point_s *cent
vector.pt1.y = pts[i].y; vector.pt1.y = pts[i].y;
vector.pt2.x = pts[i+1].x; vector.pt2.x = pts[i+1].x;
vector.pt2.y = pts[i+1].y; vector.pt2.y = pts[i+1].y;
ret = nxtk_drawlinetoolbar(hfwnd, &vector, width, color); ret = nxtk_drawlinetoolbar(hfwnd, &vector, width, color, true);
if (ret != OK) if (ret != OK)
{ {
return ret; return ret;
@ -141,5 +141,5 @@ int nxtk_drawcircletoolbar(NXTKWINDOW hfwnd, FAR const struct nxgl_point_s *cent
vector.pt1.y = pts[POINT_337p5].y; vector.pt1.y = pts[POINT_337p5].y;
vector.pt2.x = pts[POINT_0p0].x; vector.pt2.x = pts[POINT_0p0].x;
vector.pt2.y = pts[POINT_0p0].y; vector.pt2.y = pts[POINT_0p0].y;
return nxtk_drawlinetoolbar(hfwnd, &vector, width, color); return nxtk_drawlinetoolbar(hfwnd, &vector, width, color, true);
} }

View File

@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* libnx/nxtk/nxtk_drawcirclewindow.c * libnx/nxtk/nxtk_drawcirclewindow.c
* *
* Copyright (C) 2011 Gregory Nutt. All rights reserved. * Copyright (C) 2011, 2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -128,7 +128,7 @@ int nxtk_drawcirclewindow(NXTKWINDOW hfwnd, FAR const struct nxgl_point_s *cente
vector.pt1.y = pts[i].y; vector.pt1.y = pts[i].y;
vector.pt2.x = pts[i+1].x; vector.pt2.x = pts[i+1].x;
vector.pt2.y = pts[i+1].y; vector.pt2.y = pts[i+1].y;
ret = nxtk_drawlinewindow(hfwnd, &vector, width, color); ret = nxtk_drawlinewindow(hfwnd, &vector, width, color, true);
if (ret != OK) if (ret != OK)
{ {
return ret; return ret;
@ -141,5 +141,5 @@ int nxtk_drawcirclewindow(NXTKWINDOW hfwnd, FAR const struct nxgl_point_s *cente
vector.pt1.y = pts[POINT_337p5].y; vector.pt1.y = pts[POINT_337p5].y;
vector.pt2.x = pts[POINT_0p0].x; vector.pt2.x = pts[POINT_0p0].x;
vector.pt2.y = pts[POINT_0p0].y; vector.pt2.y = pts[POINT_0p0].y;
return nxtk_drawlinewindow(hfwnd, &vector, width, color); return nxtk_drawlinewindow(hfwnd, &vector, width, color, true);
} }

View File

@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* libnx/nxtk/nxtk_drawlinetoolbar.c * libnx/nxtk/nxtk_drawlinetoolbar.c
* *
* Copyright (C) 2011 Gregory Nutt. All rights reserved. * Copyright (C) 2011, 2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -85,6 +85,8 @@
* vector - Describes the line to be drawn * vector - Describes the line to be drawn
* width - The width of the line * width - The width of the line
* color - The color to use to fill the line * color - The color to use to fill the line
* capped - Draw a circular cap both ends of the line to support better
* line joins
* *
* Return: * Return:
* OK on success; ERROR on failure with errno set appropriately * OK on success; ERROR on failure with errno set appropriately
@ -92,7 +94,8 @@
****************************************************************************/ ****************************************************************************/
int nxtk_drawlinetoolbar(NXTKWINDOW hfwnd, FAR struct nxgl_vector_s *vector, int nxtk_drawlinetoolbar(NXTKWINDOW hfwnd, FAR struct nxgl_vector_s *vector,
nxgl_coord_t width, nxgl_mxpixel_t color[CONFIG_NX_NPLANES]) nxgl_coord_t width, nxgl_mxpixel_t color[CONFIG_NX_NPLANES],
bool capped)
{ {
struct nxgl_trapezoid_s trap[3]; struct nxgl_trapezoid_s trap[3];

View File

@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* libnx/nxtk/nxtk_drawlinewindow.c * libnx/nxtk/nxtk_drawlinewindow.c
* *
* Copyright (C) 2011 Gregory Nutt. All rights reserved. * Copyright (C) 2011, 2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -84,6 +84,8 @@
* vector - Describes the line to be drawn * vector - Describes the line to be drawn
* width - The width of the line * width - The width of the line
* color - The color to use to fill the line * color - The color to use to fill the line
* capped - Draw a circular cap both ends of the line to support better
* line joins
* *
* Return: * Return:
* OK on success; ERROR on failure with errno set appropriately * OK on success; ERROR on failure with errno set appropriately
@ -91,7 +93,8 @@
****************************************************************************/ ****************************************************************************/
int nxtk_drawlinewindow(NXTKWINDOW hfwnd, FAR struct nxgl_vector_s *vector, int nxtk_drawlinewindow(NXTKWINDOW hfwnd, FAR struct nxgl_vector_s *vector,
nxgl_coord_t width, nxgl_mxpixel_t color[CONFIG_NX_NPLANES]) nxgl_coord_t width, nxgl_mxpixel_t color[CONFIG_NX_NPLANES],
bool capped)
{ {
struct nxgl_trapezoid_s trap[3]; struct nxgl_trapezoid_s trap[3];