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

This commit is contained in:
Gregory Nutt 2015-04-05 16:53:51 -06:00
parent a13cdd2c39
commit f6604c7e5c
11 changed files with 35 additions and 27 deletions

View File

@ -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.

View File

@ -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,

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

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

View File

@ -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");
}

View File

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

View File

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

View File

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