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>
This commit is contained in:
Cary Clark 2018-08-28 11:48:28 -04:00 committed by Skia Commit-Bot
parent c01b5c7459
commit 153e76d4bf
10 changed files with 170 additions and 427 deletions

View File

@ -5107,7 +5107,7 @@ void draw(SkCanvas* canvas) {
} }
## ##
#SeeAlso drawString drawPosText drawPosTextH drawTextBlob drawTextOnPath drawTextRSXform #SeeAlso drawString drawPosText drawPosTextH drawTextBlob drawTextRSXform
## ##
@ -5143,7 +5143,7 @@ filled 12 point black Glyphs.
canvas->drawString("a small hello", 20, 20, paint); canvas->drawString("a small hello", 20, 20, paint);
## ##
#SeeAlso drawText drawPosText drawPosTextH drawTextBlob drawTextOnPath drawTextRSXform #SeeAlso drawText drawPosText drawPosTextH drawTextBlob drawTextRSXform
## ##
@ -5177,7 +5177,7 @@ filled 12 point black Glyphs.
canvas->drawString(string, 20, 20, paint); canvas->drawString(string, 20, 20, paint);
## ##
#SeeAlso drawText drawPosText drawPosTextH drawTextBlob drawTextOnPath drawTextRSXform #SeeAlso drawText drawPosText drawPosTextH drawTextBlob drawTextRSXform
## ##
@ -5222,7 +5222,7 @@ void draw(SkCanvas* canvas) {
} }
## ##
#SeeAlso drawText drawPosTextH drawTextBlob drawTextOnPath drawTextRSXform #SeeAlso drawText drawPosTextH drawTextBlob drawTextRSXform
## ##
@ -5267,7 +5267,7 @@ baseline.
} }
## ##
#SeeAlso drawText drawPosText drawTextBlob drawTextOnPath drawTextRSXform #SeeAlso drawText drawPosText drawTextBlob drawTextRSXform
## ##
@ -5275,111 +5275,12 @@ baseline.
#Method void drawTextOnPathHV(const void* text, size_t byteLength, const SkPath& path, SkScalar hOffset, #Method void drawTextOnPathHV(const void* text, size_t byteLength, const SkPath& path, SkScalar hOffset,
SkScalar vOffset, const SkPaint& paint) SkScalar vOffset, const SkPaint& paint)
#In Draw_Text #Deprecated
#In Draw
#Line # draws text following Path with offsets ##
Draws text on Path path, using Clip, Matrix, and Paint paint.
Origin of text is at distance hOffset along the path, offset by a perpendicular
vector of length vOffset. If the path section corresponding the glyph advance is
curved, the glyph is drawn curved to match; control points in the glyph are
mapped to projected points parallel to the path. If the text advance is larger
than the path length, the excess text is clipped.
text meaning depends on Paint_Text_Encoding; by default, text is encoded as
UTF-8. Origin meaning depends on Paint_Text_Align and Paint_Vertical_Text; by
default text positions the first glyph left side bearing and baseline relative
to origin. Text size is affected by Matrix and Paint_Text_Size.
All elements of paint: Path_Effect, Mask_Filter, Shader,
Color_Filter, Image_Filter, and Draw_Looper; apply to text. By default, draws
filled 12 point black Glyphs.
#Param text character code points or Glyphs drawn ##
#Param byteLength byte length of text array ##
#Param path Path providing text baseline ##
#Param hOffset distance along path to offset origin ##
#Param vOffset offset of text above (if negative) or below (if positive) the path ##
#Param paint text size, blend, color, and so on, used to draw ##
#Example
void draw(SkCanvas* canvas) {
const char aero[] = "correo a" "\xC3" "\xA9" "reo";
const size_t len = sizeof(aero) - 1;
SkPath path;
path.addOval({43-26, 43-26, 43+26, 43+26}, SkPath::kCW_Direction, 3);
SkPaint paint;
paint.setTextSize(24);
for (auto offset : { 0, 10, 20 } ) {
canvas->drawTextOnPathHV(aero, len, path, 0, -offset, paint);
canvas->translate(70 + offset, 70 + offset);
}
}
## ##
#SeeAlso drawTextOnPath drawText drawPosTextH drawTextBlob drawTextRSXform
##
# ------------------------------------------------------------------------------
#Method void drawTextOnPath(const void* text, size_t byteLength, const SkPath& path, #Method void drawTextOnPath(const void* text, size_t byteLength, const SkPath& path,
const SkMatrix* matrix, const SkPaint& paint) const SkMatrix* matrix, const SkPaint& paint)
#In Draw_Text #Deprecated
#In Draw
#Line # draws text following Path contour ##
Draws text on Path path, using Clip, Matrix, and Paint paint.
Origin of text is at beginning of path offset by matrix, if not nullptr.
matrix transforms text before text is mapped to path. If the path section
corresponding the glyph advance is curved, the glyph is drawn curved to match;
control points in the glyph are mapped to projected points parallel to the path.
If the text advance is larger than the path length, the excess text is clipped.
matrix does not effect paint Shader.
text meaning depends on Paint_Text_Encoding; by default, text is encoded as
UTF-8. Origin meaning depends on Paint_Text_Align and Paint_Vertical_Text; by
default text positions the first glyph left side bearing and baseline relative
to origin. Text size is affected by matrix parameter, Canvas Matrix,
and Paint_Text_Size.
All elements of paint: Path_Effect, Mask_Filter, Shader,
Color_Filter, Image_Filter, and Draw_Looper; apply to text. By default, draws
filled 12 point black Glyphs.
#Param text character code points or Glyphs drawn ##
#Param byteLength byte length of text array ##
#Param path Path providing text baseline ##
#Param matrix transform of Glyphs before mapping to path; may be nullptr
to use identity Matrix
##
#Param paint text size, blend, color, and so on, used to draw ##
#Example
void draw(SkCanvas* canvas) {
const char roller[] = "rollercoaster";
const size_t len = sizeof(roller) - 1;
SkPath path;
path.cubicTo(40, -80, 120, 80, 160, -40);
SkPaint paint;
paint.setTextSize(32);
paint.setStyle(SkPaint::kStroke_Style);
SkMatrix matrix;
matrix.setIdentity();
for (int i = 0; i < 3; ++i) {
canvas->translate(25, 60);
canvas->drawPath(path, paint);
canvas->drawTextOnPath(roller, len, path, &matrix, paint);
matrix.preTranslate(0, 10);
}
}
##
#SeeAlso drawTextOnPathHV drawText drawPosTextH drawTextBlob drawTextRSXform
## ##
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
@ -5431,7 +5332,7 @@ void draw(SkCanvas* canvas) {
} }
## ##
#SeeAlso drawTextOnPath drawTextOnPathHV drawText drawPosText drawTextBlob #SeeAlso drawText drawPosText drawTextBlob
## ##

View File

@ -3477,8 +3477,7 @@ Increments drawLooper Reference_Count by one.
Align adjusts the text relative to the text position. Align adjusts the text relative to the text position.
Align affects Glyphs drawn with: SkCanvas::drawText, SkCanvas::drawPosText, Align affects Glyphs drawn with: SkCanvas::drawText, SkCanvas::drawPosText,
SkCanvas::drawPosTextH, SkCanvas::drawTextOnPath, SkCanvas::drawPosTextH, SkCanvas::drawTextRSXform, SkCanvas::drawTextBlob,
SkCanvas::drawTextOnPathHV, SkCanvas::drawTextRSXform, SkCanvas::drawTextBlob,
and SkCanvas::drawString; and SkCanvas::drawString;
as well as calls that place text Glyphs like getTextWidths and getTextPath. as well as calls that place text Glyphs like getTextWidths and getTextPath.

View File

