Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of RA8875 by
Revision 107:f9ccffcb84f1, committed 2016-03-05
- Comitter:
- WiredHome
- Date:
- Sat Mar 05 16:20:11 2016 +0000
- Parent:
- 106:c80828f5dea4
- Child:
- 108:7415c405ee08
- Child:
- 109:7b94f06f085b
- Commit message:
- Added rounded rectangle apis that accept rect_t instead of discreet x1,y1,x2,y2 values.
Changed in this revision
| RA8875.cpp | Show annotated file Show diff for this revision Revisions of this file |
| RA8875.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/RA8875.cpp Sat Feb 27 22:27:49 2016 +0000
+++ b/RA8875.cpp Sat Mar 05 16:20:11 2016 +0000
@@ -1182,6 +1182,10 @@
return noerror;
}
+//
+// Rectangle functions all mostly helpers to the basic rectangle function
+//
+
RetCode_t RA8875::fillrect(rect_t r, color_t color, fill_t fillit)
{
return rect(r.p1.x, r.p1.y, r.p2.x, r.p2.y, color, fillit);
@@ -1205,7 +1209,6 @@
return rect(x1,y1,x2,y2,fillit);
}
-
RetCode_t RA8875::rect(loc_t x1, loc_t y1, loc_t x2, loc_t y2,
fill_t fillit)
{
@@ -1240,6 +1243,15 @@
}
+//
+// rounded rectangle functions are mostly helpers to the base round rect
+//
+
+RetCode_t RA8875::fillroundrect(rect_t r, dim_t radius1, dim_t radius2, color_t color, fill_t fillit)
+{
+ return roundrect(r.p1.x, r.p1.y, r.p2.x, r.p2.y, radius1, radius2, color, fillit);
+}
+
RetCode_t RA8875::fillroundrect(loc_t x1, loc_t y1, loc_t x2, loc_t y2,
dim_t radius1, dim_t radius2, color_t color, fill_t fillit)
{
@@ -1247,6 +1259,10 @@
return roundrect(x1,y1,x2,y2,radius1,radius2,fillit);
}
+RetCode_t RA8875::roundrect(rect_t r, dim_t radius1, dim_t radius2, color_t color, fill_t fillit)
+{
+ return roundrect(r.p1.x, r.p1.y, r.p2.x, r.p2.y, radius1, radius2, color, fillit);
+}
RetCode_t RA8875::roundrect(loc_t x1, loc_t y1, loc_t x2, loc_t y2,
dim_t radius1, dim_t radius2, color_t color, fill_t fillit)
@@ -1295,6 +1311,10 @@
}
+//
+// triangle functions
+//
+
RetCode_t RA8875::triangle(loc_t x1, loc_t y1, loc_t x2, loc_t y2,
loc_t x3, loc_t y3, color_t color, fill_t fillit)
{
--- a/RA8875.h Sat Feb 27 22:27:49 2016 +0000
+++ b/RA8875.h Sat Mar 05 16:20:11 2016 +0000
@@ -1512,6 +1512,54 @@
RetCode_t fillroundrect(loc_t x1, loc_t y1, loc_t x2, loc_t y2,
dim_t radius1, dim_t radius2, color_t color, fill_t fillit = FILL);
+ /// Draw a filled rectangle with rounded corners using the specified color.
+ ///
+ /// This draws a rounded rectangle. A numbers of checks are made on the values,
+ /// and it could reduce this to drawing a line (if either x1 == x2, or y1 == y2),
+ /// or a single point (x1 == x2 && y1 == y2). If the radius parameters are
+ /// > 1/2 the length of that side (width or height), an error value is returned.
+ ///
+ /// @note As a side effect, this changes the current
+ /// foreground color for subsequent operations.
+ ///
+ /// @param[in] r is the rectangle to draw.
+ /// @param[in] radius1 defines the horizontal radius of the curved corner. Take care
+ /// that this value < 1/2 the width of the rectangle, or bad_parameter
+ /// is returned.
+ /// @param[in] radius2 defines the vertical radius of the curved corner. Take care
+ /// that this value < 1/2 the height of the rectangle, or bad_parameter
+ /// is returned.
+ /// @param[in] color defines the foreground color.
+ /// @param[in] fillit is optional to FILL the rectangle. default is NOFILL.
+ /// @returns success/failure code. See @ref RetCode_t.
+ ///
+ RetCode_t fillroundrect(rect_t r,
+ dim_t radius1, dim_t radius2, color_t color, fill_t fillit = FILL);
+
+ /// Draw a rectangle with rounded corners using the specified color.
+ ///
+ /// This draws a rounded rectangle. A numbers of checks are made on the values,
+ /// and it could reduce this to drawing a line (if either x1 == x2, or y1 == y2),
+ /// or a single point (x1 == x2 && y1 == y2). If the radius parameters are
+ /// > 1/2 the length of that side (width or height), an error value is returned.
+ ///
+ /// @note As a side effect, this changes the current
+ /// foreground color for subsequent operations.
+ ///
+ /// @param[in] r is the rectangle to draw.
+ /// @param[in] radius1 defines the horizontal radius of the curved corner. Take care
+ /// that this value < 1/2 the width of the rectangle, or bad_parameter
+ /// is returned.
+ /// @param[in] radius2 defines the vertical radius of the curved corner. Take care
+ /// that this value < 1/2 the height of the rectangle, or bad_parameter
+ /// is returned.
+ /// @param[in] color defines the foreground color.
+ /// @param[in] fillit is optional to FILL the rectangle. default is NOFILL.
+ /// @returns success/failure code. See @ref RetCode_t.
+ ///
+ RetCode_t roundrect(rect_t r,
+ dim_t radius1, dim_t radius2, color_t color, fill_t fillit = NOFILL);
+
/// Draw a rectangle with rounded corners using the specified color.
///
/// This draws a rounded rectangle. A numbers of checks are made on the values,
