mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 00:14:22 +08:00
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:
@@ -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,
|
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);
|
uint8_t caps);
|
||||||
</pre></ul>
|
</pre></ul>
|
||||||
<p>
|
<p>
|
||||||
<b>Description:</b>
|
<b>Description:</b>
|
||||||
@@ -1781,8 +1781,17 @@ 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>
|
<dt><code>caps</code>
|
||||||
<dd>Draw a circular cap both ends of the line to support better line joins
|
<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>
|
</dl></ul>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
@@ -2389,7 +2398,7 @@ int nxtk_filltrapwindow(NXTKWINDOW hfwnd,
|
|||||||
|
|
||||||
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);
|
uint8_t caps);
|
||||||
</pre></ul>
|
</pre></ul>
|
||||||
<p>
|
<p>
|
||||||
<b>Description:</b>
|
<b>Description:</b>
|
||||||
@@ -2410,8 +2419,17 @@ 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>
|
<dt><code>caps</code>
|
||||||
<dd>Draw a circular cap both ends of the line to support better line joins
|
<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>
|
</dl></ul>
|
||||||
</p>
|
</p>
|
||||||
<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,
|
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);
|
uint8_t caps);
|
||||||
|
|
||||||
</pre></ul>
|
</pre></ul>
|
||||||
<p>
|
<p>
|
||||||
@@ -2766,8 +2784,17 @@ 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>
|
<dt><code>caps</code>
|
||||||
<dd>Draw a circular cap both ends of the line to support better line joins
|
<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>
|
</dl></ul>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
|
|||||||
+23
-17
@@ -50,21 +50,6 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Pre-Processor Definitions
|
* Pre-Processor Definitions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/* Default server MQ name used by nx_run() macro */
|
|
||||||
|
|
||||||
#define NX_DEFAULT_SERVER_MQNAME "/dev/nxs"
|
|
||||||
|
|
||||||
/* Mouse button bits */
|
|
||||||
|
|
||||||
#define NX_MOUSE_NOBUTTONS 0x00
|
|
||||||
#define NX_MOUSE_LEFTBUTTON 0x01
|
|
||||||
#define NX_MOUSE_CENTERBUTTON 0x02
|
|
||||||
#define NX_MOUSE_RIGHTBUTTON 0x04
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Public Types
|
|
||||||
****************************************************************************/
|
|
||||||
/* Configuration ************************************************************/
|
/* Configuration ************************************************************/
|
||||||
|
|
||||||
#ifndef CONFIG_NX_NPLANES
|
#ifndef CONFIG_NX_NPLANES
|
||||||
@@ -77,6 +62,27 @@
|
|||||||
# define CONFIG_NX_WRITEONLY 1
|
# define CONFIG_NX_WRITEONLY 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Default server MQ name used by nx_run() macro */
|
||||||
|
|
||||||
|
#define NX_DEFAULT_SERVER_MQNAME "/dev/nxs"
|
||||||
|
|
||||||
|
/* Mouse button bits */
|
||||||
|
|
||||||
|
#define NX_MOUSE_NOBUTTONS 0x00
|
||||||
|
#define NX_MOUSE_LEFTBUTTON 0x01
|
||||||
|
#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
|
||||||
|
****************************************************************************/
|
||||||
/* Handles ******************************************************************/
|
/* Handles ******************************************************************/
|
||||||
|
|
||||||
/* The interface to the NX server is managed using a opaque handle: */
|
/* 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
|
* 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
|
* caps - Draw a circular on the both ends of the line to support better
|
||||||
* line joins
|
* line joins
|
||||||
*
|
*
|
||||||
* Return:
|
* 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,
|
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);
|
uint8_t caps);
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: nx_drawcircle
|
* Name: nx_drawcircle
|
||||||
|
|||||||
@@ -354,7 +354,7 @@ 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
|
* caps - Draw a circular cap the ends of the line to support better
|
||||||
* line joins
|
* line joins
|
||||||
*
|
*
|
||||||
* Return:
|
* Return:
|
||||||
@@ -366,7 +366,7 @@ 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);
|
uint8_t caps);
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: nxtk_drawcirclewindow
|
* 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
|
* 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
|
* caps - Draw a circular cap on the ends of the line to support better
|
||||||
* line joins
|
* line joins
|
||||||
*
|
*
|
||||||
* Return:
|
* Return:
|
||||||
@@ -613,7 +613,7 @@ 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);
|
uint8_t caps);
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: nxtk_drawcircletoolbar
|
* Name: nxtk_drawcircletoolbar
|
||||||
|
|||||||
@@ -113,7 +113,6 @@ int nx_drawcircle(NXWINDOW hwnd, FAR const struct nxgl_point_s *center,
|
|||||||
{
|
{
|
||||||
struct nxgl_point_s pts[NCIRCLE_POINTS];
|
struct nxgl_point_s pts[NCIRCLE_POINTS];
|
||||||
FAR struct nxgl_vector_s vector;
|
FAR struct nxgl_vector_s vector;
|
||||||
bool capped;
|
|
||||||
int i;
|
int i;
|
||||||
int ret;
|
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 */
|
/* Draw each pair of points as a vector */
|
||||||
|
|
||||||
capped = false;
|
|
||||||
for (i = POINT_0p0; i < POINT_337p5; i++)
|
for (i = POINT_0p0; i < POINT_337p5; i++)
|
||||||
{
|
{
|
||||||
/* Draw one line segment */
|
/* 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.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, capped);
|
ret = nx_drawline(hwnd, &vector, width, color, NX_LINECAP_PT1);
|
||||||
if (ret != OK)
|
if (ret != OK)
|
||||||
{
|
{
|
||||||
return ret;
|
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 */
|
/* 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.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, capped);
|
return nx_drawline(hwnd, &vector, width, color, NX_LINECAP_PT1);
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-5
@@ -83,7 +83,7 @@
|
|||||||
* 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
|
* caps - Draw a circular cap on the ends of the line to support better
|
||||||
* line joins
|
* line joins
|
||||||
*
|
*
|
||||||
* Return:
|
* Return:
|
||||||
@@ -93,7 +93,7 @@
|
|||||||
|
|
||||||
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)
|
uint8_t caps)
|
||||||
{
|
{
|
||||||
struct nxgl_trapezoid_s trap[3];
|
struct nxgl_trapezoid_s trap[3];
|
||||||
struct nxgl_rect_s rect;
|
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 */
|
/* 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;
|
nxgl_coord_t radius = width >> 1;
|
||||||
|
|
||||||
/* Draw a circle at pt1 */
|
/* Draw a circle at pt1 */
|
||||||
|
|
||||||
ret = nx_fillcircle(hwnd, &vector->pt1, radius, color);
|
ret = OK;
|
||||||
if (ret == OK)
|
if ((caps & NX_LINECAP_PT1) != 0)
|
||||||
{
|
{
|
||||||
|
ret = nx_fillcircle(hwnd, &vector->pt1, radius, color);
|
||||||
|
}
|
||||||
|
|
||||||
/* Draw a circle at pt2 */
|
/* Draw a circle at pt2 */
|
||||||
|
|
||||||
|
if (ret == OK && (caps & NX_LINECAP_PT2) != 0)
|
||||||
|
{
|
||||||
ret = nx_fillcircle(hwnd, &vector->pt2, radius, color);
|
ret = nx_fillcircle(hwnd, &vector->pt2, radius, color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -113,7 +113,6 @@ int nxtk_drawcircletoolbar(NXTKWINDOW hfwnd, FAR const struct nxgl_point_s *cent
|
|||||||
{
|
{
|
||||||
struct nxgl_point_s pts[NCIRCLE_POINTS];
|
struct nxgl_point_s pts[NCIRCLE_POINTS];
|
||||||
FAR struct nxgl_vector_s vector;
|
FAR struct nxgl_vector_s vector;
|
||||||
bool capped;
|
|
||||||
int i;
|
int i;
|
||||||
int ret;
|
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.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, capped);
|
ret = nxtk_drawlinetoolbar(hfwnd, &vector, width, color, NX_LINECAP_PT1);
|
||||||
if (ret != OK)
|
if (ret != OK)
|
||||||
{
|
{
|
||||||
return ret;
|
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 */
|
/* 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.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, capped);
|
return nxtk_drawlinetoolbar(hfwnd, &vector, width, color, NX_LINECAP_PT1);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -113,7 +113,6 @@ int nxtk_drawcirclewindow(NXTKWINDOW hfwnd, FAR const struct nxgl_point_s *cente
|
|||||||
{
|
{
|
||||||
struct nxgl_point_s pts[NCIRCLE_POINTS];
|
struct nxgl_point_s pts[NCIRCLE_POINTS];
|
||||||
FAR struct nxgl_vector_s vector;
|
FAR struct nxgl_vector_s vector;
|
||||||
bool capped;
|
|
||||||
int i;
|
int i;
|
||||||
int ret;
|
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.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, capped);
|
ret = nxtk_drawlinewindow(hfwnd, &vector, width, color, NX_LINECAP_PT1);
|
||||||
if (ret != OK)
|
if (ret != OK)
|
||||||
{
|
{
|
||||||
return ret;
|
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 */
|
/* 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.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, capped);
|
return nxtk_drawlinewindow(hfwnd, &vector, width, color, NX_LINECAP_PT1);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -85,7 +85,7 @@
|
|||||||
* 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
|
* caps - Draw a circular cap on the ends of the line to support better
|
||||||
* line joins
|
* line joins
|
||||||
*
|
*
|
||||||
* Return:
|
* Return:
|
||||||
@@ -95,7 +95,7 @@
|
|||||||
|
|
||||||
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)
|
uint8_t caps)
|
||||||
|
|
||||||
{
|
{
|
||||||
struct nxgl_trapezoid_s trap[3];
|
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 */
|
/* 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;
|
nxgl_coord_t radius = width >> 1;
|
||||||
|
|
||||||
/* Draw a circle at pt1 */
|
/* Draw a circle at pt1 */
|
||||||
|
|
||||||
ret = nxtk_fillcircletoolbar(hfwnd, &vector->pt1, radius, color);
|
ret = OK;
|
||||||
if (ret == OK)
|
if ((caps & NX_LINECAP_PT1) != 0)
|
||||||
{
|
{
|
||||||
|
ret = nxtk_fillcircletoolbar(hfwnd, &vector->pt1, radius, color);
|
||||||
|
}
|
||||||
|
|
||||||
/* Draw a circle at pt2 */
|
/* Draw a circle at pt2 */
|
||||||
|
|
||||||
|
if (ret == OK && (caps & NX_LINECAP_PT2) != 0)
|
||||||
|
{
|
||||||
ret = nxtk_fillcircletoolbar(hfwnd, &vector->pt2, radius, color);
|
ret = nxtk_fillcircletoolbar(hfwnd, &vector->pt2, radius, color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -84,7 +84,7 @@
|
|||||||
* 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
|
* caps - Draw a circular cap on the ends of the line to support better
|
||||||
* line joins
|
* line joins
|
||||||
*
|
*
|
||||||
* Return:
|
* Return:
|
||||||
@@ -94,7 +94,7 @@
|
|||||||
|
|
||||||
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)
|
bool caps)
|
||||||
|
|
||||||
{
|
{
|
||||||
struct nxgl_trapezoid_s trap[3];
|
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 */
|
/* 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;
|
nxgl_coord_t radius = width >> 1;
|
||||||
|
|
||||||
/* Draw a circle at pt1 */
|
/* Draw a circle at pt1 */
|
||||||
|
|
||||||
ret = nxtk_fillcirclewindow(hfwnd, &vector->pt1, radius, color);
|
ret = OK;
|
||||||
if (ret == OK)
|
if ((caps & NX_LINECAP_PT1) != 0)
|
||||||
{
|
{
|
||||||
|
ret = nxtk_fillcirclewindow(hfwnd, &vector->pt1, radius, color);
|
||||||
|
}
|
||||||
|
|
||||||
/* Draw a circle at pt2 */
|
/* Draw a circle at pt2 */
|
||||||
|
|
||||||
|
if (ret == OK && (caps & NX_LINECAP_PT2) != 0)
|
||||||
|
{
|
||||||
ret = nxtk_fillcirclewindow(hfwnd, &vector->pt2, radius, color);
|
ret = nxtk_fillcirclewindow(hfwnd, &vector->pt2, radius, color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user