@ -3023,15 +3023,11 @@ conicTo describes Arc of less than 180 degrees as a pair of tangent lines and Co
conicTo can represent any Arc with a sweep less than 180 degrees at any rotation. All arcTo 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. 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 #ToDo example is spaced correctly on fiddle but spacing is too wide on pc
do the kind of table shown in the illustration.
example is spaced correctly on fiddle but spacing is too wide on pc
## ##
#Example #Illustration
#Height 300
#Width 600
#Description
#List #List
# <sup>1</sup> arcTo(const SkRect& oval, SkScalar startAngle, SkScalar sweepAngle, bool forceMoveTo) ## # <sup>1</sup> arcTo(const SkRect& oval, SkScalar startAngle, SkScalar sweepAngle, bool forceMoveTo) ##
# <sup>2</sup> parameter sets force MoveTo ## # <sup>2</sup> parameter sets force MoveTo ##
@ -3040,105 +3036,9 @@ constructions are converted to Conic data when added to Path.
# <sup>5</sup> arcTo(SkScalar rx, SkScalar ry, SkScalar xAxisRotate, ArcSize largeArc, # <sup>5</sup> arcTo(SkScalar rx, SkScalar ry, SkScalar xAxisRotate, ArcSize largeArc,
Direction sweep, SkScalar x, SkScalar y) ## Direction sweep, SkScalar x, SkScalar y) ##
#List ## #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 #Example
#Height 128 #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) { void draw(SkCanvas* canvas) {
SkRect oval = {8, 8, 56, 56}; SkRect oval = {8, 8, 56, 56};
SkPaint ovalPaint; SkPaint ovalPaint;
@ -3180,6 +3080,15 @@ void draw(SkCanvas* canvas) {
} }
#Example ## #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) #Method SkPath& arcTo(const SkRect& oval, SkScalar startAngle, SkScalar sweepAngle, bool forceMoveTo)
#In Build #In Build
@ -4500,6 +4409,11 @@ After appending, Path may be empty, or may contain: Rect, Oval, or Round_Rect.
#Return reference to Path ## #Return reference to Path ##
#Example #Example
###$
$Function
#include "SkTextOnPath.h"
$$
void draw(SkCanvas* canvas) { void draw(SkCanvas* canvas) {
SkPaint paint; SkPaint paint;
paint.setAntiAlias(true); paint.setAntiAlias(true);
@ -4511,9 +4425,12 @@ void draw(SkCanvas* canvas) {
for (int start = 0; start < 8; ++start) { for (int start = 0; start < 8; ++start) {
SkPath textPath; SkPath textPath;
textPath.addRRect(rrect, SkPath::kCW_Direction, start); 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 #SeeAlso addRoundRect SkCanvas::drawRRect

View File

@ -718,4 +718,99 @@ void draw(SkCanvas* canvas) {
## ##
## ##
#Subtopic Path_Arc
#Example
#Height 300
#Width 600
#Function
###$
#include "SkTextOnPath.h"
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);
SkMatrix matrix;
matrix.setTranslate(0, -9);
SkDrawTextOnPath(headers[col -1], strlen(headers[col -1]), bp, path, &matrix, canvas);
}
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 ##
##
#Topic Illustrations ## #Topic Illustrations ##

View File

@ -6,7 +6,7 @@
*/ */
/* Generated by tools/bookmaker from include/core/SkCanvas.h and docs/SkCanvas_Reference.bmh /* Generated by tools/bookmaker from include/core/SkCanvas.h and docs/SkCanvas_Reference.bmh
on 2018-08-10 12:59:44. Additional documentation and examples can be found at: on 2018-08-28 10:32:58. Additional documentation and examples can be found at:
https://skia.org/user/api/SkCanvas_Reference https://skia.org/user/api/SkCanvas_Reference
You may edit either file directly. Structural changes to public interfaces require You may edit either file directly. Structural changes to public interfaces require
@ -1946,63 +1946,12 @@ public:
void drawPosTextH(const void* text, size_t byteLength, const SkScalar xpos[], SkScalar constY, void drawPosTextH(const void* text, size_t byteLength, const SkScalar xpos[], SkScalar constY,
const SkPaint& paint); const SkPaint& paint);
/** Draws text on SkPath path, using clip, SkMatrix, and SkPaint paint. /** Deprecated.
DEPRECATED
Origin of text is at distance hOffset along the path, offset by a perpendicular
vector of length vOffset. If the path section corresponding the glyph advance is
curved, the glyph is drawn curved to match; control points in the glyph are
mapped to projected points parallel to the path. If the text advance is larger
than the path length, the excess text is clipped.
text meaning depends on SkPaint::TextEncoding; by default, text is encoded as
UTF-8. Origin meaning depends on SkPaint::Align and SkPaint vertical text; by
default text positions the first glyph left side bearing and baseline relative
to origin. Text size is affected by SkMatrix and SkPaint text size.
All elements of paint: SkPathEffect, SkMaskFilter, SkShader,
SkColorFilter, SkImageFilter, and SkDrawLooper; apply to text. By default, draws
filled 12 point black glyphs.
@param text character code points or glyphs drawn
@param byteLength byte length of text array
@param path SkPath providing text baseline
@param hOffset distance along path to offset origin
@param vOffset offset of text above (if negative) or below (if positive) the path
@param paint text size, blend, color, and so on, used to draw
*/ */
void drawTextOnPathHV(const void* text, size_t byteLength, const SkPath& path, SkScalar hOffset, void drawTextOnPathHV(const void* text, size_t byteLength, const SkPath& path, SkScalar hOffset,
SkScalar vOffset, const SkPaint& paint); SkScalar vOffset, const SkPaint& paint);
/** Draws text on SkPath path, using clip, SkMatrix, and SkPaint paint. /** Deprecated.
DEPRECATED
Origin of text is at beginning of path offset by matrix, if not nullptr.
matrix transforms text before text is mapped to path. If the path section
corresponding the glyph advance is curved, the glyph is drawn curved to match;
control points in the glyph are mapped to projected points parallel to the path.
If the text advance is larger than the path length, the excess text is clipped.
matrix does not effect paint SkShader.
text meaning depends on SkPaint::TextEncoding; by default, text is encoded as
UTF-8. Origin meaning depends on SkPaint::Align and SkPaint vertical text; by
default text positions the first glyph left side bearing and baseline relative
to origin. Text size is affected by matrix parameter, SkCanvas SkMatrix,
and SkPaint text size.
All elements of paint: SkPathEffect, SkMaskFilter, SkShader,
SkColorFilter, SkImageFilter, and SkDrawLooper; apply to text. By default, draws
filled 12 point black glyphs.
@param text character code points or glyphs drawn
@param byteLength byte length of text array
@param path SkPath providing text baseline
@param matrix transform of glyphs before mapping to path; may be nullptr
to use identity SkMatrix
@param paint text size, blend, color, and so on, used to draw
*/ */
void drawTextOnPath(const void* text, size_t byteLength, const SkPath& path, void drawTextOnPath(const void* text, size_t byteLength, const SkPath& path,
const SkMatrix* matrix, const SkPaint& paint); const SkMatrix* matrix, const SkPaint& paint);

View File

@ -6,7 +6,7 @@
*/ */
/* Generated by tools/bookmaker from include/core/SkPaint.h and docs/SkPaint_Reference.bmh /* Generated by tools/bookmaker from include/core/SkPaint.h and docs/SkPaint_Reference.bmh
on 2018-07-13 08:15:10. Additional documentation and examples can be found at: on 2018-08-28 10:32:58. Additional documentation and examples can be found at:
https://skia.org/user/api/SkPaint_Reference https://skia.org/user/api/SkPaint_Reference
You may edit either file directly. Structural changes to public interfaces require You may edit either file directly. Structural changes to public interfaces require
@ -847,8 +847,7 @@ public:
/** \enum SkPaint::Align /** \enum SkPaint::Align
Align adjusts the text relative to the text position. Align adjusts the text relative to the text position.
Align affects glyphs drawn with: SkCanvas::drawText, SkCanvas::drawPosText, Align affects glyphs drawn with: SkCanvas::drawText, SkCanvas::drawPosText,
SkCanvas::drawPosTextH, SkCanvas::drawTextOnPath, SkCanvas::drawPosTextH, SkCanvas::drawTextRSXform, SkCanvas::drawTextBlob,
SkCanvas::drawTextOnPathHV, SkCanvas::drawTextRSXform, SkCanvas::drawTextBlob,
and SkCanvas::drawString; and SkCanvas::drawString;
as well as calls that place text glyphs like getTextWidths() and getTextPath(). as well as calls that place text glyphs like getTextWidths() and getTextPath().

View File

@ -436,14 +436,6 @@ SkCanvas member functions read and modify the structure properties.
<td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a href='#SkCanvas_drawTextBlob'>drawTextBlob</a></td> <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a href='#SkCanvas_drawTextBlob'>drawTextBlob</a></td>
<td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>draws text with arrays of positions and <a href='SkPaint_Reference#Paint'>Paint</a></td> <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>draws text with arrays of positions and <a href='SkPaint_Reference#Paint'>Paint</a></td>
</tr> </tr>
<tr>
<td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a href='#SkCanvas_drawTextOnPath'>drawTextOnPath</a></td>
<td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>draws text following <a href='SkPath_Reference#Path'>Path</a> contour</td>
</tr>
<tr style='background-color: #f0f0f0; '>
<td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a href='#SkCanvas_drawTextOnPathHV'>drawTextOnPathHV</a></td>
<td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>draws text following <a href='SkPath_Reference#Path'>Path</a> with offsets</td>
</tr>
<tr> <tr>
<td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a href='#SkCanvas_drawTextRSXform'>drawTextRSXform</a></td> <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a href='#SkCanvas_drawTextRSXform'>drawTextRSXform</a></td>
<td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>draws text with array of <a href='undocumented#RSXform'>RSXform</a></td> <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>draws text with array of <a href='undocumented#RSXform'>RSXform</a></td>
@ -5808,14 +5800,6 @@ are scaled if needed to take up the remaining space; the center is transparent.
<td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '></td> <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '></td>
<td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a href='#SkCanvas_drawTextBlob_2'>drawTextBlob(const sk sp&lt;SkTextBlob&gt;& blob, SkScalar x, SkScalar y, const SkPaint& paint)</a></td> <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a href='#SkCanvas_drawTextBlob_2'>drawTextBlob(const sk sp&lt;SkTextBlob&gt;& blob, SkScalar x, SkScalar y, const SkPaint& paint)</a></td>
</tr> </tr>
<tr>
<td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a href='#SkCanvas_drawTextOnPath'>drawTextOnPath</a></td>
<td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>draws text following <a href='SkPath_Reference#Path'>Path</a> contour</td>
</tr>
<tr style='background-color: #f0f0f0; '>
<td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a href='#SkCanvas_drawTextOnPathHV'>drawTextOnPathHV</a></td>
<td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>draws text following <a href='SkPath_Reference#Path'>Path</a> with offsets</td>
</tr>
<tr> <tr>
<td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a href='#SkCanvas_drawTextRSXform'>drawTextRSXform</a></td> <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a href='#SkCanvas_drawTextRSXform'>drawTextRSXform</a></td>
<td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>draws text with array of <a href='undocumented#RSXform'>RSXform</a></td> <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>draws text with array of <a href='undocumented#RSXform'>RSXform</a></td>
@ -5869,7 +5853,7 @@ filled 12 point black <a href='undocumented#Glyph'>Glyphs</a>.
### See Also ### See Also
<a href='#SkCanvas_drawString'>drawString</a><sup><a href='#SkCanvas_drawString_2'>[2]</a></sup> <a href='#SkCanvas_drawPosText'>drawPosText</a> <a href='#SkCanvas_drawPosTextH'>drawPosTextH</a> <a href='#SkCanvas_drawTextBlob'>drawTextBlob</a><sup><a href='#SkCanvas_drawTextBlob_2'>[2]</a></sup> <a href='#SkCanvas_drawTextOnPath'>drawTextOnPath</a> <a href='#SkCanvas_drawTextRSXform'>drawTextRSXform</a> <a href='#SkCanvas_drawString'>drawString</a><sup><a href='#SkCanvas_drawString_2'>[2]</a></sup> <a href='#SkCanvas_drawPosText'>drawPosText</a> <a href='#SkCanvas_drawPosTextH'>drawPosTextH</a> <a href='#SkCanvas_drawTextBlob'>drawTextBlob</a><sup><a href='#SkCanvas_drawTextBlob_2'>[2]</a></sup> <a href='#SkCanvas_drawTextRSXform'>drawTextRSXform</a>
--- ---
@ -5918,7 +5902,7 @@ ending with a char value of zero</td>
### See Also ### See Also
<a href='#SkCanvas_drawText'>drawText</a> <a href='#SkCanvas_drawPosText'>drawPosText</a> <a href='#SkCanvas_drawPosTextH'>drawPosTextH</a> <a href='#SkCanvas_drawTextBlob'>drawTextBlob</a><sup><a href='#SkCanvas_drawTextBlob_2'>[2]</a></sup> <a href='#SkCanvas_drawTextOnPath'>drawTextOnPath</a> <a href='#SkCanvas_drawTextRSXform'>drawTextRSXform</a> <a href='#SkCanvas_drawText'>drawText</a> <a href='#SkCanvas_drawPosText'>drawPosText</a> <a href='#SkCanvas_drawPosTextH'>drawPosTextH</a> <a href='#SkCanvas_drawTextBlob'>drawTextBlob</a><sup><a href='#SkCanvas_drawTextBlob_2'>[2]</a></sup> <a href='#SkCanvas_drawTextRSXform'>drawTextRSXform</a>
--- ---
@ -5966,7 +5950,7 @@ ending with a char value of zero</td>
### See Also ### See Also
<a href='#SkCanvas_drawText'>drawText</a> <a href='#SkCanvas_drawPosText'>drawPosText</a> <a href='#SkCanvas_drawPosTextH'>drawPosTextH</a> <a href='#SkCanvas_drawTextBlob'>drawTextBlob</a><sup><a href='#SkCanvas_drawTextBlob_2'>[2]</a></sup> <a href='#SkCanvas_drawTextOnPath'>drawTextOnPath</a> <a href='#SkCanvas_drawTextRSXform'>drawTextRSXform</a> <a href='#SkCanvas_drawText'>drawText</a> <a href='#SkCanvas_drawPosText'>drawPosText</a> <a href='#SkCanvas_drawPosTextH'>drawPosTextH</a> <a href='#SkCanvas_drawTextBlob'>drawTextBlob</a><sup><a href='#SkCanvas_drawTextBlob_2'>[2]</a></sup> <a href='#SkCanvas_drawTextRSXform'>drawTextRSXform</a>
--- ---
@ -6015,7 +5999,7 @@ rather than using the font advance widths.
### See Also ### See Also
<a href='#SkCanvas_drawText'>drawText</a> <a href='#SkCanvas_drawPosTextH'>drawPosTextH</a> <a href='#SkCanvas_drawTextBlob'>drawTextBlob</a><sup><a href='#SkCanvas_drawTextBlob_2'>[2]</a></sup> <a href='#SkCanvas_drawTextOnPath'>drawTextOnPath</a> <a href='#SkCanvas_drawTextRSXform'>drawTextRSXform</a> <a href='#SkCanvas_drawText'>drawText</a> <a href='#SkCanvas_drawPosTextH'>drawPosTextH</a> <a href='#SkCanvas_drawTextBlob'>drawTextBlob</a><sup><a href='#SkCanvas_drawTextBlob_2'>[2]</a></sup> <a href='#SkCanvas_drawTextRSXform'>drawTextRSXform</a>
--- ---
@ -6070,7 +6054,7 @@ baseline.
### See Also ### See Also
<a href='#SkCanvas_drawText'>drawText</a> <a href='#SkCanvas_drawPosText'>drawPosText</a> <a href='#SkCanvas_drawTextBlob'>drawTextBlob</a><sup><a href='#SkCanvas_drawTextBlob_2'>[2]</a></sup> <a href='#SkCanvas_drawTextOnPath'>drawTextOnPath</a> <a href='#SkCanvas_drawTextRSXform'>drawTextRSXform</a> <a href='#SkCanvas_drawText'>drawText</a> <a href='#SkCanvas_drawPosText'>drawPosText</a> <a href='#SkCanvas_drawTextBlob'>drawTextBlob</a><sup><a href='#SkCanvas_drawTextBlob_2'>[2]</a></sup> <a href='#SkCanvas_drawTextRSXform'>drawTextRSXform</a>
--- ---
@ -6082,52 +6066,7 @@ void <a href='#SkCanvas_drawTextOnPathHV'>drawTextOnPathHV</a>(const void* text,
<a href='undocumented#SkScalar'>SkScalar</a> vOffset, const <a href='SkPaint_Reference#SkPaint'>SkPaint</a>& paint) <a href='undocumented#SkScalar'>SkScalar</a> vOffset, const <a href='SkPaint_Reference#SkPaint'>SkPaint</a>& paint)
</pre> </pre>
Draws <a href='#SkCanvas_drawTextOnPathHV_text'>text</a> on <a href='SkPath_Reference#Path'>Path</a> <a href='#SkCanvas_drawTextOnPathHV_path'>path</a>, using <a href='#Clip'>Clip</a>, <a href='#Matrix'>Matrix</a>, and <a href='SkPaint_Reference#Paint'>Paint</a> <a href='#SkCanvas_drawTextOnPathHV_paint'>paint</a>. Deprecated.
Origin of <a href='#SkCanvas_drawTextOnPathHV_text'>text</a> is at distance <a href='#SkCanvas_drawTextOnPathHV_hOffset'>hOffset</a> along the <a href='#SkCanvas_drawTextOnPathHV_path'>path</a>, offset by a perpendicular
vector of length <a href='#SkCanvas_drawTextOnPathHV_vOffset'>vOffset</a>. If the <a href='#SkCanvas_drawTextOnPathHV_path'>path</a> section corresponding the glyph advance is
curved, the glyph is drawn curved to match; control points in the glyph are
mapped to projected points parallel to the <a href='#SkCanvas_drawTextOnPathHV_path'>path</a>. If the <a href='#SkCanvas_drawTextOnPathHV_text'>text</a> advance is larger
than the <a href='#SkCanvas_drawTextOnPathHV_path'>path</a> length, the excess <a href='#SkCanvas_drawTextOnPathHV_text'>text</a> is clipped.
<a href='#SkCanvas_drawTextOnPathHV_text'>text</a> meaning depends on <a href='SkPaint_Reference#Text_Encoding'>Paint Text Encoding</a>; by default, <a href='#SkCanvas_drawTextOnPathHV_text'>text</a> is encoded as
UTF-8. Origin meaning depends on <a href='SkPaint_Reference#Text_Align'>Paint Text Align</a> and <a href='SkPaint_Reference#Vertical_Text'>Paint Vertical Text</a>; by
default <a href='#SkCanvas_drawTextOnPathHV_text'>text</a> positions the first glyph left side bearing and baseline relative
to origin. <a href='undocumented#Text'>Text</a> size is affected by <a href='#Matrix'>Matrix</a> and <a href='SkPaint_Reference#Text_Size'>Paint Text Size</a>.
All elements of <a href='#SkCanvas_drawTextOnPathHV_paint'>paint</a>: <a href='undocumented#Path_Effect'>Path Effect</a>, <a href='undocumented#Mask_Filter'>Mask Filter</a>, <a href='undocumented#Shader'>Shader</a>,
<a href='undocumented#Color_Filter'>Color Filter</a>, <a href='undocumented#Image_Filter'>Image Filter</a>, and <a href='undocumented#Draw_Looper'>Draw Looper</a>; apply to <a href='#SkCanvas_drawTextOnPathHV_text'>text</a>. By default, draws
filled 12 point black <a href='undocumented#Glyph'>Glyphs</a>.
### Parameters
<table> <tr> <td><a name='SkCanvas_drawTextOnPathHV_text'><code><strong>text</strong></code></a></td>
<td>character code points or <a href='undocumented#Glyph'>Glyphs</a> drawn</td>
</tr>
<tr> <td><a name='SkCanvas_drawTextOnPathHV_byteLength'><code><strong>byteLength</strong></code></a></td>
<td>byte length of <a href='#SkCanvas_drawTextOnPathHV_text'>text</a> array</td>
</tr>
<tr> <td><a name='SkCanvas_drawTextOnPathHV_path'><code><strong>path</strong></code></a></td>
<td><a href='SkPath_Reference#Path'>Path</a> providing <a href='#SkCanvas_drawTextOnPathHV_text'>text</a> baseline</td>
</tr>
<tr> <td><a name='SkCanvas_drawTextOnPathHV_hOffset'><code><strong>hOffset</strong></code></a></td>
<td>distance along <a href='#SkCanvas_drawTextOnPathHV_path'>path</a> to offset origin</td>
</tr>
<tr> <td><a name='SkCanvas_drawTextOnPathHV_vOffset'><code><strong>vOffset</strong></code></a></td>
<td>offset of <a href='#SkCanvas_drawTextOnPathHV_text'>text</a> above (if negative) or below (if positive) the <a href='#SkCanvas_drawTextOnPathHV_path'>path</a></td>
</tr>
<tr> <td><a name='SkCanvas_drawTextOnPathHV_paint'><code><strong>paint</strong></code></a></td>
<td><a href='#SkCanvas_drawTextOnPathHV_text'>text</a> size, blend, color, and so on, used to draw</td>
</tr>
</table>
### Example
<div><fiddle-embed name="b2f22d1d5041e55d6913aab52f73a7d3"></fiddle-embed></div>
### See Also
<a href='#SkCanvas_drawTextOnPath'>drawTextOnPath</a> <a href='#SkCanvas_drawText'>drawText</a> <a href='#SkCanvas_drawPosTextH'>drawPosTextH</a> <a href='#SkCanvas_drawTextBlob'>drawTextBlob</a><sup><a href='#SkCanvas_drawTextBlob_2'>[2]</a></sup> <a href='#SkCanvas_drawTextRSXform'>drawTextRSXform</a>
--- ---
@ -6139,53 +6078,7 @@ void <a href='#SkCanvas_drawTextOnPath'>drawTextOnPath</a>(const void* text, siz
const <a href='SkPaint_Reference#SkPaint'>SkPaint</a>& paint) const <a href='SkPaint_Reference#SkPaint'>SkPaint</a>& paint)
</pre> </pre>
Draws <a href='#SkCanvas_drawTextOnPath_text'>text</a> on <a href='SkPath_Reference#Path'>Path</a> <a href='#SkCanvas_drawTextOnPath_path'>path</a>, using <a href='#Clip'>Clip</a>, <a href='#Matrix'>Matrix</a>, and <a href='SkPaint_Reference#Paint'>Paint</a> <a href='#SkCanvas_drawTextOnPath_paint'>paint</a>. Deprecated.
Origin of <a href='#SkCanvas_drawTextOnPath_text'>text</a> is at beginning of <a href='#SkCanvas_drawTextOnPath_path'>path</a> offset by <a href='#SkCanvas_drawTextOnPath_matrix'>matrix</a>, if not nullptr.
<a href='#SkCanvas_drawTextOnPath_matrix'>matrix</a> transforms <a href='#SkCanvas_drawTextOnPath_text'>text</a> before <a href='#SkCanvas_drawTextOnPath_text'>text</a> is mapped to <a href='#SkCanvas_drawTextOnPath_path'>path</a>. If the <a href='#SkCanvas_drawTextOnPath_path'>path</a> section
corresponding the glyph advance is curved, the glyph is drawn curved to match;
control points in the glyph are mapped to projected points parallel to the <a href='#SkCanvas_drawTextOnPath_path'>path</a>.
If the <a href='#SkCanvas_drawTextOnPath_text'>text</a> advance is larger than the <a href='#SkCanvas_drawTextOnPath_path'>path</a> length, the excess <a href='#SkCanvas_drawTextOnPath_text'>text</a> is clipped.
<a href='#SkCanvas_drawTextOnPath_matrix'>matrix</a> does not effect <a href='#SkCanvas_drawTextOnPath_paint'>paint</a> <a href='undocumented#Shader'>Shader</a>.
<a href='#SkCanvas_drawTextOnPath_text'>text</a> meaning depends on <a href='SkPaint_Reference#Text_Encoding'>Paint Text Encoding</a>; by default, <a href='#SkCanvas_drawTextOnPath_text'>text</a> is encoded as
UTF-8. Origin meaning depends on <a href='SkPaint_Reference#Text_Align'>Paint Text Align</a> and <a href='SkPaint_Reference#Vertical_Text'>Paint Vertical Text</a>; by
default <a href='#SkCanvas_drawTextOnPath_text'>text</a> positions the first glyph left side bearing and baseline relative
to origin. <a href='undocumented#Text'>Text</a> size is affected by <a href='#SkCanvas_drawTextOnPath_matrix'>matrix</a> parameter, <a href='#Canvas'>Canvas</a> <a href='#Matrix'>Matrix</a>,
and <a href='SkPaint_Reference#Text_Size'>Paint Text Size</a>.
All elements of <a href='#SkCanvas_drawTextOnPath_paint'>paint</a>: <a href='undocumented#Path_Effect'>Path Effect</a>, <a href='undocumented#Mask_Filter'>Mask Filter</a>, <a href='undocumented#Shader'>Shader</a>,
<a href='undocumented#Color_Filter'>Color Filter</a>, <a href='undocumented#Image_Filter'>Image Filter</a>, and <a href='undocumented#Draw_Looper'>Draw Looper</a>; apply to <a href='#SkCanvas_drawTextOnPath_text'>text</a>. By default, draws
filled 12 point black <a href='undocumented#Glyph'>Glyphs</a>.
### Parameters
<table> <tr> <td><a name='SkCanvas_drawTextOnPath_text'><code><strong>text</strong></code></a></td>
<td>character code points or <a href='undocumented#Glyph'>Glyphs</a> drawn</td>
</tr>
<tr> <td><a name='SkCanvas_drawTextOnPath_byteLength'><code><strong>byteLength</strong></code></a></td>
<td>byte length of <a href='#SkCanvas_drawTextOnPath_text'>text</a> array</td>
</tr>
<tr> <td><a name='SkCanvas_drawTextOnPath_path'><code><strong>path</strong></code></a></td>
<td><a href='SkPath_Reference#Path'>Path</a> providing <a href='#SkCanvas_drawTextOnPath_text'>text</a> baseline</td>
</tr>
<tr> <td><a name='SkCanvas_drawTextOnPath_matrix'><code><strong>matrix</strong></code></a></td>
<td>transform of <a href='undocumented#Glyph'>Glyphs</a> before mapping to <a href='#SkCanvas_drawTextOnPath_path'>path</a>; may be nullptr
to use identity <a href='#Matrix'>Matrix</a></td>
</tr>
<tr> <td><a name='SkCanvas_drawTextOnPath_paint'><code><strong>paint</strong></code></a></td>
<td><a href='#SkCanvas_drawTextOnPath_text'>text</a> size, blend, color, and so on, used to draw</td>
</tr>
</table>
### Example
<div><fiddle-embed name="236e680b27960ca22641586dba0599c9"></fiddle-embed></div>
### See Also
<a href='#SkCanvas_drawTextOnPathHV'>drawTextOnPathHV</a> <a href='#SkCanvas_drawText'>drawText</a> <a href='#SkCanvas_drawPosTextH'>drawPosTextH</a> <a href='#SkCanvas_drawTextBlob'>drawTextBlob</a><sup><a href='#SkCanvas_drawTextBlob_2'>[2]</a></sup> <a href='#SkCanvas_drawTextRSXform'>drawTextRSXform</a>
--- ---
@ -6235,7 +6128,7 @@ filled 12 point black <a href='undocumented#Glyph'>Glyphs</a>.
### See Also ### See Also
<a href='#SkCanvas_drawTextOnPath'>drawTextOnPath</a> <a href='#SkCanvas_drawTextOnPathHV'>drawTextOnPathHV</a> <a href='#SkCanvas_drawText'>drawText</a> <a href='#SkCanvas_drawPosText'>drawPosText</a> <a href='#SkCanvas_drawTextBlob'>drawTextBlob</a><sup><a href='#SkCanvas_drawTextBlob_2'>[2]</a></sup> <a href='#SkCanvas_drawText'>drawText</a> <a href='#SkCanvas_drawPosText'>drawPosText</a> <a href='#SkCanvas_drawTextBlob'>drawTextBlob</a><sup><a href='#SkCanvas_drawTextBlob_2'>[2]</a></sup>
--- ---

View File

@ -4336,8 +4336,7 @@ Deprecated.
<a href='#SkPaint_Align'>Align</a> adjusts the text relative to the text position. <a href='#SkPaint_Align'>Align</a> adjusts the text relative to the text position.
<a href='#SkPaint_Align'>Align</a> affects <a href='undocumented#Glyph'>Glyphs</a> drawn with: <a href='SkCanvas_Reference#SkCanvas_drawText'>SkCanvas::drawText</a>, <a href='SkCanvas_Reference#SkCanvas_drawPosText'>SkCanvas::drawPosText</a>, <a href='#SkPaint_Align'>Align</a> affects <a href='undocumented#Glyph'>Glyphs</a> drawn with: <a href='SkCanvas_Reference#SkCanvas_drawText'>SkCanvas::drawText</a>, <a href='SkCanvas_Reference#SkCanvas_drawPosText'>SkCanvas::drawPosText</a>,
<a href='SkCanvas_Reference#SkCanvas_drawPosTextH'>SkCanvas::drawPosTextH</a>, <a href='SkCanvas_Reference#SkCanvas_drawTextOnPath'>SkCanvas::drawTextOnPath</a>, <a href='SkCanvas_Reference#SkCanvas_drawPosTextH'>SkCanvas::drawPosTextH</a>, <a href='SkCanvas_Reference#SkCanvas_drawTextRSXform'>SkCanvas::drawTextRSXform</a>, <a href='SkCanvas_Reference#SkCanvas_drawTextBlob'>SkCanvas::drawTextBlob</a>,
<a href='SkCanvas_Reference#SkCanvas_drawTextOnPathHV'>SkCanvas::drawTextOnPathHV</a>, <a href='SkCanvas_Reference#SkCanvas_drawTextRSXform'>SkCanvas::drawTextRSXform</a>, <a href='SkCanvas_Reference#SkCanvas_drawTextBlob'>SkCanvas::drawTextBlob</a>,
and <a href='SkCanvas_Reference#SkCanvas_drawString'>SkCanvas::drawString</a>; and <a href='SkCanvas_Reference#SkCanvas_drawString'>SkCanvas::drawString</a>;
as well as calls that place text <a href='undocumented#Glyph'>Glyphs</a> like <a href='#SkPaint_getTextWidths'>getTextWidths</a> and <a href='#SkPaint_getTextPath'>getTextPath</a>. as well as calls that place text <a href='undocumented#Glyph'>Glyphs</a> like <a href='#SkPaint_getTextWidths'>getTextWidths</a> and <a href='#SkPaint_getTextPath'>getTextPath</a>.

View File

@ -3684,9 +3684,7 @@ so additional values choose a single solution. This construction is similar to <
<a href='#SkPath_conicTo'>conicTo</a> can represent any <a href='#Arc'>Arc</a> with a sweep less than 180 degrees at any rotation. All <a href='#SkPath_arcTo'>arcTo</a> <a href='#SkPath_conicTo'>conicTo</a> can represent any <a href='#Arc'>Arc</a> with a sweep less than 180 degrees at any rotation. All <a href='#SkPath_arcTo'>arcTo</a>
constructions are converted to <a href='#Conic'>Conic</a> data when added to <a href='#Path'>Path</a>. constructions are converted to <a href='#Conic'>Conic</a> data when added to <a href='#Path'>Path</a>.
### Example ![Arc](https://fiddle.skia.org/i/fe909570a3c42269b447b061158177b9_raster.png "")
<div><fiddle-embed name="891ac93abd0cdb27c4156685d3b1bb4c"><div>
<table> <tr> <table> <tr>
<td><sup>1</sup> <a href='#SkPath_arcTo'>arcTo(const SkRect& oval, SkScalar startAngle, SkScalar sweepAngle, bool forceMoveTo)</a></td> <td><sup>1</sup> <a href='#SkPath_arcTo'>arcTo(const SkRect& oval, SkScalar startAngle, SkScalar sweepAngle, bool forceMoveTo)</a></td>
@ -3702,17 +3700,26 @@ Direction sweep, SkScalar x, SkScalar y)</a></td>
</tr> </tr>
</table> </table>
</div></fiddle-embed></div>
### Example ### Example
<div><fiddle-embed name="5acc77eba0cb4d00bbf3a8f4db0c0aee"><div>1 describes an arc from an oval, a starting angle, and a sweep angle. <div><fiddle-embed name="5acc77eba0cb4d00bbf3a8f4db0c0aee"></fiddle-embed></div>
2 is similar to 1, but does not require building a path to draw.
3 is similar to 1, but always begins new <a href='#Contour'>Contour</a>. In the example above:
4 describes an arc from a pair of tangent lines and a radius.
5 describes an arc from <a href='undocumented#Oval'>Oval</a> center, arc start <a href='SkPoint_Reference#Point'>Point</a> and arc end <a href='SkPoint_Reference#Point'>Point</a>. <table> <tr>
6 describes an arc from a pair of tangent lines and a <a href='#Conic_Weight'>Conic Weight</a>. <td>1 describes an arc from an oval, a starting angle, and a sweep angle.</td>
</div></fiddle-embed></div> </tr> <tr>
<td>2 is similar to 1, but does not require building a path to draw.</td>
</tr> <tr>
<td>3 is similar to 1, but always begins new <a href='#Contour'>Contour</a>.</td>
</tr> <tr>
<td>4 describes an arc from a pair of tangent lines and a radius.</td>
</tr> <tr>
<td>5 describes an arc from <a href='undocumented#Oval'>Oval</a> center, arc start <a href='SkPoint_Reference#Point'>Point</a> and arc end <a href='SkPoint_Reference#Point'>Point</a>.</td>
</tr> <tr>
<td>6 describes an arc from a pair of tangent lines and a <a href='#Conic_Weight'>Conic Weight</a>.</td>
</tr>
</table>
<a name='SkPath_arcTo'></a> <a name='SkPath_arcTo'></a>
## arcTo ## arcTo
@ -4910,7 +4917,7 @@ reference to <a href='#Path'>Path</a>
### Example ### Example
<div><fiddle-embed name="f18740ffcb10a499007488948c2cd60d"></fiddle-embed></div> <div><fiddle-embed name="0e6ca92d854035da29e89ad81d85ff85"></fiddle-embed></div>
### See Also ### See Also

View File

@ -4001,6 +4001,14 @@
"hash": "fecfe58c25cfc1b1e411e5eb50f7d8d1", "hash": "fecfe58c25cfc1b1e411e5eb50f7d8d1",
"file": "illustrations", "file": "illustrations",
"name": "Image_Info_Color_Type_RGB_888" "name": "Image_Info_Color_Type_RGB_888"
},
"Illustrations_Path_Arc": {
"code": "#include \"SkTextOnPath.h\"\nstruct data {\n const char* name;\n char super;\n int yn[10];\n};\nconst data dataSet[] = {\n{ \"arcTo sweep\", '1', {1, 3, 1, 0, 0, 0, 0, 1, 0, 0 }},\n{ \"drawArc\", 0, {1, -1, 1, 1, 1, 1, 1, 0, 0, 0 }},\n{ \"addArc\", 0, {1, 1, 1, 4, 0, 1, 1, 1, 0, 0 }},\n{ \"arcTo tangents\", '4', {0, 0, 0, 0, 0, 0, 0, 1, 1, 0 }},\n{ \"arcTo radii\", '5', {1, 0, 1, 0, 0, 0, 0, 1, 1, 0 }},\n{ \"conicTo\", 0, {1, 1, 0, 0, 0, 0, 0, 1, 1, 1 }}\n};\n#define __degree_symbol__ \"\\xC2\" \"\\xB0\"\nconst char* headers[] = {\n \"Oval part\",\n \"force moveTo\",\n \"can draw 180\" __degree_symbol__,\n \"can draw 360\" __degree_symbol__,\n \"can draw greater than 360\" __degree_symbol__,\n \"ignored if radius is zero\",\n \"ignored if sweep is zero\",\n \"requires Path\",\n \"describes rotation\",\n \"describes perspective\",\n};\nconst char* yna[] = {\n \"n/a\",\n \"no\",\n \"yes\"\n};\n\nvoid draw(SkCanvas* canvas) {\n SkPaint lp;\n lp.setAntiAlias(true);\n SkPaint tp(lp);\n SkPaint sp(tp);\n SkPaint bp(tp);\n bp.setFakeBoldText(true);\n sp.setTextSize(10);\n lp.setColor(SK_ColorGRAY);\n canvas->translate(0, 32);\n const int tl = 115;\n for (unsigned col = 0; col <= SK_ARRAY_COUNT(headers); ++col) {\n canvas->drawLine(tl + col * 35, 100, tl + col * 35, 250, lp);\n if (0 == col) {\n continue;\n }\n canvas->drawLine(tl + col * 35, 100, tl + 100 + col * 35, 0, lp);\n SkPath path;\n path.moveTo(tl - 3 + col * 35, 103);\n path.lineTo(tl + 124 + col * 35, -24);\n SkMatrix matrix;\n matrix.setTranslate(0, -9);\n SkDrawTextOnPath(headers[col -1], strlen(headers[col -1]), bp, path, &matrix, canvas);\n }\n for (unsigned row = 0; row <= SK_ARRAY_COUNT(dataSet); ++row) {\n if (0 == row) {\n canvas->drawLine(tl, 100, tl + 350, 100, lp);\n } else {\n canvas->drawLine(5, 100 + row * 25, tl + 350, 100 + row * 25, lp);\n }\n if (row == SK_ARRAY_COUNT(dataSet)) {\n break;\n }\n canvas->drawString(dataSet[row].name, 5, 117 + row * 25, bp);\n if (dataSet[row].super) {\n SkScalar width = bp.measureText(dataSet[row].name, strlen(dataSet[row].name));\n canvas->drawText(&dataSet[row].super, 1, 8 + width, 112 + row * 25, sp);\n }\n for (unsigned col = 0; col < SK_ARRAY_COUNT(headers); ++col) {\n int val = dataSet[row].yn[col];\n canvas->drawString(yna[SkTMin(2, val + 1)], tl + 5 + col * 35, 117 + row * 25, tp);\n if (val > 1) {\n char supe = '0' + val - 1;\n canvas->drawText(&supe, 1, tl + 25 + col * 35, 112 + row * 25, sp);\n }\n }\n }\n}\n",
"width": 600,
"height": 300,
"hash": "fe909570a3c42269b447b061158177b9",
"file": "illustrations",
"name": "Path_Arc"
}, },
"Image_Info_Alpha_Type_Opaque": { "Image_Info_Alpha_Type_Opaque": {
"code": "void draw(SkCanvas* canvas) {\n SkPMColor color = SkPreMultiplyARGB(255, 50, 100, 150);\n SkString s;\n s.printf(\"%u %u %u %u\", SkColorGetA(color), SkColorGetR(color),\n SkColorGetG(color), SkColorGetB(color));\n SkPaint paint;\n paint.setAntiAlias(true);\n canvas->drawString(s, 10, 62, paint);\n canvas->scale(50, 50);\n SkBitmap bitmap;\n SkImageInfo imageInfo = SkImageInfo::Make(1, 1, kN32_SkColorType, kOpaque_SkAlphaType);\n if (bitmap.installPixels(imageInfo, (void*) &color, imageInfo.minRowBytes())) {\n canvas->drawBitmap(bitmap, 0, 0);\n }\n}", "code": "void draw(SkCanvas* canvas) {\n SkPMColor color = SkPreMultiplyARGB(255, 50, 100, 150);\n SkString s;\n s.printf(\"%u %u %u %u\", SkColorGetA(color), SkColorGetR(color),\n SkColorGetG(color), SkColorGetB(color));\n SkPaint paint;\n paint.setAntiAlias(true);\n canvas->drawString(s, 10, 62, paint);\n canvas->scale(50, 50);\n SkBitmap bitmap;\n SkImageInfo imageInfo = SkImageInfo::Make(1, 1, kN32_SkColorType, kOpaque_SkAlphaType);\n if (bitmap.installPixels(imageInfo, (void*) &color, imageInfo.minRowBytes())) {\n canvas->drawBitmap(bitmap, 0, 0);\n }\n}",
@ -4347,20 +4355,12 @@
"name": "Path" "name": "Path"
}, },
"Path_Arc": { "Path_Arc": {
"code": "struct data {\n const char* name;\n char super;\n int yn[10];\n};\nconst data dataSet[] = {\n{ \"arcTo sweep\", '1', {1, 3, 1, 0, 0, 0, 0, 1, 0, 0 }},\n{ \"drawArc\", 0, {1, -1, 1, 1, 1, 1, 1, 0, 0, 0 }},\n{ \"addArc\", 0, {1, 1, 1, 4, 0, 1, 1, 1, 0, 0 }},\n{ \"arcTo tangents\", '4', {0, 0, 0, 0, 0, 0, 0, 1, 1, 0 }},\n{ \"arcTo radii\", '5', {1, 0, 1, 0, 0, 0, 0, 1, 1, 0 }},\n{ \"conicTo\", 0, {1, 1, 0, 0, 0, 0, 0, 1, 1, 1 }}\n};\n#define __degree_symbol__ \"\\xC2\" \"\\xB0\"\nconst char* headers[] = {\n \"Oval part\",\n \"force moveTo\",\n \"can draw 180\" __degree_symbol__,\n \"can draw 360\" __degree_symbol__,\n \"can draw greater than 360\" __degree_symbol__,\n \"ignored if radius is zero\",\n \"ignored if sweep is zero\",\n \"requires Path\",\n \"describes rotation\",\n \"describes perspective\",\n};\nconst char* yna[] = {\n \"n/a\",\n \"no\",\n \"yes\"\n};\n\nvoid draw(SkCanvas* canvas) {\n SkPaint lp;\n lp.setAntiAlias(true);\n SkPaint tp(lp);\n SkPaint sp(tp);\n SkPaint bp(tp);\n bp.setFakeBoldText(true);\n sp.setTextSize(10);\n lp.setColor(SK_ColorGRAY);\n canvas->translate(0, 32);\n const int tl = 115;\n for (unsigned col = 0; col <= SK_ARRAY_COUNT(headers); ++col) {\n canvas->drawLine(tl + col * 35, 100, tl + col * 35, 250, lp);\n if (0 == col) {\n continue;\n }\n canvas->drawLine(tl + col * 35, 100, tl + 100 + col * 35, 0, lp);\n SkPath path;\n path.moveTo(tl - 3 + col * 35, 103);\n path.lineTo(tl + 124 + col * 35, -24);\n canvas->drawTextOnPathHV(headers[col -1], strlen(headers[col -1]), path, 0, -9, bp);\n }\n for (unsigned row = 0; row <= SK_ARRAY_COUNT(dataSet); ++row) {\n if (0 == row) {\n canvas->drawLine(tl, 100, tl + 350, 100, lp);\n } else {\n canvas->drawLine(5, 100 + row * 25, tl + 350, 100 + row * 25, lp);\n }\n if (row == SK_ARRAY_COUNT(dataSet)) {\n break;\n }\n canvas->drawString(dataSet[row].name, 5, 117 + row * 25, bp);\n if (dataSet[row].super) {\n SkScalar width = bp.measureText(dataSet[row].name, strlen(dataSet[row].name));\n canvas->drawText(&dataSet[row].super, 1, 8 + width, 112 + row * 25, sp);\n }\n for (unsigned col = 0; col < SK_ARRAY_COUNT(headers); ++col) {\n int val = dataSet[row].yn[col];\n canvas->drawString(yna[SkTMin(2, val + 1)], tl + 5 + col * 35, 117 + row * 25, tp);\n if (val > 1) {\n char supe = '0' + val - 1;\n canvas->drawText(&supe, 1, tl + 25 + col * 35, 112 + row * 25, sp);\n }\n }\n }\n}\n",
"width": 600,
"height": 300,
"hash": "891ac93abd0cdb27c4156685d3b1bb4c",
"file": "SkPath_Reference",
"name": "Arc"
},
"Path_Arc_a": {
"code": "void draw(SkCanvas* canvas) {\n SkRect oval = {8, 8, 56, 56};\n SkPaint ovalPaint;\n ovalPaint.setAntiAlias(true);\n SkPaint textPaint(ovalPaint);\n ovalPaint.setStyle(SkPaint::kStroke_Style);\n SkPaint arcPaint(ovalPaint);\n arcPaint.setStrokeWidth(5);\n arcPaint.setColor(SK_ColorBLUE);\n canvas->translate(-64, 0);\n for (char arcStyle = '1'; arcStyle <= '6'; ++arcStyle) {\n '4' == arcStyle ? canvas->translate(-96, 55) : canvas->translate(64, 0);\n canvas->drawText(&arcStyle, 1, 30, 36, textPaint);\n canvas->drawOval(oval, ovalPaint);\n SkPath path;\n path.moveTo({56, 32});\n switch (arcStyle) {\n case '1':\n path.arcTo(oval, 0, 90, false);\n break;\n case '2':\n canvas->drawArc(oval, 0, 90, false, arcPaint);\n continue;\n case '3':\n path.addArc(oval, 0, 90);\n break;\n case '4':\n path.arcTo({56, 56}, {32, 56}, 24);\n break;\n case '5':\n path.arcTo({24, 24}, 0, SkPath::kSmall_ArcSize, SkPath::kCW_Direction, {32, 56});\n break;\n case '6':\n path.conicTo({56, 56}, {32, 56}, SK_ScalarRoot2Over2);\n break;\n }\n canvas->drawPath(path, arcPaint);\n }\n}\n", "code": "void draw(SkCanvas* canvas) {\n SkRect oval = {8, 8, 56, 56};\n SkPaint ovalPaint;\n ovalPaint.setAntiAlias(true);\n SkPaint textPaint(ovalPaint);\n ovalPaint.setStyle(SkPaint::kStroke_Style);\n SkPaint arcPaint(ovalPaint);\n arcPaint.setStrokeWidth(5);\n arcPaint.setColor(SK_ColorBLUE);\n canvas->translate(-64, 0);\n for (char arcStyle = '1'; arcStyle <= '6'; ++arcStyle) {\n '4' == arcStyle ? canvas->translate(-96, 55) : canvas->translate(64, 0);\n canvas->drawText(&arcStyle, 1, 30, 36, textPaint);\n canvas->drawOval(oval, ovalPaint);\n SkPath path;\n path.moveTo({56, 32});\n switch (arcStyle) {\n case '1':\n path.arcTo(oval, 0, 90, false);\n break;\n case '2':\n canvas->drawArc(oval, 0, 90, false, arcPaint);\n continue;\n case '3':\n path.addArc(oval, 0, 90);\n break;\n case '4':\n path.arcTo({56, 56}, {32, 56}, 24);\n break;\n case '5':\n path.arcTo({24, 24}, 0, SkPath::kSmall_ArcSize, SkPath::kCW_Direction, {32, 56});\n break;\n case '6':\n path.conicTo({56, 56}, {32, 56}, SK_ScalarRoot2Over2);\n break;\n }\n canvas->drawPath(path, arcPaint);\n }\n}\n",
"width": 256, "width": 256,
"height": 128, "height": 128,
"hash": "5acc77eba0cb4d00bbf3a8f4db0c0aee", "hash": "5acc77eba0cb4d00bbf3a8f4db0c0aee",
"file": "SkPath_Reference", "file": "SkPath_Reference",
"name": "Arc_2" "name": "Arc"
}, },
"Path_Contour": { "Path_Contour": {
"code": "void draw(SkCanvas* canvas) {\n SkPaint paint;\n paint.setAntiAlias(true);\n canvas->drawString(\"1st contour\", 150, 100, paint);\n canvas->drawString(\"2nd contour\", 130, 160, paint);\n canvas->drawString(\"3rd contour\", 40, 30, paint);\n paint.setStyle(SkPaint::kStroke_Style);\n SkPath path;\n path.moveTo(124, 108);\n path.lineTo(172, 24);\n path.moveTo(36, 148);\n path.quadTo(66, 188, 120, 136);\n path.close();\n path.conicTo(70, 20, 110, 40, 0.6f);\n canvas->drawPath(path, paint);\n}", "code": "void draw(SkCanvas* canvas) {\n SkPaint paint;\n paint.setAntiAlias(true);\n canvas->drawString(\"1st contour\", 150, 100, paint);\n canvas->drawString(\"2nd contour\", 130, 160, paint);\n canvas->drawString(\"3rd contour\", 40, 30, paint);\n paint.setStyle(SkPaint::kStroke_Style);\n SkPath path;\n path.moveTo(124, 108);\n path.lineTo(172, 24);\n path.moveTo(36, 148);\n path.quadTo(66, 188, 120, 136);\n path.close();\n path.conicTo(70, 20, 110, 40, 0.6f);\n canvas->drawPath(path, paint);\n}",
@ -5313,22 +5313,6 @@
"hash": "af4c69fbbd165c8b0eb0c9bd49ccbd8d", "hash": "af4c69fbbd165c8b0eb0c9bd49ccbd8d",
"file": "SkCanvas_Reference", "file": "SkCanvas_Reference",
"name": "SkCanvas::drawTextBlob_2" "name": "SkCanvas::drawTextBlob_2"
},
"SkCanvas_drawTextOnPath": {
"code": "void draw(SkCanvas* canvas) {\n const char roller[] = \"rollercoaster\";\n const size_t len = sizeof(roller) - 1;\n SkPath path;\n path.cubicTo(40, -80, 120, 80, 160, -40);\n SkPaint paint;\n paint.setTextSize(32);\n paint.setStyle(SkPaint::kStroke_Style);\n SkMatrix matrix;\n matrix.setIdentity();\n for (int i = 0; i < 3; ++i) {\n canvas->translate(25, 60);\n canvas->drawPath(path, paint);\n canvas->drawTextOnPath(roller, len, path, &matrix, paint);\n matrix.preTranslate(0, 10);\n }\n}\n",
"width": 256,
"height": 256,
"hash": "236e680b27960ca22641586dba0599c9",
"file": "SkCanvas_Reference",
"name": "SkCanvas::drawTextOnPath"
},
"SkCanvas_drawTextOnPathHV": {
"code": "void draw(SkCanvas* canvas) {\n const char aero[] = \"correo a\" \"\\xC3\" \"\\xA9\" \"reo\";\n const size_t len = sizeof(aero) - 1;\n SkPath path;\n path.addOval({43-26, 43-26, 43+26, 43+26}, SkPath::kCW_Direction, 3);\n SkPaint paint;\n paint.setTextSize(24);\n for (auto offset : { 0, 10, 20 } ) {\n canvas->drawTextOnPathHV(aero, len, path, 0, -offset, paint);\n canvas->translate(70 + offset, 70 + offset);\n }\n}\n",
"width": 256,
"height": 256,
"hash": "b2f22d1d5041e55d6913aab52f73a7d3",
"file": "SkCanvas_Reference",
"name": "SkCanvas::drawTextOnPathHV"
}, },
"SkCanvas_drawTextRSXform": { "SkCanvas_drawTextRSXform": {
"code": "void draw(SkCanvas* canvas) {\n const int iterations = 26;\n SkRSXform transforms[iterations];\n char alphabet[iterations];\n SkScalar angle = 0;\n SkScalar scale = 1;\n for (size_t i = 0; i < SK_ARRAY_COUNT(transforms); ++i) {\n const SkScalar s = SkScalarSin(angle) * scale;\n const SkScalar c = SkScalarCos(angle) * scale;\n transforms[i] = SkRSXform::Make(-c, -s, -s * 16, c * 16);\n angle += .45;\n scale += .2;\n alphabet[i] = 'A' + i;\n }\n SkPaint paint;\n paint.setTextAlign(SkPaint::kCenter_Align);\n canvas->translate(110, 138);\n canvas->drawTextRSXform(alphabet, sizeof(alphabet), transforms, nullptr, paint);\n}\n", "code": "void draw(SkCanvas* canvas) {\n const int iterations = 26;\n SkRSXform transforms[iterations];\n char alphabet[iterations];\n SkScalar angle = 0;\n SkScalar scale = 1;\n for (size_t i = 0; i < SK_ARRAY_COUNT(transforms); ++i) {\n const SkScalar s = SkScalarSin(angle) * scale;\n const SkScalar c = SkScalarCos(angle) * scale;\n transforms[i] = SkRSXform::Make(-c, -s, -s * 16, c * 16);\n angle += .45;\n scale += .2;\n alphabet[i] = 'A' + i;\n }\n SkPaint paint;\n paint.setTextAlign(SkPaint::kCenter_Align);\n canvas->translate(110, 138);\n canvas->drawTextRSXform(alphabet, sizeof(alphabet), transforms, nullptr, paint);\n}\n",
@ -7515,10 +7499,10 @@
"name": "SkPath::addRRect" "name": "SkPath::addRRect"
}, },
"SkPath_addRRect_2": { "SkPath_addRRect_2": {
"code": "void draw(SkCanvas* canvas) {\n SkPaint paint;\n paint.setAntiAlias(true);\n SkRRect rrect;\n rrect.setRectXY({40, 40, 215, 215}, 50, 50);\n SkPath path;\n path.addRRect(rrect);\n canvas->drawPath(path, paint);\n for (int start = 0; start < 8; ++start) {\n SkPath textPath;\n textPath.addRRect(rrect, SkPath::kCW_Direction, start);\n canvas->drawTextOnPathHV(&\"01234567\"[start], 1, textPath, 0, -5, paint);\n }\n}\n", "code": "#include \"SkTextOnPath.h\"\n\nvoid draw(SkCanvas* canvas) {\n SkPaint paint;\n paint.setAntiAlias(true);\n SkRRect rrect;\n rrect.setRectXY({40, 40, 215, 215}, 50, 50);\n SkPath path;\n path.addRRect(rrect);\n canvas->drawPath(path, paint);\n for (int start = 0; start < 8; ++start) {\n SkPath textPath;\n textPath.addRRect(rrect, SkPath::kCW_Direction, start);\n SkMatrix matrix;\n matrix.setTranslate(0, -5);\n SkDrawTextOnPath(&\"01234567\"[start], 1, paint, textPath, &matrix, canvas);\n }\n}\n",
"width": 256, "width": 256,
"height": 256, "height": 256,
"hash": "f18740ffcb10a499007488948c2cd60d", "hash": "0e6ca92d854035da29e89ad81d85ff85",
"file": "SkPath_Reference", "file": "SkPath_Reference",
"name": "SkPath::addRRect_2" "name": "SkPath::addRRect_2"
}, },