deprecate draw text on path in docs
Remove documentation, see also references, and examples
that rely on SkCanvas::drawTextOnPath(HV).
Move example that uses SkDrawTextOnPath into illustrations.
TBR=reed@google.com
Docs-Preview: https://skia.org/?cl=150020
Bug: skia:6898
Change-Id: I1d92f258b75a8a10a6aa89ebf9380871ba7ecac5
Reviewed-on: https://skia-review.googlesource.com/150020
Commit-Queue: Cary Clark <caryclark@skia.org>
Reviewed-by: Cary Clark <caryclark@skia.org>
diff --git a/docs/SkPath_Reference.bmh b/docs/SkPath_Reference.bmh
index b41fe22..23736fb 100644
--- a/docs/SkPath_Reference.bmh
+++ b/docs/SkPath_Reference.bmh
@@ -3023,15 +3023,11 @@
conicTo can represent any Arc with a sweep less than 180 degrees at any rotation. All arcTo
constructions are converted to Conic data when added to Path.
-#ToDo allow example to hide source and not be exposed as fiddle since markdown / html can't
- do the kind of table shown in the illustration.
- example is spaced correctly on fiddle but spacing is too wide on pc
+#ToDo example is spaced correctly on fiddle but spacing is too wide on pc
##
-#Example
-#Height 300
-#Width 600
-#Description
+#Illustration
+
#List
# <sup>1</sup> arcTo(const SkRect& oval, SkScalar startAngle, SkScalar sweepAngle, bool forceMoveTo) ##
# <sup>2</sup> parameter sets force MoveTo ##
@@ -3040,105 +3036,9 @@
# <sup>5</sup> arcTo(SkScalar rx, SkScalar ry, SkScalar xAxisRotate, ArcSize largeArc,
Direction sweep, SkScalar x, SkScalar y) ##
#List ##
-#Description ##
-#Function
-###$
-struct data {
- const char* name;
- char super;
- int yn[10];
-};
-
-const data dataSet[] = {
-{ "arcTo sweep", '1', {1, 3, 1, 0, 0, 0, 0, 1, 0, 0 }},
-{ "drawArc", 0, {1, -1, 1, 1, 1, 1, 1, 0, 0, 0 }},
-{ "addArc", 0, {1, 1, 1, 4, 0, 1, 1, 1, 0, 0 }},
-{ "arcTo tangents", '4', {0, 0, 0, 0, 0, 0, 0, 1, 1, 0 }},
-{ "arcTo radii", '5', {1, 0, 1, 0, 0, 0, 0, 1, 1, 0 }},
-{ "conicTo", 0, {1, 1, 0, 0, 0, 0, 0, 1, 1, 1 }}
-};
-
-#define __degree_symbol__ "\xC2" "\xB0"
-
-const char* headers[] = {
- "Oval part",
- "force moveTo",
- "can draw 180" __degree_symbol__,
- "can draw 360" __degree_symbol__,
- "can draw greater than 360" __degree_symbol__,
- "ignored if radius is zero",
- "ignored if sweep is zero",
- "requires Path",
- "describes rotation",
- "describes perspective",
-};
-
-const char* yna[] = {
- "n/a",
- "no",
- "yes"
-};
-$$$#
-##
-void draw(SkCanvas* canvas) {
- SkPaint lp;
- lp.setAntiAlias(true);
- SkPaint tp(lp);
- SkPaint sp(tp);
- SkPaint bp(tp);
- bp.setFakeBoldText(true);
- sp.setTextSize(10);
- lp.setColor(SK_ColorGRAY);
- canvas->translate(0, 32);
- const int tl = 115;
- for (unsigned col = 0; col <= SK_ARRAY_COUNT(headers); ++col) {
- canvas->drawLine(tl + col * 35, 100, tl + col * 35, 250, lp);
- if (0 == col) {
- continue;
- }
- canvas->drawLine(tl + col * 35, 100, tl + 100 + col * 35, 0, lp);
- SkPath path;
- path.moveTo(tl - 3 + col * 35, 103);
- path.lineTo(tl + 124 + col * 35, -24);
- canvas->drawTextOnPathHV(headers[col -1], strlen(headers[col -1]), path, 0, -9, bp);
- }
- for (unsigned row = 0; row <= SK_ARRAY_COUNT(dataSet); ++row) {
- if (0 == row) {
- canvas->drawLine(tl, 100, tl + 350, 100, lp);
- } else {
- canvas->drawLine(5, 100 + row * 25, tl + 350, 100 + row * 25, lp);
- }
- if (row == SK_ARRAY_COUNT(dataSet)) {
- break;
- }
- canvas->drawString(dataSet[row].name, 5, 117 + row * 25, bp);
- if (dataSet[row].super) {
- SkScalar width = bp.measureText(dataSet[row].name, strlen(dataSet[row].name));
- canvas->drawText(&dataSet[row].super, 1, 8 + width, 112 + row * 25, sp);
- }
- for (unsigned col = 0; col < SK_ARRAY_COUNT(headers); ++col) {
- int val = dataSet[row].yn[col];
- canvas->drawString(yna[SkTMin(2, val + 1)], tl + 5 + col * 35, 117 + row * 25, tp);
- if (val > 1) {
- char supe = '0' + val - 1;
- canvas->drawText(&supe, 1, tl + 25 + col * 35, 112 + row * 25, sp);
- }
- }
- }
-}
-#Example ##
#Example
#Height 128
-#Description
-#ToDo make this a list or table ##
-1 describes an arc from an oval, a starting angle, and a sweep angle.
-2 is similar to 1, but does not require building a path to draw.
-3 is similar to 1, but always begins new Contour.
-4 describes an arc from a pair of tangent lines and a radius.
-5 describes an arc from Oval center, arc start Point and arc end Point.
-6 describes an arc from a pair of tangent lines and a Conic_Weight.
-##
void draw(SkCanvas* canvas) {
SkRect oval = {8, 8, 56, 56};
SkPaint ovalPaint;
@@ -3180,6 +3080,15 @@
}
#Example ##
+In the example above:
+#List
+# 1 describes an arc from an oval, a starting angle, and a sweep angle. ##
+# 2 is similar to 1, but does not require building a path to draw. ##
+# 3 is similar to 1, but always begins new Contour. ##
+# 4 describes an arc from a pair of tangent lines and a radius. ##
+# 5 describes an arc from Oval center, arc start Point and arc end Point. ##
+# 6 describes an arc from a pair of tangent lines and a Conic_Weight. ##
+#List ##
#Method SkPath& arcTo(const SkRect& oval, SkScalar startAngle, SkScalar sweepAngle, bool forceMoveTo)
#In Build
@@ -4500,6 +4409,11 @@
#Return reference to Path ##
#Example
+###$
+$Function
+#include "SkTextOnPath.h"
+$$
+
void draw(SkCanvas* canvas) {
SkPaint paint;
paint.setAntiAlias(true);
@@ -4511,9 +4425,12 @@
for (int start = 0; start < 8; ++start) {
SkPath textPath;
textPath.addRRect(rrect, SkPath::kCW_Direction, start);
- canvas->drawTextOnPathHV(&"01234567"[start], 1, textPath, 0, -5, paint);
+ SkMatrix matrix;
+ matrix.setTranslate(0, -5);
+ SkDrawTextOnPath(&"01234567"[start], 1, paint, textPath, &matrix, canvas);
}
}
+$$$#
##
#SeeAlso addRoundRect SkCanvas::drawRRect