From 0aa9b220495236e5ce855a2fd7565e3ccd94114a Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sun, 5 Apr 2015 08:50:01 -0600 Subject: Add a 'capped' boolean parameter to all drawline/drawLine functions/methods. The idea is that this will produce better joining between lines --- NxWidgets/libnxwidgets/include/cbgwindow.hxx | 8 +++--- NxWidgets/libnxwidgets/include/cgraphicsport.hxx | 6 +++-- NxWidgets/libnxwidgets/include/cnxtkwindow.hxx | 8 +++--- NxWidgets/libnxwidgets/include/cnxtoolbar.hxx | 8 +++--- NxWidgets/libnxwidgets/include/cnxwindow.hxx | 7 ++++-- NxWidgets/libnxwidgets/include/inxwindow.hxx | 8 +++--- NxWidgets/libnxwidgets/src/cbgwindow.cxx | 9 ++++--- NxWidgets/libnxwidgets/src/cgraphicsport.cxx | 18 +++++++------ NxWidgets/libnxwidgets/src/cnxtkwindow.cxx | 9 ++++--- NxWidgets/libnxwidgets/src/cnxtoolbar.cxx | 9 ++++--- NxWidgets/libnxwidgets/src/cnxwindow.cxx | 9 ++++--- apps/examples/nxlines/nxlines_bkgd.c | 8 +++--- nuttx/Documentation/NXGraphicsSubsystem.html | 17 ++++++++++--- nuttx/TODO | 32 +++++++++++++----------- nuttx/include/nuttx/nx/nx.h | 7 ++++-- nuttx/include/nuttx/nx/nxtk.h | 12 ++++++--- nuttx/libnx/nx/nx_drawcircle.c | 6 ++--- nuttx/libnx/nx/nx_drawline.c | 7 ++++-- nuttx/libnx/nxtk/nxtk_drawcircletoolbar.c | 6 ++--- nuttx/libnx/nxtk/nxtk_drawcirclewindow.c | 6 ++--- nuttx/libnx/nxtk/nxtk_drawlinetoolbar.c | 7 ++++-- nuttx/libnx/nxtk/nxtk_drawlinewindow.c | 7 ++++-- 22 files changed, 137 insertions(+), 77 deletions(-) diff --git a/NxWidgets/libnxwidgets/include/cbgwindow.hxx b/NxWidgets/libnxwidgets/include/cbgwindow.hxx index 90113cfe9..8a63633bd 100644 --- a/NxWidgets/libnxwidgets/include/cbgwindow.hxx +++ b/NxWidgets/libnxwidgets/include/cbgwindow.hxx @@ -1,7 +1,7 @@ /**************************************************************************** * NxWidgets/libnxwidgets/include/cbgwindow.hxx * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2012, 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -285,13 +285,15 @@ 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 + * better line joins * * @return True on success; false on failure. */ bool drawLine(FAR struct nxgl_vector_s *vector, - nxgl_coord_t width, - nxgl_mxpixel_t color); + nxgl_coord_t width, nxgl_mxpixel_t color, + bool capped); /** * 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 c5148c8bc..4d529c94d 100644 --- a/NxWidgets/libnxwidgets/include/cgraphicsport.hxx +++ b/NxWidgets/libnxwidgets/include/cgraphicsport.hxx @@ -1,7 +1,7 @@ /**************************************************************************** * NxWidgets/libnxwidgets/include/cgraphicsport.hxx * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2012, 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -242,11 +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 + * 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); + nxgl_mxpixel_t color, bool capped); /** * 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 b20bc2a24..1ac801b95 100644 --- a/NxWidgets/libnxwidgets/include/cnxtkwindow.hxx +++ b/NxWidgets/libnxwidgets/include/cnxtkwindow.hxx @@ -1,7 +1,7 @@ /**************************************************************************** * NxWidgets/libnxwidgets/include/cnxtkwindow.hxx * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2012, 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -306,13 +306,15 @@ 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 + * better line joins * * @return True on success; false on failure. */ bool drawLine(FAR struct nxgl_vector_s *vector, - nxgl_coord_t width, - nxgl_mxpixel_t color); + nxgl_coord_t width, nxgl_mxpixel_t color, + bool capped); /** * 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 fd635b206..c7107678e 100644 --- a/NxWidgets/libnxwidgets/include/cnxtoolbar.hxx +++ b/NxWidgets/libnxwidgets/include/cnxtoolbar.hxx @@ -1,7 +1,7 @@ /**************************************************************************** * NxWidgets/libnxwidgets/include/cnxtoolbar.hxx * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2012, 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -275,13 +275,15 @@ 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 + * better line joins * * @return True on success; false on failure. */ bool drawLine(FAR struct nxgl_vector_s *vector, - nxgl_coord_t width, - nxgl_mxpixel_t color); + nxgl_coord_t width, nxgl_mxpixel_t color, + bool capped); /** * 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 98f89acc0..21a077954 100644 --- a/NxWidgets/libnxwidgets/include/cnxwindow.hxx +++ b/NxWidgets/libnxwidgets/include/cnxwindow.hxx @@ -1,7 +1,7 @@ /**************************************************************************** * NxWidgets/libnxwidgets/include/cnxwindow.hxx * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2012, 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -279,12 +279,15 @@ 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 + * better line joins * * @return True on success; false on failure. */ bool drawLine(FAR struct nxgl_vector_s *vector, - nxgl_coord_t width, nxgl_mxpixel_t color); + nxgl_coord_t width, nxgl_mxpixel_t color, + bool capped); /** * 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 3e2f6c4a1..23b99fe90 100644 --- a/NxWidgets/libnxwidgets/include/inxwindow.hxx +++ b/NxWidgets/libnxwidgets/include/inxwindow.hxx @@ -1,7 +1,7 @@ /**************************************************************************** * NxWidgets/libnxwidgets/include/inxwindow.hxx * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2012, 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -249,13 +249,15 @@ 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 + * better line joins * * @return True on success; false on failure. */ virtual bool drawLine(FAR struct nxgl_vector_s *vector, - nxgl_coord_t width, - nxgl_mxpixel_t color) = 0; + nxgl_coord_t width, nxgl_mxpixel_t color, + bool capped) = 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 2cb3d2389..979cb3aeb 100644 --- a/NxWidgets/libnxwidgets/src/cbgwindow.cxx +++ b/NxWidgets/libnxwidgets/src/cbgwindow.cxx @@ -1,7 +1,7 @@ /**************************************************************************** * NxWidgets/libnxwidgets/src/cbgwindow.cxx * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2012, 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -308,16 +308,19 @@ 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 + * better line joins * * @return True on success; false on failure. */ bool CBgWindow::drawLine(FAR struct nxgl_vector_s *vector, - nxgl_coord_t width, nxgl_mxpixel_t color) + nxgl_coord_t width, nxgl_mxpixel_t color, + bool capped) { // Draw a line with the specified color - return nx_drawline(m_hWindow, vector, width, &color) == OK; + return nx_drawline(m_hWindow, vector, width, &color, capped) == OK; } /** diff --git a/NxWidgets/libnxwidgets/src/cgraphicsport.cxx b/NxWidgets/libnxwidgets/src/cgraphicsport.cxx index 5791ab773..d3fcdd3b5 100644 --- a/NxWidgets/libnxwidgets/src/cgraphicsport.cxx +++ b/NxWidgets/libnxwidgets/src/cgraphicsport.cxx @@ -1,7 +1,7 @@ /**************************************************************************** * NxWidgets/libnxwidgets/src/cgraphicsport.cxx * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2012, 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -241,16 +241,18 @@ void CGraphicsPort::drawVertLine(nxgl_coord_t x, nxgl_coord_t y, /** * Draw a line of a fixed color in the window. * - * @param x1 The x coordinate of the start point of the line. - * @param y1 The y coordinate of the start point of the line. - * @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 x1 - The x coordinate of the start point of the line. + * @param y1 - The y coordinate of the start point of the line. + * @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 + * - 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) + nxgl_mxpixel_t color, bool capped) { struct nxgl_vector_s vector; @@ -259,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)) + if (!m_pNxWnd->drawLine(&vector, 1, color, capped)) { gdbg("INxWindow::drawLine failed\n"); } diff --git a/NxWidgets/libnxwidgets/src/cnxtkwindow.cxx b/NxWidgets/libnxwidgets/src/cnxtkwindow.cxx index 57ca5eb2b..14e07dbbb 100644 --- a/NxWidgets/libnxwidgets/src/cnxtkwindow.cxx +++ b/NxWidgets/libnxwidgets/src/cnxtkwindow.cxx @@ -1,7 +1,7 @@ /**************************************************************************** * NxWidgets/libnxwidgets/src/cnxtkwindow.cxx * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2012, 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -442,16 +442,19 @@ 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 + * better line joins * * @return True on success; false on failure. */ bool CNxTkWindow::drawLine(FAR struct nxgl_vector_s *vector, - nxgl_coord_t width, nxgl_mxpixel_t color) + nxgl_coord_t width, nxgl_mxpixel_t color, + bool capped) { // Draw a line with the specified color - return nxtk_drawlinewindow(m_hNxTkWindow, vector, width, &color) == OK; + return nxtk_drawlinewindow(m_hNxTkWindow, vector, width, &color, capped) == OK; } /** diff --git a/NxWidgets/libnxwidgets/src/cnxtoolbar.cxx b/NxWidgets/libnxwidgets/src/cnxtoolbar.cxx index 3c336f06a..01b72e32f 100644 --- a/NxWidgets/libnxwidgets/src/cnxtoolbar.cxx +++ b/NxWidgets/libnxwidgets/src/cnxtoolbar.cxx @@ -1,7 +1,7 @@ /**************************************************************************** * NxWidgets/libnxwidgets/src/cnxtoolbar.cxx * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2012, 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -313,16 +313,19 @@ 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 + * better line joins * * @return True on success; false on failure. */ bool CNxToolbar::drawLine(FAR struct nxgl_vector_s *vector, - nxgl_coord_t width, nxgl_mxpixel_t color) + nxgl_coord_t width, nxgl_mxpixel_t color, + bool capped) { // Draw a line with the specified color - return nxtk_drawlinetoolbar(m_hNxTkWindow, vector, width, &color) == OK; + return nxtk_drawlinetoolbar(m_hNxTkWindow, vector, width, &color, capped) == OK; } /** diff --git a/NxWidgets/libnxwidgets/src/cnxwindow.cxx b/NxWidgets/libnxwidgets/src/cnxwindow.cxx index 046660774..c600ecd1b 100644 --- a/NxWidgets/libnxwidgets/src/cnxwindow.cxx +++ b/NxWidgets/libnxwidgets/src/cnxwindow.cxx @@ -1,7 +1,7 @@ /**************************************************************************** * NxWidgets/libnxwidgets/src/cnxwindow.cxx * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2012, 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -286,16 +286,19 @@ 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 + * better line joins * * @return True on success; false on failure. */ bool CNxWindow::drawLine(FAR struct nxgl_vector_s *vector, - nxgl_coord_t width, nxgl_mxpixel_t color) + nxgl_coord_t width, nxgl_mxpixel_t color, + bool capped) { // Draw a line with the specified color - return nx_drawline(m_hNxWindow, vector, width, &color) == OK; + return nx_drawline(m_hNxWindow, vector, width, &color, capped) == OK; } /** diff --git a/apps/examples/nxlines/nxlines_bkgd.c b/apps/examples/nxlines/nxlines_bkgd.c index dcf2a10bd..42cd98451 100644 --- a/apps/examples/nxlines/nxlines_bkgd.c +++ b/apps/examples/nxlines/nxlines_bkgd.c @@ -1,7 +1,7 @@ /**************************************************************************** * examples/nxlines/nxlines_bkgd.c * - * Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2011-2012, 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -293,7 +293,8 @@ void nxlines_test(NXWINDOW hwnd) /* Clear the previous line by overwriting it with the circle color */ color[0] = CONFIG_EXAMPLES_NXLINES_CIRCLECOLOR; - ret = nx_drawline((NXWINDOW)hwnd, &previous, CONFIG_EXAMPLES_NXLINES_LINEWIDTH, color); + ret = nx_drawline((NXWINDOW)hwnd, &previous, + CONFIG_EXAMPLES_NXLINES_LINEWIDTH, color, false); if (ret < 0) { printf("nxlines_test: nx_drawline failed clearing: %d\n", ret); @@ -302,7 +303,8 @@ void nxlines_test(NXWINDOW hwnd) /* Draw the new line */ color[0] = CONFIG_EXAMPLES_NXLINES_LINECOLOR; - ret = nx_drawline((NXWINDOW)hwnd, &vector, CONFIG_EXAMPLES_NXLINES_LINEWIDTH, color); + ret = nx_drawline((NXWINDOW)hwnd, &vector, + CONFIG_EXAMPLES_NXLINES_LINEWIDTH, color, false); 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 c8c3e0b83..d13a115b5 100644 --- a/nuttx/Documentation/NXGraphicsSubsystem.html +++ b/nuttx/Documentation/NXGraphicsSubsystem.html @@ -12,7 +12,7 @@

NX Graphics Subsystem

-

Last Updated: December 28, 2013

+

Last Updated: April 5, 2015

@@ -1759,7 +1759,8 @@ int nx_filltrapezoid(NXWINDOW hwnd, FAR const struct nxgl_rect_s *clip, #include <nuttx/nx/nx.h> 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);

Description: @@ -1780,6 +1781,8 @@ int nx_drawline(NXWINDOW hwnd, FAR struct nxgl_vector_s *vector,

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 line joins

@@ -2385,7 +2388,8 @@ int nxtk_filltrapwindow(NXTKWINDOW hfwnd, #include <nuttx/nx/nxtk.h> 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);

Description: @@ -2406,6 +2410,8 @@ int nxtk_drawlinewindow(NXTKWINDOW hfwnd, FAR struct nxgl_vector_s *vector,

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 line joins

@@ -2738,7 +2744,8 @@ int nxtk_filltraptoolbar(NXTKWINDOW hfwnd, FAR const struct nxgl_trapezoid_s *tr #include <nuttx/nx/nxtk.h> 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);

@@ -2759,6 +2766,8 @@ int nxtk_drawlinetoolbar(NXTKWINDOW hfwnd, FAR struct nxgl_vector_s *vector,

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 line joins

diff --git a/nuttx/TODO b/nuttx/TODO index d0d4027f3..373a586f7 100644 --- a/nuttx/TODO +++ b/nuttx/TODO @@ -880,20 +880,24 @@ o Network (net/, drivers/net) should be eliminated). This applies to almost all Ethernet drivers: - ARCHITECTURE CONFIG_NET_NOINTS - C5471 NO - STM32 YES << - TIVA/LM3S NO - TIVA/TM4C YES << - eZ80 NO - LPC17xx YES << - DMxxx NIC NO - PIC32 NO - RGMP NO - SAM3/4 YES << - SAMA5D3 NO - SAMA5D4 YES << - SIM N/A << Doesn't support interrupts + ARCHITECTURE CONFIG_NET_NOINTS? ADDRESS FILTER SUPPORT? + C5471 NO NO + STM32 YES YES + TIVA ----------------------- ------ + LM3S NO NO + TM4C YES YES + eZ80 NO NO + LPC17xx YES (could be issues) YES (not tested) + DMxxx NIC NO NO + PIC32 NO NO + RGMP ??? ??? + SAM3/4 YES YES + SAMA5D ----------------------- ------ + 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 drivers/net/skeleton.c diff --git a/nuttx/include/nuttx/nx/nx.h b/nuttx/include/nuttx/nx/nx.h index 6093a0878..6f8077f61 100644 --- a/nuttx/include/nuttx/nx/nx.h +++ b/nuttx/include/nuttx/nx/nx.h @@ -1,7 +1,7 @@ /**************************************************************************** * 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 * * 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 * 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 + * line joins * * Return: * 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, - 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 diff --git a/nuttx/include/nuttx/nx/nxtk.h b/nuttx/include/nuttx/nx/nxtk.h index eb0d9df6f..7b7d76212 100644 --- a/nuttx/include/nuttx/nx/nxtk.h +++ b/nuttx/include/nuttx/nx/nxtk.h @@ -1,7 +1,7 @@ /**************************************************************************** * 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 * * 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 * 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 + * line joins * * Return: * 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, FAR struct nxgl_vector_s *vector, nxgl_coord_t width, - nxgl_mxpixel_t color[CONFIG_NX_NPLANES]); + nxgl_mxpixel_t color[CONFIG_NX_NPLANES], + bool capped); /**************************************************************************** * 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 * 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 + * line joins * * Return: * 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, FAR struct nxgl_vector_s *vector, nxgl_coord_t width, - nxgl_mxpixel_t color[CONFIG_NX_NPLANES]); + nxgl_mxpixel_t color[CONFIG_NX_NPLANES], + bool capped); /**************************************************************************** * Name: nxtk_drawcircletoolbar diff --git a/nuttx/libnx/nx/nx_drawcircle.c b/nuttx/libnx/nx/nx_drawcircle.c index 97f0a4e3f..ea279a45d 100644 --- a/nuttx/libnx/nx/nx_drawcircle.c +++ b/nuttx/libnx/nx/nx_drawcircle.c @@ -1,7 +1,7 @@ /**************************************************************************** * 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 * * 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.pt2.x = pts[i+1].x; 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) { 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.pt2.x = pts[POINT_0p0].x; vector.pt2.y = pts[POINT_0p0].y; - return nx_drawline(hwnd, &vector, width, color); + return nx_drawline(hwnd, &vector, width, color, true); } diff --git a/nuttx/libnx/nx/nx_drawline.c b/nuttx/libnx/nx/nx_drawline.c index ac47a4418..f29c3b609 100644 --- a/nuttx/libnx/nx/nx_drawline.c +++ b/nuttx/libnx/nx/nx_drawline.c @@ -1,7 +1,7 @@ /**************************************************************************** * 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 * * Redistribution and use in source and binary forms, with or without @@ -83,6 +83,8 @@ * 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 + * line joins * * Return: * 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, - 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_rect_s rect; diff --git a/nuttx/libnx/nxtk/nxtk_drawcircletoolbar.c b/nuttx/libnx/nxtk/nxtk_drawcircletoolbar.c index fa7905cd4..3aab9fd6e 100644 --- a/nuttx/libnx/nxtk/nxtk_drawcircletoolbar.c +++ b/nuttx/libnx/nxtk/nxtk_drawcircletoolbar.c @@ -1,7 +1,7 @@ /**************************************************************************** * 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 * * 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.pt2.x = pts[i+1].x; 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) { 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.pt2.x = pts[POINT_0p0].x; vector.pt2.y = pts[POINT_0p0].y; - return nxtk_drawlinetoolbar(hfwnd, &vector, width, color); + return nxtk_drawlinetoolbar(hfwnd, &vector, width, color, true); } diff --git a/nuttx/libnx/nxtk/nxtk_drawcirclewindow.c b/nuttx/libnx/nxtk/nxtk_drawcirclewindow.c index ec0fe6312..38435d943 100644 --- a/nuttx/libnx/nxtk/nxtk_drawcirclewindow.c +++ b/nuttx/libnx/nxtk/nxtk_drawcirclewindow.c @@ -1,7 +1,7 @@ /**************************************************************************** * 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 * * 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.pt2.x = pts[i+1].x; 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) { 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.pt2.x = pts[POINT_0p0].x; vector.pt2.y = pts[POINT_0p0].y; - return nxtk_drawlinewindow(hfwnd, &vector, width, color); + return nxtk_drawlinewindow(hfwnd, &vector, width, color, true); } diff --git a/nuttx/libnx/nxtk/nxtk_drawlinetoolbar.c b/nuttx/libnx/nxtk/nxtk_drawlinetoolbar.c index 2bcb8b890..8c2810ce3 100644 --- a/nuttx/libnx/nxtk/nxtk_drawlinetoolbar.c +++ b/nuttx/libnx/nxtk/nxtk_drawlinetoolbar.c @@ -1,7 +1,7 @@ /**************************************************************************** * 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 * * Redistribution and use in source and binary forms, with or without @@ -85,6 +85,8 @@ * 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 + * line joins * * Return: * 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, - 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]; diff --git a/nuttx/libnx/nxtk/nxtk_drawlinewindow.c b/nuttx/libnx/nxtk/nxtk_drawlinewindow.c index 176f60b82..8183bf79d 100644 --- a/nuttx/libnx/nxtk/nxtk_drawlinewindow.c +++ b/nuttx/libnx/nxtk/nxtk_drawlinewindow.c @@ -1,7 +1,7 @@ /**************************************************************************** * 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 * * Redistribution and use in source and binary forms, with or without @@ -84,6 +84,8 @@ * 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 + * line joins * * Return: * 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, - 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]; -- cgit v1.2.3