blob: 52ab245f5533c065d08b10dedfa701b804d3dade [file] [log] [blame] [view]
Cary Clark12799e12017-07-28 15:18:29 -04001SkPaint Reference
2===
3
4# <a name="Paint"></a> Paint
5<a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> controls options applied when drawing and measuring. <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> collects all
6options outside of the <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Canvas Clip</a> and <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Canvas Matrix</a>.
7
8Various options apply to text, strokes and fills, and images.
9
10Some options may not be implemented on all platforms; in these cases, setting
11the option has no effect. Some options are conveniences that duplicate <a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a>
12functionality; for instance, text size is identical to matrix scale.
13
14<a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> options are rarely exclusive; each option modifies a stage of the drawing
15pipeline and multiple pipeline stages may be affected by a single <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a>.
16
17<a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> collects effects and filters that describe single-pass and multiple-pass
18algorithms that alter the drawing geometry, color, and transparency. For instance,
19<a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> does not directly implement dashing or blur, but contains the objects that do so.
20
21The objects contained by <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> are opaque, and cannot be edited outside of the <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a>
22to affect it. The implementation is free to defer computations associated with the
23<a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a>, or ignore them altogether. For instance, some <a href="bmh_undocumented?cl=9919#GPU">GPU</a> implementations draw all
Cary Clarkbad5ad72017-08-03 17:14:08 -040024<a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> geometries with anti-aliasing, regardless of how <a href="bmh_SkPaint_Reference?cl=9919#kAntiAlias_Flag">SkPaint::kAntiAlias Flag</a>
25is set in <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a>.
Cary Clark12799e12017-07-28 15:18:29 -040026
27<a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> describes a single color, a single font, a single image quality, and so on.
28Multiple colors are drawn either by using multiple paints or with objects like
29<a href="bmh_undocumented?cl=9919#Shader">Shader</a> attached to <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a>.
30
31# <a name="SkPaint"></a> Class SkPaint
32
33# <a name="Overview"></a> Overview
34
35## <a name="Subtopics"></a> Subtopics
36
37| topics | description |
38| --- | --- |
39| <a href="bmh_SkPaint_Reference?cl=9919#Initializers">Initializers</a> | Constructors and initialization. |
40| <a href="bmh_SkPaint_Reference?cl=9919#Destructor">Destructor</a> | <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> termination. |
41| <a href="bmh_SkPaint_Reference?cl=9919#Management">Management</a> | <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> copying, moving, comparing. |
42| <a href="bmh_SkPaint_Reference?cl=9919#Hinting">Hinting</a> | <a href="bmh_undocumented?cl=9919#Glyph">Glyph</a> outline adjustment. |
43| <a href="bmh_SkPaint_Reference?cl=9919#Flags">Flags</a> | Attributes represented by single bits. |
44| <a href="bmh_SkPaint_Reference?cl=9919#Anti_alias">Anti-alias</a> | Approximating coverage with transparency. |
45| <a href="bmh_SkPaint_Reference?cl=9919#Dither">Dither</a> | Distributing color error. |
46| <a href="bmh_SkPaint_Reference?cl=9919#Device_Text">Device Text</a> | Increase precision of glyph position. |
47| <a href="bmh_SkPaint_Reference?cl=9919#Font_Embedded_Bitmaps">Font Embedded Bitmaps</a> | Custom-sized bitmap glyphs. |
48| <a href="bmh_SkPaint_Reference?cl=9919#Automatic_Hinting">Automatic Hinting</a> | Always adjust glyph paths. |
49| <a href="bmh_SkPaint_Reference?cl=9919#Vertical_Text">Vertical Text</a> | Orient text from top to bottom. |
50| <a href="bmh_SkPaint_Reference?cl=9919#Fake_Bold">Fake Bold</a> | Approximate font styles. |
51| <a href="bmh_SkPaint_Reference?cl=9919#Full_Hinting_Spacing">Full Hinting Spacing</a> | <a href="bmh_undocumented?cl=9919#Glyph">Glyph</a> spacing affected by hinting. |
52| <a href="bmh_SkPaint_Reference?cl=9919#Filter_Quality_Methods">Filter Quality Methods</a> | Get and set <a href="bmh_undocumented?cl=9919#Filter_Quality">Filter Quality</a>. |
53| <a href="bmh_SkPaint_Reference?cl=9919#Color_Methods">Color Methods</a> | Get and set <a href="bmh_undocumented?cl=9919#Color">Color</a>. |
54| <a href="bmh_SkPaint_Reference?cl=9919#Style">Style</a> | Geometry filling, stroking. |
55| <a href="bmh_SkPaint_Reference?cl=9919#Stroke_Width">Stroke Width</a> | Thickness perpendicular to geometry. |
56| <a href="bmh_SkPaint_Reference?cl=9919#Miter_Limit">Miter Limit</a> | Maximum length of stroked corners. |
57| <a href="bmh_SkPaint_Reference?cl=9919#Stroke_Cap">Stroke Cap</a> | Decorations at ends of open strokes. |
58| <a href="bmh_SkPaint_Reference?cl=9919#Stroke_Join">Stroke Join</a> | Decoration at corners of strokes. |
59| <a href="bmh_SkPaint_Reference?cl=9919#Fill_Path">Fill Path</a> | Make <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> from <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a>, stroking. |
60| <a href="bmh_SkPaint_Reference?cl=9919#Shader_Methods">Shader Methods</a> | Get and set <a href="bmh_undocumented?cl=9919#Shader">Shader</a>. |
61| <a href="bmh_SkPaint_Reference?cl=9919#Color_Filter_Methods">Color Filter Methods</a> | Get and set <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>. |
62| <a href="bmh_SkPaint_Reference?cl=9919#Blend_Mode_Methods">Blend Mode Methods</a> | Get and set <a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a>. |
63| <a href="bmh_SkPaint_Reference?cl=9919#Path_Effect_Methods">Path Effect Methods</a> | Get and set <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a>. |
64| <a href="bmh_SkPaint_Reference?cl=9919#Mask_Filter_Methods">Mask Filter Methods</a> | Get and set <a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a>. |
65| <a href="bmh_SkPaint_Reference?cl=9919#Typeface_Methods">Typeface Methods</a> | Get and set <a href="bmh_undocumented?cl=9919#Typeface">Typeface</a>. |
66| <a href="bmh_SkPaint_Reference?cl=9919#Rasterizer_Methods">Rasterizer Methods</a> | Get and set <a href="bmh_undocumented?cl=9919#Rasterizer">Rasterizer</a>. |
67| <a href="bmh_SkPaint_Reference?cl=9919#Image_Filter_Methods">Image Filter Methods</a> | Get and set <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a>. |
68| <a href="bmh_SkPaint_Reference?cl=9919#Draw_Looper_Methods">Draw Looper Methods</a> | Get and set <a href="bmh_undocumented?cl=9919#Draw_Looper">Draw Looper</a>. |
69| <a href="bmh_SkPaint_Reference?cl=9919#Text_Align">Text Align</a> | <a href="bmh_undocumented?cl=9919#Text">Text</a> placement relative to position. |
70| <a href="bmh_SkPaint_Reference?cl=9919#Text_Size">Text Size</a> | Overall height in points. |
71| <a href="bmh_SkPaint_Reference?cl=9919#Text_Scale_X">Text Scale X</a> | <a href="bmh_undocumented?cl=9919#Text">Text</a> horizontal scale. |
72| <a href="bmh_SkPaint_Reference?cl=9919#Text_Skew_X">Text Skew X</a> | <a href="bmh_undocumented?cl=9919#Text">Text</a> horizontal slant. |
73| <a href="bmh_SkPaint_Reference?cl=9919#Text_Encoding">Text Encoding</a> | <a href="bmh_undocumented?cl=9919#Text">Text</a> encoded as characters or glyphs. |
74| <a href="bmh_SkPaint_Reference?cl=9919#Font_Metrics">Font Metrics</a> | Common glyph dimensions. |
75| <a href="bmh_SkPaint_Reference?cl=9919#Measure_Text">Measure Text</a> | Width, height, bounds of text. |
76| <a href="bmh_SkPaint_Reference?cl=9919#Text_Path">Text Path</a> | Geometry of glyphs. |
77| <a href="bmh_SkPaint_Reference?cl=9919#Text_Intercepts">Text Intercepts</a> | Advanced underline, strike through. |
78| <a href="bmh_SkPaint_Reference?cl=9919#Fast_Bounds">Fast Bounds</a> | Appproxiate area required by <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a>. |
79
80## <a name="Constants"></a> Constants
81
82| constants | description |
83| --- | --- |
84| <a href="bmh_SkPaint_Reference?cl=9919#Align">Align</a> | <a href="bmh_undocumented?cl=9919#Glyph">Glyph</a> locations relative to text position. |
85| <a href="bmh_SkPaint_Reference?cl=9919#Cap">Cap</a> | Start and end geometry on stroked shapes. |
86| <a href="bmh_SkPaint_Reference?cl=9919#Flags">Flags</a> | Values described by bits and masks. |
87| <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_FontMetricsFlags">FontMetrics::FontMetricsFlags</a> | Valid <a href="bmh_SkPaint_Reference?cl=9919#Font_Metrics">Font Metrics</a>. |
88| <a href="bmh_SkPaint_Reference?cl=9919#Hinting">Hinting</a> | Level of glyph outline adjustment. |
89| <a href="bmh_SkPaint_Reference?cl=9919#Join">Join</a> | Corner geometry on stroked shapes. |
90| <a href="bmh_SkPaint_Reference?cl=9919#Style">Style</a> | Stroke, fill, or both. |
91| <a href="bmh_SkPaint_Reference?cl=9919#TextEncoding">TextEncoding</a> | Character or glyph encoding size. |
92
93## <a name="Structs"></a> Structs
94
95| struct | description |
96| --- | --- |
97| <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics">FontMetrics</a> | <a href="bmh_undocumented?cl=9919#Typeface">Typeface</a> values. |
98
99## <a name="Constructors"></a> Constructors
100
101| | description |
102| --- | --- |
103| <a href="bmh_SkPaint_Reference?cl=9919#empty_constructor">SkPaint()</a> | Constructs with default values. |
104| <a href="bmh_SkPaint_Reference?cl=9919#copy_constructor">SkPaint(const SkPaint& paint)</a> | Makes a shallow copy. |
105| <a href="bmh_SkPaint_Reference?cl=9919#move_constructor">SkPaint(SkPaint&& paint)</a> | Moves paint without copying it. |
106| | Decreases <a href="bmh_undocumented?cl=9919#Reference_Count">Reference Count</a> of owned objects. |
107
108## <a name="Operators"></a> Operators
109
110| operator | description |
111| --- | --- |
112| <a href="bmh_SkPaint_Reference?cl=9919#copy_assignment_operator">operator=(const SkPaint& paint)</a> | Makes a shallow copy. |
113| <a href="bmh_SkPaint_Reference?cl=9919#move_assignment_operator">operator=(SkPaint&& paint)</a> | Moves paint without copying it. |
114| <a href="bmh_SkPaint_Reference?cl=9919#equal_operator">operator==(const SkPaint& a, const SkPaint& b)</a> | Compares paints for equality. |
115| <a href="bmh_SkPaint_Reference?cl=9919#not_equal_operator">operator!=(const SkPaint& a, const SkPaint& b)</a> | Compares paints for inequality. |
116
117## <a name="Member_Functions"></a> Member Functions
118
119| function | description |
120| --- | --- |
121| <a href="bmh_SkPaint_Reference?cl=9919#breakText">breakText</a> | Returns text that fits in a width. |
122| <a href="bmh_SkPaint_Reference?cl=9919#canComputeFastBounds">canComputeFastBounds</a> | Returns true if settings allow for fast bounds computation. |
123| <a href="bmh_SkPaint_Reference?cl=9919#computeFastBounds">computeFastBounds</a> | Returns fill bounds for quick reject tests. |
124| <a href="bmh_SkPaint_Reference?cl=9919#computeFastStrokeBounds">computeFastStrokeBounds</a> | Returns stroke bounds for quick reject tests. |
125| <a href="bmh_SkPaint_Reference?cl=9919#containsText">containsText</a> | Returns if all text corresponds to glyphs. |
126| <a href="bmh_SkPaint_Reference?cl=9919#countText">countText</a> | Returns number of glyphs in text. |
127| <a href="bmh_SkPaint_Reference?cl=9919#doComputeFastBounds">doComputeFastBounds</a> | Returns bounds for quick reject tests. |
128| <a href="bmh_SkPaint_Reference?cl=9919#flatten">flatten</a> | Serializes into a buffer. |
129| <a href="bmh_SkPaint_Reference?cl=9919#getAlpha">getAlpha</a> | Returns <a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a>, color opacity. |
130| <a href="bmh_SkPaint_Reference?cl=9919#getBlendMode">getBlendMode</a> | Returns <a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a>, how colors combine with dest. |
131| <a href="bmh_SkPaint_Reference?cl=9919#getColor">getColor</a> | Returns <a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a> and <a href="bmh_undocumented?cl=9919#RGB">Color RGB</a>, one drawing color. |
132| <a href="bmh_SkPaint_Reference?cl=9919#getColorFilter">getColorFilter</a> | Returns <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>, how colors are altered. |
133| <a href="bmh_SkPaint_Reference?cl=9919#getDrawLooper">getDrawLooper</a> | Returns <a href="bmh_undocumented?cl=9919#Draw_Looper">Draw Looper</a>, multiple layers. |
134| <a href="bmh_SkPaint_Reference?cl=9919#getFillPath">getFillPath</a> | Returns fill path equivalent to stroke. |
135| <a href="bmh_SkPaint_Reference?cl=9919#getFilterQuality">getFilterQuality</a> | Returns <a href="bmh_undocumented?cl=9919#Filter_Quality">Filter Quality</a>, image filtering level. |
136| <a href="bmh_SkPaint_Reference?cl=9919#getFlags">getFlags</a> | Returns <a href="bmh_SkPaint_Reference?cl=9919#Flags">Flags</a> stored in a bit field. |
137| <a href="bmh_SkPaint_Reference?cl=9919#getFontBounds">getFontBounds</a> | Returns union all glyph bounds. |
138| <a href="bmh_SkPaint_Reference?cl=9919#getFontMetrics">getFontMetrics</a> | Returns <a href="bmh_undocumented?cl=9919#Typeface">Typeface</a> metrics scaled by text size. |
139| <a href="bmh_SkPaint_Reference?cl=9919#getFontSpacing">getFontSpacing</a> | Returns recommended spacing between lines. |
140| <a href="bmh_SkPaint_Reference?cl=9919#getHash">getHash</a> | Returns a shallow hash for equality checks. |
141| <a href="bmh_SkPaint_Reference?cl=9919#getHinting">getHinting</a> | Returns <a href="bmh_SkPaint_Reference?cl=9919#Hinting">Hinting</a>, glyph outline adjustment level. |
142| <a href="bmh_SkPaint_Reference?cl=9919#getImageFilter">getImageFilter</a> | Returns <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a>, alter pixels; blur. |
143| <a href="bmh_SkPaint_Reference?cl=9919#getMaskFilter">getMaskFilter</a> | Returns <a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a>, alterations to <a href="bmh_undocumented?cl=9919#Mask_Alpha">Mask Alpha</a>. |
144| <a href="bmh_SkPaint_Reference?cl=9919#getPathEffect">getPathEffect</a> | Returns <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a>, modifications to path geometry; dashing. |
145| <a href="bmh_SkPaint_Reference?cl=9919#getPosTextPath">getPosTextPath</a> | Returns <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> equivalent to positioned text. |
146| <a href="bmh_SkPaint_Reference?cl=9919#getPosTextIntercepts">getPosTextIntercepts</a> | Returns where lines intersect positioned text; underlines. |
147| <a href="bmh_SkPaint_Reference?cl=9919#getPosTextHIntercepts">getPosTextHIntercepts</a> | Returns where lines intersect horizontally positioned text; underlines. |
148| <a href="bmh_SkPaint_Reference?cl=9919#getRasterizer">getRasterizer</a> | Returns <a href="bmh_undocumented?cl=9919#Rasterizer">Rasterizer</a>, <a href="bmh_undocumented?cl=9919#Mask_Alpha">Mask Alpha</a> generation from <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>. |
149| <a href="bmh_SkPaint_Reference?cl=9919#getShader">getShader</a> | Returns <a href="bmh_undocumented?cl=9919#Shader">Shader</a>, multiple drawing colors; gradients. |
150| <a href="bmh_SkPaint_Reference?cl=9919#getStrokeCap">getStrokeCap</a> | Returns <a href="bmh_SkPaint_Reference?cl=9919#Cap">Cap</a>, the area drawn at path ends. |
151| <a href="bmh_SkPaint_Reference?cl=9919#getStrokeJoin">getStrokeJoin</a> | Returns <a href="bmh_SkPaint_Reference?cl=9919#Join">Join</a>, geometry on path corners. |
152| <a href="bmh_SkPaint_Reference?cl=9919#getStrokeMiter">getStrokeMiter</a> | Returns <a href="bmh_SkPaint_Reference?cl=9919#Miter_Limit">Miter Limit</a>, angles with sharp corners. |
153| <a href="bmh_SkPaint_Reference?cl=9919#getStrokeWidth">getStrokeWidth</a> | Returns thickness of the stroke. |
154| <a href="bmh_SkPaint_Reference?cl=9919#getStyle">getStyle</a> | Returns <a href="bmh_SkPaint_Reference?cl=9919#Style">Style</a>: stroke, fill, or both. |
155| <a href="bmh_SkPaint_Reference?cl=9919#getTextAlign">getTextAlign</a> | Returns <a href="bmh_SkPaint_Reference?cl=9919#Align">Align</a>: left, center, or right. |
156| <a href="bmh_SkPaint_Reference?cl=9919#getTextBlobIntercepts">getTextBlobIntercepts</a> | Returns where lines intersect <a href="bmh_undocumented?cl=9919#Text_Blob">Text Blob</a>; underlines. |
157| <a href="bmh_SkPaint_Reference?cl=9919#getTextEncoding">getTextEncoding</a> | Returns character or glyph encoding size. |
158| <a href="bmh_SkPaint_Reference?cl=9919#getTextIntercepts">getTextIntercepts</a> | Returns where lines intersect text; underlines. |
159| <a href="bmh_SkPaint_Reference?cl=9919#getTextPath">getTextPath</a> | Returns <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> equivalent to text. |
160| <a href="bmh_SkPaint_Reference?cl=9919#getTextScaleX">getTextScaleX</a> | Returns the text horizontal scale; condensed text. |
161| <a href="bmh_SkPaint_Reference?cl=9919#getTextSkewX">getTextSkewX</a> | Returns the text horizontal skew; oblique text. |
162| <a href="bmh_SkPaint_Reference?cl=9919#getTextSize">getTextSize</a> | Returns text size in points. |
163| <a href="bmh_SkPaint_Reference?cl=9919#getTextWidths">getTextWidths</a> | Returns advance and bounds for each glyph in text. |
164| <a href="bmh_SkPaint_Reference?cl=9919#getTypeface">getTypeface</a> | Returns <a href="bmh_undocumented?cl=9919#Typeface">Typeface</a>, font description. |
165| <a href="bmh_SkPaint_Reference?cl=9919#glyphsToUnichars">glyphsToUnichars</a> | Converts glyphs into text. |
166| <a href="bmh_SkPaint_Reference?cl=9919#isAntiAlias">isAntiAlias</a> | Returns true if <a href="bmh_SkPaint_Reference?cl=9919#Anti_alias">Anti-alias</a> is set. |
167| <a href="bmh_SkPaint_Reference?cl=9919#isAutohinted">isAutohinted</a> | Returns true if glyphs are always hinted. |
168| <a href="bmh_SkPaint_Reference?cl=9919#isDevKernText">isDevKernText</a> | Returns true if <a href="bmh_SkPaint_Reference?cl=9919#Full_Hinting_Spacing">Full Hinting Spacing</a> is set. |
169| <a href="bmh_SkPaint_Reference?cl=9919#isDither">isDither</a> | Returns true if <a href="bmh_SkPaint_Reference?cl=9919#Dither">Dither</a> is set. |
170| <a href="bmh_SkPaint_Reference?cl=9919#isEmbeddedBitmapText">isEmbeddedBitmapText</a> | Returns true if <a href="bmh_SkPaint_Reference?cl=9919#Font_Embedded_Bitmaps">Font Embedded Bitmaps</a> is set. |
171| <a href="bmh_SkPaint_Reference?cl=9919#isFakeBoldText">isFakeBoldText</a> | Returns true if <a href="bmh_SkPaint_Reference?cl=9919#Fake_Bold">Fake Bold</a> is set. |
172| <a href="bmh_SkPaint_Reference?cl=9919#isLCDRenderText">isLCDRenderText</a> | Returns true if <a href="bmh_SkPaint_Reference?cl=9919#LCD_Text">LCD Text</a> is set. |
173| <a href="bmh_SkPaint_Reference?cl=9919#isSrcOver">isSrcOver</a> | Returns true if <a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a> is <a href="bmh_undocumented?cl=9919#kSrcOver">SkBlendMode::kSrcOver</a>. |
174| <a href="bmh_SkPaint_Reference?cl=9919#isSubpixelText">isSubpixelText</a> | Returns true if <a href="bmh_SkPaint_Reference?cl=9919#Subpixel_Text">Subpixel Text</a> is set. |
175| <a href="bmh_SkPaint_Reference?cl=9919#isVerticalText">isVerticalText</a> | Returns true if <a href="bmh_SkPaint_Reference?cl=9919#Vertical_Text">Vertical Text</a> is set. |
176| <a href="bmh_SkPaint_Reference?cl=9919#measureText">measureText</a> | Returns advance width and bounds of text. |
177| <a href="bmh_SkPaint_Reference?cl=9919#nothingToDraw">nothingToDraw</a> | Returns true if <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> prevents all drawing. |
178| <a href="bmh_SkPaint_Reference?cl=9919#refColorFilter">refColorFilter</a> | References <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>, how colors are altered. |
179| <a href="bmh_SkPaint_Reference?cl=9919#refDrawLooper">refDrawLooper</a> | References <a href="bmh_undocumented?cl=9919#Draw_Looper">Draw Looper</a>, multiple layers. |
180| <a href="bmh_SkPaint_Reference?cl=9919#refImageFilter">refImageFilter</a> | References <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a>, alter pixels; blur. |
181| <a href="bmh_SkPaint_Reference?cl=9919#refMaskFilter">refMaskFilter</a> | References <a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a>, alterations to <a href="bmh_undocumented?cl=9919#Mask_Alpha">Mask Alpha</a>. |
182| <a href="bmh_SkPaint_Reference?cl=9919#refPathEffect">refPathEffect</a> | References <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a>, modifications to path geometry; dashing. |
183| <a href="bmh_SkPaint_Reference?cl=9919#refRasterizer">refRasterizer</a> | References <a href="bmh_undocumented?cl=9919#Rasterizer">Rasterizer</a>, mask generation from path. |
184| <a href="bmh_SkPaint_Reference?cl=9919#refShader">refShader</a> | References <a href="bmh_undocumented?cl=9919#Shader">Shader</a>, multiple drawing colors; gradients. |
185| <a href="bmh_SkPaint_Reference?cl=9919#refTypeface">refTypeface</a> | References <a href="bmh_undocumented?cl=9919#Typeface">Typeface</a>, font description. |
186| <a href="bmh_SkPaint_Reference?cl=9919#reset">reset</a> | Sets to default values. |
187| <a href="bmh_SkPaint_Reference?cl=9919#setAlpha">setAlpha</a> | Sets <a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a>, color opacity. |
188| <a href="bmh_SkPaint_Reference?cl=9919#setAntiAlias">setAntiAlias</a> | Sets or clears <a href="bmh_SkPaint_Reference?cl=9919#Anti_alias">Anti-alias</a>. |
189| <a href="bmh_SkPaint_Reference?cl=9919#setARGB">setARGB</a> | Sets color by component. |
190| <a href="bmh_SkPaint_Reference?cl=9919#setAutohinted">setAutohinted</a> | Sets glyphs to always be hinted. |
191| <a href="bmh_SkPaint_Reference?cl=9919#setBlendMode">setBlendMode</a> | Sets <a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a>, how colors combine with destination. |
192| <a href="bmh_SkPaint_Reference?cl=9919#setColor">setColor</a> | Sets <a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a> and <a href="bmh_undocumented?cl=9919#RGB">Color RGB</a>, one drawing color. |
193| <a href="bmh_SkPaint_Reference?cl=9919#setColorFilter">setColorFilter</a> | Sets <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>, alters color. |
194| <a href="bmh_SkPaint_Reference?cl=9919#setDevKernText">setDevKernText</a> | Sets or clears <a href="bmh_SkPaint_Reference?cl=9919#Full_Hinting_Spacing">Full Hinting Spacing</a>. |
195| <a href="bmh_SkPaint_Reference?cl=9919#setDither">setDither</a> | Sets or clears <a href="bmh_SkPaint_Reference?cl=9919#Dither">Dither</a>. |
196| <a href="bmh_SkPaint_Reference?cl=9919#setDrawLooper">setDrawLooper</a> | Sets <a href="bmh_undocumented?cl=9919#Draw_Looper">Draw Looper</a>, multiple layers. |
197| <a href="bmh_SkPaint_Reference?cl=9919#setEmbeddedBitmapText">setEmbeddedBitmapText</a> | Sets or clears <a href="bmh_SkPaint_Reference?cl=9919#Font_Embedded_Bitmaps">Font Embedded Bitmaps</a>. |
198| <a href="bmh_SkPaint_Reference?cl=9919#setFakeBoldText">setFakeBoldText</a> | Sets or clears <a href="bmh_SkPaint_Reference?cl=9919#Fake_Bold">Fake Bold</a>. |
199| <a href="bmh_SkPaint_Reference?cl=9919#setFilterQuality">setFilterQuality</a> | Sets <a href="bmh_undocumented?cl=9919#Filter_Quality">Filter Quality</a>, the image filtering level. |
200| <a href="bmh_SkPaint_Reference?cl=9919#setFlags">setFlags</a> | Sets multiple <a href="bmh_SkPaint_Reference?cl=9919#Flags">Flags</a> in a bit field. |
201| <a href="bmh_SkPaint_Reference?cl=9919#setHinting">setHinting</a> | Sets <a href="bmh_SkPaint_Reference?cl=9919#Hinting">Hinting</a>, glyph outline adjustment level. |
202| <a href="bmh_SkPaint_Reference?cl=9919#setLCDRenderText">setLCDRenderText</a> | Sets or clears <a href="bmh_SkPaint_Reference?cl=9919#LCD_Text">LCD Text</a>. |
203| <a href="bmh_SkPaint_Reference?cl=9919#setMaskFilter">setMaskFilter</a> | Sets <a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a>, alterations to <a href="bmh_undocumented?cl=9919#Mask_Alpha">Mask Alpha</a>. |
204| <a href="bmh_SkPaint_Reference?cl=9919#setPathEffect">setPathEffect</a> | Sets <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a>, modifications to path geometry; dashing. |
205| <a href="bmh_SkPaint_Reference?cl=9919#setRasterizer">setRasterizer</a> | Sets <a href="bmh_undocumented?cl=9919#Rasterizer">Rasterizer</a>, <a href="bmh_undocumented?cl=9919#Mask_Alpha">Mask Alpha</a> generation from <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>. |
206| <a href="bmh_SkPaint_Reference?cl=9919#setImageFilter">setImageFilter</a> | Sets <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a>, alter pixels; blur. |
207| <a href="bmh_SkPaint_Reference?cl=9919#setShader">setShader</a> | Sets <a href="bmh_undocumented?cl=9919#Shader">Shader</a>, multiple drawing colors; gradients. |
208| <a href="bmh_SkPaint_Reference?cl=9919#setStrokeCap">setStrokeCap</a> | Sets <a href="bmh_SkPaint_Reference?cl=9919#Cap">Cap</a>, the area drawn at path ends. |
209| <a href="bmh_SkPaint_Reference?cl=9919#setStrokeJoin">setStrokeJoin</a> | Sets <a href="bmh_SkPaint_Reference?cl=9919#Join">Join</a>, geometry on path corners. |
210| <a href="bmh_SkPaint_Reference?cl=9919#setStrokeMiter">setStrokeMiter</a> | Sets <a href="bmh_SkPaint_Reference?cl=9919#Miter_Limit">Miter Limit</a>, angles with sharp corners. |
211| <a href="bmh_SkPaint_Reference?cl=9919#setStrokeWidth">setStrokeWidth</a> | Sets thickness of the stroke. |
212| <a href="bmh_SkPaint_Reference?cl=9919#setStyle">setStyle</a> | Sets <a href="bmh_SkPaint_Reference?cl=9919#Style">Style</a>: stroke, fill, or both. |
213| <a href="bmh_SkPaint_Reference?cl=9919#setSubpixelText">setSubpixelText</a> | Sets or clears <a href="bmh_SkPaint_Reference?cl=9919#Subpixel_Text">Subpixel Text</a>. |
214| <a href="bmh_SkPaint_Reference?cl=9919#setTextAlign">setTextAlign</a> | Sets <a href="bmh_SkPaint_Reference?cl=9919#Align">Align</a>: left, center, or right. |
215| <a href="bmh_SkPaint_Reference?cl=9919#setTextEncoding">setTextEncoding</a> | Sets character or glyph encoding size. |
216| <a href="bmh_SkPaint_Reference?cl=9919#setTextScaleX">setTextScaleX</a> | Sets the text horizontal scale; condensed text. |
217| <a href="bmh_SkPaint_Reference?cl=9919#setTextSkewX">setTextSkewX</a> | Sets the text horizontal skew; oblique text. |
218| <a href="bmh_SkPaint_Reference?cl=9919#setTextSize">setTextSize</a> | Sets text size in points. |
219| <a href="bmh_SkPaint_Reference?cl=9919#setTypeface">setTypeface</a> | Sets <a href="bmh_undocumented?cl=9919#Typeface">Typeface</a>, font description. |
220| <a href="bmh_SkPaint_Reference?cl=9919#setVerticalText">setVerticalText</a> | Sets or clears <a href="bmh_SkPaint_Reference?cl=9919#Vertical_Text">Vertical Text</a>. |
221| <a href="bmh_SkPaint_Reference?cl=9919#textToGlyphs">textToGlyphs</a> | Converts text into glyph indices. |
222| <a href="bmh_SkPaint_Reference?cl=9919#toString">toString</a> | Converts <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> to machine parsable form (<a href="bmh_undocumented?cl=9919#Developer_Mode">Developer Mode</a>) |
223| <a href="bmh_SkPaint_Reference?cl=9919#unflatten">unflatten</a> | Populates from a serialized stream. |
224
225# <a name="Initializers"></a> Initializers
226
227<a name="empty_constructor"></a>
228## SkPaint
229
230<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
231SkPaint()
232</pre>
233
234Constructs <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> with default values.
235
236| attribute | default value |
237| --- | --- |
238| <a href="bmh_SkPaint_Reference?cl=9919#Anti_alias">Anti-alias</a> | false |
239| <a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a> | <a href="bmh_undocumented?cl=9919#kSrcOver">SkBlendMode::kSrcOver</a> |
240| <a href="bmh_undocumented?cl=9919#Color">Color</a> | <a href="bmh_undocumented?cl=9919#SK_ColorBLACK">SK ColorBLACK</a> |
241| <a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a> | 255 |
242| <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a> | nullptr |
243| <a href="bmh_SkPaint_Reference?cl=9919#Dither">Dither</a> | false |
244| <a href="bmh_undocumented?cl=9919#Draw_Looper">Draw Looper</a> | nullptr |
245| <a href="bmh_SkPaint_Reference?cl=9919#Fake_Bold">Fake Bold</a> | false |
246| <a href="bmh_undocumented?cl=9919#Filter_Quality">Filter Quality</a> | <a href="bmh_undocumented?cl=9919#SkFilterQuality">kNone SkFilterQuality</a> |
247| <a href="bmh_SkPaint_Reference?cl=9919#Font_Embedded_Bitmaps">Font Embedded Bitmaps</a> | false |
248| <a href="bmh_SkPaint_Reference?cl=9919#Automatic_Hinting">Automatic Hinting</a> | false |
249| <a href="bmh_SkPaint_Reference?cl=9919#Full_Hinting_Spacing">Full Hinting Spacing</a> | false |
250| <a href="bmh_SkPaint_Reference?cl=9919#Hinting">Hinting</a> | <a href="bmh_SkPaint_Reference?cl=9919#kNormal_Hinting">kNormal Hinting</a> |
251| <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a> | nullptr |
252| <a href="bmh_SkPaint_Reference?cl=9919#LCD_Text">LCD Text</a> | false |
253| <a href="bmh_SkPaint_Reference?cl=9919#Linear_Text">Linear Text</a> | false |
254| <a href="bmh_SkPaint_Reference?cl=9919#Miter_Limit">Miter Limit</a> | 4 |
255| <a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a> | nullptr |
256| <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a> | nullptr |
257| <a href="bmh_undocumented?cl=9919#Rasterizer">Rasterizer</a> | nullptr |
258| <a href="bmh_undocumented?cl=9919#Shader">Shader</a> | nullptr |
259| <a href="bmh_SkPaint_Reference?cl=9919#Style">Style</a> | <a href="bmh_SkPaint_Reference?cl=9919#kFill_Style">kFill Style</a> |
260| <a href="bmh_SkPaint_Reference?cl=9919#Text_Align">Text Align</a> | <a href="bmh_SkPaint_Reference?cl=9919#kLeft_Align">kLeft Align</a> |
261| <a href="bmh_SkPaint_Reference?cl=9919#Text_Encoding">Text Encoding</a> | <a href="bmh_SkPaint_Reference?cl=9919#kUTF8_TextEncoding">kUTF8 TextEncoding</a> |
262| <a href="bmh_SkPaint_Reference?cl=9919#Text_Scale_X">Text Scale X</a> | 1 |
263| <a href="bmh_SkPaint_Reference?cl=9919#Text_Size">Text Size</a> | 12 |
264| <a href="bmh_SkPaint_Reference?cl=9919#Text_Skew_X">Text Skew X</a> | 0 |
265| <a href="bmh_undocumented?cl=9919#Typeface">Typeface</a> | nullptr |
266| <a href="bmh_SkPaint_Reference?cl=9919#Stroke_Cap">Stroke Cap</a> | <a href="bmh_SkPaint_Reference?cl=9919#kButt_Cap">kButt Cap</a> |
267| <a href="bmh_SkPaint_Reference?cl=9919#Stroke_Join">Stroke Join</a> | <a href="bmh_SkPaint_Reference?cl=9919#kMiter_Join">kMiter Join</a> |
268| <a href="bmh_SkPaint_Reference?cl=9919#Stroke_Width">Stroke Width</a> | 0 |
269| <a href="bmh_SkPaint_Reference?cl=9919#Subpixel_Text">Subpixel Text</a> | false |
270| <a href="bmh_SkPaint_Reference?cl=9919#Vertical_Text">Vertical Text</a> | false |
271
272The flags, text size, hinting, and miter limit may be overridden at compile time by defining
273paint default values. The overrides may be included in <a href="bmh_undocumented?cl=9919#SkUserConfig.h">SkUserConfig.h</a> or predefined by the
274build system.
275
276### Return Value
277
278default initialized <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a>
279
280### Example
281
282<div><fiddle-embed name="c4b2186d85c142a481298f7144295ffd"></fiddle-embed></div>
283
284---
285
286<a name="copy_constructor"></a>
287## SkPaint
288
289<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
290SkPaint(const SkPaint& paint)
291</pre>
292
293Makes a shallow copy of <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a>. <a href="bmh_undocumented?cl=9919#Typeface">Typeface</a>, <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a>, <a href="bmh_undocumented?cl=9919#Shader">Shader</a>,
294<a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a>, <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>, <a href="bmh_undocumented?cl=9919#Rasterizer">Rasterizer</a>, <a href="bmh_undocumented?cl=9919#Draw_Looper">Draw Looper</a>, and <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a> are shared
Cary Clarkbad5ad72017-08-03 17:14:08 -0400295between the original <a href="bmh_SkPaint_Reference?cl=9919#paint">paint</a> and the copy. Objects containing <a href="bmh_undocumented?cl=9919#Reference_Count">Reference Count</a> increment
296their references by one.
Cary Clark12799e12017-07-28 15:18:29 -0400297
298The referenced objects <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a>, <a href="bmh_undocumented?cl=9919#Shader">Shader</a>, <a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a>, <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>, <a href="bmh_undocumented?cl=9919#Rasterizer">Rasterizer</a>,
299<a href="bmh_undocumented?cl=9919#Draw_Looper">Draw Looper</a>, and <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a> cannot be modified after they are created.
300This prevents objects with <a href="bmh_undocumented?cl=9919#Reference_Count">Reference Count</a> from being modified once <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> refers to them.
301
302### Parameters
303
304<table> <tr> <td><code><strong>paint </strong></code></td> <td>
305original to copy</td>
306 </tr>
307</table>
308
309### Return Value
310
311shallow copy of <a href="bmh_SkPaint_Reference?cl=9919#paint">paint</a>
312
313### Example
314
315<div><fiddle-embed name="b99971ad0ef243d617925289d963b62d">
316
317#### Example Output
318
319~~~~
320SK_ColorRED == paint1.getColor()
321SK_ColorBLUE == paint2.getColor()
322~~~~
323
324</fiddle-embed></div>
325
326---
327
328<a name="move_constructor"></a>
329## SkPaint
330
331<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
332SkPaint(SkPaint&& paint)
333</pre>
334
335Implements a move constructor to avoid incrementing the reference counts
336of objects referenced by the <a href="bmh_SkPaint_Reference?cl=9919#paint">paint</a>.
337
338After the call, <a href="bmh_SkPaint_Reference?cl=9919#paint">paint</a> is undefined, and can be safely destructed.
339
340### Parameters
341
342<table> <tr> <td><code><strong>paint </strong></code></td> <td>
343original to move</td>
344 </tr>
345</table>
346
347### Return Value
348
349content of <a href="bmh_SkPaint_Reference?cl=9919#paint">paint</a>
350
351### Example
352
353<div><fiddle-embed name="8ed1488a503cd5282b86a51614aa90b1">
354
355#### Example Output
356
357~~~~
358path effect unique: true
359~~~~
360
361</fiddle-embed></div>
362
363---
364
365<a name="reset"></a>
366## reset
367
368<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
369void reset()
370</pre>
371
372Sets all paint's contents to their initial values. This is equivalent to replacing
373the paint with the result of <a href="bmh_SkPaint_Reference?cl=9919#empty_constructor">SkPaint()</a>.
374
375### Example
376
377<div><fiddle-embed name="ef269937ade7e7353635121d9a64f9f7">
378
379#### Example Output
380
381~~~~
382paint1 == paint2
383~~~~
384
385</fiddle-embed></div>
386
387---
388
389# <a name="Destructor"></a> Destructor
390
391<a name="destructor"></a>
392## ~SkPaint
393
394<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
395~SkPaint()
396</pre>
397
398Decreases <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> <a href="bmh_undocumented?cl=9919#Reference_Count">Reference Count</a> of owned objects: <a href="bmh_undocumented?cl=9919#Typeface">Typeface</a>, <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a>, <a href="bmh_undocumented?cl=9919#Shader">Shader</a>,
399<a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a>, <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>, <a href="bmh_undocumented?cl=9919#Rasterizer">Rasterizer</a>, <a href="bmh_undocumented?cl=9919#Draw_Looper">Draw Looper</a>, and <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a>. If the
Cary Clarkbad5ad72017-08-03 17:14:08 -0400400objects containing <a href="bmh_undocumented?cl=9919#Reference_Count">Reference Count</a> go to zero, they are deleted.
Cary Clark12799e12017-07-28 15:18:29 -0400401
402---
403
404# <a name="Management"></a> Management
405
406<a name="copy_assignment_operator"></a>
407## operator=
408
409<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
410SkPaint& operator=(const SkPaint& paint)
411</pre>
412
413Makes a shallow copy of <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a>. <a href="bmh_undocumented?cl=9919#Typeface">Typeface</a>, <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a>, <a href="bmh_undocumented?cl=9919#Shader">Shader</a>,
414<a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a>, <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>, <a href="bmh_undocumented?cl=9919#Rasterizer">Rasterizer</a>, <a href="bmh_undocumented?cl=9919#Draw_Looper">Draw Looper</a>, and <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a> are shared
Cary Clarkbad5ad72017-08-03 17:14:08 -0400415between the original <a href="bmh_SkPaint_Reference?cl=9919#paint">paint</a> and the copy. Objects containing <a href="bmh_undocumented?cl=9919#Reference_Count">Reference Count</a> in the
Cary Clark12799e12017-07-28 15:18:29 -0400416prior destination are decreased by one, and the referenced objects are deleted if the
Cary Clarkbad5ad72017-08-03 17:14:08 -0400417resulting count is zero. Objects containing <a href="bmh_undocumented?cl=9919#Reference_Count">Reference Count</a> in the parameter <a href="bmh_SkPaint_Reference?cl=9919#paint">paint</a>
418are increased by one. <a href="bmh_SkPaint_Reference?cl=9919#paint">paint</a> is unmodified.
Cary Clark12799e12017-07-28 15:18:29 -0400419
420### Parameters
421
422<table> <tr> <td><code><strong>paint </strong></code></td> <td>
423original to copy</td>
424 </tr>
425</table>
426
427### Return Value
428
429content of <a href="bmh_SkPaint_Reference?cl=9919#paint">paint</a>
430
431### Example
432
433<div><fiddle-embed name="b476a9088f80dece176ed577807d3992">
434
435#### Example Output
436
437~~~~
438SK_ColorRED == paint1.getColor()
439SK_ColorRED == paint2.getColor()
440~~~~
441
442</fiddle-embed></div>
443
444---
445
446<a name="move_assignment_operator"></a>
447## operator=
448
449<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
450SkPaint& operator=(SkPaint&& paint)
451</pre>
452
453Moves the <a href="bmh_SkPaint_Reference?cl=9919#paint">paint</a> to avoid incrementing the reference counts
Cary Clarkbad5ad72017-08-03 17:14:08 -0400454of objects referenced by the <a href="bmh_SkPaint_Reference?cl=9919#paint">paint</a> parameter. Objects containing <a href="bmh_undocumented?cl=9919#Reference_Count">Reference Count</a> in the
455prior destination are decreased by one; those objects are deleted if the resulting count
456is zero.
Cary Clark12799e12017-07-28 15:18:29 -0400457
458After the call, <a href="bmh_SkPaint_Reference?cl=9919#paint">paint</a> is undefined, and can be safely destructed.
459
460### Parameters
461
462<table> <tr> <td><code><strong>paint </strong></code></td> <td>
463original to move</td>
464 </tr>
465</table>
466
467### Return Value
468
469content of <a href="bmh_SkPaint_Reference?cl=9919#paint">paint</a>
470
471### Example
472
473<div><fiddle-embed name="9fb7459b097d713f5f1fe5675afe14f5">
474
475#### Example Output
476
477~~~~
478SK_ColorRED == paint2.getColor()
479~~~~
480
481</fiddle-embed></div>
482
483---
484
485<a name="equal_operator"></a>
486## operator==
487
488<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
489bool operator==(const SkPaint& a, const SkPaint& b)
490</pre>
491
492Compares <a href="bmh_SkPaint_Reference?cl=9919#a">a</a> and <a href="bmh_SkPaint_Reference?cl=9919#b">b</a>, and returns true if <a href="bmh_SkPaint_Reference?cl=9919#a">a</a> and <a href="bmh_SkPaint_Reference?cl=9919#b">b</a> are equivalent. May return false
493if <a href="bmh_undocumented?cl=9919#Typeface">Typeface</a>, <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a>, <a href="bmh_undocumented?cl=9919#Shader">Shader</a>, <a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a>, <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>, <a href="bmh_undocumented?cl=9919#Rasterizer">Rasterizer</a>,
494<a href="bmh_undocumented?cl=9919#Draw_Looper">Draw Looper</a>, or <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a> have identical contents but different pointers.
495
496### Parameters
497
498<table> <tr> <td><code><strong>a </strong></code></td> <td>
499<a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> to compare</td>
500 </tr> <tr> <td><code><strong>b </strong></code></td> <td>
501<a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> to compare</td>
502 </tr>
503</table>
504
505### Return Value
506
507true if <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> pair are equivalent
508
509### Example
510
511<div><fiddle-embed name="7481a948e34672720337a631830586dd">
512
513#### Example Output
514
515~~~~
516paint1 == paint2
517paint1 != paint2
518~~~~
519
520</fiddle-embed></div>
521
522---
523
524<a name="not_equal_operator"></a>
525## operator!=
526
527<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
528bool operator!=(const SkPaint& a, const SkPaint& b)
529</pre>
530
531Compares <a href="bmh_SkPaint_Reference?cl=9919#a">a</a> and <a href="bmh_SkPaint_Reference?cl=9919#b">b</a>, and returns true if <a href="bmh_SkPaint_Reference?cl=9919#a">a</a> and <a href="bmh_SkPaint_Reference?cl=9919#b">b</a> are not equivalent. May return true
532if <a href="bmh_undocumented?cl=9919#Typeface">Typeface</a>, <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a>, <a href="bmh_undocumented?cl=9919#Shader">Shader</a>, <a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a>, <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>, <a href="bmh_undocumented?cl=9919#Rasterizer">Rasterizer</a>,
533<a href="bmh_undocumented?cl=9919#Draw_Looper">Draw Looper</a>, or <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a> have identical contents but different pointers.
534
535### Parameters
536
537<table> <tr> <td><code><strong>a </strong></code></td> <td>
538<a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> to compare</td>
539 </tr> <tr> <td><code><strong>b </strong></code></td> <td>
540<a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> to compare</td>
541 </tr>
542</table>
543
544### Return Value
545
546true if <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> pair are not equivalent
547
548### Example
549
550<div><fiddle-embed name="b6c8484b1187f555b435ad5369833be4">
551
552#### Example Output
553
554~~~~
555paint1 == paint2
556paint1 == paint2
557~~~~
558
559</fiddle-embed></div>
560
561---
562
563<a name="getHash"></a>
564## getHash
565
566<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
567uint32_t getHash() const
568</pre>
569
570Returns a hash generated from <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> values and pointers.
571Identical hashes guarantee that the paints are
572equivalent, but differing hashes do not guarantee that the paints have differing
573contents.
574
575If <a href="bmh_SkPaint_Reference?cl=9919#equal_operator">operator==(const SkPaint& a, const SkPaint& b)</a> returns true for two paints,
576their hashes are also equal.
577
578The hash returned is platform and implementation specific.
579
580### Return Value
581
582a shallow hash
583
584### Example
585
586<div><fiddle-embed name="7f7e1b701361912b344f90ae6b530393">
587
588#### Example Output
589
590~~~~
591paint1 == paint2
592paint1.getHash() == paint2.getHash()
593~~~~
594
595</fiddle-embed></div>
596
597---
598
599<a name="flatten"></a>
600## flatten
601
602<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
603void flatten(SkWriteBuffer& buffer) const
604</pre>
605
606Serializes <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> into a <a href="bmh_SkPaint_Reference?cl=9919#buffer">buffer</a>. A companion <a href="bmh_SkPaint_Reference?cl=9919#unflatten">unflatten</a> call
607can reconstitute the paint at a later time.
608
609### Parameters
610
611<table> <tr> <td><code><strong>buffer </strong></code></td> <td>
612<a href="bmh_undocumented?cl=9919#Write_Buffer">Write Buffer</a> receiving the flattened <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> data</td>
613 </tr>
614</table>
615
616### Example
617
618<div><fiddle-embed name="670672b146b50eced4d3dd10c701e0a7">
619
620#### Example Output
621
622~~~~
623color = 0xffff0000
624~~~~
625
626</fiddle-embed></div>
627
628---
629
630<a name="unflatten"></a>
631## unflatten
632
633<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
634void unflatten(SkReadBuffer& buffer)
635</pre>
636
637Populates <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a>, typically from a serialized stream, created by calling
638<a href="bmh_SkPaint_Reference?cl=9919#flatten">flatten</a> at an earlier time.
639
640<a href="bmh_undocumented?cl=9919#SkReadBuffer">SkReadBuffer</a> class is not public, so <a href="bmh_SkPaint_Reference?cl=9919#unflatten">unflatten</a> cannot be meaningfully called
641by the client.
642
643### Parameters
644
645<table> <tr> <td><code><strong>buffer </strong></code></td> <td>
646serialized data to unflatten</td>
647 </tr>
648</table>
649
650---
651
652# <a name="Hinting"></a> Hinting
653
654## <a name="SkPaint::Hinting"></a> Enum SkPaint::Hinting
655
656<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0">
657enum <a href="bmh_SkPaint_Reference?cl=9919#Hinting">Hinting</a> {
658<a href="bmh_SkPaint_Reference?cl=9919#kNo_Hinting">kNo Hinting</a> = 0,
659<a href="bmh_SkPaint_Reference?cl=9919#kSlight_Hinting">kSlight Hinting</a> = 1,
660<a href="bmh_SkPaint_Reference?cl=9919#kNormal_Hinting">kNormal Hinting</a> = 2,
Cary Clarkbad5ad72017-08-03 17:14:08 -0400661<a href="bmh_SkPaint_Reference?cl=9919#kFull_Hinting">kFull Hinting</a> = 3,
Cary Clark12799e12017-07-28 15:18:29 -0400662};</pre>
663
664<a href="bmh_SkPaint_Reference?cl=9919#Hinting">Hinting</a> adjusts the glyph outlines so that the shape provides a uniform
665look at a given point size on font engines that support it. <a href="bmh_SkPaint_Reference?cl=9919#Hinting">Hinting</a> may have a
666muted effect or no effect at all depending on the platform.
667
668The four levels roughly control corresponding features on platforms that use <a href="bmh_undocumented?cl=9919#FreeType">FreeType</a>
669as the <a href="bmh_undocumented?cl=9919#Engine">Font Engine</a>.
670
671### Constants
672
673<table>
674 <tr>
675 <td><a name="SkPaint::kNo_Hinting"></a> <code><strong>SkPaint::kNo_Hinting </strong></code></td><td>0</td><td>Leaves glyph outlines unchanged from their native representation.
676With <a href="bmh_undocumented?cl=9919#FreeType">FreeType</a>, this is equivalent to the <a href="bmh_undocumented?cl=9919#FT_LOAD_NO_HINTING">FT LOAD NO HINTING</a>
677bit-field constant supplied to <a href="bmh_undocumented?cl=9919#FT_Load_Glyph">FT Load Glyph</a>, which indicates that the vector
678outline being loaded should not be fitted to the pixel grid but simply scaled
679to 26.6 fractional pixels.</td>
680 </tr>
681 <tr>
682 <td><a name="SkPaint::kSlight_Hinting"></a> <code><strong>SkPaint::kSlight_Hinting </strong></code></td><td>1</td><td>Modifies glyph outlines minimally to improve constrast.
683With <a href="bmh_undocumented?cl=9919#FreeType">FreeType</a>, this is equivalent in spirit to the
684<a href="bmh_undocumented?cl=9919#FT_LOAD_TARGET_LIGHT">FT LOAD TARGET LIGHT</a> value supplied to <a href="bmh_undocumented?cl=9919#FT_Load_Glyph">FT Load Glyph</a>. It chooses a
685lighter hinting algorithm for non-monochrome modes.
686Generated glyphs may be fuzzy but better resemble their original shape.</td>
687 </tr>
688 <tr>
689 <td><a name="SkPaint::kNormal_Hinting"></a> <code><strong>SkPaint::kNormal_Hinting </strong></code></td><td>2</td><td>Modifies glyph outlines to improve constrast. This is the default.
690With <a href="bmh_undocumented?cl=9919#FreeType">FreeType</a>, this supplies <a href="bmh_undocumented?cl=9919#FT_LOAD_TARGET_NORMAL">FT LOAD TARGET NORMAL</a> to <a href="bmh_undocumented?cl=9919#FT_Load_Glyph">FT Load Glyph</a>,
691choosing the default hinting algorithm, which is optimized for standard
692gray-level rendering.</td>
693 </tr>
694 <tr>
695 <td><a name="SkPaint::kFull_Hinting"></a> <code><strong>SkPaint::kFull_Hinting </strong></code></td><td>3</td><td>Modifies glyph outlines for maxiumum constrast. With <a href="bmh_undocumented?cl=9919#FreeType">FreeType</a>, this selects
696<a href="bmh_undocumented?cl=9919#FT_LOAD_TARGET_LCD">FT LOAD TARGET LCD</a> or <a href="bmh_undocumented?cl=9919#FT_LOAD_TARGET_LCD_V">FT LOAD TARGET LCD V</a> if <a href="bmh_SkPaint_Reference?cl=9919#kLCDRenderText_Flag">kLCDRenderText Flag</a> is set.
697<a href="bmh_undocumented?cl=9919#FT_LOAD_TARGET_LCD">FT LOAD TARGET LCD</a> is a variant of <a href="bmh_undocumented?cl=9919#FT_LOAD_TARGET_NORMAL">FT LOAD TARGET NORMAL</a> optimized for
698horizontally decimated <a href="bmh_undocumented?cl=9919#LCD">LCD</a> displays; <a href="bmh_undocumented?cl=9919#FT_LOAD_TARGET_LCD_V">FT LOAD TARGET LCD V</a> is a
699variant of <a href="bmh_undocumented?cl=9919#FT_LOAD_TARGET_NORMAL">FT LOAD TARGET NORMAL</a> optimized for vertically decimated <a href="bmh_undocumented?cl=9919#LCD">LCD</a> displays.</td>
700 </tr>
701</table>
702
703On <a href="bmh_undocumented?cl=9919#Windows">Windows</a> with <a href="bmh_undocumented?cl=9919#DirectWrite">DirectWrite</a>, <a href="bmh_SkPaint_Reference?cl=9919#Hinting">Hinting</a> has no effect.
704
705<a href="bmh_SkPaint_Reference?cl=9919#Hinting">Hinting</a> defaults to <a href="bmh_SkPaint_Reference?cl=9919#kNormal_Hinting">kNormal Hinting</a>.
706Set <a href="bmh_undocumented?cl=9919#SkPaintDefaults_Hinting">SkPaintDefaults Hinting</a> at compile time to change the default setting.
707
708
709
710<a name="getHinting"></a>
711## getHinting
712
713<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
714Hinting getHinting() const
715</pre>
716
717Returns level of glyph outline adjustment.
718
719### Return Value
720
721one of: <a href="bmh_SkPaint_Reference?cl=9919#kNo_Hinting">kNo Hinting</a>, <a href="bmh_SkPaint_Reference?cl=9919#kSlight_Hinting">kSlight Hinting</a>, <a href="bmh_SkPaint_Reference?cl=9919#kNormal_Hinting">kNormal Hinting</a>, <a href="bmh_SkPaint_Reference?cl=9919#kFull_Hinting">kFull Hinting</a>
722
723### Example
724
725<div><fiddle-embed name="329e2e5a5919ac431e1c58878a5b99e0">
726
727#### Example Output
728
729~~~~
730SkPaint::kNormal_Hinting == paint.getHinting()
731~~~~
732
733</fiddle-embed></div>
734
735---
736
737<a name="setHinting"></a>
738## setHinting
739
740<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
741void setHinting(Hinting hintingLevel)
742</pre>
743
744Sets level of glyph outline adjustment.
745Does not check for valid values of <a href="bmh_SkPaint_Reference?cl=9919#hintingLevel">hintingLevel</a>.
746
747| <a href="bmh_SkPaint_Reference?cl=9919#Hinting">Hinting</a> | value | effect on generated glyph outlines |
748| --- | --- | --- |
749| <a href="bmh_SkPaint_Reference?cl=9919#kNo_Hinting">kNo Hinting</a> | 0 | leaves glyph outlines unchanged from their native representation |
750| <a href="bmh_SkPaint_Reference?cl=9919#kSlight_Hinting">kSlight Hinting</a> | 1 | modifies glyph outlines minimally to improve constrast |
751| <a href="bmh_SkPaint_Reference?cl=9919#kNormal_Hinting">kNormal Hinting</a> | 2 | modifies glyph outlines to improve constrast |
752| <a href="bmh_SkPaint_Reference?cl=9919#kFull_Hinting">kFull Hinting</a> | 3 | modifies glyph outlines for maxiumum constrast |
753
754### Parameters
755
756<table> <tr> <td><code><strong>hintingLevel </strong></code></td> <td>
757one of: <a href="bmh_SkPaint_Reference?cl=9919#kNo_Hinting">kNo Hinting</a>, <a href="bmh_SkPaint_Reference?cl=9919#kSlight_Hinting">kSlight Hinting</a>, <a href="bmh_SkPaint_Reference?cl=9919#kNormal_Hinting">kNormal Hinting</a>, <a href="bmh_SkPaint_Reference?cl=9919#kFull_Hinting">kFull Hinting</a></td>
758 </tr>
759</table>
760
761### Example
762
763<div><fiddle-embed name="78153fbd3f1000cb33b97bbe831ed34e">
764
765#### Example Output
766
767~~~~
768paint1 == paint2
769~~~~
770
771</fiddle-embed></div>
772
773---
774
775# <a name="Flags"></a> Flags
776
777## <a name="SkPaint::Flags"></a> Enum SkPaint::Flags
778
779<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0">
780enum <a href="bmh_SkPaint_Reference?cl=9919#Flags">Flags</a> {
781<a href="bmh_SkPaint_Reference?cl=9919#kAntiAlias_Flag">kAntiAlias Flag</a> = 0x01,
782<a href="bmh_SkPaint_Reference?cl=9919#kDither_Flag">kDither Flag</a> = 0x04,
783<a href="bmh_SkPaint_Reference?cl=9919#kFakeBoldText_Flag">kFakeBoldText Flag</a> = 0x20,
784<a href="bmh_SkPaint_Reference?cl=9919#kLinearText_Flag">kLinearText Flag</a> = 0x40,
785<a href="bmh_SkPaint_Reference?cl=9919#kSubpixelText_Flag">kSubpixelText Flag</a> = 0x80,
786<a href="bmh_SkPaint_Reference?cl=9919#kDevKernText_Flag">kDevKernText Flag</a> = 0x100,
787<a href="bmh_SkPaint_Reference?cl=9919#kLCDRenderText_Flag">kLCDRenderText Flag</a> = 0x200,
788<a href="bmh_SkPaint_Reference?cl=9919#kEmbeddedBitmapText_Flag">kEmbeddedBitmapText Flag</a> = 0x400,
789<a href="bmh_SkPaint_Reference?cl=9919#kAutoHinting_Flag">kAutoHinting Flag</a> = 0x800,
790<a href="bmh_SkPaint_Reference?cl=9919#kVerticalText_Flag">kVerticalText Flag</a> = 0x1000,
791<a href="bmh_SkPaint_Reference?cl=9919#kGenA8FromLCD_Flag">kGenA8FromLCD Flag</a> = 0x2000,
792
793<a href="bmh_SkPaint_Reference?cl=9919#kAllFlags">kAllFlags</a> = 0xFFFF,
794};
795</pre>
796
797The bit values stored in <a href="bmh_SkPaint_Reference?cl=9919#Flags">Flags</a>.
798The default value for <a href="bmh_SkPaint_Reference?cl=9919#Flags">Flags</a>, normally zero, can be changed at compile time
799with a custom definition of <a href="bmh_undocumented?cl=9919#SkPaintDefaults_Flags">SkPaintDefaults Flags</a>.
800All flags can be read and written explicitly; <a href="bmh_SkPaint_Reference?cl=9919#Flags">Flags</a> allows manipulating
801multiple settings at once.
802
803### Constants
804
805<table>
806 <tr>
807 <td><a name="SkPaint::kAntiAlias_Flag"></a> <code><strong>SkPaint::kAntiAlias_Flag </strong></code></td><td>0x0001 </td><td>mask for setting <a href="bmh_SkPaint_Reference?cl=9919#Anti_alias">Anti-alias</a></td>
808 </tr>
809 <tr>
810 <td><a name="SkPaint::kDither_Flag"></a> <code><strong>SkPaint::kDither_Flag </strong></code></td><td>0x0004</td><td>mask for setting <a href="bmh_SkPaint_Reference?cl=9919#Dither">Dither</a></td>
811 </tr>
812 <tr>
813 <td><a name="SkPaint::kFakeBoldText_Flag"></a> <code><strong>SkPaint::kFakeBoldText_Flag </strong></code></td><td>0x0020</td><td>mask for setting <a href="bmh_SkPaint_Reference?cl=9919#Fake_Bold">Fake Bold</a></td>
814 </tr>
815 <tr>
816 <td><a name="SkPaint::kLinearText_Flag"></a> <code><strong>SkPaint::kLinearText_Flag </strong></code></td><td>0x0040</td><td>mask for setting <a href="bmh_SkPaint_Reference?cl=9919#Linear_Text">Linear Text</a></td>
817 </tr>
818 <tr>
819 <td><a name="SkPaint::kSubpixelText_Flag"></a> <code><strong>SkPaint::kSubpixelText_Flag </strong></code></td><td>0x0080</td><td>mask for setting <a href="bmh_SkPaint_Reference?cl=9919#Subpixel_Text">Subpixel Text</a></td>
820 </tr>
821 <tr>
822 <td><a name="SkPaint::kDevKernText_Flag"></a> <code><strong>SkPaint::kDevKernText_Flag </strong></code></td><td>0x0100</td><td>mask for setting <a href="bmh_SkPaint_Reference?cl=9919#Full_Hinting_Spacing">Full Hinting Spacing</a></td>
823 </tr>
824 <tr>
825 <td><a name="SkPaint::kLCDRenderText_Flag"></a> <code><strong>SkPaint::kLCDRenderText_Flag </strong></code></td><td>0x0200</td><td>mask for setting <a href="bmh_SkPaint_Reference?cl=9919#LCD_Text">LCD Text</a></td>
826 </tr>
827 <tr>
828 <td><a name="SkPaint::kEmbeddedBitmapText_Flag"></a> <code><strong>SkPaint::kEmbeddedBitmapText_Flag </strong></code></td><td>0x0400</td><td>mask for setting <a href="bmh_SkPaint_Reference?cl=9919#Font_Embedded_Bitmaps">Font Embedded Bitmaps</a></td>
829 </tr>
830 <tr>
831 <td><a name="SkPaint::kAutoHinting_Flag"></a> <code><strong>SkPaint::kAutoHinting_Flag </strong></code></td><td>0x0800</td><td>mask for setting <a href="bmh_SkPaint_Reference?cl=9919#Automatic_Hinting">Automatic Hinting</a></td>
832 </tr>
833 <tr>
834 <td><a name="SkPaint::kVerticalText_Flag"></a> <code><strong>SkPaint::kVerticalText_Flag </strong></code></td><td>0x1000</td><td>mask for setting <a href="bmh_SkPaint_Reference?cl=9919#Vertical_Text">Vertical Text</a></td>
835 </tr>
836 <tr>
837 <td><a name="SkPaint::kGenA8FromLCD_Flag"></a> <code><strong>SkPaint::kGenA8FromLCD_Flag </strong></code></td><td>0x2000</td><td>not intended for public use</td>
838 </tr>
839 <tr>
840 <td><a name="SkPaint::kAllFlags"></a> <code><strong>SkPaint::kAllFlags </strong></code></td><td>0xFFFF</td><td>mask of all <a href="bmh_SkPaint_Reference?cl=9919#Flags">Flags</a>, including private flags and flags reserved for future use</td>
841 </tr>
842<a href="bmh_SkPaint_Reference?cl=9919#Flags">Flags</a> default to all flags clear, disabling the associated feature.
843
844</table>
845
846## <a name="SkPaint::ReserveFlags"></a> Enum SkPaint::ReserveFlags
847
848<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0">
849enum <a href="bmh_SkPaint_Reference?cl=9919#ReserveFlags">ReserveFlags</a> {
850<a href="bmh_SkPaint_Reference?cl=9919#kUnderlineText_ReserveFlag">kUnderlineText ReserveFlag</a> = 0x08,
851<a href="bmh_SkPaint_Reference?cl=9919#kStrikeThruText_ReserveFlag">kStrikeThruText ReserveFlag</a> = 0x10,
852};</pre>
853
854### Constants
855
856<table>
857 <tr>
858 <td><a name="SkPaint::kUnderlineText_ReserveFlag"></a> <code><strong>SkPaint::kUnderlineText_ReserveFlag </strong></code></td><td>0x0008</td><td>mask for underline text</td>
859 </tr>
860 <tr>
861 <td><a name="SkPaint::kStrikeThruText_ReserveFlag"></a> <code><strong>SkPaint::kStrikeThruText_ReserveFlag </strong></code></td><td>0x0010</td><td>mask for strike-thru text</td>
862 </tr>
863</table>
864
865
866
867<a name="getFlags"></a>
868## getFlags
869
870<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
871uint32_t getFlags() const
872</pre>
873
874Returns paint settings described by <a href="bmh_SkPaint_Reference?cl=9919#Flags">Flags</a>. Each setting uses one
875bit, and can be tested with <a href="bmh_SkPaint_Reference?cl=9919#Flags">Flags</a> members.
876
877### Return Value
878
879zero, one, or more bits described by <a href="bmh_SkPaint_Reference?cl=9919#Flags">Flags</a>
880
881### Example
882
883<div><fiddle-embed name="8a3f8c309533388b01aa66e1267f322d">
884
885#### Example Output
886
887~~~~
888(SkPaint::kAntiAlias_Flag & paint.getFlags()) != 0
889~~~~
890
891</fiddle-embed></div>
892
893---
894
895<a name="setFlags"></a>
896## setFlags
897
898<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
899void setFlags(uint32_t flags)
900</pre>
901
902Replaces <a href="bmh_SkPaint_Reference?cl=9919#Flags">Flags</a> with <a href="bmh_SkPaint_Reference?cl=9919#flags">flags</a>, the union of the <a href="bmh_SkPaint_Reference?cl=9919#Flags">Flags</a> members.
903All <a href="bmh_SkPaint_Reference?cl=9919#Flags">Flags</a> members may be cleared, or one or more may be set.
904
905### Parameters
906
907<table> <tr> <td><code><strong>flags </strong></code></td> <td>
908union of <a href="bmh_SkPaint_Reference?cl=9919#Flags">Flags</a> for <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a></td>
909 </tr>
910</table>
911
912### Example
913
914<div><fiddle-embed name="54baed3f6bc4b9c31ba664e27767fdc7">
915
916#### Example Output
917
918~~~~
919paint.isAntiAlias()
920paint.isDither()
921~~~~
922
923</fiddle-embed></div>
924
925---
926
927# <a name="Anti-alias"></a> Anti-alias
928<a href="bmh_SkPaint_Reference?cl=9919#Anti_alias">Anti-alias</a> drawing approximates partial pixel coverage with transparency.
929If <a href="bmh_SkPaint_Reference?cl=9919#kAntiAlias_Flag">kAntiAlias Flag</a> is clear, pixel centers contained by the shape edge are drawn opaque.
930If <a href="bmh_SkPaint_Reference?cl=9919#kAntiAlias_Flag">kAntiAlias Flag</a> is set, pixels are drawn with <a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a> equal to their coverage.
931
932The rule for aliased pixels is inconsistent across platforms. A shape edge
933passing through the pixel center may, but is not required to, draw the pixel.
934
935<a href="bmh_undocumented?cl=9919#Raster_Engine">Raster Engine</a> draws aliased pixels whose centers are on or to the right of the start of an
936active <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> edge, and whose center is to the left of the end of the active <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> edge.
937
938A platform may only support anti-aliased drawing. Some <a href="bmh_undocumented?cl=9919#GPU_backed">GPU-backed</a> platforms use
939supersampling to anti-alias all drawing, and have no mechanism to selectively
940alias.
941
942The amount of coverage computed for anti-aliased pixels also varies across platforms.
943
944<a href="bmh_SkPaint_Reference?cl=9919#Anti_alias">Anti-alias</a> is disabled by default.
945<a href="bmh_SkPaint_Reference?cl=9919#Anti_alias">Anti-alias</a> can be enabled by default by setting <a href="bmh_undocumented?cl=9919#SkPaintDefaults_Flags">SkPaintDefaults Flags</a> to <a href="bmh_SkPaint_Reference?cl=9919#kAntiAlias_Flag">kAntiAlias Flag</a>
946at compile time.
947
948### Example
949
950<div><fiddle-embed name="a6575a49467ce8d28bb01cc7638fa04d"><div>A red line is drawn with transparency on the edges to make it look smoother.
951A blue line draws only where the pixel centers are contained.
952The lines are drawn into an offscreen bitmap, then drawn magified to make the
953aliasing easier to see.</div></fiddle-embed></div>
954
955<a name="isAntiAlias"></a>
956## isAntiAlias
957
958<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
959bool isAntiAlias() const
960</pre>
961
962If true, pixels on the active edges of <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> may be drawn with partial transparency.
963
964Equivalent to <a href="bmh_SkPaint_Reference?cl=9919#getFlags">getFlags</a> masked with <a href="bmh_SkPaint_Reference?cl=9919#kAntiAlias_Flag">kAntiAlias Flag</a>.
965
966### Return Value
967
968<a href="bmh_SkPaint_Reference?cl=9919#kAntiAlias_Flag">kAntiAlias Flag</a> state
969
970### Example
971
972<div><fiddle-embed name="d7d5f4f7da7acd5104a652f490c6f7b8">
973
974#### Example Output
975
976~~~~
977paint.isAntiAlias() == !!(paint.getFlags() & SkPaint::kAntiAlias_Flag)
978paint.isAntiAlias() == !!(paint.getFlags() & SkPaint::kAntiAlias_Flag)
979~~~~
980
981</fiddle-embed></div>
982
983---
984
985<a name="setAntiAlias"></a>
986## setAntiAlias
987
988<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
989void setAntiAlias(bool aa)
990</pre>
991
992Requests, but does not require, that <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> edge pixels draw opaque or with
993partial transparency.
994
995Sets <a href="bmh_SkPaint_Reference?cl=9919#kAntiAlias_Flag">kAntiAlias Flag</a> if <a href="bmh_SkPaint_Reference?cl=9919#aa">aa</a> is true.
996Clears <a href="bmh_SkPaint_Reference?cl=9919#kAntiAlias_Flag">kAntiAlias Flag</a> if <a href="bmh_SkPaint_Reference?cl=9919#aa">aa</a> is false.
997
998### Parameters
999
1000<table> <tr> <td><code><strong>aa </strong></code></td> <td>
1001setting for <a href="bmh_SkPaint_Reference?cl=9919#kAntiAlias_Flag">kAntiAlias Flag</a></td>
1002 </tr>
1003</table>
1004
1005### Example
1006
1007<div><fiddle-embed name="c2ff148374d01cbef845b223e725905c">
1008
1009#### Example Output
1010
1011~~~~
1012paint1 == paint2
1013~~~~
1014
1015</fiddle-embed></div>
1016
1017---
1018
1019# <a name="Dither"></a> Dither
1020<a href="bmh_SkPaint_Reference?cl=9919#Dither">Dither</a> increases fidelity by adjusting the color of adjcent pixels.
1021This can help to smooth color transitions and reducing banding in gradients.
1022Dithering lessens visible banding from <a href="bmh_undocumented?cl=9919#SkColorType">kRGB 565 SkColorType</a>
1023and <a href="bmh_undocumented?cl=9919#SkColorType">kRGBA 8888 SkColorType</a> gradients,
1024and improves rendering into a <a href="bmh_undocumented?cl=9919#SkColorType">kRGB 565 SkColorType</a> <a href="bmh_undocumented?cl=9919#Surface">Surface</a>.
1025
1026Dithering is always enabled for linear gradients drawing into
1027<a href="bmh_undocumented?cl=9919#SkColorType">kRGB 565 SkColorType</a> <a href="bmh_undocumented?cl=9919#Surface">Surface</a> and <a href="bmh_undocumented?cl=9919#SkColorType">kRGBA 8888 SkColorType</a> <a href="bmh_undocumented?cl=9919#Surface">Surface</a>.
1028<a href="bmh_SkPaint_Reference?cl=9919#Dither">Dither</a> cannot be enabled for <a href="bmh_undocumented?cl=9919#SkColorType">kAlpha 8 SkColorType</a> <a href="bmh_undocumented?cl=9919#Surface">Surface</a> and
1029<a href="bmh_undocumented?cl=9919#SkColorType">kRGBA F16 SkColorType</a> <a href="bmh_undocumented?cl=9919#Surface">Surface</a>.
1030
1031<a href="bmh_SkPaint_Reference?cl=9919#Dither">Dither</a> is disabled by default.
1032<a href="bmh_SkPaint_Reference?cl=9919#Dither">Dither</a> can be enabled by default by setting <a href="bmh_undocumented?cl=9919#SkPaintDefaults_Flags">SkPaintDefaults Flags</a> to <a href="bmh_SkPaint_Reference?cl=9919#kDither_Flag">kDither Flag</a>
1033at compile time.
1034
Cary Clarkbad5ad72017-08-03 17:14:08 -04001035Some platform implementations may ignore dithering. Setto ignore <a href="bmh_SkPaint_Reference?cl=9919#Dither">Dither</a> on <a href="bmh_undocumented?cl=9919#GPU_Surface">GPU Surface</a>.
Cary Clark12799e12017-07-28 15:18:29 -04001036
1037### Example
1038
1039<div><fiddle-embed name="8b26507690b71462f44642b911890bbf"><div>Dithering in the bottom half more closely approximates the requested color by
1040alternating nearby colors from pixel to pixel.</div></fiddle-embed></div>
1041
1042### Example
1043
1044<div><fiddle-embed name="76d4d4a7931a48495e4d5f54e073be53"><div>Dithering introduces subtle adjustments to color to smooth gradients.
1045Drawing the gradient repeatedly with <a href="bmh_undocumented?cl=9919#kPlus">SkBlendMode::kPlus</a> exaggerates the
1046dither, making it easier to see.</div></fiddle-embed></div>
1047
1048<a name="isDither"></a>
1049## isDither
1050
1051<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
1052bool isDither() const
1053</pre>
1054
1055If true, color error may be distributed to smooth color transition.
1056Equivalent to <a href="bmh_SkPaint_Reference?cl=9919#getFlags">getFlags</a> masked with <a href="bmh_SkPaint_Reference?cl=9919#kDither_Flag">kDither Flag</a>.
1057
1058### Return Value
1059
1060<a href="bmh_SkPaint_Reference?cl=9919#kDither_Flag">kDither Flag</a> state
1061
1062### Example
1063
1064<div><fiddle-embed name="f4ce93f6c5e7335436a985377fd980c0">
1065
1066#### Example Output
1067
1068~~~~
1069paint.isDither() == !!(paint.getFlags() & SkPaint::kDither_Flag)
1070paint.isDither() == !!(paint.getFlags() & SkPaint::kDither_Flag)
1071~~~~
1072
1073</fiddle-embed></div>
1074
1075---
1076
1077<a name="setDither"></a>
1078## setDither
1079
1080<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
1081void setDither(bool dither)
1082</pre>
1083
1084Requests, but does not require, to distribute color error.
1085
1086Sets <a href="bmh_SkPaint_Reference?cl=9919#kDither_Flag">kDither Flag</a> if <a href="bmh_SkPaint_Reference?cl=9919#dither">dither</a> is true.
1087Clears <a href="bmh_SkPaint_Reference?cl=9919#kDither_Flag">kDither Flag</a> if <a href="bmh_SkPaint_Reference?cl=9919#dither">dither</a> is false.
1088
1089### Parameters
1090
1091<table> <tr> <td><code><strong>dither </strong></code></td> <td>
1092setting for <a href="bmh_SkPaint_Reference?cl=9919#kDither_Flag">kDither Flag</a></td>
1093 </tr>
1094</table>
1095
1096### Example
1097
1098<div><fiddle-embed name="69b7162e8324d9239dd02dd9ada2bdff">
1099
1100#### Example Output
1101
1102~~~~
1103paint1 == paint2
1104~~~~
1105
1106</fiddle-embed></div>
1107
1108### See Also
1109
1110<a href="bmh_undocumented?cl=9919#SkColorType">kRGB 565 SkColorType</a>
1111
1112---
1113
1114### See Also
1115
1116Gradient <a href="bmh_undocumented?cl=9919#RGB_565">Color RGB-565</a>
1117
1118# <a name="Device_Text"></a> Device Text
1119<a href="bmh_SkPaint_Reference?cl=9919#LCD_Text">LCD Text</a> and <a href="bmh_SkPaint_Reference?cl=9919#Subpixel_Text">Subpixel Text</a> increase the precision of glyph position.
1120
1121When set, <a href="bmh_SkPaint_Reference?cl=9919#Flags">Flags</a> <a href="bmh_SkPaint_Reference?cl=9919#kLCDRenderText_Flag">kLCDRenderText Flag</a> takes advantage of the organization of <a href="bmh_undocumented?cl=9919#RGB">Color RGB</a> stripes that
1122create a color, and relies
1123on the small size of the stripe and visual perception to make the color fringing inperceptible.
1124<a href="bmh_SkPaint_Reference?cl=9919#LCD_Text">LCD Text</a> can be enabled on devices that orient stripes horizontally or vertically, and that order
1125the color components as <a href="bmh_undocumented?cl=9919#RGB">Color RGB</a> or <a href="bmh_undocumented?cl=9919#RBG">Color RBG</a>.
1126
1127<a href="bmh_SkPaint_Reference?cl=9919#Flags">Flags</a> <a href="bmh_SkPaint_Reference?cl=9919#kSubpixelText_Flag">kSubpixelText Flag</a> uses the pixel transparency to represent a fractional offset.
1128As the opaqueness
1129of the color increases, the edge of the glyph appears to move towards the outside of the pixel.
1130
1131Either or both techniques can be enabled.
1132<a href="bmh_SkPaint_Reference?cl=9919#kLCDRenderText_Flag">kLCDRenderText Flag</a> and <a href="bmh_SkPaint_Reference?cl=9919#kSubpixelText_Flag">kSubpixelText Flag</a> are clear by default.
1133<a href="bmh_SkPaint_Reference?cl=9919#LCD_Text">LCD Text</a> or <a href="bmh_SkPaint_Reference?cl=9919#Subpixel_Text">Subpixel Text</a> can be enabled by default by setting <a href="bmh_undocumented?cl=9919#SkPaintDefaults_Flags">SkPaintDefaults Flags</a> to
1134<a href="bmh_SkPaint_Reference?cl=9919#kLCDRenderText_Flag">kLCDRenderText Flag</a> or <a href="bmh_SkPaint_Reference?cl=9919#kSubpixelText_Flag">kSubpixelText Flag</a> (or both) at compile time.
1135
1136### Example
1137
1138<div><fiddle-embed name="4606ae1be792d6bc46d496432f050ee9"><div>Four commas are drawn normally and with combinations of <a href="bmh_SkPaint_Reference?cl=9919#LCD_Text">LCD Text</a> and <a href="bmh_SkPaint_Reference?cl=9919#Subpixel_Text">Subpixel Text</a>.
1139When <a href="bmh_SkPaint_Reference?cl=9919#Subpixel_Text">Subpixel Text</a> is disabled, the comma glyphs are indentical, but not evenly spaced.
1140When <a href="bmh_SkPaint_Reference?cl=9919#Subpixel_Text">Subpixel Text</a> is enabled, the comma glyphs are unique, but appear evenly spaced.</div></fiddle-embed></div>
1141
1142## <a name="Linear_Text"></a> Linear Text
1143
1144<a href="bmh_SkPaint_Reference?cl=9919#Linear_Text">Linear Text</a> selects whether text is rendered as a <a href="bmh_undocumented?cl=9919#Glyph">Glyph</a> or as a <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>.
1145If <a href="bmh_SkPaint_Reference?cl=9919#kLinearText_Flag">kLinearText Flag</a> is set, it has the same effect as setting <a href="bmh_SkPaint_Reference?cl=9919#Hinting">Hinting</a> to <a href="bmh_SkPaint_Reference?cl=9919#kNormal_Hinting">kNormal Hinting</a>.
1146If <a href="bmh_SkPaint_Reference?cl=9919#kLinearText_Flag">kLinearText Flag</a> is clear, it's the same as setting <a href="bmh_SkPaint_Reference?cl=9919#Hinting">Hinting</a> to <a href="bmh_SkPaint_Reference?cl=9919#kNo_Hinting">kNo Hinting</a>.
1147
1148<a name="isLinearText"></a>
1149## isLinearText
1150
1151<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
1152bool isLinearText() const
1153</pre>
1154
1155If true, text is converted to <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> before drawing and measuring.
1156
1157Equivalent to <a href="bmh_SkPaint_Reference?cl=9919#getFlags">getFlags</a> masked with <a href="bmh_SkPaint_Reference?cl=9919#kLinearText_Flag">kLinearText Flag</a>.
1158
1159### Return Value
1160
1161<a href="bmh_SkPaint_Reference?cl=9919#kLinearText_Flag">kLinearText Flag</a> state
1162
1163### Example
1164
1165<div><fiddle-embed name="2890ad644f980637837e6fcb386fb462"></fiddle-embed></div>
1166
1167### See Also
1168
1169<a href="bmh_SkPaint_Reference?cl=9919#setLinearText">setLinearText</a> <a href="bmh_SkPaint_Reference?cl=9919#Hinting">Hinting</a>
1170
1171---
1172
1173<a name="setLinearText"></a>
1174## setLinearText
1175
1176<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
1177void setLinearText(bool linearText)
1178</pre>
1179
1180If true, text is converted to <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> before drawing and measuring.
1181By default, <a href="bmh_SkPaint_Reference?cl=9919#kLinearText_Flag">kLinearText Flag</a> is clear.
1182
1183Sets <a href="bmh_SkPaint_Reference?cl=9919#kLinearText_Flag">kLinearText Flag</a> if <a href="bmh_SkPaint_Reference?cl=9919#linearText">linearText</a> is true.
1184Clears <a href="bmh_SkPaint_Reference?cl=9919#kLinearText_Flag">kLinearText Flag</a> if <a href="bmh_SkPaint_Reference?cl=9919#linearText">linearText</a> is false.
1185
1186### Parameters
1187
1188<table> <tr> <td><code><strong>linearText </strong></code></td> <td>
1189setting for <a href="bmh_SkPaint_Reference?cl=9919#kLinearText_Flag">kLinearText Flag</a></td>
1190 </tr>
1191</table>
1192
1193### Example
1194
1195<div><fiddle-embed name="c93bb912f3bddfb4d96d3ad70ada552b"></fiddle-embed></div>
1196
1197### See Also
1198
1199<a href="bmh_SkPaint_Reference?cl=9919#isLinearText">isLinearText</a> <a href="bmh_SkPaint_Reference?cl=9919#Hinting">Hinting</a>
1200
1201---
1202
1203## <a name="Subpixel_Text"></a> Subpixel Text
1204
1205<a href="bmh_SkPaint_Reference?cl=9919#Flags">Flags</a> <a href="bmh_SkPaint_Reference?cl=9919#kSubpixelText_Flag">kSubpixelText Flag</a> uses the pixel transparency to represent a fractional offset.
1206As the opaqueness
1207of the color increases, the edge of the glyph appears to move towards the outside of the pixel.
1208
1209<a name="isSubpixelText"></a>
1210## isSubpixelText
1211
1212<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
1213bool isSubpixelText() const
1214</pre>
1215
1216If true, glyphs at different sub-pixel positions may differ on pixel edge coverage.
1217
1218Equivalent to <a href="bmh_SkPaint_Reference?cl=9919#getFlags">getFlags</a> masked with <a href="bmh_SkPaint_Reference?cl=9919#kSubpixelText_Flag">kSubpixelText Flag</a>.
1219
1220### Return Value
1221
1222<a href="bmh_SkPaint_Reference?cl=9919#kSubpixelText_Flag">kSubpixelText Flag</a> state
1223
1224### Example
1225
1226<div><fiddle-embed name="abe9afc0932e2199324ae6cbb396e67c">
1227
1228#### Example Output
1229
1230~~~~
1231paint.isSubpixelText() == !!(paint.getFlags() & SkPaint::kSubpixelText_Flag)
1232paint.isSubpixelText() == !!(paint.getFlags() & SkPaint::kSubpixelText_Flag)
1233~~~~
1234
1235</fiddle-embed></div>
1236
1237---
1238
1239<a name="setSubpixelText"></a>
1240## setSubpixelText
1241
1242<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
1243void setSubpixelText(bool subpixelText)
1244</pre>
1245
1246Requests, but does not require, that glyphs respect sub-pixel positioning.
1247
1248Sets <a href="bmh_SkPaint_Reference?cl=9919#kSubpixelText_Flag">kSubpixelText Flag</a> if <a href="bmh_SkPaint_Reference?cl=9919#subpixelText">subpixelText</a> is true.
1249Clears <a href="bmh_SkPaint_Reference?cl=9919#kSubpixelText_Flag">kSubpixelText Flag</a> if <a href="bmh_SkPaint_Reference?cl=9919#subpixelText">subpixelText</a> is false.
1250
1251### Parameters
1252
1253<table> <tr> <td><code><strong>subpixelText </strong></code></td> <td>
1254setting for <a href="bmh_SkPaint_Reference?cl=9919#kSubpixelText_Flag">kSubpixelText Flag</a></td>
1255 </tr>
1256</table>
1257
1258### Example
1259
1260<div><fiddle-embed name="a77bbc1a4e3be9a8ab0f842f877c5ee4">
1261
1262#### Example Output
1263
1264~~~~
1265paint1 == paint2
1266~~~~
1267
1268</fiddle-embed></div>
1269
1270---
1271
1272## <a name="LCD_Text"></a> LCD Text
1273
1274When set, <a href="bmh_SkPaint_Reference?cl=9919#Flags">Flags</a> <a href="bmh_SkPaint_Reference?cl=9919#kLCDRenderText_Flag">kLCDRenderText Flag</a> takes advantage of the organization of <a href="bmh_undocumented?cl=9919#RGB">Color RGB</a> stripes that
1275create a color, and relies
1276on the small size of the stripe and visual perception to make the color fringing inperceptible.
1277<a href="bmh_SkPaint_Reference?cl=9919#LCD_Text">LCD Text</a> can be enabled on devices that orient stripes horizontally or vertically, and that order
1278the color components as <a href="bmh_undocumented?cl=9919#RGB">Color RGB</a> or <a href="bmh_undocumented?cl=9919#RBG">Color RBG</a>.
1279
1280<a name="isLCDRenderText"></a>
1281## isLCDRenderText
1282
1283<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
1284bool isLCDRenderText() const
1285</pre>
1286
1287If true, glyphs may use <a href="bmh_undocumented?cl=9919#LCD">LCD</a> striping to improve glyph edges.
1288
1289Returns true if <a href="bmh_SkPaint_Reference?cl=9919#Flags">Flags</a> <a href="bmh_SkPaint_Reference?cl=9919#kLCDRenderText_Flag">kLCDRenderText Flag</a> is set.
1290
1291### Return Value
1292
1293<a href="bmh_SkPaint_Reference?cl=9919#kLCDRenderText_Flag">kLCDRenderText Flag</a> state
1294
1295### Example
1296
1297<div><fiddle-embed name="68e1fd95dd2fd06a333899d2bd2396b9">
1298
1299#### Example Output
1300
1301~~~~
1302paint.isLCDRenderText() == !!(paint.getFlags() & SkPaint::kLCDRenderText_Flag)
1303paint.isLCDRenderText() == !!(paint.getFlags() & SkPaint::kLCDRenderText_Flag)
1304~~~~
1305
1306</fiddle-embed></div>
1307
1308---
1309
1310<a name="setLCDRenderText"></a>
1311## setLCDRenderText
1312
1313<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
1314void setLCDRenderText(bool lcdText)
1315</pre>
1316
1317Requests, but does not require, that glyphs use <a href="bmh_undocumented?cl=9919#LCD">LCD</a> striping for glyph edges.
1318
1319Sets <a href="bmh_SkPaint_Reference?cl=9919#kLCDRenderText_Flag">kLCDRenderText Flag</a> if <a href="bmh_SkPaint_Reference?cl=9919#lcdText">lcdText</a> is true.
1320Clears <a href="bmh_SkPaint_Reference?cl=9919#kLCDRenderText_Flag">kLCDRenderText Flag</a> if <a href="bmh_SkPaint_Reference?cl=9919#lcdText">lcdText</a> is false.
1321
1322### Parameters
1323
1324<table> <tr> <td><code><strong>lcdText </strong></code></td> <td>
1325setting for <a href="bmh_SkPaint_Reference?cl=9919#kLCDRenderText_Flag">kLCDRenderText Flag</a></td>
1326 </tr>
1327</table>
1328
1329### Example
1330
1331<div><fiddle-embed name="50dedf8450159571a3edaf4f0050defe">
1332
1333#### Example Output
1334
1335~~~~
1336paint1 == paint2
1337~~~~
1338
1339</fiddle-embed></div>
1340
1341---
1342
1343# <a name="Font_Embedded_Bitmaps"></a> Font Embedded Bitmaps
1344<a href="bmh_SkPaint_Reference?cl=9919#Font_Embedded_Bitmaps">Font Embedded Bitmaps</a> allows selecting custom-sized bitmap glyphs.
1345<a href="bmh_SkPaint_Reference?cl=9919#Flags">Flags</a> <a href="bmh_SkPaint_Reference?cl=9919#kEmbeddedBitmapText_Flag">kEmbeddedBitmapText Flag</a> when set chooses an embedded bitmap glyph over an outline contained
1346in a font if the platform supports this option.
1347
1348<a href="bmh_undocumented?cl=9919#FreeType">FreeType</a> selects the bitmap glyph if available when <a href="bmh_SkPaint_Reference?cl=9919#kEmbeddedBitmapText_Flag">kEmbeddedBitmapText Flag</a> is set, and selects
1349the outline glyph if <a href="bmh_SkPaint_Reference?cl=9919#kEmbeddedBitmapText_Flag">kEmbeddedBitmapText Flag</a> is clear.
1350<a href="bmh_undocumented?cl=9919#Windows">Windows</a> may select the bitmap glyph but is not required to do so.
1351<a href="bmh_undocumented?cl=9919#OS_X">OS X</a> and <a href="bmh_undocumented?cl=9919#iOS">iOS</a> do not support this option.
1352
1353<a href="bmh_SkPaint_Reference?cl=9919#Font_Embedded_Bitmaps">Font Embedded Bitmaps</a> is disabled by default.
1354<a href="bmh_SkPaint_Reference?cl=9919#Font_Embedded_Bitmaps">Font Embedded Bitmaps</a> can be enabled by default by setting <a href="bmh_undocumented?cl=9919#SkPaintDefaults_Flags">SkPaintDefaults Flags</a> to
1355<a href="bmh_SkPaint_Reference?cl=9919#kEmbeddedBitmapText_Flag">kEmbeddedBitmapText Flag</a> at compile time.
1356
1357### Example
1358
1359<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0">
1360!fiddle<div>The hintgasp <a href="bmh_undocumented?cl=9919#TrueType">TrueType</a> font in the <a href="bmh_undocumented?cl=9919#Skia">Skia</a> resources/fonts directory includes an embedded
1361bitmap glyph at odd font sizes. This example works on platforms that use <a href="bmh_undocumented?cl=9919#FreeType">FreeType</a>
1362as their <a href="bmh_undocumented?cl=9919#Engine">Font Engine</a>.
1363<a href="bmh_undocumented?cl=9919#Windows">Windows</a> may, but is not required to, return a bitmap glyph if <a href="bmh_SkPaint_Reference?cl=9919#kEmbeddedBitmapText_Flag">kEmbeddedBitmapText Flag</a> is set.</div><a href="bmh_undocumented?cl=9919#SkBitmap">SkBitmap</a> bitmap;
1364bitmap.allocN32Pixels(30, 15);
1365bitmap.eraseColor(0);
1366<a href="bmh_SkCanvas_Reference?cl=9919#SkCanvas">SkCanvas</a> offscreen(bitmap);
1367<a href="bmh_SkPaint_Reference?cl=9919#SkPaint">SkPaint</a> paint;
1368paint.</pre>
1369
1370<a name="isEmbeddedBitmapText"></a>
1371## isEmbeddedBitmapText
1372
1373<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
1374bool isEmbeddedBitmapText() const
1375</pre>
1376
1377If true, <a href="bmh_undocumented?cl=9919#Engine">Font Engine</a> may return glyphs from font bitmaps instead of from outlines.
1378
1379Equivalent to <a href="bmh_SkPaint_Reference?cl=9919#getFlags">getFlags</a> masked with <a href="bmh_SkPaint_Reference?cl=9919#kEmbeddedBitmapText_Flag">kEmbeddedBitmapText Flag</a>.
1380
1381### Return Value
1382
1383<a href="bmh_SkPaint_Reference?cl=9919#kEmbeddedBitmapText_Flag">kEmbeddedBitmapText Flag</a> state
1384
1385### Example
1386
1387<div><fiddle-embed name="eba10b27b790e87183ae451b3fc5c4b1">
1388
1389#### Example Output
1390
1391~~~~
1392paint.isEmbeddedBitmapText() == !!(paint.getFlags() & SkPaint::kEmbeddedBitmapText_Flag)
1393paint.isEmbeddedBitmapText() == !!(paint.getFlags() & SkPaint::kEmbeddedBitmapText_Flag)
1394~~~~
1395
1396</fiddle-embed></div>
1397
1398---
1399
1400<a name="setEmbeddedBitmapText"></a>
1401## setEmbeddedBitmapText
1402
1403<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
1404void setEmbeddedBitmapText(bool useEmbeddedBitmapText)
1405</pre>
1406
1407Requests, but does not require, to use bitmaps in fonts instead of outlines.
1408
1409Sets <a href="bmh_SkPaint_Reference?cl=9919#kEmbeddedBitmapText_Flag">kEmbeddedBitmapText Flag</a> if <a href="bmh_SkPaint_Reference?cl=9919#useEmbeddedBitmapText">useEmbeddedBitmapText</a> is true.
1410Clears <a href="bmh_SkPaint_Reference?cl=9919#kEmbeddedBitmapText_Flag">kEmbeddedBitmapText Flag</a> if <a href="bmh_SkPaint_Reference?cl=9919#useEmbeddedBitmapText">useEmbeddedBitmapText</a> is false.
1411
1412### Parameters
1413
1414<table> <tr> <td><code><strong>useEmbeddedBitmapText </strong></code></td> <td>
1415setting for <a href="bmh_SkPaint_Reference?cl=9919#kEmbeddedBitmapText_Flag">kEmbeddedBitmapText Flag</a></td>
1416 </tr>
1417</table>
1418
1419### Example
1420
1421<div><fiddle-embed name="246dffdd93a484ba4ad7ecf71198a5d4">
1422
1423#### Example Output
1424
1425~~~~
1426paint1 == paint2
1427~~~~
1428
1429</fiddle-embed></div>
1430
1431---
1432
1433# <a name="Automatic_Hinting"></a> Automatic Hinting
1434If <a href="bmh_SkPaint_Reference?cl=9919#Hinting">Hinting</a> is set to <a href="bmh_SkPaint_Reference?cl=9919#kNormal_Hinting">kNormal Hinting</a> or <a href="bmh_SkPaint_Reference?cl=9919#kFull_Hinting">kFull Hinting</a>, <a href="bmh_SkPaint_Reference?cl=9919#Automatic_Hinting">Automatic Hinting</a>
Cary Clarkbad5ad72017-08-03 17:14:08 -04001435instructs the <a href="bmh_undocumented?cl=9919#Font_Manager">Font Manager</a> to always hint glyphs.
Cary Clark12799e12017-07-28 15:18:29 -04001436<a href="bmh_SkPaint_Reference?cl=9919#Automatic_Hinting">Automatic Hinting</a> has no effect if <a href="bmh_SkPaint_Reference?cl=9919#Hinting">Hinting</a> is set to <a href="bmh_SkPaint_Reference?cl=9919#kNo_Hinting">kNo Hinting</a> or
1437<a href="bmh_SkPaint_Reference?cl=9919#kSlight_Hinting">kSlight Hinting</a>.
1438
1439<a href="bmh_SkPaint_Reference?cl=9919#Automatic_Hinting">Automatic Hinting</a> only affects platforms that use <a href="bmh_undocumented?cl=9919#FreeType">FreeType</a> as the <a href="bmh_undocumented?cl=9919#Font_Manager">Font Manager</a>.
1440
1441<a name="isAutohinted"></a>
1442## isAutohinted
1443
1444<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
1445bool isAutohinted() const
1446</pre>
1447
1448If true, and if <a href="bmh_SkPaint_Reference?cl=9919#Hinting">Hinting</a> is set to <a href="bmh_SkPaint_Reference?cl=9919#kNormal_Hinting">kNormal Hinting</a> or <a href="bmh_SkPaint_Reference?cl=9919#kFull_Hinting">kFull Hinting</a>, and if
1449platform uses <a href="bmh_undocumented?cl=9919#FreeType">FreeType</a> as the <a href="bmh_undocumented?cl=9919#Font_Manager">Font Manager</a>, instruct the <a href="bmh_undocumented?cl=9919#Font_Manager">Font Manager</a> to always hint
Cary Clarkbad5ad72017-08-03 17:14:08 -04001450glyphs.
Cary Clark12799e12017-07-28 15:18:29 -04001451
1452Equivalent to <a href="bmh_SkPaint_Reference?cl=9919#getFlags">getFlags</a> masked with <a href="bmh_SkPaint_Reference?cl=9919#kAutoHinting_Flag">kAutoHinting Flag</a>.
1453
1454### Return Value
1455
1456<a href="bmh_SkPaint_Reference?cl=9919#kAutoHinting_Flag">kAutoHinting Flag</a> state
1457
1458### Example
1459
1460<div><fiddle-embed name="aa4781afbe3b90e7ef56a287e5b9ce1e">
1461
1462#### Example Output
1463
1464~~~~
1465paint.isAutohinted() == !!(paint.getFlags() & SkPaint::kAutoHinting_Flag)
1466paint.isAutohinted() == !!(paint.getFlags() & SkPaint::kAutoHinting_Flag)
1467~~~~
1468
1469</fiddle-embed></div>
1470
1471### See Also
1472
1473<a href="bmh_SkPaint_Reference?cl=9919#setAutohinted">setAutohinted</a> <a href="bmh_SkPaint_Reference?cl=9919#Hinting">Hinting</a>
1474
1475---
1476
1477<a name="setAutohinted"></a>
1478## setAutohinted
1479
1480<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
1481void setAutohinted(bool useAutohinter)
1482</pre>
1483
1484If <a href="bmh_SkPaint_Reference?cl=9919#Hinting">Hinting</a> is set to <a href="bmh_SkPaint_Reference?cl=9919#kNormal_Hinting">kNormal Hinting</a> or <a href="bmh_SkPaint_Reference?cl=9919#kFull_Hinting">kFull Hinting</a> and <a href="bmh_SkPaint_Reference?cl=9919#useAutohinter">useAutohinter</a> is set,
Cary Clarkbad5ad72017-08-03 17:14:08 -04001485instruct the <a href="bmh_undocumented?cl=9919#Font_Manager">Font Manager</a> to always hint glyphs.
Cary Clark12799e12017-07-28 15:18:29 -04001486<a href="bmh_SkPaint_Reference?cl=9919#Automatic_Hinting">Automatic Hinting</a> has no effect if <a href="bmh_SkPaint_Reference?cl=9919#Hinting">Hinting</a> is set to <a href="bmh_SkPaint_Reference?cl=9919#kNo_Hinting">kNo Hinting</a> or
1487<a href="bmh_SkPaint_Reference?cl=9919#kSlight_Hinting">kSlight Hinting</a>.
1488
Cary Clarkbad5ad72017-08-03 17:14:08 -04001489Only affects platforms that use <a href="bmh_undocumented?cl=9919#FreeType">FreeType</a> as the <a href="bmh_undocumented?cl=9919#Font_Manager">Font Manager</a>.
Cary Clark12799e12017-07-28 15:18:29 -04001490
1491Sets <a href="bmh_SkPaint_Reference?cl=9919#kAutoHinting_Flag">kAutoHinting Flag</a> if <a href="bmh_SkPaint_Reference?cl=9919#useAutohinter">useAutohinter</a> is true.
1492Clears <a href="bmh_SkPaint_Reference?cl=9919#kAutoHinting_Flag">kAutoHinting Flag</a> if <a href="bmh_SkPaint_Reference?cl=9919#useAutohinter">useAutohinter</a> is false.
1493
1494### Parameters
1495
1496<table> <tr> <td><code><strong>useAutohinter </strong></code></td> <td>
1497setting for <a href="bmh_SkPaint_Reference?cl=9919#kAutoHinting_Flag">kAutoHinting Flag</a></td>
1498 </tr>
1499</table>
1500
1501### Example
1502
1503<div><fiddle-embed name="4e185306d7de9390fe8445eed0139309"></fiddle-embed></div>
1504
1505### See Also
1506
1507<a href="bmh_SkPaint_Reference?cl=9919#isAutohinted">isAutohinted</a> <a href="bmh_SkPaint_Reference?cl=9919#Hinting">Hinting</a>
1508
1509---
1510
1511# <a name="Vertical_Text"></a> Vertical Text
1512<a href="bmh_undocumented?cl=9919#Text">Text</a> may be drawn by positioning each glyph, or by positioning the first glyph and
1513using <a href="bmh_undocumented?cl=9919#Advance">Font Advance</a> to position subsequent glyphs. By default, each successive glyph
1514is positioned to the right of the preceeding glyph. <a href="bmh_SkPaint_Reference?cl=9919#Vertical_Text">Vertical Text</a> sets successive
1515glyphs to position below the preceeding glyph.
1516
1517<a href="bmh_undocumented?cl=9919#Skia">Skia</a> can translate text character codes as a series of glyphs, but does not implement
1518font substitution,
1519textual substitution, line layout, or contextual spacing like kerning pairs. Use
1520a text shaping engine likeHarfBuzzhttp://harfbuzz.org/to translate text runs
1521into glyph series.
1522
1523<a href="bmh_SkPaint_Reference?cl=9919#Vertical_Text">Vertical Text</a> is clear if text is drawn left to right or set if drawn from top to bottom.
1524
1525<a href="bmh_SkPaint_Reference?cl=9919#Flags">Flags</a> <a href="bmh_SkPaint_Reference?cl=9919#kVerticalText_Flag">kVerticalText Flag</a> if clear draws text left to right.
1526<a href="bmh_SkPaint_Reference?cl=9919#Flags">Flags</a> <a href="bmh_SkPaint_Reference?cl=9919#kVerticalText_Flag">kVerticalText Flag</a> if set draws text top to bottom.
1527
1528<a href="bmh_SkPaint_Reference?cl=9919#Vertical_Text">Vertical Text</a> is clear by default.
1529<a href="bmh_SkPaint_Reference?cl=9919#Vertical_Text">Vertical Text</a> can be set by default by setting <a href="bmh_undocumented?cl=9919#SkPaintDefaults_Flags">SkPaintDefaults Flags</a> to
1530<a href="bmh_SkPaint_Reference?cl=9919#kVerticalText_Flag">kVerticalText Flag</a> at compile time.
1531
1532### Example
1533
1534<div><fiddle-embed name="8df5800819311b71373d9abb669b49b8"></fiddle-embed></div>
1535
1536<a name="isVerticalText"></a>
1537## isVerticalText
1538
1539<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
1540bool isVerticalText() const
1541</pre>
1542
1543If true, glyphs are drawn top to bottom instead of left to right.
1544
1545Equivalent to <a href="bmh_SkPaint_Reference?cl=9919#getFlags">getFlags</a> masked with <a href="bmh_SkPaint_Reference?cl=9919#kVerticalText_Flag">kVerticalText Flag</a>.
1546
1547### Return Value
1548
1549<a href="bmh_SkPaint_Reference?cl=9919#kVerticalText_Flag">kVerticalText Flag</a> state
1550
1551### Example
1552
1553<div><fiddle-embed name="4a269b16e644d473870ffa873396f139">
1554
1555#### Example Output
1556
1557~~~~
1558paint.isVerticalText() == !!(paint.getFlags() & SkPaint::kVerticalText_Flag)
1559paint.isVerticalText() == !!(paint.getFlags() & SkPaint::kVerticalText_Flag)
1560~~~~
1561
1562</fiddle-embed></div>
1563
1564---
1565
1566<a name="setVerticalText"></a>
1567## setVerticalText
1568
1569<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
1570void setVerticalText(bool verticalText)
1571</pre>
1572
1573If true, text advance positions the next glyph below the previous glyph instead of to the
1574right of previous glyph.
1575
1576Sets <a href="bmh_SkPaint_Reference?cl=9919#kVerticalText_Flag">kVerticalText Flag</a> if vertical is true.
1577Clears <a href="bmh_SkPaint_Reference?cl=9919#kVerticalText_Flag">kVerticalText Flag</a> if vertical is false.
1578
1579### Parameters
1580
1581<table> <tr> <td><code><strong>verticalText </strong></code></td> <td>
1582setting for <a href="bmh_SkPaint_Reference?cl=9919#kVerticalText_Flag">kVerticalText Flag</a></td>
1583 </tr>
1584</table>
1585
1586### Example
1587
1588<div><fiddle-embed name="6fbd7e9e1a346cb8d7f537786009c736">
1589
1590#### Example Output
1591
1592~~~~
1593paint1 == paint2
1594~~~~
1595
1596</fiddle-embed></div>
1597
1598---
1599
1600# <a name="Fake_Bold"></a> Fake Bold
1601<a href="bmh_SkPaint_Reference?cl=9919#Fake_Bold">Fake Bold</a> approximates the bold font style accompanying a normal font when a bold font face
1602is not available. <a href="bmh_undocumented?cl=9919#Skia">Skia</a> does not provide font substitution; it is up to the client to find the
1603bold font face using the platform's <a href="bmh_undocumented?cl=9919#Font_Manager">Font Manager</a>.
1604
1605Use <a href="bmh_SkPaint_Reference?cl=9919#Text_Skew_X">Text Skew X</a> to approximate an italic font style when the italic font face
1606is not available.
1607
1608A <a href="bmh_undocumented?cl=9919#FreeType_based">FreeType-based</a> port may define <a href="bmh_undocumented?cl=9919#SK_USE_FREETYPE_EMBOLDEN">SK USE FREETYPE EMBOLDEN</a> at compile time to direct
1609the font engine to create the bold glyphs. Otherwise, the extra bold is computed
1610by increasing the stroke width and setting the <a href="bmh_SkPaint_Reference?cl=9919#Style">Style</a> to <a href="bmh_SkPaint_Reference?cl=9919#kStrokeAndFill_Style">kStrokeAndFill Style</a> as needed.
1611
1612<a href="bmh_SkPaint_Reference?cl=9919#Fake_Bold">Fake Bold</a> is disabled by default.
1613
1614### Example
1615
1616<div><fiddle-embed name="e811f4829a2daaaeaad3795504a7e02a"></fiddle-embed></div>
1617
1618<a name="isFakeBoldText"></a>
1619## isFakeBoldText
1620
1621<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
1622bool isFakeBoldText() const
1623</pre>
1624
1625If true, approximate bold by increasing the stroke width when creating glyph bitmaps
1626from outlines.
1627
1628Equivalent to <a href="bmh_SkPaint_Reference?cl=9919#getFlags">getFlags</a> masked with <a href="bmh_SkPaint_Reference?cl=9919#kFakeBoldText_Flag">kFakeBoldText Flag</a>.
1629
1630### Return Value
1631
1632<a href="bmh_SkPaint_Reference?cl=9919#kFakeBoldText_Flag">kFakeBoldText Flag</a> state
1633
1634### Example
1635
1636<div><fiddle-embed name="f54d1f85b16073b80b9eef2e1a1d151d">
1637
1638#### Example Output
1639
1640~~~~
1641paint.isFakeBoldText() == !!(paint.getFlags() & SkPaint::kFakeBoldText_Flag)
1642paint.isFakeBoldText() == !!(paint.getFlags() & SkPaint::kFakeBoldText_Flag)
1643~~~~
1644
1645</fiddle-embed></div>
1646
1647---
1648
1649<a name="setFakeBoldText"></a>
1650## setFakeBoldText
1651
1652<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
1653void setFakeBoldText(bool fakeBoldText)
1654</pre>
1655
1656Use increased stroke width when creating glyph bitmaps to approximate bolding.
1657
1658Sets <a href="bmh_SkPaint_Reference?cl=9919#kFakeBoldText_Flag">kFakeBoldText Flag</a> if <a href="bmh_SkPaint_Reference?cl=9919#fakeBoldText">fakeBoldText</a> is true.
1659Clears <a href="bmh_SkPaint_Reference?cl=9919#kFakeBoldText_Flag">kFakeBoldText Flag</a> if <a href="bmh_SkPaint_Reference?cl=9919#fakeBoldText">fakeBoldText</a> is false.
1660
1661### Parameters
1662
1663<table> <tr> <td><code><strong>fakeBoldText </strong></code></td> <td>
1664setting for <a href="bmh_SkPaint_Reference?cl=9919#kFakeBoldText_Flag">kFakeBoldText Flag</a></td>
1665 </tr>
1666</table>
1667
1668### Example
1669
1670<div><fiddle-embed name="594d47858eb11028cb626515a520910a">
1671
1672#### Example Output
1673
1674~~~~
1675paint1 == paint2
1676~~~~
1677
1678</fiddle-embed></div>
1679
1680---
1681
1682# <a name="Full_Hinting_Spacing"></a> Full Hinting Spacing
1683<a href="bmh_SkPaint_Reference?cl=9919#Full_Hinting_Spacing">Full Hinting Spacing</a> adjusts the character spacing by the difference of the
1684hinted and unhinted left and right side bearings,
1685if <a href="bmh_SkPaint_Reference?cl=9919#Hinting">Hinting</a> is set to <a href="bmh_SkPaint_Reference?cl=9919#kFull_Hinting">kFull Hinting</a>. <a href="bmh_SkPaint_Reference?cl=9919#Full_Hinting_Spacing">Full Hinting Spacing</a> only
1686applies to platforms that use <a href="bmh_undocumented?cl=9919#FreeType">FreeType</a> as their <a href="bmh_undocumented?cl=9919#Engine">Font Engine</a>.
1687
1688<a href="bmh_SkPaint_Reference?cl=9919#Full_Hinting_Spacing">Full Hinting Spacing</a> is not related to text kerning, where the space between
1689a specific pair of characters is adjusted using data in the font's kerning tables.
1690
1691<a name="isDevKernText"></a>
1692## isDevKernText
1693
1694<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
1695bool isDevKernText() const
1696</pre>
1697
1698Returns if character spacing may be adjusted by the hinting difference.
1699
1700Equivalent to <a href="bmh_SkPaint_Reference?cl=9919#getFlags">getFlags</a> masked with <a href="bmh_SkPaint_Reference?cl=9919#kDevKernText_Flag">kDevKernText Flag</a>.
1701
1702### Return Value
1703
1704<a href="bmh_SkPaint_Reference?cl=9919#kDevKernText_Flag">kDevKernText Flag</a> state
1705
1706### Example
1707
1708<div><fiddle-embed name="4f69a84b2505b12809c30b0cc09c5157"></fiddle-embed></div>
1709
1710---
1711
1712<a name="setDevKernText"></a>
1713## setDevKernText
1714
1715<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
1716void setDevKernText(bool devKernText)
1717</pre>
1718
1719Requests, but does not require, to use hinting to adjust glyph spacing.
1720
1721Sets <a href="bmh_SkPaint_Reference?cl=9919#kDevKernText_Flag">kDevKernText Flag</a> if <a href="bmh_SkPaint_Reference?cl=9919#devKernText">devKernText</a> is true.
1722Clears <a href="bmh_SkPaint_Reference?cl=9919#kDevKernText_Flag">kDevKernText Flag</a> if <a href="bmh_SkPaint_Reference?cl=9919#devKernText">devKernText</a> is false.
1723
1724### Parameters
1725
1726<table> <tr> <td><code><strong>devKernText </strong></code></td> <td>
1727setting for <a href="bmh_SkPaint_Reference?cl=9919#devKernText">devKernText</a></td>
1728 </tr>
1729</table>
1730
1731### Example
1732
1733<div><fiddle-embed name="2b718a059072908bf68942503f264797">
1734
1735#### Example Output
1736
1737~~~~
1738paint1 == paint2
1739~~~~
1740
1741</fiddle-embed></div>
1742
1743---
1744
1745# <a name="Filter_Quality_Methods"></a> Filter Quality Methods
1746<a href="bmh_undocumented?cl=9919#Filter_Quality">Filter Quality</a> trades speed for image filtering when the image is scaled.
1747A lower <a href="bmh_undocumented?cl=9919#Filter_Quality">Filter Quality</a> draws faster, but has less fidelity.
1748A higher <a href="bmh_undocumented?cl=9919#Filter_Quality">Filter Quality</a> draws slower, but looks better.
1749If the image is unscaled, the <a href="bmh_undocumented?cl=9919#Filter_Quality">Filter Quality</a> choice will not result in a noticable
1750difference.
1751
1752<a href="bmh_undocumented?cl=9919#Filter_Quality">Filter Quality</a> is used in <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> passed as a parameter to
1753
1754<table> <tr>
1755 <td><a href="bmh_SkCanvas_Reference?cl=9919#drawBitmap">SkCanvas::drawBitmap</a></td> </tr> <tr>
1756 <td><a href="bmh_SkCanvas_Reference?cl=9919#drawBitmapRect">SkCanvas::drawBitmapRect</a></td> </tr> <tr>
1757 <td><a href="bmh_SkCanvas_Reference?cl=9919#drawImage">SkCanvas::drawImage</a></td> </tr> <tr>
1758 <td><a href="bmh_SkCanvas_Reference?cl=9919#drawImageRect">SkCanvas::drawImageRect</a></td> </tr>
1759</table>
1760
1761and when <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> has a <a href="bmh_undocumented?cl=9919#Shader">Shader</a> specialization that uses <a href="bmh_undocumented?cl=9919#Image">Image</a> or <a href="bmh_undocumented?cl=9919#Bitmap">Bitmap</a>.
1762
1763<a href="bmh_undocumented?cl=9919#Filter_Quality">Filter Quality</a> is <a href="bmh_undocumented?cl=9919#SkFilterQuality">kNone SkFilterQuality</a> by default.
1764
1765### Example
1766
1767<div><fiddle-embed name="ee77f83f7291e07ae0d89f1380c7d67c"></fiddle-embed></div>
1768
1769<a name="getFilterQuality"></a>
1770## getFilterQuality
1771
1772<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
1773SkFilterQuality getFilterQuality() const
1774</pre>
1775
1776Returns <a href="bmh_undocumented?cl=9919#Filter_Quality">Filter Quality</a>, the image filtering level. A lower setting
1777draws faster; a higher setting looks better when the image is scaled.
1778
1779### Return Value
1780
1781one of: <a href="bmh_undocumented?cl=9919#SkFilterQuality">kNone SkFilterQuality</a>, <a href="bmh_undocumented?cl=9919#SkFilterQuality">kLow SkFilterQuality</a>,
1782<a href="bmh_undocumented?cl=9919#SkFilterQuality">kMedium SkFilterQuality</a>, <a href="bmh_undocumented?cl=9919#SkFilterQuality">kHigh SkFilterQuality</a>
1783
1784### Example
1785
1786<div><fiddle-embed name="d4ca1f23809b6835c4ba46ea98a86900">
1787
1788#### Example Output
1789
1790~~~~
1791kNone_SkFilterQuality == paint.getFilterQuality()
1792~~~~
1793
1794</fiddle-embed></div>
1795
1796---
1797
1798<a name="setFilterQuality"></a>
1799## setFilterQuality
1800
1801<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
1802void setFilterQuality(SkFilterQuality quality)
1803</pre>
1804
1805Sets <a href="bmh_undocumented?cl=9919#Filter_Quality">Filter Quality</a>, the image filtering level. A lower setting
1806draws faster; a higher setting looks better when the image is scaled.
Cary Clarkbad5ad72017-08-03 17:14:08 -04001807Does not check to see if <a href="bmh_SkPaint_Reference?cl=9919#setFilterQuality">quality</a> is valid.
Cary Clark12799e12017-07-28 15:18:29 -04001808
1809### Parameters
1810
1811<table> <tr> <td><code><strong>quality </strong></code></td> <td>
1812one of: <a href="bmh_undocumented?cl=9919#SkFilterQuality">kNone SkFilterQuality</a>, <a href="bmh_undocumented?cl=9919#SkFilterQuality">kLow SkFilterQuality</a>,
1813<a href="bmh_undocumented?cl=9919#SkFilterQuality">kMedium SkFilterQuality</a>, <a href="bmh_undocumented?cl=9919#SkFilterQuality">kHigh SkFilterQuality</a></td>
1814 </tr>
1815</table>
1816
1817### Example
1818
1819<div><fiddle-embed name="e4288fabf24ee60b645e8bb6ea0afadf">
1820
1821#### Example Output
1822
1823~~~~
1824kHigh_SkFilterQuality == paint.getFilterQuality()
1825~~~~
1826
1827</fiddle-embed></div>
1828
1829### See Also
1830
1831<a href="bmh_undocumented?cl=9919#SkFilterQuality">SkFilterQuality</a> <a href="bmh_undocumented?cl=9919#Image_Scaling">Image Scaling</a>
1832
1833---
1834
1835# <a name="Color_Methods"></a> Color Methods
1836<a href="bmh_undocumented?cl=9919#Color">Color</a> specifies the <a href="bmh_undocumented?cl=9919#RGB_Red">Color RGB Red</a>, <a href="bmh_undocumented?cl=9919#RGB_Blue">Color RGB Blue</a>, <a href="bmh_undocumented?cl=9919#RGB_Green">Color RGB Green</a>, and <a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a> values used to draw a filled
1837or stroked shape in a
183832-bit value. Each component occupies 8-bits, ranging from zero: no contribution;
1839to 255: full intensity. All values in any combination are valid.
1840
1841<a href="bmh_undocumented?cl=9919#Color">Color</a> is not premultiplied;
1842<a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a> sets the transparency independent of <a href="bmh_undocumented?cl=9919#RGB">Color RGB</a>: <a href="bmh_undocumented?cl=9919#RGB_Red">Color RGB Red</a>, <a href="bmh_undocumented?cl=9919#RGB_Blue">Color RGB Blue</a>, and <a href="bmh_undocumented?cl=9919#RGB_Green">Color RGB Green</a>.
1843
1844The bit positions of <a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a> and <a href="bmh_undocumented?cl=9919#RGB">Color RGB</a> are independent of the bit positions
1845on the output device, which may have more or fewer bits, and may have a different arrangement.
1846
1847| bit positions | <a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a> | <a href="bmh_undocumented?cl=9919#RGB_Red">Color RGB Red</a> | <a href="bmh_undocumented?cl=9919#RGB_Blue">Color RGB Blue</a> | <a href="bmh_undocumented?cl=9919#RGB_Green">Color RGB Green</a> |
1848| --- | --- | --- | --- | --- |
1849| | 31 - 24 | 23 - 16 | 15 - 8 | 7 - 0 |
1850
1851### Example
1852
1853<div><fiddle-embed name="214b559d75c65a7bef6ef4be1f860053"></fiddle-embed></div>
1854
1855<a name="getColor"></a>
1856## getColor
1857
1858<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
1859SkColor getColor() const
1860</pre>
1861
1862Retrieves <a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a> and <a href="bmh_undocumented?cl=9919#RGB">Color RGB</a>, unpremultiplied, packed into 32 bits.
1863Use helpers <a href="bmh_undocumented?cl=9919#SkColorGetA">SkColorGetA</a>, <a href="bmh_undocumented?cl=9919#SkColorGetR">SkColorGetR</a>, <a href="bmh_undocumented?cl=9919#SkColorGetG">SkColorGetG</a>, and <a href="bmh_undocumented?cl=9919#SkColorGetB">SkColorGetB</a> to extract
1864a color component.
1865
1866### Return Value
1867
1868<a href="bmh_undocumented?cl=9919#Unpremultiplied">Unpremultiplied</a> <a href="bmh_undocumented?cl=9919#ARGB">Color ARGB</a>
1869
1870### Example
1871
1872<div><fiddle-embed name="72d41f890203109a41f589a7403acae9">
1873
1874#### Example Output
1875
1876~~~~
1877Yellow is 100% red, 100% green, and 0% blue.
1878~~~~
1879
1880</fiddle-embed></div>
1881
1882### See Also
1883
1884<a href="bmh_undocumented?cl=9919#SkColor">SkColor</a>
1885
1886---
1887
1888<a name="setColor"></a>
1889## setColor
1890
1891<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
1892void setColor(SkColor color)
1893</pre>
1894
1895Sets <a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a> and <a href="bmh_undocumented?cl=9919#RGB">Color RGB</a> used when stroking and filling. The <a href="bmh_SkPaint_Reference?cl=9919#color">color</a> is a 32-bit value,
1896unpremutiplied, packing 8-bit components for <a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a>, <a href="bmh_undocumented?cl=9919#RGB_Red">Color RGB Red</a>, <a href="bmh_undocumented?cl=9919#RGB_Blue">Color RGB Blue</a>, and <a href="bmh_undocumented?cl=9919#RGB_Green">Color RGB Green</a>.
1897
1898### Parameters
1899
1900<table> <tr> <td><code><strong>color </strong></code></td> <td>
1901<a href="bmh_undocumented?cl=9919#Unpremultiplied">Unpremultiplied</a> <a href="bmh_undocumented?cl=9919#ARGB">Color ARGB</a></td>
1902 </tr>
1903</table>
1904
1905### Example
1906
1907<div><fiddle-embed name="6e70f18300bd676a3c056ceb6b62f8df">
1908
1909#### Example Output
1910
1911~~~~
1912green1 == green2
1913~~~~
1914
1915</fiddle-embed></div>
1916
1917### See Also
1918
1919<a href="bmh_undocumented?cl=9919#SkColor">SkColor</a> <a href="bmh_SkPaint_Reference?cl=9919#setARGB">setARGB</a> <a href="bmh_undocumented?cl=9919#SkColorSetARGB">SkColorSetARGB</a>
1920
1921---
1922
1923## <a name="Alpha_Methods"></a> Alpha Methods
1924
1925<a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a> sets the transparency independent of <a href="bmh_undocumented?cl=9919#RGB">Color RGB</a>: <a href="bmh_undocumented?cl=9919#RGB_Red">Color RGB Red</a>, <a href="bmh_undocumented?cl=9919#RGB_Blue">Color RGB Blue</a>, and <a href="bmh_undocumented?cl=9919#RGB_Green">Color RGB Green</a>.
1926
1927<a name="getAlpha"></a>
1928## getAlpha
1929
1930<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
1931uint8_t getAlpha() const
1932</pre>
1933
1934Retrieves <a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a> from the <a href="bmh_undocumented?cl=9919#Color">Color</a> used when stroking and filling.
1935
1936### Return Value
1937
1938<a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a> ranging from zero, fully transparent, to 255, fully opaque
1939
1940### Example
1941
1942<div><fiddle-embed name="9a85bb62fe3d877b18fb7f952c4fa7f7">
1943
1944#### Example Output
1945
1946~~~~
1947255 == paint.getAlpha()
1948~~~~
1949
1950</fiddle-embed></div>
1951
1952---
1953
1954<a name="setAlpha"></a>
1955## setAlpha
1956
1957<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
1958void setAlpha(U8CPU a)
1959</pre>
1960
1961Replaces <a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a>, leaving <a href="bmh_undocumented?cl=9919#RGB">Color RGB</a>
1962unchanged. An out of range value triggers an assert in the debug
1963build. <a href="bmh_SkPaint_Reference?cl=9919#a">a</a> is <a href="bmh_SkPaint_Reference?cl=9919#a">a</a> value from zero to 255.
1964<a href="bmh_SkPaint_Reference?cl=9919#a">a</a> set to zero makes <a href="bmh_undocumented?cl=9919#Color">Color</a> fully transparent; <a href="bmh_SkPaint_Reference?cl=9919#a">a</a> set to 255 makes <a href="bmh_undocumented?cl=9919#Color">Color</a>
1965fully opaque.
1966
1967### Parameters
1968
1969<table> <tr> <td><code><strong>a </strong></code></td> <td>
1970<a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a> component of <a href="bmh_undocumented?cl=9919#Color">Color</a></td>
1971 </tr>
1972</table>
1973
1974### Example
1975
1976<div><fiddle-embed name="6ddc0360512dfb9947e75c17e6a8103d">
1977
1978#### Example Output
1979
1980~~~~
19810x44112233 == paint.getColor()
1982~~~~
1983
1984</fiddle-embed></div>
1985
1986---
1987
1988<a name="setARGB"></a>
1989## setARGB
1990
1991<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
1992void setARGB(U8CPU a, U8CPU r, U8CPU g, U8CPU b)
1993</pre>
1994
1995Sets <a href="bmh_undocumented?cl=9919#Color">Color</a> used when drawing solid fills. The color components range from 0 to 255.
1996The color is unpremultiplied;
1997<a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a> sets the transparency independent of <a href="bmh_undocumented?cl=9919#RGB">Color RGB</a>.
1998
1999### Parameters
2000
2001<table> <tr> <td><code><strong>a </strong></code></td> <td>
2002amount of <a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a>, from fully transparent (0) to fully opaque (255)</td>
2003 </tr> <tr> <td><code><strong>r </strong></code></td> <td>
2004amount of <a href="bmh_undocumented?cl=9919#RGB_Red">Color RGB Red</a>, from no red (0) to full red (255)</td>
2005 </tr> <tr> <td><code><strong>g </strong></code></td> <td>
2006amount of <a href="bmh_undocumented?cl=9919#RGB_Green">Color RGB Green</a>, from no green (0) to full green (255)</td>
2007 </tr> <tr> <td><code><strong>b </strong></code></td> <td>
2008amount of <a href="bmh_undocumented?cl=9919#RGB_Blue">Color RGB Blue</a>, from no blue (0) to full blue (255)</td>
2009 </tr>
2010</table>
2011
2012### Example
2013
2014<div><fiddle-embed name="cb62e4755789ed32f7120dc55984959d">
2015
2016#### Example Output
2017
2018~~~~
2019transRed1 == transRed2
2020~~~~
2021
2022</fiddle-embed></div>
2023
2024### See Also
2025
2026<a href="bmh_SkPaint_Reference?cl=9919#setColor">setColor</a> <a href="bmh_undocumented?cl=9919#SkColorSetARGB">SkColorSetARGB</a>
2027
2028---
2029
2030# <a name="Style"></a> Style
2031<a href="bmh_SkPaint_Reference?cl=9919#Style">Style</a> specifies if the geometry is filled, stroked, or both filled and stroked.
2032Some shapes ignore <a href="bmh_SkPaint_Reference?cl=9919#Style">Style</a> and are always drawn filled or stroked.
2033
2034Set <a href="bmh_SkPaint_Reference?cl=9919#Style">Style</a> to <a href="bmh_SkPaint_Reference?cl=9919#kFill_Style">kFill Style</a> to fill the shape.
2035The fill covers the area inside the geometry for most shapes.
2036
2037Set <a href="bmh_SkPaint_Reference?cl=9919#Style">Style</a> to <a href="bmh_SkPaint_Reference?cl=9919#kStroke_Style">kStroke Style</a> to stroke the shape.
2038
2039## <a name="Fill"></a> Fill
2040
2041### See Also
2042
2043<a href="bmh_SkPath_Reference?cl=9919#Fill_Type">Path Fill Type</a>
2044
2045## <a name="Stroke"></a> Stroke
2046
2047The stroke covers the area described by following the shape's edge with a pen or brush of
2048<a href="bmh_SkPaint_Reference?cl=9919#Stroke_Width">Stroke Width</a>. The area covered where the shape starts and stops is described by <a href="bmh_SkPaint_Reference?cl=9919#Stroke_Cap">Stroke Cap</a>.
2049The area covered where the shape turns a corner is described by <a href="bmh_SkPaint_Reference?cl=9919#Stroke_Join">Stroke Join</a>.
2050The stroke is centered on the shape; it extends equally on either side of the shape's edge.
2051
2052As <a href="bmh_SkPaint_Reference?cl=9919#Stroke_Width">Stroke Width</a> gets smaller, the drawn path frame is thinner. <a href="bmh_SkPaint_Reference?cl=9919#Stroke_Width">Stroke Width</a> less than one
2053may have gaps, and if <a href="bmh_SkPaint_Reference?cl=9919#kAntiAlias_Flag">kAntiAlias Flag</a> is set, <a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a> will increase to visually decrease coverage.
2054
2055## <a name="Hairline"></a> Hairline
2056
2057<a href="bmh_SkPaint_Reference?cl=9919#Stroke_Width">Stroke Width</a> of zero has a special meaning and switches drawing to use <a href="bmh_SkPaint_Reference?cl=9919#Hairline">Hairline</a>.
2058<a href="bmh_SkPaint_Reference?cl=9919#Hairline">Hairline</a> draws the thinnest continuous frame. If <a href="bmh_SkPaint_Reference?cl=9919#kAntiAlias_Flag">kAntiAlias Flag</a> is clear, adjacent pixels
2059flow horizontally, vertically,or diagonally.
2060
2061<a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> drawing with <a href="bmh_SkPaint_Reference?cl=9919#Hairline">Hairline</a> may hit the same pixel more than once. For instance, <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> containing
2062two lines in one <a href="bmh_SkPath_Reference?cl=9919#Contour">Path Contour</a> will draw the corner point once, but may both lines may draw the adjacent
2063pixel. If <a href="bmh_SkPaint_Reference?cl=9919#kAntiAlias_Flag">kAntiAlias Flag</a> is set, transparency is applied twice, resulting in a darker pixel. Some
2064<a href="bmh_undocumented?cl=9919#GPU_backed">GPU-backed</a> implementations apply transparency at a later drawing stage, avoiding double hit pixels
2065while stroking.
2066
2067## <a name="SkPaint::Style"></a> Enum SkPaint::Style
2068
2069<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0">
2070enum <a href="bmh_SkPaint_Reference?cl=9919#Style">Style</a> {
2071<a href="bmh_SkPaint_Reference?cl=9919#kFill_Style">kFill Style</a>,
2072<a href="bmh_SkPaint_Reference?cl=9919#kStroke_Style">kStroke Style</a>,
2073<a href="bmh_SkPaint_Reference?cl=9919#kStrokeAndFill_Style">kStrokeAndFill Style</a>,
2074};</pre>
2075
2076Set <a href="bmh_SkPaint_Reference?cl=9919#Style">Style</a> to fill, stroke, or both fill and stroke geometry.
2077The stroke and fill
2078share all paint attributes; for instance, they are drawn with the same color.
2079
2080Use <a href="bmh_SkPaint_Reference?cl=9919#kStrokeAndFill_Style">kStrokeAndFill Style</a> to avoid hitting the same pixels twice with a stroke draw and
2081a fill draw.
2082
2083### Constants
2084
2085<table>
2086 <tr>
2087 <td><a name="SkPaint::kFill_Style"></a> <code><strong>SkPaint::kFill_Style </strong></code></td><td>0</td><td>Set to fill geometry.
2088Applies to <a href="bmh_undocumented?cl=9919#Rect">Rect</a>, <a href="bmh_undocumented?cl=9919#Region">Region</a>, <a href="bmh_undocumented?cl=9919#Round_Rect">Round Rect</a>, <a href="bmh_undocumented?cl=9919#Circle">Circle</a>, <a href="bmh_undocumented?cl=9919#Oval">Oval</a>, <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>, and <a href="bmh_undocumented?cl=9919#Text">Text</a>.
2089<a href="bmh_undocumented?cl=9919#Bitmap">Bitmap</a>, <a href="bmh_undocumented?cl=9919#Image">Image</a>, <a href="bmh_undocumented?cl=9919#Patch">Patch</a>, <a href="bmh_undocumented?cl=9919#Region">Region</a>, <a href="bmh_undocumented?cl=9919#Sprite">Sprite</a>, and <a href="bmh_undocumented?cl=9919#Vertices">Vertices</a> are painted as if
2090<a href="bmh_SkPaint_Reference?cl=9919#kFill_Style">kFill Style</a> is set, and ignore the set <a href="bmh_SkPaint_Reference?cl=9919#Style">Style</a>.
2091The <a href="bmh_SkPath_Reference?cl=9919#Fill_Type">Path Fill Type</a> specifies additional rules to fill the area outside the path edge,
2092and to create an unfilled hole inside the shape.
2093<a href="bmh_SkPaint_Reference?cl=9919#Style">Style</a> is set to <a href="bmh_SkPaint_Reference?cl=9919#kFill_Style">kFill Style</a> by default.</td>
2094 </tr>
2095 <tr>
2096 <td><a name="SkPaint::kStroke_Style"></a> <code><strong>SkPaint::kStroke_Style </strong></code></td><td>1</td><td>Set to stroke geometry.
2097Applies to <a href="bmh_undocumented?cl=9919#Rect">Rect</a>, <a href="bmh_undocumented?cl=9919#Region">Region</a>, <a href="bmh_undocumented?cl=9919#Round_Rect">Round Rect</a>, <a href="bmh_undocumented?cl=9919#Arc">Arc</a>, <a href="bmh_undocumented?cl=9919#Circle">Circle</a>, <a href="bmh_undocumented?cl=9919#Oval">Oval</a>,
2098<a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>, and <a href="bmh_undocumented?cl=9919#Text">Text</a>.
2099<a href="bmh_undocumented?cl=9919#Arc">Arc</a>, <a href="bmh_undocumented?cl=9919#Line">Line</a>, <a href="bmh_undocumented?cl=9919#Point">Point</a>, and <a href="bmh_undocumented?cl=9919#Array">Point Array</a> are always drawn as if <a href="bmh_SkPaint_Reference?cl=9919#kStroke_Style">kStroke Style</a> is set,
2100and ignore the set <a href="bmh_SkPaint_Reference?cl=9919#Style">Style</a>.
2101The stroke construction is unaffected by the <a href="bmh_SkPath_Reference?cl=9919#Fill_Type">Path Fill Type</a>.</td>
2102 </tr>
2103 <tr>
2104 <td><a name="SkPaint::kStrokeAndFill_Style"></a> <code><strong>SkPaint::kStrokeAndFill_Style </strong></code></td><td>2</td><td>Set to stroke and fill geometry.
2105Applies to <a href="bmh_undocumented?cl=9919#Rect">Rect</a>, <a href="bmh_undocumented?cl=9919#Region">Region</a>, <a href="bmh_undocumented?cl=9919#Round_Rect">Round Rect</a>, <a href="bmh_undocumented?cl=9919#Circle">Circle</a>, <a href="bmh_undocumented?cl=9919#Oval">Oval</a>, <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>, and <a href="bmh_undocumented?cl=9919#Text">Text</a>.
2106<a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> is treated as if it is set to <a href="bmh_SkPath_Reference?cl=9919#kWinding_FillType">SkPath::kWinding FillType</a>,
2107and the set <a href="bmh_SkPath_Reference?cl=9919#Fill_Type">Path Fill Type</a> is ignored.</td>
2108 </tr>
2109
2110</table>
2111
2112## <a name="SkPaint::_anonymous"></a> Enum SkPaint::_anonymous
2113
2114<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0">
2115enum {
Cary Clarkbad5ad72017-08-03 17:14:08 -04002116<a href="bmh_SkPaint_Reference?cl=9919#kStyleCount">kStyleCount</a> = <a href="bmh_SkPaint_Reference?cl=9919#kStrokeAndFill_Style">kStrokeAndFill Style</a> + 1,
Cary Clark12799e12017-07-28 15:18:29 -04002117};</pre>
2118
2119### Constants
2120
2121<table>
2122 <tr>
2123 <td><a name="SkPaint::kStyleCount"></a> <code><strong>SkPaint::kStyleCount </strong></code></td><td>3</td><td>The number of different <a href="bmh_SkPaint_Reference?cl=9919#Style">Style</a> values defined.
2124May be used to verify that <a href="bmh_SkPaint_Reference?cl=9919#Style">Style</a> is a legal value.</td>
2125 </tr>
2126
2127</table>
2128
2129<a name="getStyle"></a>
2130## getStyle
2131
2132<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
2133Style getStyle() const
2134</pre>
2135
2136Whether the geometry is filled, stroked, or filled and stroked.
2137
2138### Return Value
2139
2140one of:<a href="bmh_SkPaint_Reference?cl=9919#kFill_Style">kFill Style</a>, <a href="bmh_SkPaint_Reference?cl=9919#kStroke_Style">kStroke Style</a>, <a href="bmh_SkPaint_Reference?cl=9919#kStrokeAndFill_Style">kStrokeAndFill Style</a>
2141
2142### Example
2143
2144<div><fiddle-embed name="1c5e18c3c0102d2dac86a78ba8c8ce01">
2145
2146#### Example Output
2147
2148~~~~
2149SkPaint::kFill_Style == paint.getStyle()
2150~~~~
2151
2152</fiddle-embed></div>
2153
2154### See Also
2155
2156<a href="bmh_SkPaint_Reference?cl=9919#Style">Style</a> <a href="bmh_SkPaint_Reference?cl=9919#setStyle">setStyle</a>
2157
2158---
2159
2160<a name="setStyle"></a>
2161## setStyle
2162
2163<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
2164void setStyle(Style style)
2165</pre>
2166
2167Sets whether the geometry is filled, stroked, or filled and stroked.
2168Has no effect if <a href="bmh_SkPaint_Reference?cl=9919#setStyle">style</a> is not a legal <a href="bmh_SkPaint_Reference?cl=9919#Style">Style</a> value.
2169
2170### Parameters
2171
2172<table> <tr> <td><code><strong>style </strong></code></td> <td>
2173one of: <a href="bmh_SkPaint_Reference?cl=9919#kFill_Style">kFill Style</a>, <a href="bmh_SkPaint_Reference?cl=9919#kStroke_Style">kStroke Style</a>, <a href="bmh_SkPaint_Reference?cl=9919#kStrokeAndFill_Style">kStrokeAndFill Style</a></td>
2174 </tr>
2175</table>
2176
2177### Example
2178
2179<div><fiddle-embed name="c7bb6248e4735b8d1a32d02fba40d344"></fiddle-embed></div>
2180
2181### See Also
2182
2183<a href="bmh_SkPaint_Reference?cl=9919#Style">Style</a> <a href="bmh_SkPaint_Reference?cl=9919#getStyle">getStyle</a>
2184
2185---
2186
2187### See Also
2188
2189<a href="bmh_SkPath_Reference?cl=9919#Fill_Type">Path Fill Type</a> <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a> <a href="bmh_SkPaint_Reference?cl=9919#Style_Fill">Style Fill</a> <a href="bmh_SkPaint_Reference?cl=9919#Style_Stroke">Style Stroke</a>
2190
2191# <a name="Stroke_Width"></a> Stroke Width
2192<a href="bmh_SkPaint_Reference?cl=9919#Stroke_Width">Stroke Width</a> sets the width for stroking. The width is the thickness
2193of the stroke perpendicular to the path's direction when the paint's style is
2194set to <a href="bmh_SkPaint_Reference?cl=9919#kStroke_Style">kStroke Style</a> or <a href="bmh_SkPaint_Reference?cl=9919#kStrokeAndFill_Style">kStrokeAndFill Style</a>.
2195
2196When width is greater than zero, the stroke encompasses as many pixels partially
2197or fully as needed. When the width equals zero, the paint enables hairlines;
2198the stroke is always one pixel wide.
2199
2200The stroke's dimensions are scaled by the canvas matrix, but <a href="bmh_SkPaint_Reference?cl=9919#Hairline">Hairline</a> stroke
2201remains one pixel wide regardless of scaling.
2202
2203The default width for the paint is zero.
2204
2205### Example
2206
2207<div><fiddle-embed name="01e3e08a3022a351628ff54e84887756">raster gpu<div>The pixels hit to represent thin lines vary with the angle of the
2208line and the platform's implementation.</div></fiddle-embed></div>
2209
2210<a name="getStrokeWidth"></a>
2211## getStrokeWidth
2212
2213<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
2214SkScalar getStrokeWidth() const
2215</pre>
2216
2217Returns the thickness of the pen used by <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> to
2218outline the shape.
2219
2220### Return Value
2221
2222zero for <a href="bmh_SkPaint_Reference?cl=9919#Hairline">Hairline</a>, greater than zero for pen thickness
2223
2224### Example
2225
2226<div><fiddle-embed name="99aa73f64df8bbf06e656cd891a81b9e">
2227
2228#### Example Output
2229
2230~~~~
22310 == paint.getStrokeWidth()
2232~~~~
2233
2234</fiddle-embed></div>
2235
2236---
2237
2238<a name="setStrokeWidth"></a>
2239## setStrokeWidth
2240
2241<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
2242void setStrokeWidth(SkScalar width)
2243</pre>
2244
2245Sets the thickness of the pen used by the paint to
2246outline the shape.
2247Has no effect if <a href="bmh_SkPaint_Reference?cl=9919#setStrokeWidth">width</a> is less than zero.
2248
2249### Parameters
2250
2251<table> <tr> <td><code><strong>width </strong></code></td> <td>
2252zero thickness for <a href="bmh_SkPaint_Reference?cl=9919#Hairline">Hairline</a>; greater than zero for pen thickness</td>
2253 </tr>
2254</table>
2255
2256### Example
2257
2258<div><fiddle-embed name="0c4446c0870b5c7b5a2efe77ff92afb8">
2259
2260#### Example Output
2261
2262~~~~
22635 == paint.getStrokeWidth()
2264~~~~
2265
2266</fiddle-embed></div>
2267
2268---
2269
2270# <a name="Miter_Limit"></a> Miter Limit
2271<a href="bmh_SkPaint_Reference?cl=9919#Miter_Limit">Miter Limit</a> specifies the maximum miter length,
2272relative to the stroke width.
2273
2274<a href="bmh_SkPaint_Reference?cl=9919#Miter_Limit">Miter Limit</a> is used when the <a href="bmh_SkPaint_Reference?cl=9919#Stroke_Join">Stroke Join</a>
2275is set to <a href="bmh_SkPaint_Reference?cl=9919#kMiter_Join">kMiter Join</a>, and the <a href="bmh_SkPaint_Reference?cl=9919#Style">Style</a> is either <a href="bmh_SkPaint_Reference?cl=9919#kStroke_Style">kStroke Style</a>
2276or <a href="bmh_SkPaint_Reference?cl=9919#kStrokeAndFill_Style">kStrokeAndFill Style</a>.
2277
2278If the miter at a corner exceeds this limit, <a href="bmh_SkPaint_Reference?cl=9919#kMiter_Join">kMiter Join</a>
2279is replaced with <a href="bmh_SkPaint_Reference?cl=9919#kBevel_Join">kBevel Join</a>.
2280
2281<a href="bmh_SkPaint_Reference?cl=9919#Miter_Limit">Miter Limit</a> can be computed from the corner angle:
2282
2283miter limit = 1 / sin ( angle / 2 )<a href="bmh_SkPaint_Reference?cl=9919#Miter_Limit">Miter Limit</a> default value is 4.
2284The default may be changed at compile time by setting <a href="bmh_undocumented?cl=9919#SkPaintDefaults_MiterLimit">SkPaintDefaults MiterLimit</a>
2285in <a href="bmh_undocumented?cl=9919#SkUserConfig.h">SkUserConfig.h</a> or as a define supplied by the build environment.
2286
2287Here are some miter limits and the angles that triggers them.
2288
2289| miter limit | angle in degrees |
2290| --- | --- |
2291| 10 | 11.48 |
2292| 9 | 12.76 |
2293| 8 | 14.36 |
2294| 7 | 16.43 |
2295| 6 | 19.19 |
2296| 5 | 23.07 |
2297| 4 | 28.96 |
2298| 3 | 38.94 |
2299| 2 | 60 |
2300| 1 | 180 |
2301
2302### Example
2303
2304<div><fiddle-embed name="5de2de0f00354e59074a9bb1a42d5a63"><div>This example draws a stroked corner and the miter length beneath.
2305When the miter limit is decreased slightly, the miter join is replaced
2306by a bevel join.</div></fiddle-embed></div>
2307
2308<a name="getStrokeMiter"></a>
2309## getStrokeMiter
2310
2311<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
2312SkScalar getStrokeMiter() const
2313</pre>
2314
2315The limit at which a sharp corner is drawn beveled.
2316
2317### Return Value
2318
2319zero and greater <a href="bmh_SkPaint_Reference?cl=9919#Miter_Limit">Miter Limit</a>
2320
2321### Example
2322
2323<div><fiddle-embed name="50da74a43b725f07a914df588c867d36">
2324
2325#### Example Output
2326
2327~~~~
2328default miter limit == 4
2329~~~~
2330
2331</fiddle-embed></div>
2332
2333### See Also
2334
2335<a href="bmh_SkPaint_Reference?cl=9919#Miter_Limit">Miter Limit</a> <a href="bmh_SkPaint_Reference?cl=9919#setStrokeMiter">setStrokeMiter</a> <a href="bmh_SkPaint_Reference?cl=9919#Join">Join</a>
2336
2337---
2338
2339<a name="setStrokeMiter"></a>
2340## setStrokeMiter
2341
2342<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
2343void setStrokeMiter(SkScalar miter)
2344</pre>
2345
2346The limit at which a sharp corner is drawn beveled.
2347Valid values are zero and greater.
2348Has no effect if <a href="bmh_SkPaint_Reference?cl=9919#setStrokeMiter">miter</a> is less than zero.
2349
2350### Parameters
2351
2352<table> <tr> <td><code><strong>miter </strong></code></td> <td>
2353zero and greater <a href="bmh_SkPaint_Reference?cl=9919#Miter_Limit">Miter Limit</a></td>
2354 </tr>
2355</table>
2356
2357### Example
2358
2359<div><fiddle-embed name="700b284dbc97785c6a9c9636088713ad">
2360
2361#### Example Output
2362
2363~~~~
2364default miter limit == 8
2365~~~~
2366
2367</fiddle-embed></div>
2368
2369### See Also
2370
2371<a href="bmh_SkPaint_Reference?cl=9919#Miter_Limit">Miter Limit</a> <a href="bmh_SkPaint_Reference?cl=9919#getStrokeMiter">getStrokeMiter</a> <a href="bmh_SkPaint_Reference?cl=9919#Join">Join</a>
2372
2373---
2374
2375# <a name="Stroke_Cap"></a> Stroke Cap
2376
2377## <a name="SkPaint::Cap"></a> Enum SkPaint::Cap
2378
2379<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0">
2380enum <a href="bmh_SkPaint_Reference?cl=9919#Cap">Cap</a> {
2381<a href="bmh_SkPaint_Reference?cl=9919#kButt_Cap">kButt Cap</a>,
2382<a href="bmh_SkPaint_Reference?cl=9919#kRound_Cap">kRound Cap</a>,
2383<a href="bmh_SkPaint_Reference?cl=9919#kSquare_Cap">kSquare Cap</a>,
2384
2385<a href="bmh_SkPaint_Reference?cl=9919#kLast_Cap">kLast Cap</a> = <a href="bmh_SkPaint_Reference?cl=9919#kSquare_Cap">kSquare Cap</a>,
Cary Clarkbad5ad72017-08-03 17:14:08 -04002386<a href="bmh_SkPaint_Reference?cl=9919#kDefault_Cap">kDefault Cap</a> = <a href="bmh_SkPaint_Reference?cl=9919#kButt_Cap">kButt Cap</a>,
Cary Clark12799e12017-07-28 15:18:29 -04002387};
2388static constexpr int <a href="bmh_SkPaint_Reference?cl=9919#kCapCount">kCapCount</a> = <a href="bmh_SkPaint_Reference?cl=9919#kLast_Cap">kLast Cap</a> + 1;</pre>
2389
2390<a href="bmh_SkPaint_Reference?cl=9919#Stroke_Cap">Stroke Cap</a> draws at the beginning and end of an open <a href="bmh_SkPath_Reference?cl=9919#Contour">Path Contour</a>.
2391
2392### Constants
2393
2394<table>
2395 <tr>
2396 <td><a name="SkPaint::kButt_Cap"></a> <code><strong>SkPaint::kButt_Cap </strong></code></td><td>0</td><td>Does not extend the stroke past the beginning or the end.</td>
2397 </tr>
2398 <tr>
2399 <td><a name="SkPaint::kRound_Cap"></a> <code><strong>SkPaint::kRound_Cap </strong></code></td><td>1</td><td>Adds a circle with a diameter equal to <a href="bmh_SkPaint_Reference?cl=9919#Stroke_Width">Stroke Width</a> at the beginning
2400and end.</td>
2401 </tr>
2402 <tr>
2403 <td><a name="SkPaint::kSquare_Cap"></a> <code><strong>SkPaint::kSquare_Cap </strong></code></td><td>2</td><td>Adds a square with sides equal to <a href="bmh_SkPaint_Reference?cl=9919#Stroke_Width">Stroke Width</a> at the beginning
2404and end. The square sides are parallel to the initial and final direction
2405of the stroke.</td>
2406 </tr>
2407 <tr>
2408 <td><a name="SkPaint::kLast_Cap"></a> <code><strong>SkPaint::kLast_Cap </strong></code></td><td>2</td><td>Equivalent to the largest value for <a href="bmh_SkPaint_Reference?cl=9919#Stroke_Cap">Stroke Cap</a>.</td>
2409 </tr>
2410 <tr>
2411 <td><a name="SkPaint::kDefault_Cap"></a> <code><strong>SkPaint::kDefault_Cap </strong></code></td><td>0</td><td>Equivalent to <a href="bmh_SkPaint_Reference?cl=9919#kButt_Cap">kButt Cap</a>.
2412<a href="bmh_SkPaint_Reference?cl=9919#Stroke_Cap">Stroke Cap</a> is set to <a href="bmh_SkPaint_Reference?cl=9919#kButt_Cap">kButt Cap</a> by default.</td>
2413 </tr>
2414 <tr>
2415 <td><a name="SkPaint::kCapCount"></a> <code><strong>SkPaint::kCapCount </strong></code></td><td>3</td><td>The number of different <a href="bmh_SkPaint_Reference?cl=9919#Stroke_Cap">Stroke Cap</a> values defined.
2416May be used to verify that <a href="bmh_SkPaint_Reference?cl=9919#Stroke_Cap">Stroke Cap</a> is a legal value.</td>
2417 </tr>
2418
2419Stroke describes the area covered by a pen of <a href="bmh_SkPaint_Reference?cl=9919#Stroke_Width">Stroke Width</a> as it
2420follows the <a href="bmh_SkPath_Reference?cl=9919#Contour">Path Contour</a>, moving parallel to the contours's direction.
2421
2422If the <a href="bmh_SkPath_Reference?cl=9919#Contour">Path Contour</a> is not terminated by <a href="bmh_SkPath_Reference?cl=9919#kClose_Verb">SkPath::kClose Verb</a>, the contour has a
2423visible beginning and end.
2424
2425<a href="bmh_SkPath_Reference?cl=9919#Contour">Path Contour</a> may start and end at the same point; defining <a href="bmh_SkPath_Reference?cl=9919#Zero_Length">Zero Length Contour</a>.
2426
2427<a href="bmh_SkPaint_Reference?cl=9919#kButt_Cap">kButt Cap</a> and <a href="bmh_SkPath_Reference?cl=9919#Zero_Length">Zero Length Contour</a> is not drawn.
2428<a href="bmh_SkPaint_Reference?cl=9919#kRound_Cap">kRound Cap</a> and <a href="bmh_SkPath_Reference?cl=9919#Zero_Length">Zero Length Contour</a> draws a circle of diameter <a href="bmh_SkPaint_Reference?cl=9919#Stroke_Width">Stroke Width</a>
2429at the contour point.
2430<a href="bmh_SkPaint_Reference?cl=9919#kSquare_Cap">kSquare Cap</a> and <a href="bmh_SkPath_Reference?cl=9919#Zero_Length">Zero Length Contour</a> draws an upright square with a side of
2431<a href="bmh_SkPaint_Reference?cl=9919#Stroke_Width">Stroke Width</a> at the contour point.
2432
2433<a href="bmh_SkPaint_Reference?cl=9919#Stroke_Cap">Stroke Cap</a> is <a href="bmh_SkPaint_Reference?cl=9919#kButt_Cap">kButt Cap</a> by default.
2434
2435</table>
2436
2437### Example
2438
2439<div><fiddle-embed name="3d92b449b298b4ce4004cfca6b91cee7"></fiddle-embed></div>
2440
2441<a name="getStrokeCap"></a>
2442## getStrokeCap
2443
2444<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
2445Cap getStrokeCap() const
2446</pre>
2447
2448The geometry drawn at the beginning and end of strokes.
2449
2450### Return Value
2451
2452one of: <a href="bmh_SkPaint_Reference?cl=9919#kButt_Cap">kButt Cap</a>, <a href="bmh_SkPaint_Reference?cl=9919#kRound_Cap">kRound Cap</a>, <a href="bmh_SkPaint_Reference?cl=9919#kSquare_Cap">kSquare Cap</a>
2453
2454### Example
2455
2456<div><fiddle-embed name="aabf9baee8e026fae36fca30e955512b">
2457
2458#### Example Output
2459
2460~~~~
2461kButt_Cap == default stroke cap
2462~~~~
2463
2464</fiddle-embed></div>
2465
2466### See Also
2467
2468<a href="bmh_SkPaint_Reference?cl=9919#Stroke_Cap">Stroke Cap</a> <a href="bmh_SkPaint_Reference?cl=9919#setStrokeCap">setStrokeCap</a>
2469
2470---
2471
2472<a name="setStrokeCap"></a>
2473## setStrokeCap
2474
2475<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
2476void setStrokeCap(Cap cap)
2477</pre>
2478
2479The geometry drawn at the beginning and end of strokes.
2480
2481### Parameters
2482
2483<table> <tr> <td><code><strong>cap </strong></code></td> <td>
2484one of: <a href="bmh_SkPaint_Reference?cl=9919#kButt_Cap">kButt Cap</a>, <a href="bmh_SkPaint_Reference?cl=9919#kRound_Cap">kRound Cap</a>, <a href="bmh_SkPaint_Reference?cl=9919#kSquare_Cap">kSquare Cap</a>;
2485has no effect if <a href="bmh_SkPaint_Reference?cl=9919#setStrokeCap">cap</a> is not valid</td>
2486 </tr>
2487</table>
2488
2489### Example
2490
2491<div><fiddle-embed name="de83fbd848a4625345b4b87a6e55d98a">
2492
2493#### Example Output
2494
2495~~~~
2496kRound_Cap == paint.getStrokeCap()
2497~~~~
2498
2499</fiddle-embed></div>
2500
2501### See Also
2502
2503<a href="bmh_SkPaint_Reference?cl=9919#Stroke_Cap">Stroke Cap</a> <a href="bmh_SkPaint_Reference?cl=9919#getStrokeCap">getStrokeCap</a>
2504
2505---
2506
2507# <a name="Stroke_Join"></a> Stroke Join
2508<a href="bmh_SkPaint_Reference?cl=9919#Stroke_Join">Stroke Join</a> draws at the sharp corners of an open or closed <a href="bmh_SkPath_Reference?cl=9919#Contour">Path Contour</a>.
2509
2510Stroke describes the area covered by a pen of <a href="bmh_SkPaint_Reference?cl=9919#Stroke_Width">Stroke Width</a> as it
2511follows the <a href="bmh_SkPath_Reference?cl=9919#Contour">Path Contour</a>, moving parallel to the contours's direction.
2512
2513If the contour direction changes abruptly, because the tangent direction leading
2514to the end of a curve within the contour does not match the tangent direction of
2515the following curve, the pair of curves meet at <a href="bmh_SkPaint_Reference?cl=9919#Stroke_Join">Stroke Join</a>.
2516
2517### Example
2518
2519<div><fiddle-embed name="4a4e41ed89a57d47eab5d1600c33b0e8"></fiddle-embed></div>
2520
2521## <a name="SkPaint::Join"></a> Enum SkPaint::Join
2522
2523<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0">
2524enum <a href="bmh_SkPaint_Reference?cl=9919#Join">Join</a> {
2525<a href="bmh_SkPaint_Reference?cl=9919#kMiter_Join">kMiter Join</a>,
2526<a href="bmh_SkPaint_Reference?cl=9919#kRound_Join">kRound Join</a>,
2527<a href="bmh_SkPaint_Reference?cl=9919#kBevel_Join">kBevel Join</a>,
2528
2529<a href="bmh_SkPaint_Reference?cl=9919#kLast_Join">kLast Join</a> = <a href="bmh_SkPaint_Reference?cl=9919#kBevel_Join">kBevel Join</a>,
Cary Clarkbad5ad72017-08-03 17:14:08 -04002530<a href="bmh_SkPaint_Reference?cl=9919#kDefault_Join">kDefault Join</a> = <a href="bmh_SkPaint_Reference?cl=9919#kMiter_Join">kMiter Join</a>,
Cary Clark12799e12017-07-28 15:18:29 -04002531};
2532static constexpr int <a href="bmh_SkPaint_Reference?cl=9919#kJoinCount">kJoinCount</a> = <a href="bmh_SkPaint_Reference?cl=9919#kLast_Join">kLast Join</a> + 1;</pre>
2533
Cary Clarkbad5ad72017-08-03 17:14:08 -04002534<a href="bmh_SkPaint_Reference?cl=9919#Join">Join</a> specifies how corners are drawn when a shape is stroked. <a href="bmh_SkPaint_Reference?cl=9919#Join">Join</a>
Cary Clark12799e12017-07-28 15:18:29 -04002535affects the four corners of a stroked rectangle, and the connected segments in a
2536stroked path.
2537
2538Choose miter join to draw sharp corners. Choose round join to draw a circle with a
2539radius equal to the stroke width on top of the corner. Choose bevel join to minimally
2540connect the thick strokes.
2541
2542The fill path constructed to describe the stroked path respects the join setting but may
2543not contain the actual join. For instance, a fill path constructed with round joins does
2544not necessarily include circles at each connected segment.
2545
2546### Constants
2547
2548<table>
2549 <tr>
2550 <td><a name="SkPaint::kMiter_Join"></a> <code><strong>SkPaint::kMiter_Join </strong></code></td><td>0</td><td>Extends the outside corner to the extent allowed by <a href="bmh_SkPaint_Reference?cl=9919#Miter_Limit">Miter Limit</a>.
2551If the extension exceeds <a href="bmh_SkPaint_Reference?cl=9919#Miter_Limit">Miter Limit</a>, <a href="bmh_SkPaint_Reference?cl=9919#kBevel_Join">kBevel Join</a> is used instead.</td>
2552 </tr>
2553 <tr>
2554 <td><a name="SkPaint::kRound_Join"></a> <code><strong>SkPaint::kRound_Join </strong></code></td><td>1</td><td>Adds a circle with a diameter of <a href="bmh_SkPaint_Reference?cl=9919#Stroke_Width">Stroke Width</a> at the sharp corner.</td>
2555 </tr>
2556 <tr>
2557 <td><a name="SkPaint::kBevel_Join"></a> <code><strong>SkPaint::kBevel_Join </strong></code></td><td>2</td><td>Connects the outside edges of the sharp corner.</td>
2558 </tr>
2559 <tr>
2560 <td><a name="SkPaint::kLast_Join"></a> <code><strong>SkPaint::kLast_Join </strong></code></td><td>2</td><td>Equivalent to the largest value for <a href="bmh_SkPaint_Reference?cl=9919#Stroke_Join">Stroke Join</a>.</td>
2561 </tr>
2562 <tr>
2563 <td><a name="SkPaint::kDefault_Join"></a> <code><strong>SkPaint::kDefault_Join </strong></code></td><td>1</td><td>Equivalent to <a href="bmh_SkPaint_Reference?cl=9919#kMiter_Join">kMiter Join</a>.
2564<a href="bmh_SkPaint_Reference?cl=9919#Stroke_Join">Stroke Join</a> is set to <a href="bmh_SkPaint_Reference?cl=9919#kMiter_Join">kMiter Join</a> by default.</td>
2565 </tr>
2566 <tr>
2567 <td><a name="SkPaint::kJoinCount"></a> <code><strong>SkPaint::kJoinCount </strong></code></td><td>3</td><td>The number of different <a href="bmh_SkPaint_Reference?cl=9919#Stroke_Join">Stroke Join</a> values defined.
2568May be used to verify that <a href="bmh_SkPaint_Reference?cl=9919#Stroke_Join">Stroke Join</a> is a legal value.</td>
2569 </tr>
2570</table>
2571
2572### Example
2573
2574<div><fiddle-embed name="3b1aebacc21c1836a52876b9b0b3905e"></fiddle-embed></div>
2575
2576### See Also
2577
2578<a href="bmh_SkPaint_Reference?cl=9919#setStrokeJoin">setStrokeJoin</a> <a href="bmh_SkPaint_Reference?cl=9919#getStrokeJoin">getStrokeJoin</a> <a href="bmh_SkPaint_Reference?cl=9919#setStrokeMiter">setStrokeMiter</a> <a href="bmh_SkPaint_Reference?cl=9919#getStrokeMiter">getStrokeMiter</a>
2579
2580
2581
2582<a name="getStrokeJoin"></a>
2583## getStrokeJoin
2584
2585<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
2586Join getStrokeJoin() const
2587</pre>
2588
2589The geometry drawn at the corners of strokes.
2590
2591### Return Value
2592
2593one of: <a href="bmh_SkPaint_Reference?cl=9919#kMiter_Join">kMiter Join</a>, <a href="bmh_SkPaint_Reference?cl=9919#kRound_Join">kRound Join</a>, <a href="bmh_SkPaint_Reference?cl=9919#kBevel_Join">kBevel Join</a>
2594
2595### Example
2596
2597<div><fiddle-embed name="31bf751d0a8ddf176b871810820d8199">
2598
2599#### Example Output
2600
2601~~~~
2602kMiter_Join == default stroke join
2603~~~~
2604
2605</fiddle-embed></div>
2606
2607### See Also
2608
2609<a href="bmh_SkPaint_Reference?cl=9919#Stroke_Join">Stroke Join</a> <a href="bmh_SkPaint_Reference?cl=9919#setStrokeJoin">setStrokeJoin</a>
2610
2611---
2612
2613<a name="setStrokeJoin"></a>
2614## setStrokeJoin
2615
2616<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
2617void setStrokeJoin(Join join)
2618</pre>
2619
2620The geometry drawn at the corners of strokes.
2621
2622### Parameters
2623
2624<table> <tr> <td><code><strong>join </strong></code></td> <td>
2625one of: <a href="bmh_SkPaint_Reference?cl=9919#kMiter_Join">kMiter Join</a>, <a href="bmh_SkPaint_Reference?cl=9919#kRound_Join">kRound Join</a>, <a href="bmh_SkPaint_Reference?cl=9919#kBevel_Join">kBevel Join</a>;
Cary Clarkbad5ad72017-08-03 17:14:08 -04002626otherwise, has no effect</td>
Cary Clark12799e12017-07-28 15:18:29 -04002627 </tr>
2628</table>
2629
2630### Example
2631
2632<div><fiddle-embed name="48d963ad4286eddf680f9c511eb6da91">
2633
2634#### Example Output
2635
2636~~~~
2637kMiter_Join == paint.getStrokeJoin()
2638~~~~
2639
2640</fiddle-embed></div>
2641
2642### See Also
2643
2644<a href="bmh_SkPaint_Reference?cl=9919#Stroke_Join">Stroke Join</a> <a href="bmh_SkPaint_Reference?cl=9919#getStrokeJoin">getStrokeJoin</a>
2645
2646---
2647
2648### See Also
2649
2650<a href="bmh_SkPaint_Reference?cl=9919#Miter_Limit">Miter Limit</a>
2651
2652# <a name="Fill_Path"></a> Fill Path
2653<a href="bmh_SkPaint_Reference?cl=9919#Fill_Path">Fill Path</a> creates a <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> by applying the <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a>, followed by the <a href="bmh_SkPaint_Reference?cl=9919#Style_Stroke">Style Stroke</a>.
2654
2655If <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> contains <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a>, <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a> operates on the source <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>; the result
2656replaces the destination <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>. Otherwise, the source <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> is replaces the
2657destination <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>.
2658
2659Fill <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> can request the <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a> to restrict to a culling rectangle, but
2660the <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a> is not required to do so.
2661
2662If <a href="bmh_SkPaint_Reference?cl=9919#Style">Style</a> is <a href="bmh_SkPaint_Reference?cl=9919#kStroke_Style">kStroke Style</a> or <a href="bmh_SkPaint_Reference?cl=9919#kStrokeAndFill_Style">kStrokeAndFill Style</a>,
2663and <a href="bmh_SkPaint_Reference?cl=9919#Stroke_Width">Stroke Width</a> is greater than zero, the <a href="bmh_SkPaint_Reference?cl=9919#Stroke_Width">Stroke Width</a>, <a href="bmh_SkPaint_Reference?cl=9919#Stroke_Cap">Stroke Cap</a>, <a href="bmh_SkPaint_Reference?cl=9919#Stroke_Join">Stroke Join</a>,
2664and <a href="bmh_SkPaint_Reference?cl=9919#Miter_Limit">Miter Limit</a> operate on the destination <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>, replacing it.
2665
2666Fill <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> can specify the precision used by <a href="bmh_SkPaint_Reference?cl=9919#Stroke_Width">Stroke Width</a> to approximate the stroke geometry.
2667
2668If the <a href="bmh_SkPaint_Reference?cl=9919#Style">Style</a> is <a href="bmh_SkPaint_Reference?cl=9919#kStroke_Style">kStroke Style</a> and the <a href="bmh_SkPaint_Reference?cl=9919#Stroke_Width">Stroke Width</a> is zero, <a href="bmh_SkPaint_Reference?cl=9919#getFillPath">getFillPath</a>
2669returns false since <a href="bmh_SkPaint_Reference?cl=9919#Hairline">Hairline</a> has no filled equivalent.
2670
2671<a name="getFillPath"></a>
2672## getFillPath
2673
2674<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
2675bool getFillPath(const SkPath& src, SkPath* dst, const SkRect* cullRect,
2676 SkScalar resScale = 1) const
2677</pre>
2678
2679The filled equivalent of the stroked path.
2680
2681### Parameters
2682
2683<table> <tr> <td><code><strong>src </strong></code></td> <td>
2684<a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> read to create a filled version</td>
2685 </tr> <tr> <td><code><strong>dst </strong></code></td> <td>
2686resulting <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>; may be the same as <a href="bmh_SkPaint_Reference?cl=9919#src">src</a>, but may not be nullptr</td>
2687 </tr> <tr> <td><code><strong>cullRect </strong></code></td> <td>
2688optional limit passed to <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a></td>
2689 </tr> <tr> <td><code><strong>resScale </strong></code></td> <td>
2690if > 1, increase precision, else if (0 < res < 1) reduce precision
2691to favor speed and size</td>
2692 </tr>
2693</table>
2694
2695### Return Value
2696
2697true if the path represents <a href="bmh_SkPaint_Reference?cl=9919#Style_Fill">Style Fill</a>, or false if it represents <a href="bmh_SkPaint_Reference?cl=9919#Hairline">Hairline</a>
2698
2699### Example
2700
2701<div><fiddle-embed name="cedd6233848198e1fca4d1e14816baaf"><div>A very small quad stroke is turned into a filled path with increasing levels of precision.
2702At the lowest precision, the quad stroke is approximated by a rectangle.
2703At the highest precision, the filled path has high fidelity compared to the original stroke.</div></fiddle-embed></div>
2704
2705---
2706
2707<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
2708bool getFillPath(const SkPath& src, SkPath* dst) const
2709</pre>
2710
2711The filled equivalent of the stroked path.
2712
2713Replaces <a href="bmh_SkPaint_Reference?cl=9919#dst">dst</a> with the <a href="bmh_SkPaint_Reference?cl=9919#src">src</a> path modified by <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a> and <a href="bmh_SkPaint_Reference?cl=9919#Style_Stroke">Style Stroke</a>.
2714<a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a>, if any, is not culled. <a href="bmh_SkPaint_Reference?cl=9919#Stroke_Width">Stroke Width</a> is created with default precision.
2715
2716### Parameters
2717
2718<table> <tr> <td><code><strong>src </strong></code></td> <td>
2719<a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> read to create a filled version</td>
2720 </tr> <tr> <td><code><strong>dst </strong></code></td> <td>
2721resulting <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> <a href="bmh_SkPaint_Reference?cl=9919#dst">dst</a> may be the same as <a href="bmh_SkPaint_Reference?cl=9919#src">src</a>, but may not be nullptr</td>
2722 </tr>
2723</table>
2724
2725### Return Value
2726
2727true if the path represents <a href="bmh_SkPaint_Reference?cl=9919#Style_Fill">Style Fill</a>, or false if it represents <a href="bmh_SkPaint_Reference?cl=9919#Hairline">Hairline</a>
2728
2729### Example
2730
2731<div><fiddle-embed name="e6d8ca0cc17e0b475bd54dd995825468"></fiddle-embed></div>
2732
2733---
2734
2735### See Also
2736
2737<a href="bmh_SkPaint_Reference?cl=9919#Style_Stroke">Style Stroke</a> <a href="bmh_SkPaint_Reference?cl=9919#Stroke_Width">Stroke Width</a> <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a>
2738
2739# <a name="Shader_Methods"></a> Shader Methods
2740<a href="bmh_undocumented?cl=9919#Shader">Shader</a> defines the colors used when drawing a shape.
2741<a href="bmh_undocumented?cl=9919#Shader">Shader</a> may be an image, a gradient, or a computed fill.
2742If <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> has no <a href="bmh_undocumented?cl=9919#Shader">Shader</a>, then <a href="bmh_undocumented?cl=9919#Color">Color</a> fills the shape.
2743
2744<a href="bmh_undocumented?cl=9919#Shader">Shader</a> is modulated by <a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a> component of <a href="bmh_undocumented?cl=9919#Color">Color</a>.
2745If <a href="bmh_undocumented?cl=9919#Shader">Shader</a> object defines only <a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a>, then <a href="bmh_undocumented?cl=9919#Color">Color</a> modulated by <a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a> describes
2746the fill.
2747
2748The drawn transparency can be modified without altering <a href="bmh_undocumented?cl=9919#Shader">Shader</a>, by changing <a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a>.
2749
2750### Example
2751
2752<div><fiddle-embed name="c015dc2010c15e1c00b4f7330232b0f7"></fiddle-embed></div>
2753
2754If <a href="bmh_undocumented?cl=9919#Shader">Shader</a> generates only <a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a> then all components of <a href="bmh_undocumented?cl=9919#Color">Color</a> modulate the output.
2755
2756### Example
2757
2758<div><fiddle-embed name="9673be7720ba3adcdae42ddc1565b588"></fiddle-embed></div>
2759
2760<a name="getShader"></a>
2761## getShader
2762
2763<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
2764SkShader* getShader() const
2765</pre>
2766
2767Optional colors used when filling a path, such as a gradient.
2768
2769Does not alter <a href="bmh_undocumented?cl=9919#Shader">Shader</a> <a href="bmh_undocumented?cl=9919#Reference_Count">Reference Count</a>.
2770
2771### Return Value
2772
2773<a href="bmh_undocumented?cl=9919#Shader">Shader</a> if previously set, nullptr otherwise
2774
2775### Example
2776
2777<div><fiddle-embed name="09f15b9fd88882850da2d235eb86292f">
2778
2779#### Example Output
2780
2781~~~~
2782nullptr == shader
2783nullptr != shader
2784~~~~
2785
2786</fiddle-embed></div>
2787
2788---
2789
2790<a name="refShader"></a>
2791## refShader
2792
2793<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
2794sk_sp<SkShader> refShader() const
2795</pre>
2796
2797Optional colors used when filling a path, such as a gradient.
2798
2799Increases <a href="bmh_undocumented?cl=9919#Shader">Shader</a> <a href="bmh_undocumented?cl=9919#Reference_Count">Reference Count</a> by one.
2800
2801### Return Value
2802
2803<a href="bmh_undocumented?cl=9919#Shader">Shader</a> if previously set, nullptr otherwise
2804
2805### Example
2806
2807<div><fiddle-embed name="53da0295972a418cbc9607bbb17feaa8">
2808
2809#### Example Output
2810
2811~~~~
2812shader unique: true
2813shader unique: false
2814~~~~
2815
2816</fiddle-embed></div>
2817
2818---
2819
2820<a name="setShader"></a>
2821## setShader
2822
2823<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
2824void setShader(sk_sp<SkShader> shader)
2825</pre>
2826
2827Optional colors used when filling a path, such as a gradient.
2828
2829Sets <a href="bmh_undocumented?cl=9919#Shader">Shader</a> to <a href="bmh_SkPaint_Reference?cl=9919#shader">shader</a>, decrementing <a href="bmh_undocumented?cl=9919#Reference_Count">Reference Count</a> of the previous <a href="bmh_undocumented?cl=9919#Shader">Shader</a>.
2830Does not alter <a href="bmh_SkPaint_Reference?cl=9919#shader">shader</a> <a href="bmh_undocumented?cl=9919#Reference_Count">Reference Count</a>.
2831
2832### Parameters
2833
2834<table> <tr> <td><code><strong>shader </strong></code></td> <td>
2835how geometry is filled with color; if nullptr, <a href="bmh_undocumented?cl=9919#Color">Color</a> is used instead</td>
2836 </tr>
2837</table>
2838
2839### Example
2840
2841<div><fiddle-embed name="77e64d5bae9b1ba037fd99252bb4aa58"></fiddle-embed></div>
2842
2843---
2844
2845# <a name="Color_Filter_Methods"></a> Color Filter Methods
2846<a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a> alters the color used when drawing a shape.
2847<a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a> may apply <a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a>, transform the color through a matrix, or composite multiple filters.
2848If <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> has no <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>, the color is unaltered.
2849
2850The drawn transparency can be modified without altering <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>, by changing <a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a>.
2851
2852### Example
2853
2854<div><fiddle-embed name="5abde56ca2f89a18b8e231abd1b57c56"></fiddle-embed></div>
2855
2856<a name="getColorFilter"></a>
2857## getColorFilter
2858
2859<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
2860SkColorFilter* getColorFilter() const
2861</pre>
2862
2863Returns <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a> if set, or nullptr.
2864Does not alter <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a> <a href="bmh_undocumented?cl=9919#Reference_Count">Reference Count</a>.
2865
2866### Return Value
2867
2868<a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a> if previously set, nullptr otherwise
2869
2870### Example
2871
2872<div><fiddle-embed name="093bdc627d6b59002670fd290931f6c9">
2873
2874#### Example Output
2875
2876~~~~
2877nullptr == color filter
2878nullptr != color filter
2879~~~~
2880
2881</fiddle-embed></div>
2882
2883---
2884
2885<a name="refColorFilter"></a>
2886## refColorFilter
2887
2888<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
2889sk_sp<SkColorFilter> refColorFilter() const
2890</pre>
2891
2892Returns <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a> if set, or nullptr.
2893Increases <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a> <a href="bmh_undocumented?cl=9919#Reference_Count">Reference Count</a> by one.
2894
2895### Return Value
2896
2897<a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a> if set, or nullptr
2898
2899### Example
2900
2901<div><fiddle-embed name="b588c95fa4c86ddbc4b0546762f08297">
2902
2903#### Example Output
2904
2905~~~~
2906color filter unique: true
2907color filter unique: false
2908~~~~
2909
2910</fiddle-embed></div>
2911
2912---
2913
2914<a name="setColorFilter"></a>
2915## setColorFilter
2916
2917<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
2918void setColorFilter(sk_sp<SkColorFilter> colorFilter)
2919</pre>
2920
2921Sets <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a> to filter, decrementing <a href="bmh_undocumented?cl=9919#Reference_Count">Reference Count</a> of the previous <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>.
2922Pass nullptr to clear <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>.
2923Does not alter filter <a href="bmh_undocumented?cl=9919#Reference_Count">Reference Count</a>.
2924
2925### Parameters
2926
2927<table> <tr> <td><code><strong>colorFilter </strong></code></td> <td>
2928<a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a> to apply to subsequent draw</td>
2929 </tr>
2930</table>
2931
2932### Example
2933
2934<div><fiddle-embed name="c7b786dc9b3501cd0eaba47494b6fa31"></fiddle-embed></div>
2935
2936---
2937
2938# <a name="Blend_Mode_Methods"></a> Blend Mode Methods
2939<a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a> describes how <a href="bmh_undocumented?cl=9919#Color">Color</a> combines with the destination color.
2940The default setting, <a href="bmh_undocumented?cl=9919#kSrcOver">SkBlendMode::kSrcOver</a>, draws the source color
2941over the destination color.
2942
2943### Example
2944
2945<div><fiddle-embed name="73092d4d06faecea3c204d852a4dd8a8"></fiddle-embed></div>
2946
2947### See Also
2948
2949<a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a>
2950
2951<a name="getBlendMode"></a>
2952## getBlendMode
2953
2954<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
2955SkBlendMode getBlendMode() const
2956</pre>
2957
2958Returns <a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a>.
Cary Clarkbad5ad72017-08-03 17:14:08 -04002959By default, returns <a href="bmh_undocumented?cl=9919#kSrcOver">SkBlendMode::kSrcOver</a>.
Cary Clark12799e12017-07-28 15:18:29 -04002960
2961### Return Value
2962
2963mode used to combine source color with destination color
2964
2965### Example
2966
2967<div><fiddle-embed name="4ec1864b8203d52c0810e8605092f45c">
2968
2969#### Example Output
2970
2971~~~~
2972kSrcOver == getBlendMode
2973kSrcOver != getBlendMode
2974~~~~
2975
2976</fiddle-embed></div>
2977
2978---
2979
2980<a name="isSrcOver"></a>
2981## isSrcOver
2982
2983<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
2984bool isSrcOver() const
2985</pre>
2986
2987Returns true if <a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a> is <a href="bmh_undocumented?cl=9919#kSrcOver">SkBlendMode::kSrcOver</a>, the default.
2988
2989### Return Value
2990
2991true if <a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a> is <a href="bmh_undocumented?cl=9919#kSrcOver">SkBlendMode::kSrcOver</a>
2992
2993### Example
2994
2995<div><fiddle-embed name="257c9473db7a2b3a0fb2b9e2431e59a6">
2996
2997#### Example Output
2998
2999~~~~
3000isSrcOver == true
3001isSrcOver != true
3002~~~~
3003
3004</fiddle-embed></div>
3005
3006---
3007
3008<a name="setBlendMode"></a>
3009## setBlendMode
3010
3011<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
3012void setBlendMode(SkBlendMode mode)
3013</pre>
3014
3015Sets <a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a> to <a href="bmh_SkPaint_Reference?cl=9919#mode">mode</a>.
3016Does not check for valid input.
3017
3018### Parameters
3019
3020<table> <tr> <td><code><strong>mode </strong></code></td> <td>
3021<a href="bmh_undocumented?cl=9919#SkBlendMode">SkBlendMode</a> used to combine source color and destination</td>
3022 </tr>
3023</table>
3024
3025### Example
3026
3027<div><fiddle-embed name="257c9473db7a2b3a0fb2b9e2431e59a6">
3028
3029#### Example Output
3030
3031~~~~
3032isSrcOver == true
3033isSrcOver != true
3034~~~~
3035
3036</fiddle-embed></div>
3037
3038---
3039
3040# <a name="Path_Effect_Methods"></a> Path Effect Methods
3041<a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a> modifies the path geometry before drawing it.
3042<a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a> may implement dashing, custom fill effects and custom stroke effects.
3043If <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> has no <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a>, the path geometry is unaltered when filled or stroked.
3044
3045### Example
3046
3047<div><fiddle-embed name="8cf5684b187d60f09e11c4a48993ea39"></fiddle-embed></div>
3048
3049### See Also
3050
3051<a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a>
3052
3053<a name="getPathEffect"></a>
3054## getPathEffect
3055
3056<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
3057SkPathEffect* getPathEffect() const
3058</pre>
3059
3060Returns <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a> if set, or nullptr.
3061Does not alter <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a> <a href="bmh_undocumented?cl=9919#Reference_Count">Reference Count</a>.
3062
3063### Return Value
3064
3065<a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a> if previously set, nullptr otherwise
3066
3067### Example
3068
3069<div><fiddle-embed name="211a1b14bfa6c4332082c8eab4fbc5fd">
3070
3071#### Example Output
3072
3073~~~~
3074nullptr == path effect
3075nullptr != path effect
3076~~~~
3077
3078</fiddle-embed></div>
3079
3080---
3081
3082<a name="refPathEffect"></a>
3083## refPathEffect
3084
3085<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
3086sk_sp<SkPathEffect> refPathEffect() const
3087</pre>
3088
3089Returns <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a> if set, or nullptr.
3090Increases <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a> <a href="bmh_undocumented?cl=9919#Reference_Count">Reference Count</a> by one.
3091
3092### Return Value
3093
3094<a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a> if previously set, nullptr otherwise
3095
3096### Example
3097
3098<div><fiddle-embed name="c55c74f8f581870bd2c18f2f99765579">
3099
3100#### Example Output
3101
3102~~~~
3103path effect unique: true
3104path effect unique: false
3105~~~~
3106
3107</fiddle-embed></div>
3108
3109---
3110
3111<a name="setPathEffect"></a>
3112## setPathEffect
3113
3114<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
3115void setPathEffect(sk_sp<SkPathEffect> pathEffect)
3116</pre>
3117
3118Sets <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a> to <a href="bmh_SkPaint_Reference?cl=9919#pathEffect">pathEffect</a>,
3119decrementing <a href="bmh_undocumented?cl=9919#Reference_Count">Reference Count</a> of the previous <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a>.
3120Pass nullptr to leave the path geometry unaltered.
3121Does not alter <a href="bmh_SkPaint_Reference?cl=9919#pathEffect">pathEffect</a> <a href="bmh_undocumented?cl=9919#Reference_Count">Reference Count</a>.
3122
3123### Parameters
3124
3125<table> <tr> <td><code><strong>pathEffect </strong></code></td> <td>
3126replace <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> with a modification when drawn</td>
3127 </tr>
3128</table>
3129
3130### Example
3131
3132<div><fiddle-embed name="52dd55074ca0b7d520d04e750ca2a0d7"></fiddle-embed></div>
3133
3134---
3135
3136# <a name="Mask_Filter_Methods"></a> Mask Filter Methods
3137<a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a> uses <a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a> of the shape drawn to create <a href="bmh_undocumented?cl=9919#Mask_Alpha">Mask Alpha</a>.
3138<a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a> operates at a lower level than <a href="bmh_undocumented?cl=9919#Rasterizer">Rasterizer</a>; <a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a> takes a <a href="bmh_undocumented?cl=9919#Mask">Mask</a>,
3139and returns a <a href="bmh_undocumented?cl=9919#Mask">Mask</a>.
3140<a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a> may change the geometry and transparency of the shape, such as creating a blur effect.
3141Set <a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a> to nullptr to prevent <a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a> from modifying the draw.
3142
3143### Example
3144
3145<div><fiddle-embed name="320b04ea1e1291d49f1e61994a0410fe"></fiddle-embed></div>
3146
3147<a name="getMaskFilter"></a>
3148## getMaskFilter
3149
3150<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
3151SkMaskFilter* getMaskFilter() const
3152</pre>
3153
3154Returns <a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a> if set, or nullptr.
3155Does not alter <a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a> <a href="bmh_undocumented?cl=9919#Reference_Count">Reference Count</a>.
3156
3157### Return Value
3158
3159<a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a> if previously set, nullptr otherwise
3160
3161### Example
3162
3163<div><fiddle-embed name="8cd53ece8fc83e4560599ace094b0f16">
3164
3165#### Example Output
3166
3167~~~~
3168nullptr == mask filter
3169nullptr != mask filter
3170~~~~
3171
3172</fiddle-embed></div>
3173
3174---
3175
3176<a name="refMaskFilter"></a>
3177## refMaskFilter
3178
3179<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
3180sk_sp<SkMaskFilter> refMaskFilter() const
3181</pre>
3182
3183Returns <a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a> if set, or nullptr.
3184Increases <a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a> <a href="bmh_undocumented?cl=9919#Reference_Count">Reference Count</a> by one.
3185
3186### Return Value
3187
3188<a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a> if previously set, nullptr otherwise
3189
3190### Example
3191
3192<div><fiddle-embed name="35a397dce5d44658ee4e9e9dfb9fee22">
3193
3194#### Example Output
3195
3196~~~~
3197mask filter unique: true
3198mask filter unique: false
3199~~~~
3200
3201</fiddle-embed></div>
3202
3203---
3204
3205<a name="setMaskFilter"></a>
3206## setMaskFilter
3207
3208<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
3209void setMaskFilter(sk_sp<SkMaskFilter> maskFilter)
3210</pre>
3211
3212Sets <a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a> to <a href="bmh_SkPaint_Reference?cl=9919#maskFilter">maskFilter</a>,
3213decrementing <a href="bmh_undocumented?cl=9919#Reference_Count">Reference Count</a> of the previous <a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a>.
3214Pass nullptr to clear <a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a> and leave <a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a> effect on <a href="bmh_undocumented?cl=9919#Mask_Alpha">Mask Alpha</a> unaltered.
3215Does not affect <a href="bmh_undocumented?cl=9919#Rasterizer">Rasterizer</a>.
3216Does not alter <a href="bmh_SkPaint_Reference?cl=9919#maskFilter">maskFilter</a> <a href="bmh_undocumented?cl=9919#Reference_Count">Reference Count</a>.
3217
3218### Parameters
3219
3220<table> <tr> <td><code><strong>maskFilter </strong></code></td> <td>
3221modifies clipping mask generated from drawn geometry</td>
3222 </tr>
3223</table>
3224
3225### Example
3226
3227<div><fiddle-embed name="62c5a826692f85c3de3bab65e9e97aa9"></fiddle-embed></div>
3228
3229---
3230
3231# <a name="Typeface_Methods"></a> Typeface Methods
3232<a href="bmh_undocumented?cl=9919#Typeface">Typeface</a> identifies the font used when drawing and measuring text.
3233<a href="bmh_undocumented?cl=9919#Typeface">Typeface</a> may be specified by name, from a file, or from a data stream.
3234The default <a href="bmh_undocumented?cl=9919#Typeface">Typeface</a> defers to the platform-specific default font
3235implementation.
3236
3237### Example
3238
3239<div><fiddle-embed name="c18b1696b8c1649bebf7eb1f8b89e0b0"></fiddle-embed></div>
3240
3241<a name="getTypeface"></a>
3242## getTypeface
3243
3244<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
3245SkTypeface* getTypeface() const
3246</pre>
3247
3248Returns <a href="bmh_undocumented?cl=9919#Typeface">Typeface</a> if set, or nullptr.
3249Does not alter <a href="bmh_undocumented?cl=9919#Typeface">Typeface</a> <a href="bmh_undocumented?cl=9919#Reference_Count">Reference Count</a>.
3250
3251### Return Value
3252
3253<a href="bmh_undocumented?cl=9919#Typeface">Typeface</a> if previously set, nullptr otherwise
3254
3255### Example
3256
3257<div><fiddle-embed name="4d9ffb5761b62a9e3bc9b0bca8787bce">
3258
3259#### Example Output
3260
3261~~~~
3262nullptr == typeface
3263nullptr != typeface
3264~~~~
3265
3266</fiddle-embed></div>
3267
3268---
3269
3270<a name="refTypeface"></a>
3271## refTypeface
3272
3273<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
3274sk_sp<SkTypeface> refTypeface() const
3275</pre>
3276
3277Increases <a href="bmh_undocumented?cl=9919#Typeface">Typeface</a> <a href="bmh_undocumented?cl=9919#Reference_Count">Reference Count</a> by one.
3278
3279### Return Value
3280
3281<a href="bmh_undocumented?cl=9919#Typeface">Typeface</a> if previously set, nullptr otherwise
3282
3283### Example
3284
3285<div><fiddle-embed name="c8edce7b36a3ffda8af4fe89d7187dbc">
3286
3287#### Example Output
3288
3289~~~~
3290typeface1 != typeface2
3291typeface1 == typeface2
3292~~~~
3293
3294</fiddle-embed></div>
3295
3296---
3297
3298<a name="setTypeface"></a>
3299## setTypeface
3300
3301<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
3302void setTypeface(sk_sp<SkTypeface> typeface)
3303</pre>
3304
3305Sets <a href="bmh_undocumented?cl=9919#Typeface">Typeface</a> to <a href="bmh_SkPaint_Reference?cl=9919#typeface">typeface</a>,
3306decrementing <a href="bmh_undocumented?cl=9919#Reference_Count">Reference Count</a> of the previous <a href="bmh_undocumented?cl=9919#Typeface">Typeface</a>.
3307Pass nullptr to clear <a href="bmh_undocumented?cl=9919#Typeface">Typeface</a> and use the default <a href="bmh_SkPaint_Reference?cl=9919#typeface">typeface</a>.
3308Does not alter <a href="bmh_SkPaint_Reference?cl=9919#typeface">typeface</a> <a href="bmh_undocumented?cl=9919#Reference_Count">Reference Count</a>.
3309
3310### Parameters
3311
3312<table> <tr> <td><code><strong>typeface </strong></code></td> <td>
3313font and style used to draw text</td>
3314 </tr>
3315</table>
3316
3317### Example
3318
3319<div><fiddle-embed name="3d2656ec4c555ed2c7ec086720124a2a"></fiddle-embed></div>
3320
3321---
3322
3323# <a name="Rasterizer_Methods"></a> Rasterizer Methods
3324<a href="bmh_undocumented?cl=9919#Rasterizer">Rasterizer</a> controls how shapes are converted to <a href="bmh_undocumented?cl=9919#Mask_Alpha">Mask Alpha</a>.
3325<a href="bmh_undocumented?cl=9919#Rasterizer">Rasterizer</a> operates at a higher level than <a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a>; <a href="bmh_undocumented?cl=9919#Rasterizer">Rasterizer</a> takes a <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>,
3326and returns a <a href="bmh_undocumented?cl=9919#Mask">Mask</a>.
3327<a href="bmh_undocumented?cl=9919#Rasterizer">Rasterizer</a> may change the geometry and transparency of the shape, such as
3328creating a shadow effect. <a href="bmh_undocumented?cl=9919#Rasterizer">Rasterizer</a> forms the base of <a href="bmh_undocumented?cl=9919#Layer">Rasterizer Layer</a>, which
3329creates effects like embossing and outlining.
3330<a href="bmh_undocumented?cl=9919#Rasterizer">Rasterizer</a> applies to <a href="bmh_undocumented?cl=9919#Rect">Rect</a>, <a href="bmh_undocumented?cl=9919#Region">Region</a>, <a href="bmh_undocumented?cl=9919#Round_Rect">Round Rect</a>, <a href="bmh_undocumented?cl=9919#Arc">Arc</a>, <a href="bmh_undocumented?cl=9919#Circle">Circle</a>, <a href="bmh_undocumented?cl=9919#Oval">Oval</a>,
3331<a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>, and <a href="bmh_undocumented?cl=9919#Text">Text</a>.
3332
3333### Example
3334
3335<div><fiddle-embed name="e63f8a50996699342a14c6e54d684108"></fiddle-embed></div>
3336
3337<a name="getRasterizer"></a>
3338## getRasterizer
3339
3340<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
3341SkRasterizer* getRasterizer() const
3342</pre>
3343
3344Returns <a href="bmh_undocumented?cl=9919#Rasterizer">Rasterizer</a> if set, or nullptr.
3345Does not alter <a href="bmh_undocumented?cl=9919#Rasterizer">Rasterizer</a> <a href="bmh_undocumented?cl=9919#Reference_Count">Reference Count</a>.
3346
3347### Return Value
3348
3349<a href="bmh_undocumented?cl=9919#Rasterizer">Rasterizer</a> if previously set, nullptr otherwise
3350
3351### Example
3352
3353<div><fiddle-embed name="0707d407c3a14388b107af8ae5873e55">
3354
3355#### Example Output
3356
3357~~~~
3358nullptr == rasterizer
3359nullptr != rasterizer
3360~~~~
3361
3362</fiddle-embed></div>
3363
3364---
3365
3366<a name="refRasterizer"></a>
3367## refRasterizer
3368
3369<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
3370sk_sp<SkRasterizer> refRasterizer() const
3371</pre>
3372
3373Returns <a href="bmh_undocumented?cl=9919#Rasterizer">Rasterizer</a> if set, or nullptr.
3374Increases <a href="bmh_undocumented?cl=9919#Rasterizer">Rasterizer</a> <a href="bmh_undocumented?cl=9919#Reference_Count">Reference Count</a> by one.
3375
3376### Return Value
3377
3378<a href="bmh_undocumented?cl=9919#Rasterizer">Rasterizer</a> if previously set, nullptr otherwise
3379
3380### Example
3381
3382<div><fiddle-embed name="c0855ce19a33cb7e5747750ef341b7b3">
3383
3384#### Example Output
3385
3386~~~~
3387rasterizer unique: true
3388rasterizer unique: false
3389~~~~
3390
3391</fiddle-embed></div>
3392
3393---
3394
3395<a name="setRasterizer"></a>
3396## setRasterizer
3397
3398<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
3399void setRasterizer(sk_sp<SkRasterizer> rasterizer)
3400</pre>
3401
3402Sets <a href="bmh_undocumented?cl=9919#Rasterizer">Rasterizer</a> to <a href="bmh_SkPaint_Reference?cl=9919#rasterizer">rasterizer</a>,
3403decrementing <a href="bmh_undocumented?cl=9919#Reference_Count">Reference Count</a> of the previous <a href="bmh_undocumented?cl=9919#Rasterizer">Rasterizer</a>.
3404Pass nullptr to clear <a href="bmh_undocumented?cl=9919#Rasterizer">Rasterizer</a> and leave <a href="bmh_undocumented?cl=9919#Rasterizer">Rasterizer</a> effect on <a href="bmh_undocumented?cl=9919#Mask_Alpha">Mask Alpha</a> unaltered.
3405Does not affect <a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a>.
3406Does not alter <a href="bmh_SkPaint_Reference?cl=9919#rasterizer">rasterizer</a> <a href="bmh_undocumented?cl=9919#Reference_Count">Reference Count</a>.
3407
3408### Parameters
3409
3410<table> <tr> <td><code><strong>rasterizer </strong></code></td> <td>
3411how geometry is converted to <a href="bmh_undocumented?cl=9919#Mask_Alpha">Mask Alpha</a></td>
3412 </tr>
3413</table>
3414
3415### Example
3416
3417<div><fiddle-embed name="aec8ed9296c1628073086a33039f62b7"></fiddle-embed></div>
3418
3419---
3420
3421# <a name="Image_Filter_Methods"></a> Image Filter Methods
3422<a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a> operates on the pixel representation of the shape, as modified by <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a>
3423with <a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a> set to <a href="bmh_undocumented?cl=9919#kSrcOver">SkBlendMode::kSrcOver</a>. <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a> creates a new bitmap,
3424which is drawn to the device using the set <a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a>.
3425<a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a> is higher level than <a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a>; for instance, an <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a>
3426can operate on all channels of <a href="bmh_undocumented?cl=9919#Color">Color</a>, while <a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a> generates <a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a> only.
3427<a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a> operates independently of and can be used in combination with
3428<a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a> and <a href="bmh_undocumented?cl=9919#Rasterizer">Rasterizer</a>.
3429
3430### Example
3431
3432<div><fiddle-embed name="88804938b49eb4f7c7f01ad52f4db0d8"></fiddle-embed></div>
3433
3434<a name="getImageFilter"></a>
3435## getImageFilter
3436
3437<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
3438SkImageFilter* getImageFilter() const
3439</pre>
3440
3441Returns <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a> if set, or nullptr.
3442Does not alter <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a> <a href="bmh_undocumented?cl=9919#Reference_Count">Reference Count</a>.
3443
3444### Return Value
3445
3446<a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a> if previously set, nullptr otherwise
3447
3448### Example
3449
3450<div><fiddle-embed name="38788d42772641606e08c60d9dd418a2">
3451
3452#### Example Output
3453
3454~~~~
3455nullptr == image filter
3456nullptr != image filter
3457~~~~
3458
3459</fiddle-embed></div>
3460
3461---
3462
3463<a name="refImageFilter"></a>
3464## refImageFilter
3465
3466<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
3467sk_sp<SkImageFilter> refImageFilter() const
3468</pre>
3469
3470Returns <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a> if set, or nullptr.
3471Increases <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a> <a href="bmh_undocumented?cl=9919#Reference_Count">Reference Count</a> by one.
3472
3473### Return Value
3474
3475<a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a> if previously set, nullptr otherwise
3476
3477### Example
3478
3479<div><fiddle-embed name="13f09088b569251547107d14ae989dc1">
3480
3481#### Example Output
3482
3483~~~~
3484image filter unique: true
3485image filter unique: false
3486~~~~
3487
3488</fiddle-embed></div>
3489
3490---
3491
3492<a name="setImageFilter"></a>
3493## setImageFilter
3494
3495<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
3496void setImageFilter(sk_sp<SkImageFilter> imageFilter)
3497</pre>
3498
3499Sets <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a> to <a href="bmh_SkPaint_Reference?cl=9919#imageFilter">imageFilter</a>,
3500decrementing <a href="bmh_undocumented?cl=9919#Reference_Count">Reference Count</a> of the previous <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a>.
3501Pass nullptr to clear <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a>, and remove <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a> effect
3502on drawing.
3503Does not affect <a href="bmh_undocumented?cl=9919#Rasterizer">Rasterizer</a> or <a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a>.
3504Does not alter <a href="bmh_SkPaint_Reference?cl=9919#imageFilter">imageFilter</a> <a href="bmh_undocumented?cl=9919#Reference_Count">Reference Count</a>.
3505
3506### Parameters
3507
3508<table> <tr> <td><code><strong>imageFilter </strong></code></td> <td>
3509how <a href="bmh_undocumented?cl=9919#Image">Image</a> is sampled when transformed</td>
3510 </tr>
3511</table>
3512
3513### Example
3514
3515<div><fiddle-embed name="6679d6e4ec632715ee03e68391bd7f9a"></fiddle-embed></div>
3516
3517---
3518
3519# <a name="Draw_Looper_Methods"></a> Draw Looper Methods
3520<a href="bmh_undocumented?cl=9919#Draw_Looper">Draw Looper</a> sets a modifier that communicates state from one <a href="bmh_undocumented?cl=9919#Draw_Layer">Draw Layer</a>
3521to another to construct the draw.
3522<a href="bmh_undocumented?cl=9919#Draw_Looper">Draw Looper</a> draws one or more times, modifying the canvas and paint each time.
3523<a href="bmh_undocumented?cl=9919#Draw_Looper">Draw Looper</a> may be used to draw multiple colors or create a colored shadow.
3524Set <a href="bmh_undocumented?cl=9919#Draw_Looper">Draw Looper</a> to nullptr to prevent <a href="bmh_undocumented?cl=9919#Draw_Looper">Draw Looper</a> from modifying the draw.
3525
3526### Example
3527
3528<div><fiddle-embed name="84ec12a36e50df5ac565cc7a75ffbe9f"></fiddle-embed></div>
3529
3530<a name="getDrawLooper"></a>
3531## getDrawLooper
3532
3533<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
3534SkDrawLooper* getDrawLooper() const
3535</pre>
3536
3537Returns <a href="bmh_undocumented?cl=9919#Draw_Looper">Draw Looper</a> if set, or nullptr.
3538Does not alter <a href="bmh_undocumented?cl=9919#Draw_Looper">Draw Looper</a> <a href="bmh_undocumented?cl=9919#Reference_Count">Reference Count</a>.
3539
3540### Return Value
3541
3542<a href="bmh_undocumented?cl=9919#Draw_Looper">Draw Looper</a> if previously set, nullptr otherwise
3543
3544### Example
3545
3546<div><fiddle-embed name="af4c5acc7a91e7f23c2af48018903ad4">
3547
3548#### Example Output
3549
3550~~~~
3551nullptr == draw looper
3552nullptr != draw looper
3553~~~~
3554
3555</fiddle-embed></div>
3556
3557---
3558
3559<a name="refDrawLooper"></a>
3560## refDrawLooper
3561
3562<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
3563sk_sp<SkDrawLooper> refDrawLooper() const
3564</pre>
3565
3566Returns <a href="bmh_undocumented?cl=9919#Draw_Looper">Draw Looper</a> if set, or nullptr.
3567Increases <a href="bmh_undocumented?cl=9919#Draw_Looper">Draw Looper</a> <a href="bmh_undocumented?cl=9919#Reference_Count">Reference Count</a> by one.
3568
3569### Return Value
3570
3571<a href="bmh_undocumented?cl=9919#Draw_Looper">Draw Looper</a> if previously set, nullptr otherwise
3572
3573### Example
3574
3575<div><fiddle-embed name="2a3782c33f04ed17a725d0e449c6f7c3">
3576
3577#### Example Output
3578
3579~~~~
3580draw looper unique: true
3581draw looper unique: false
3582~~~~
3583
3584</fiddle-embed></div>
3585
3586---
3587
3588<a name="getLooper"></a>
3589## getLooper
3590
3591<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
3592SkDrawLooper* getLooper() const
3593</pre>
3594
3595Deprecated.
3596
3597(see bug.skia.org/6259)
3598
3599### Return Value
3600
3601<a href="bmh_undocumented?cl=9919#Draw_Looper">Draw Looper</a> if previously set, nullptr otherwise
3602
3603---
3604
3605<a name="setDrawLooper"></a>
3606## setDrawLooper
3607
3608<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
3609void setDrawLooper(sk_sp<SkDrawLooper> drawLooper)
3610</pre>
3611
3612Sets <a href="bmh_undocumented?cl=9919#Draw_Looper">Draw Looper</a> to <a href="bmh_SkPaint_Reference?cl=9919#drawLooper">drawLooper</a>,
3613decrementing <a href="bmh_undocumented?cl=9919#Reference_Count">Reference Count</a> of the previous <a href="bmh_SkPaint_Reference?cl=9919#drawLooper">drawLooper</a>.
3614Pass nullptr to clear <a href="bmh_undocumented?cl=9919#Draw_Looper">Draw Looper</a> and leave <a href="bmh_undocumented?cl=9919#Draw_Looper">Draw Looper</a> effect on drawing unaltered.
Cary Clarkbad5ad72017-08-03 17:14:08 -04003615Does not alter <a href="bmh_SkPaint_Reference?cl=9919#drawLooper">drawLooper</a> <a href="bmh_undocumented?cl=9919#Reference_Count">Reference Count</a>.
Cary Clark12799e12017-07-28 15:18:29 -04003616
3617### Parameters
3618
3619<table> <tr> <td><code><strong>drawLooper </strong></code></td> <td>
3620Iterates through drawing one or more time, altering <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a></td>
3621 </tr>
3622</table>
3623
3624### Example
3625
3626<div><fiddle-embed name="bf10f838b330f0a3a3266d42ea68a638"></fiddle-embed></div>
3627
3628---
3629
3630<a name="setLooper"></a>
3631## setLooper
3632
3633<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
3634void setLooper(sk_sp<SkDrawLooper> drawLooper)
3635</pre>
3636
3637Deprecated.
3638
3639(see bug.skia.org/6259)
3640
3641### Parameters
3642
3643<table> <tr> <td><code><strong>drawLooper </strong></code></td> <td>
3644sets <a href="bmh_undocumented?cl=9919#Draw_Looper">Draw Looper</a> to <a href="bmh_SkPaint_Reference?cl=9919#drawLooper">drawLooper</a></td>
3645 </tr>
3646
3647---
3648
3649</table>
3650
3651# <a name="Text_Align"></a> Text Align
3652
3653## <a name="SkPaint::Align"></a> Enum SkPaint::Align
3654
3655<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0">
3656enum <a href="bmh_SkPaint_Reference?cl=9919#Align">Align</a> {
3657<a href="bmh_SkPaint_Reference?cl=9919#kLeft_Align">kLeft Align</a>,
3658<a href="bmh_SkPaint_Reference?cl=9919#kCenter_Align">kCenter Align</a>,
3659<a href="bmh_SkPaint_Reference?cl=9919#kRight_Align">kRight Align</a>,
3660};</pre>
3661
3662<a href="bmh_SkPaint_Reference?cl=9919#Align">Align</a> adjusts the text relative to the text position.
3663<a href="bmh_SkPaint_Reference?cl=9919#Align">Align</a> affects glyphs drawn with: <a href="bmh_SkCanvas_Reference?cl=9919#drawText">SkCanvas::drawText</a>, <a href="bmh_SkCanvas_Reference?cl=9919#drawPosText">SkCanvas::drawPosText</a>,
3664<a href="bmh_SkCanvas_Reference?cl=9919#drawPosTextH">SkCanvas::drawPosTextH</a>, <a href="bmh_SkCanvas_Reference?cl=9919#drawTextOnPath">SkCanvas::drawTextOnPath</a>,
3665<a href="bmh_SkCanvas_Reference?cl=9919#drawTextOnPathHV">SkCanvas::drawTextOnPathHV</a>, <a href="bmh_SkCanvas_Reference?cl=9919#drawTextRSXform">SkCanvas::drawTextRSXform</a>, <a href="bmh_SkCanvas_Reference?cl=9919#drawTextBlob">SkCanvas::drawTextBlob</a>,
3666and <a href="bmh_SkCanvas_Reference?cl=9919#drawString">SkCanvas::drawString</a>;
3667as well as calls that place text glyphs like <a href="bmh_SkPaint_Reference?cl=9919#getTextWidths">getTextWidths</a> and <a href="bmh_SkPaint_Reference?cl=9919#getTextPath">getTextPath</a>.
3668
3669The text position is set by the font for both horizontal and vertical text.
3670Typically, for horizontal text, the position is to the left side of the glyph on the
3671base line; and for vertical text, the position is the horizontal center of the glyph
3672at the caps height.
3673
3674<a href="bmh_SkPaint_Reference?cl=9919#Align">Align</a> adjusts the glyph position to center it or move it to abut the position
3675using the metrics returned by the font.
3676
3677<a href="bmh_SkPaint_Reference?cl=9919#Align">Align</a> defaults to <a href="bmh_SkPaint_Reference?cl=9919#kLeft_Align">kLeft Align</a>.
3678
3679### Constants
3680
3681<table>
3682 <tr>
3683 <td><a name="SkPaint::kLeft_Align"></a> <code><strong>SkPaint::kLeft_Align </strong></code></td><td>0</td><td>Leaves the glyph at the position computed by the font offset by the text position.</td>
3684 </tr>
3685 <tr>
3686 <td><a name="SkPaint::kCenter_Align"></a> <code><strong>SkPaint::kCenter_Align </strong></code></td><td>1</td><td>Moves the glyph half its width if <a href="bmh_SkPaint_Reference?cl=9919#Flags">Flags</a> has <a href="bmh_SkPaint_Reference?cl=9919#kVerticalText_Flag">kVerticalText Flag</a> clear, and
3687half its height if <a href="bmh_SkPaint_Reference?cl=9919#Flags">Flags</a> has <a href="bmh_SkPaint_Reference?cl=9919#kVerticalText_Flag">kVerticalText Flag</a> set.</td>
3688 </tr>
3689 <tr>
3690 <td><a name="SkPaint::kRight_Align"></a> <code><strong>SkPaint::kRight_Align </strong></code></td><td>2</td><td>Moves the glyph by its width if <a href="bmh_SkPaint_Reference?cl=9919#Flags">Flags</a> has <a href="bmh_SkPaint_Reference?cl=9919#kVerticalText_Flag">kVerticalText Flag</a> clear,
3691and by its height if <a href="bmh_SkPaint_Reference?cl=9919#Flags">Flags</a> has <a href="bmh_SkPaint_Reference?cl=9919#kVerticalText_Flag">kVerticalText Flag</a> set.</td>
3692 </tr>
3693
3694</table>
3695
3696## <a name="SkPaint::_anonymous_2"></a> Enum SkPaint::_anonymous_2
3697
3698<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0">
3699enum {
Cary Clarkbad5ad72017-08-03 17:14:08 -04003700<a href="bmh_SkPaint_Reference?cl=9919#kAlignCount">kAlignCount</a> = 3,
Cary Clark12799e12017-07-28 15:18:29 -04003701};</pre>
3702
3703### Constants
3704
3705<table>
3706 <tr>
3707 <td><a name="SkPaint::kAlignCount"></a> <code><strong>SkPaint::kAlignCount </strong></code></td><td>3</td><td>The number of different <a href="bmh_SkPaint_Reference?cl=9919#Text_Align">Text Align</a> values defined.</td>
3708 </tr>
3709
3710</table>
3711
3712### Example
3713
3714<div><fiddle-embed name="702617fd9ebc3f12e30081b5db93e8a8"><div>Each position separately moves the glyph in drawPosText.</div></fiddle-embed></div>
3715
3716### Example
3717
3718<div><fiddle-embed name="f1cbbbafe6b3c52b81309cccbf96a308"><div><a href="bmh_SkPaint_Reference?cl=9919#Vertical_Text">Vertical Text</a> treats <a href="bmh_SkPaint_Reference?cl=9919#kLeft_Align">kLeft Align</a> as top align, and <a href="bmh_SkPaint_Reference?cl=9919#kRight_Align">kRight Align</a> as bottom align.</div></fiddle-embed></div>
3719
3720<a name="getTextAlign"></a>
3721## getTextAlign
3722
3723<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
3724Align getTextAlign() const
3725</pre>
3726
3727Returns <a href="bmh_SkPaint_Reference?cl=9919#Text_Align">Text Align</a>.
3728Returns <a href="bmh_SkPaint_Reference?cl=9919#kLeft_Align">kLeft Align</a> if <a href="bmh_SkPaint_Reference?cl=9919#Text_Align">Text Align</a> has not been set.
3729
3730### Return Value
3731
3732text placement relative to position
3733
3734### Example
3735
3736<div><fiddle-embed name="2df932f526e810f74c89d30ec3f4c947">
3737
3738#### Example Output
3739
3740~~~~
3741kLeft_Align == default
3742~~~~
3743
3744</fiddle-embed></div>
3745
3746---
3747
3748<a name="setTextAlign"></a>
3749## setTextAlign
3750
3751<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
3752void setTextAlign(Align align)
3753</pre>
3754
3755Sets <a href="bmh_SkPaint_Reference?cl=9919#Text_Align">Text Align</a> to <a href="bmh_SkPaint_Reference?cl=9919#align">align</a>.
3756Has no effect if <a href="bmh_SkPaint_Reference?cl=9919#align">align</a> is an invalid value.
3757
3758### Parameters
3759
3760<table> <tr> <td><code><strong>align </strong></code></td> <td>
3761text placement relative to position</td>
3762 </tr>
3763</table>
3764
3765### Example
3766
3767<div><fiddle-embed name="d37540afd918506ac2594665ca63979b"><div><a href="bmh_undocumented?cl=9919#Text">Text</a> is left-aligned by default, and then set to center. Setting the
3768alignment out of range has no effect.</div></fiddle-embed></div>
3769
3770---
3771
3772# <a name="Text_Size"></a> Text Size
3773<a href="bmh_SkPaint_Reference?cl=9919#Text_Size">Text Size</a> adjusts the overall text size in points.
3774<a href="bmh_SkPaint_Reference?cl=9919#Text_Size">Text Size</a> can be set to any positive value or zero.
3775<a href="bmh_SkPaint_Reference?cl=9919#Text_Size">Text Size</a> defaults to 12.
3776Set <a href="bmh_undocumented?cl=9919#SkPaintDefaults_TextSize">SkPaintDefaults TextSize</a> at compile time to change the default setting.
3777
3778### Example
3779
3780<div><fiddle-embed name="91c9a3e498bb9412e4522a95d076ed5f"></fiddle-embed></div>
3781
3782<a name="getTextSize"></a>
3783## getTextSize
3784
3785<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
3786SkScalar getTextSize() const
3787</pre>
3788
3789Returns <a href="bmh_SkPaint_Reference?cl=9919#Text_Size">Text Size</a> in points.
3790
3791### Return Value
3792
3793typographic height of text
3794
3795### Example
3796
3797<div><fiddle-embed name="983e2a71ba72d4ba8c945420040b8f1c"></fiddle-embed></div>
3798
3799---
3800
3801<a name="setTextSize"></a>
3802## setTextSize
3803
3804<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
3805void setTextSize(SkScalar textSize)
3806</pre>
3807
3808Sets <a href="bmh_SkPaint_Reference?cl=9919#Text_Size">Text Size</a> in points.
3809Has no effect if <a href="bmh_SkPaint_Reference?cl=9919#textSize">textSize</a> is not greater than or equal to zero.
3810
3811### Parameters
3812
3813<table> <tr> <td><code><strong>textSize </strong></code></td> <td>
3814typographic height of text</td>
3815 </tr>
3816</table>
3817
3818### Example
3819
3820<div><fiddle-embed name="6510c9e2f57b83c47e67829e7a68d493"></fiddle-embed></div>
3821
3822---
3823
3824# <a name="Text_Scale_X"></a> Text Scale X
3825<a href="bmh_SkPaint_Reference?cl=9919#Text_Scale_X">Text Scale X</a> adjusts the text horizontal scale.
3826<a href="bmh_undocumented?cl=9919#Text">Text</a> scaling approximates condensed and expanded type faces when the actual face
3827is not available.
3828<a href="bmh_SkPaint_Reference?cl=9919#Text_Scale_X">Text Scale X</a> can be set to any value.
3829<a href="bmh_SkPaint_Reference?cl=9919#Text_Scale_X">Text Scale X</a> defaults to 1.
3830
3831### Example
3832
3833<div><fiddle-embed name="d13d787c1e36f515319fc998411c1d91"></fiddle-embed></div>
3834
3835<a name="getTextScaleX"></a>
3836## getTextScaleX
3837
3838<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
3839SkScalar getTextScaleX() const
3840</pre>
3841
3842Returns <a href="bmh_SkPaint_Reference?cl=9919#Text_Scale_X">Text Scale X</a>.
3843Default value is 1.
3844
3845### Return Value
3846
3847text horizontal scale
3848
3849### Example
3850
3851<div><fiddle-embed name="5dc8e58f6910cb8e4de9ed60f888188b"></fiddle-embed></div>
3852
3853---
3854
3855<a name="setTextScaleX"></a>
3856## setTextScaleX
3857
3858<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
3859void setTextScaleX(SkScalar scaleX)
3860</pre>
3861
3862Sets <a href="bmh_SkPaint_Reference?cl=9919#Text_Scale_X">Text Scale X</a>.
3863Default value is 1.
3864
3865### Parameters
3866
3867<table> <tr> <td><code><strong>scaleX </strong></code></td> <td>
3868text horizontal scale</td>
3869 </tr>
3870</table>
3871
3872### Example
3873
3874<div><fiddle-embed name="a75bbdb8bb866b125c4c1dd5e967d470"></fiddle-embed></div>
3875
3876---
3877
3878# <a name="Text_Skew_X"></a> Text Skew X
3879<a href="bmh_SkPaint_Reference?cl=9919#Text_Skew_X">Text Skew X</a> adjusts the text horizontal slant.
3880<a href="bmh_undocumented?cl=9919#Text">Text</a> skewing approximates italic and oblique type faces when the actual face
3881is not available.
3882<a href="bmh_SkPaint_Reference?cl=9919#Text_Skew_X">Text Skew X</a> can be set to any value.
3883<a href="bmh_SkPaint_Reference?cl=9919#Text_Skew_X">Text Skew X</a> defaults to 0.
3884
3885### Example
3886
3887<div><fiddle-embed name="aff208b0aab265f273045b27e683c17c"></fiddle-embed></div>
3888
3889<a name="getTextSkewX"></a>
3890## getTextSkewX
3891
3892<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
3893SkScalar getTextSkewX() const
3894</pre>
3895
3896Returns <a href="bmh_SkPaint_Reference?cl=9919#Text_Skew_X">Text Skew X</a>.
3897Default value is zero.
3898
3899### Return Value
3900
3901additional shear in x-axis relative to y-axis
3902
3903### Example
3904
3905<div><fiddle-embed name="11c10f466dae0d1639dbb9f6a0040218"></fiddle-embed></div>
3906
3907---
3908
3909<a name="setTextSkewX"></a>
3910## setTextSkewX
3911
3912<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
3913void setTextSkewX(SkScalar skewX)
3914</pre>
3915
3916Sets <a href="bmh_SkPaint_Reference?cl=9919#Text_Skew_X">Text Skew X</a>.
3917Default value is zero.
3918
3919### Parameters
3920
3921<table> <tr> <td><code><strong>skewX </strong></code></td> <td>
3922additional shear in x-axis relative to y-axis</td>
3923 </tr>
3924</table>
3925
3926### Example
3927
3928<div><fiddle-embed name="6bd705a6e0c5f8ee24f302fe531bfabc"></fiddle-embed></div>
3929
3930---
3931
3932# <a name="Text_Encoding"></a> Text Encoding
3933
3934## <a name="SkPaint::TextEncoding"></a> Enum SkPaint::TextEncoding
3935
3936<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0">
3937enum <a href="bmh_SkPaint_Reference?cl=9919#TextEncoding">TextEncoding</a> {
3938<a href="bmh_SkPaint_Reference?cl=9919#kUTF8_TextEncoding">kUTF8 TextEncoding</a>,
3939<a href="bmh_SkPaint_Reference?cl=9919#kUTF16_TextEncoding">kUTF16 TextEncoding</a>,
3940<a href="bmh_SkPaint_Reference?cl=9919#kUTF32_TextEncoding">kUTF32 TextEncoding</a>,
Cary Clarkbad5ad72017-08-03 17:14:08 -04003941<a href="bmh_SkPaint_Reference?cl=9919#kGlyphID_TextEncoding">kGlyphID TextEncoding</a>,
Cary Clark12799e12017-07-28 15:18:29 -04003942};</pre>
3943
3944<a href="bmh_SkPaint_Reference?cl=9919#TextEncoding">TextEncoding</a> determines whether text specifies character codes and their encoded size,
3945or glyph indices. Character codes use the encoding specified by the<a href="bmh_undocumented?cl=9919#Unicode">Unicode</a> standardhttp://unicode.org/standard/standard.html.
3946Character codes encoded size are specified by <a href="bmh_undocumented?cl=9919#UTF_8">UTF-8</a>, <a href="bmh_undocumented?cl=9919#UTF_16">UTF-16</a>, or <a href="bmh_undocumented?cl=9919#UTF_32">UTF-32</a>.
3947All character encoding are able to represent all of <a href="bmh_undocumented?cl=9919#Unicode">Unicode</a>, differing only
3948in the total storage required.
3949
3950<a href="bmh_undocumented?cl=9919#UTF_8">UTF-8</a> (<a href="bmh_undocumented?cl=9919#RFC">RFC</a> 3629)https://tools.ietf.org/html/rfc3629is made up of 8-bit bytes,
3951and is a superset of <a href="bmh_undocumented?cl=9919#ASCII">ASCII</a>.
3952<a href="bmh_undocumented?cl=9919#UTF_16">UTF-16</a> (<a href="bmh_undocumented?cl=9919#RFC">RFC</a> 2781)https://tools.ietf.org/html/rfc2781is made up of 16-bit words,
3953and is a superset of <a href="bmh_undocumented?cl=9919#Unicode">Unicode</a> ranges 0x0000 to 0xD7FF and 0xE000 to 0xFFFF.
3954<a href="bmh_undocumented?cl=9919#UTF_32">UTF-32</a>http://www.unicode.org/versions/<a href="bmh_undocumented?cl=9919#Unicode5">Unicode5</a>.0.0/ch03.pdfis
3955made up of 32-bit words, and is a superset of <a href="bmh_undocumented?cl=9919#Unicode">Unicode</a>.
3956
3957<a href="bmh_undocumented?cl=9919#Font_Manager">Font Manager</a> uses font data to convert character code points into glyph indices.
3958A glyph index is a 16-bit word.
3959
3960<a href="bmh_SkPaint_Reference?cl=9919#TextEncoding">TextEncoding</a> is set to <a href="bmh_SkPaint_Reference?cl=9919#kUTF8_TextEncoding">kUTF8 TextEncoding</a> by default.
3961
3962### Constants
3963
3964<table>
3965 <tr>
3966 <td><a name="SkPaint::kUTF8_TextEncoding"></a> <code><strong>SkPaint::kUTF8_TextEncoding </strong></code></td><td>0</td><td>Uses bytes to represent <a href="bmh_undocumented?cl=9919#UTF_8">UTF-8</a> or <a href="bmh_undocumented?cl=9919#ASCII">ASCII</a>.</td>
3967 </tr>
3968 <tr>
3969 <td><a name="SkPaint::kUTF16_TextEncoding"></a> <code><strong>SkPaint::kUTF16_TextEncoding </strong></code></td><td>1</td><td>Uses two byte words to represent most of <a href="bmh_undocumented?cl=9919#Unicode">Unicode</a>.</td>
3970 </tr>
3971 <tr>
3972 <td><a name="SkPaint::kUTF32_TextEncoding"></a> <code><strong>SkPaint::kUTF32_TextEncoding </strong></code></td><td>2</td><td>Uses four byte words to represent all of <a href="bmh_undocumented?cl=9919#Unicode">Unicode</a>.</td>
3973 </tr>
3974 <tr>
3975 <td><a name="SkPaint::kGlyphID_TextEncoding"></a> <code><strong>SkPaint::kGlyphID_TextEncoding </strong></code></td><td>3</td><td>Uses two byte words to represent glyph indices.</td>
3976 </tr>
3977
3978</table>
3979
3980### Example
3981
3982<div><fiddle-embed name="b29294e7f29d160a1b46abf2dcec9d2a"><div>First line has <a href="bmh_undocumented?cl=9919#UTF_8">UTF-8</a> encoding.
3983Second line has <a href="bmh_undocumented?cl=9919#UTF_16">UTF-16</a> encoding.
3984Third line has <a href="bmh_undocumented?cl=9919#UTF_32">UTF-32</a> encoding.
3985Fourth line has 16 bit glyph indices.</div></fiddle-embed></div>
3986
3987<a name="getTextEncoding"></a>
3988## getTextEncoding
3989
3990<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
3991TextEncoding getTextEncoding() const
3992</pre>
3993
3994Returns <a href="bmh_SkPaint_Reference?cl=9919#Text_Encoding">Text Encoding</a>.
3995<a href="bmh_SkPaint_Reference?cl=9919#Text_Encoding">Text Encoding</a> determines how character code points are mapped to font glyph indices.
3996
3997### Return Value
3998
3999one of: <a href="bmh_SkPaint_Reference?cl=9919#kUTF8_TextEncoding">kUTF8 TextEncoding</a>, <a href="bmh_SkPaint_Reference?cl=9919#kUTF16_TextEncoding">kUTF16 TextEncoding</a>, <a href="bmh_SkPaint_Reference?cl=9919#kUTF32_TextEncoding">kUTF32 TextEncoding</a>, or
4000<a href="bmh_SkPaint_Reference?cl=9919#kGlyphID_TextEncoding">kGlyphID TextEncoding</a>
4001
4002### Example
4003
4004<div><fiddle-embed name="70ad28bbf7668b38474d7f225e3540bc">
4005
4006#### Example Output
4007
4008~~~~
4009kUTF8_TextEncoding == text encoding
4010kGlyphID_TextEncoding == text encoding
4011~~~~
4012
4013</fiddle-embed></div>
4014
4015---
4016
4017<a name="setTextEncoding"></a>
4018## setTextEncoding
4019
4020<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
4021void setTextEncoding(TextEncoding encoding)
4022</pre>
4023
4024Sets <a href="bmh_SkPaint_Reference?cl=9919#Text_Encoding">Text Encoding</a> to <a href="bmh_SkPaint_Reference?cl=9919#setTextEncoding">encoding</a>.
4025<a href="bmh_SkPaint_Reference?cl=9919#Text_Encoding">Text Encoding</a> determines how character code points are mapped to font glyph indices.
4026Invalid values for <a href="bmh_SkPaint_Reference?cl=9919#setTextEncoding">encoding</a> are ignored.
4027
4028### Parameters
4029
4030<table> <tr> <td><code><strong>encoding </strong></code></td> <td>
Cary Clarkbad5ad72017-08-03 17:14:08 -04004031one of: <a href="bmh_SkPaint_Reference?cl=9919#kUTF8_TextEncoding">kUTF8 TextEncoding</a>, <a href="bmh_SkPaint_Reference?cl=9919#kUTF16_TextEncoding">kUTF16 TextEncoding</a>, <a href="bmh_SkPaint_Reference?cl=9919#kUTF32_TextEncoding">kUTF32 TextEncoding</a>, or
4032<a href="bmh_SkPaint_Reference?cl=9919#kGlyphID_TextEncoding">kGlyphID TextEncoding</a></td>
Cary Clark12799e12017-07-28 15:18:29 -04004033 </tr>
Cary Clarkbad5ad72017-08-03 17:14:08 -04004034#
4035
Cary Clark12799e12017-07-28 15:18:29 -04004036</table>
4037
4038### Example
4039
4040<div><fiddle-embed name="329b92fbc35151dee9aa0c0e70107665">
4041
4042#### Example Output
4043
4044~~~~
40454 != text encoding
4046~~~~
4047
4048</fiddle-embed></div>
4049
4050---
4051
4052# <a name="Font_Metrics"></a> Font Metrics
4053<a href="bmh_SkPaint_Reference?cl=9919#Font_Metrics">Font Metrics</a> describe dimensions common to the glyphs in <a href="bmh_undocumented?cl=9919#Typeface">Typeface</a>.
4054The dimensions are computed by <a href="bmh_undocumented?cl=9919#Font_Manager">Font Manager</a> from font data and do not take
4055<a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> settings other than <a href="bmh_SkPaint_Reference?cl=9919#Text_Size">Text Size</a> into account.
4056
4057<a href="bmh_undocumented?cl=9919#Font">Font</a> dimensions specify the anchor to the left of the glyph at baseline as the origin.
4058X-axis values to the left of the glyph are negative, and to the right of the left glyph edge
4059are positive.
4060Y-axis values above the baseline are negative, and below the baseline are positive.
4061
4062### Example
4063
4064<div><fiddle-embed name="b5b76e0a15da0c3530071186a9006498"></fiddle-embed></div>
4065
4066# <a name="SkPaint::FontMetrics"></a> Struct SkPaint::FontMetrics
4067
4068<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0">
4069struct <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics">FontMetrics</a> {
4070enum <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_FontMetricsFlags">FontMetricsFlags</a> {
4071<a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_kUnderlineThicknessIsValid_Flag">kUnderlineThicknessIsValid Flag</a> = 1 << 0,
4072<a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_kUnderlinePositionIsValid_Flag">kUnderlinePositionIsValid Flag</a> = 1 << 1,
4073<a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_kStrikeoutThicknessIsValid_Flag">kStrikeoutThicknessIsValid Flag</a> = 1 << 2,
4074<a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_kStrikeoutPositionIsValid_Flag">kStrikeoutPositionIsValid Flag</a> = 1 << 3,
4075};
4076
4077uint32_t <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_fFlags">fFlags</a>;
4078<a href="bmh_undocumented?cl=9919#SkScalar">SkScalar</a> <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_fTop">fTop</a>;
4079<a href="bmh_undocumented?cl=9919#SkScalar">SkScalar</a> <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_fAscent">fAscent</a>;
4080<a href="bmh_undocumented?cl=9919#SkScalar">SkScalar</a> <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_fDescent">fDescent</a>;
4081<a href="bmh_undocumented?cl=9919#SkScalar">SkScalar</a> <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_fBottom">fBottom</a>;
4082<a href="bmh_undocumented?cl=9919#SkScalar">SkScalar</a> <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_fLeading">fLeading</a>;
4083<a href="bmh_undocumented?cl=9919#SkScalar">SkScalar</a> <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_fAvgCharWidth">fAvgCharWidth</a>;
4084<a href="bmh_undocumented?cl=9919#SkScalar">SkScalar</a> <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_fMaxCharWidth">fMaxCharWidth</a>;
4085<a href="bmh_undocumented?cl=9919#SkScalar">SkScalar</a> <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_fXMin">fXMin</a>;
4086<a href="bmh_undocumented?cl=9919#SkScalar">SkScalar</a> <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_fXMax">fXMax</a>;
4087<a href="bmh_undocumented?cl=9919#SkScalar">SkScalar</a> <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_fXHeight">fXHeight</a>;
4088<a href="bmh_undocumented?cl=9919#SkScalar">SkScalar</a> <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_fCapHeight">fCapHeight</a>;
4089<a href="bmh_undocumented?cl=9919#SkScalar">SkScalar</a> <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_fUnderlineThickness">fUnderlineThickness</a>;
4090<a href="bmh_undocumented?cl=9919#SkScalar">SkScalar</a> <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_fUnderlinePosition">fUnderlinePosition</a>;
4091<a href="bmh_undocumented?cl=9919#SkScalar">SkScalar</a> <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_fStrikeoutThickness">fStrikeoutThickness</a>;
4092<a href="bmh_undocumented?cl=9919#SkScalar">SkScalar</a> <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_fStrikeoutPosition">fStrikeoutPosition</a>;
4093
4094bool <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_hasUnderlineThickness">hasUnderlineThickness(SkScalar* thickness)</a> const;
4095bool <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_hasUnderlinePosition">hasUnderlinePosition(SkScalar* position)</a> const;
4096bool <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_hasStrikeoutThickness">hasStrikeoutThickness(SkScalar* thickness)</a> const;
4097bool <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_hasStrikeoutPosition">hasStrikeoutPosition(SkScalar* position)</a> const;
4098};</pre>
4099
4100<a href="bmh_SkPaint_Reference?cl=9919#FontMetrics">FontMetrics</a> is filled out by <a href="bmh_SkPaint_Reference?cl=9919#getFontMetrics">getFontMetrics</a>. <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics">FontMetrics</a> contents reflect the values
4101computed by <a href="bmh_undocumented?cl=9919#Font_Manager">Font Manager</a> using <a href="bmh_undocumented?cl=9919#Typeface">Typeface</a>. Values are set to zero if they are
4102not availble.
4103
4104<a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_fUnderlineThickness">fUnderlineThickness</a> and <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_fUnderlinePosition">fUnderlinePosition</a> have a bit set in <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_fFlags">fFlags</a> if their values
4105are valid, since their value may be zero.
4106<a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_fStrikeoutThickness">fStrikeoutThickness</a> and <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_fStrikeoutPosition">fStrikeoutPosition</a> have a bit set in <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_fFlags">fFlags</a> if their values
4107are valid, since their value may be zero.
4108
4109## <a name="SkPaint::FontMetrics::FontMetricsFlags"></a> Enum SkPaint::FontMetrics::FontMetricsFlags
4110
4111<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0">
4112enum <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_FontMetricsFlags">FontMetricsFlags</a> {
4113<a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_kUnderlineThicknessIsValid_Flag">kUnderlineThicknessIsValid Flag</a> = 1 << 0,
4114<a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_kUnderlinePositionIsValid_Flag">kUnderlinePositionIsValid Flag</a> = 1 << 1,
4115<a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_kStrikeoutThicknessIsValid_Flag">kStrikeoutThicknessIsValid Flag</a> = 1 << 2,
4116<a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_kStrikeoutPositionIsValid_Flag">kStrikeoutPositionIsValid Flag</a> = 1 << 3,
4117};</pre>
4118
4119<a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_FontMetricsFlags">FontMetricsFlags</a> are set in <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_fFlags">fFlags</a> when underline and strikeout metrics are valid;
4120the underline or strikeout metric may be valid and zero.
4121Fonts with embedded bitmaps may not have valid underline or strikeout metrics.
4122
4123### Constants
4124
4125<table>
4126 <tr>
4127 <td><a name="SkPaint::FontMetrics::kUnderlineThicknessIsValid_Flag"></a> <code><strong>SkPaint::FontMetrics::kUnderlineThicknessIsValid_Flag </strong></code></td><td>0x0001</td><td>Set if <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_fUnderlineThickness">fUnderlineThickness</a> is valid.</td>
4128 </tr>
4129 <tr>
4130 <td><a name="SkPaint::FontMetrics::kUnderlinePositionIsValid_Flag"></a> <code><strong>SkPaint::FontMetrics::kUnderlinePositionIsValid_Flag </strong></code></td><td>0x0002</td><td>Set if <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_fUnderlinePosition">fUnderlinePosition</a> is valid.</td>
4131 </tr>
4132 <tr>
4133 <td><a name="SkPaint::FontMetrics::kStrikeoutThicknessIsValid_Flag"></a> <code><strong>SkPaint::FontMetrics::kStrikeoutThicknessIsValid_Flag </strong></code></td><td>0x0004</td><td>Set if <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_fStrikeoutThickness">fStrikeoutThickness</a> is valid.</td>
4134 </tr>
4135 <tr>
4136 <td><a name="SkPaint::FontMetrics::kStrikeoutPositionIsValid_Flag"></a> <code><strong>SkPaint::FontMetrics::kStrikeoutPositionIsValid_Flag </strong></code></td><td>0x0008</td><td>Set if <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_fStrikeoutPosition">fStrikeoutPosition</a> is valid.</td>
4137 </tr>
4138
4139</table>
4140
4141<code><strong>uint32_t fFlags</strong></code>
4142
4143<a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_fFlags">fFlags</a> is set when underline metrics are valid.
4144
4145<code><strong>SkScalar fTop</strong></code>
4146
4147Largest height for any glyph.
4148A measure from the baseline, and is less than or equal to zero.
4149
4150<code><strong>SkScalar fAscent</strong></code>
4151
4152Recommended distance above the baseline to reserve for a line of text.
4153A measure from the baseline, and is less than or equal to zero.
4154
4155<code><strong>SkScalar fDescent</strong></code>
4156
4157Recommended distance below the baseline to reserve for a line of text.
4158A measure from the baseline, and is greater than or equal to zero.
4159
4160<code><strong>SkScalar fBottom</strong></code>
4161
4162Greatest extent below the baseline for any glyph.
4163A measure from the baseline, and is greater than or equal to zero.
4164
4165<code><strong>SkScalar fLeading</strong></code>
4166
4167Recommended distance to add between lines of text.
4168Greater than or equal to zero.
4169
4170<code><strong>SkScalar fAvgCharWidth</strong></code>
4171
4172Average character width, if it is available.
4173Zero if no average width is stored in the font.
4174
4175<code><strong>SkScalar fMaxCharWidth</strong></code>
4176
4177Maximum character width.
4178
4179<code><strong>SkScalar fXMin</strong></code>
4180
4181Minimum bounding box x value for all glyphs.
4182Typically less than zero.
4183
4184<code><strong>SkScalar fXMax</strong></code>
4185
4186Maximum bounding box x value for all glyphs.
4187Typically greater than zero.
4188
4189<code><strong>SkScalar fXHeight</strong></code>
4190
4191Height of a lower-case 'x'.
4192May be zero if no lower-case height is stored in the font.
4193
4194<code><strong>SkScalar fCapHeight</strong></code>
4195
4196Height of an upper-case letter.
4197May be zero if no upper-case height is stored in the font.
4198
4199<code><strong>SkScalar fUnderlineThickness</strong></code>
4200
4201Underline thickness. If the metric
4202is valid, the <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_kUnderlineThicknessIsValid_Flag">kUnderlineThicknessIsValid Flag</a> is set in <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_fFlags">fFlags</a>.
4203If <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_kUnderlineThicknessIsValid_Flag">kUnderlineThicknessIsValid Flag</a> is clear, <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_fUnderlineThickness">fUnderlineThickness</a> is zero.
4204
4205<code><strong>SkScalar fUnderlinePosition</strong></code>
4206
4207Underline position relative to the baseline.
4208It may be negative, to draw the underline above the baseline, zero
4209to draw the underline on the baseline, or positive to draw the underline
4210below the baseline.
4211
4212If the metric is valid, the <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_kUnderlinePositionIsValid_Flag">kUnderlinePositionIsValid Flag</a> is set in <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_fFlags">fFlags</a>.
4213If <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_kUnderlinePositionIsValid_Flag">kUnderlinePositionIsValid Flag</a> is clear, <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_fUnderlinePosition">fUnderlinePosition</a> is zero.
4214
4215<code><strong>SkScalar fStrikeoutThickness</strong></code>
4216
4217Strikeout thickness. If the metric
4218is valid, the <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_kStrikeoutThicknessIsValid_Flag">kStrikeoutThicknessIsValid Flag</a> is set in <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_fFlags">fFlags</a>.
4219If <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_kStrikeoutThicknessIsValid_Flag">kStrikeoutThicknessIsValid Flag</a> is clear, <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_fStrikeoutThickness">fStrikeoutThickness</a> is zero.
4220
4221<code><strong>SkScalar fStrikeoutPosition</strong></code>
4222
4223Strikeout position relative to the baseline.
4224It may be negative, to draw the strikeout above the baseline, zero
4225to draw the strikeout on the baseline, or positive to draw the strikeout
4226below the baseline.
4227
4228If the metric is valid, the <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_kStrikeoutPositionIsValid_Flag">kStrikeoutPositionIsValid Flag</a> is set in <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_fFlags">fFlags</a>.
4229If <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_kStrikeoutPositionIsValid_Flag">kStrikeoutPositionIsValid Flag</a> is clear, <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_fStrikeoutPosition">fStrikeoutPosition</a> is zero.
4230
4231<a name="hasUnderlineThickness"></a>
4232## hasUnderlineThickness
4233
4234<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
4235bool hasUnderlineThickness(SkScalar* thickness) const
4236</pre>
4237
4238If <a href="bmh_SkPaint_Reference?cl=9919#Font_Metrics">Font Metrics</a> has a valid underline <a href="bmh_SkPaint_Reference?cl=9919#thickness">thickness</a>, return true, and set
4239<a href="bmh_SkPaint_Reference?cl=9919#thickness">thickness</a> to that value. If it doesn't, return false, and ignore
4240<a href="bmh_SkPaint_Reference?cl=9919#thickness">thickness</a>.
4241
4242### Parameters
4243
4244<table> <tr> <td><code><strong>thickness </strong></code></td> <td>
4245storage for underline width</td>
4246 </tr>
4247</table>
4248
4249### Return Value
4250
4251true if font specifies underline width
4252
4253---
4254
4255<a name="hasUnderlinePosition"></a>
4256## hasUnderlinePosition
4257
4258<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
4259bool hasUnderlinePosition(SkScalar* position) const
4260</pre>
4261
4262If <a href="bmh_SkPaint_Reference?cl=9919#Font_Metrics">Font Metrics</a> has a valid underline <a href="bmh_SkPaint_Reference?cl=9919#position">position</a>, return true, and set
4263<a href="bmh_SkPaint_Reference?cl=9919#position">position</a> to that value. If it doesn't, return false, and ignore
4264<a href="bmh_SkPaint_Reference?cl=9919#position">position</a>.
4265
4266### Parameters
4267
4268<table> <tr> <td><code><strong>position </strong></code></td> <td>
4269storage for underline <a href="bmh_SkPaint_Reference?cl=9919#position">position</a></td>
4270 </tr>
4271</table>
4272
4273### Return Value
4274
4275true if font specifies underline <a href="bmh_SkPaint_Reference?cl=9919#position">position</a>
4276
4277---
4278
4279<a name="hasStrikeoutThickness"></a>
4280## hasStrikeoutThickness
4281
4282<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
4283bool hasStrikeoutThickness(SkScalar* thickness) const
4284</pre>
4285
4286If <a href="bmh_SkPaint_Reference?cl=9919#Font_Metrics">Font Metrics</a> has a valid strikeout <a href="bmh_SkPaint_Reference?cl=9919#thickness">thickness</a>, return true, and set
4287<a href="bmh_SkPaint_Reference?cl=9919#thickness">thickness</a> to that value. If it doesn't, return false, and ignore
4288<a href="bmh_SkPaint_Reference?cl=9919#thickness">thickness</a>.
4289
4290### Parameters
4291
4292<table> <tr> <td><code><strong>thickness </strong></code></td> <td>
4293storage for strikeout width</td>
4294 </tr>
4295</table>
4296
4297### Return Value
4298
4299true if font specifies strikeout width
4300
4301---
4302
4303<a name="hasStrikeoutPosition"></a>
4304## hasStrikeoutPosition
4305
4306<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
4307bool hasStrikeoutPosition(SkScalar* position) const
4308</pre>
4309
4310If <a href="bmh_SkPaint_Reference?cl=9919#Font_Metrics">Font Metrics</a> has a valid strikeout <a href="bmh_SkPaint_Reference?cl=9919#position">position</a>, return true, and set
4311<a href="bmh_SkPaint_Reference?cl=9919#position">position</a> to that value. If it doesn't, return false, and ignore
4312<a href="bmh_SkPaint_Reference?cl=9919#position">position</a>.
4313
4314### Parameters
4315
4316<table> <tr> <td><code><strong>position </strong></code></td> <td>
4317storage for strikeout <a href="bmh_SkPaint_Reference?cl=9919#position">position</a></td>
4318 </tr>
4319</table>
4320
4321### Return Value
4322
4323true if font specifies strikeout <a href="bmh_SkPaint_Reference?cl=9919#position">position</a>
4324
4325---
4326
4327<a name="getFontMetrics"></a>
4328## getFontMetrics
4329
4330<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
4331SkScalar getFontMetrics(FontMetrics* metrics, SkScalar scale = 0) const
4332</pre>
4333
4334Returns <a href="bmh_SkPaint_Reference?cl=9919#Font_Metrics">Font Metrics</a> associated with <a href="bmh_undocumented?cl=9919#Typeface">Typeface</a>.
4335The return value is the recommended spacing between lines: the sum of <a href="bmh_SkPaint_Reference?cl=9919#metrics">metrics</a>
4336descent, ascent, and leading.
4337If <a href="bmh_SkPaint_Reference?cl=9919#metrics">metrics</a> is not nullptr, <a href="bmh_SkPaint_Reference?cl=9919#Font_Metrics">Font Metrics</a> is copied to <a href="bmh_SkPaint_Reference?cl=9919#metrics">metrics</a>.
4338Results are scaled by <a href="bmh_SkPaint_Reference?cl=9919#Text_Size">Text Size</a> but does not take into account
4339dimensions required by <a href="bmh_SkPaint_Reference?cl=9919#Text_Scale_X">Text Scale X</a>, <a href="bmh_SkPaint_Reference?cl=9919#Text_Skew_X">Text Skew X</a>, <a href="bmh_SkPaint_Reference?cl=9919#Fake_Bold">Fake Bold</a>,
4340<a href="bmh_SkPaint_Reference?cl=9919#Style_Stroke">Style Stroke</a>, and <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a>.
4341Results can be additionally scaled by <a href="bmh_SkPaint_Reference?cl=9919#scale">scale</a>; a <a href="bmh_SkPaint_Reference?cl=9919#scale">scale</a> of zero
4342is ignored.
4343
4344### Parameters
4345
4346<table> <tr> <td><code><strong>metrics </strong></code></td> <td>
4347storage for <a href="bmh_SkPaint_Reference?cl=9919#Font_Metrics">Font Metrics</a> from <a href="bmh_undocumented?cl=9919#Typeface">Typeface</a>; may be nullptr</td>
4348 </tr> <tr> <td><code><strong>scale </strong></code></td> <td>
4349additional multiplier for returned values</td>
4350 </tr>
4351</table>
4352
4353### Return Value
4354
4355recommended spacing between lines
4356
4357### Example
4358
4359<div><fiddle-embed name="b899d84caba6607340322d317992d070"></fiddle-embed></div>
4360
4361### See Also
4362
4363<a href="bmh_SkPaint_Reference?cl=9919#Text_Size">Text Size</a> <a href="bmh_undocumented?cl=9919#Typeface">Typeface</a> <a href="bmh_SkPaint_Reference?cl=9919#Typeface_Methods">Typeface Methods</a>
4364
4365---
4366
4367<a name="getFontSpacing"></a>
4368## getFontSpacing
4369
4370<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
4371SkScalar getFontSpacing() const
4372</pre>
4373
4374Returns the recommended spacing between lines: the sum of metrics
4375descent, ascent, and leading.
4376Result is scaled by <a href="bmh_SkPaint_Reference?cl=9919#Text_Size">Text Size</a> but does not take into account
4377dimensions required by stroking and <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a>.
Cary Clarkbad5ad72017-08-03 17:14:08 -04004378Returns the same result as <a href="bmh_SkPaint_Reference?cl=9919#getFontMetrics">getFontMetrics</a>.
Cary Clark12799e12017-07-28 15:18:29 -04004379
4380### Return Value
4381
4382recommended spacing between lines
4383
4384### Example
4385
4386<div><fiddle-embed name="424741e26e1b174e43087d67422ce14f">
4387
4388#### Example Output
4389
4390~~~~
4391textSize: 12 fontSpacing: 13.9688
4392textSize: 18 fontSpacing: 20.9531
4393textSize: 24 fontSpacing: 27.9375
4394textSize: 32 fontSpacing: 37.25
4395~~~~
4396
4397</fiddle-embed></div>
4398
4399---
4400
4401<a name="getFontBounds"></a>
4402## getFontBounds
4403
4404<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
4405SkRect getFontBounds() const
4406</pre>
4407
4408Returns the union of bounds of all glyphs.
4409Returned dimensions are computed by <a href="bmh_undocumented?cl=9919#Font_Manager">Font Manager</a> from font data,
Cary Clarkbad5ad72017-08-03 17:14:08 -04004410ignoring <a href="bmh_SkPaint_Reference?cl=9919#Hinting">Hinting</a>. Includes <a href="bmh_SkPaint_Reference?cl=9919#Text_Size">Text Size</a>, <a href="bmh_SkPaint_Reference?cl=9919#Text_Scale_X">Text Scale X</a>,
Cary Clark12799e12017-07-28 15:18:29 -04004411and <a href="bmh_SkPaint_Reference?cl=9919#Text_Skew_X">Text Skew X</a>, but not <a href="bmh_SkPaint_Reference?cl=9919#Fake_Bold">Fake Bold</a> or <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a>.
4412
4413If <a href="bmh_SkPaint_Reference?cl=9919#Text_Size">Text Size</a> is large, <a href="bmh_SkPaint_Reference?cl=9919#Text_Scale_X">Text Scale X</a> is one, and <a href="bmh_SkPaint_Reference?cl=9919#Text_Skew_X">Text Skew X</a> is zero,
Cary Clarkbad5ad72017-08-03 17:14:08 -04004414returns the same bounds as <a href="bmh_SkPaint_Reference?cl=9919#Font_Metrics">Font Metrics</a> { <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_fXMin">FontMetrics::fXMin</a>,
Cary Clark12799e12017-07-28 15:18:29 -04004415<a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_fTop">FontMetrics::fTop</a>, <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_fXMax">FontMetrics::fXMax</a>, <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_fBottom">FontMetrics::fBottom</a> }.
4416
4417### Return Value
4418
4419union of bounds of all glyphs
4420
4421### Example
4422
4423<div><fiddle-embed name="facaddeec7943bc491988e345e27e65f">
4424
4425#### Example Output
4426
4427~~~~
4428metrics bounds = { -12.2461, -14.7891, 21.5215, 5.55469 }
4429font bounds = { -12.2461, -14.7891, 21.5215, 5.55469 }
4430~~~~
4431
4432</fiddle-embed></div>
4433
4434---
4435
4436<a name="textToGlyphs"></a>
4437## textToGlyphs
4438
4439<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
4440int textToGlyphs(const void* text, size_t byteLength, SkGlyphID glyphs[]) const
4441</pre>
4442
4443Converts <a href="bmh_SkPaint_Reference?cl=9919#text">text</a> into glyph indices.
4444Returns the number of glyph indices represented by <a href="bmh_SkPaint_Reference?cl=9919#text">text</a>.
4445<a href="bmh_SkPaint_Reference?cl=9919#Text_Encoding">Text Encoding</a> specifies how <a href="bmh_SkPaint_Reference?cl=9919#text">text</a> represents characters or <a href="bmh_SkPaint_Reference?cl=9919#glyphs">glyphs</a>.
4446<a href="bmh_SkPaint_Reference?cl=9919#glyphs">glyphs</a> may be nullptr, to compute the glyph count.
4447
4448Does not check <a href="bmh_SkPaint_Reference?cl=9919#text">text</a> for valid character encoding or valid
4449glyph indices.
4450
Cary Clarkbad5ad72017-08-03 17:14:08 -04004451If <a href="bmh_SkPaint_Reference?cl=9919#byteLength">byteLength</a> equals zero, returns zero.
Cary Clark12799e12017-07-28 15:18:29 -04004452If <a href="bmh_SkPaint_Reference?cl=9919#byteLength">byteLength</a> includes a partial character, the partial character is ignored.
4453
4454If <a href="bmh_SkPaint_Reference?cl=9919#Text_Encoding">Text Encoding</a> is <a href="bmh_SkPaint_Reference?cl=9919#kUTF8_TextEncoding">kUTF8 TextEncoding</a> and
4455<a href="bmh_SkPaint_Reference?cl=9919#text">text</a> contains an invalid <a href="bmh_undocumented?cl=9919#UTF_8">UTF-8</a> sequence, zero is returned.
4456
4457### Parameters
4458
4459<table> <tr> <td><code><strong>text </strong></code></td> <td>
4460character stroage encoded with <a href="bmh_SkPaint_Reference?cl=9919#Text_Encoding">Text Encoding</a></td>
4461 </tr> <tr> <td><code><strong>byteLength </strong></code></td> <td>
4462length of character storage in bytes</td>
4463 </tr> <tr> <td><code><strong>glyphs </strong></code></td> <td>
4464storage for glyph indices; may be nullptr</td>
4465 </tr>
4466</table>
4467
4468### Return Value
4469
4470number of <a href="bmh_SkPaint_Reference?cl=9919#glyphs">glyphs</a> represented by <a href="bmh_SkPaint_Reference?cl=9919#text">text</a> of length <a href="bmh_SkPaint_Reference?cl=9919#byteLength">byteLength</a>
4471
4472### Example
4473
4474<div><fiddle-embed name="343e9471a7f7b5f09abdc3b44983433b"></fiddle-embed></div>
4475
4476---
4477
4478<a name="countText"></a>
4479## countText
4480
4481<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
4482int countText(const void* text, size_t byteLength) const
4483</pre>
4484
4485Returns the number of glyphs in <a href="bmh_SkPaint_Reference?cl=9919#text">text</a>.
4486Uses <a href="bmh_SkPaint_Reference?cl=9919#Text_Encoding">Text Encoding</a> to count the glyphs.
4487Returns the same result as <a href="bmh_SkPaint_Reference?cl=9919#textToGlyphs">textToGlyphs</a>.
4488
4489### Parameters
4490
4491<table> <tr> <td><code><strong>text </strong></code></td> <td>
4492character stroage encoded with <a href="bmh_SkPaint_Reference?cl=9919#Text_Encoding">Text Encoding</a></td>
4493 </tr> <tr> <td><code><strong>byteLength </strong></code></td> <td>
4494length of character storage in bytes</td>
4495 </tr>
4496</table>
4497
4498### Return Value
4499
4500number of glyphs represented by <a href="bmh_SkPaint_Reference?cl=9919#text">text</a> of length <a href="bmh_SkPaint_Reference?cl=9919#byteLength">byteLength</a>
4501
4502### Example
4503
4504<div><fiddle-embed name="85436c71aab5410767fc688ab0573e09">
4505
4506#### Example Output
4507
4508~~~~
4509count = 5
4510~~~~
4511
4512</fiddle-embed></div>
4513
4514---
4515
4516<a name="containsText"></a>
4517## containsText
4518
4519<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
4520bool containsText(const void* text, size_t byteLength) const
4521</pre>
4522
4523Returns true if all <a href="bmh_SkPaint_Reference?cl=9919#text">text</a> corresponds to a non-zero glyph index.
4524Returns false if any characters in <a href="bmh_SkPaint_Reference?cl=9919#text">text</a> are not supported in
4525<a href="bmh_undocumented?cl=9919#Typeface">Typeface</a>.
4526
Cary Clarkbad5ad72017-08-03 17:14:08 -04004527If <a href="bmh_SkPaint_Reference?cl=9919#Text_Encoding">Text Encoding</a> is <a href="bmh_SkPaint_Reference?cl=9919#kGlyphID_TextEncoding">kGlyphID TextEncoding</a>,
4528returns true if all glyph indices in <a href="bmh_SkPaint_Reference?cl=9919#text">text</a> are non-zero;
Cary Clark12799e12017-07-28 15:18:29 -04004529does not check to see if <a href="bmh_SkPaint_Reference?cl=9919#text">text</a> contains valid glyph indices for <a href="bmh_undocumented?cl=9919#Typeface">Typeface</a>.
4530
4531Returns true if bytelength is zero.
4532
4533### Parameters
4534
4535<table> <tr> <td><code><strong>text </strong></code></td> <td>
4536array of characters or glyphs</td>
4537 </tr> <tr> <td><code><strong>byteLength </strong></code></td> <td>
4538number of bytes in <a href="bmh_SkPaint_Reference?cl=9919#text">text</a> array</td>
4539 </tr>
4540</table>
4541
4542### Return Value
4543
4544true if all <a href="bmh_SkPaint_Reference?cl=9919#text">text</a> corresponds to a non-zero glyph index
4545
4546### Example
4547
4548<div><fiddle-embed name="9202369019552f09cd4bec7f3046fee4"><div><a href="bmh_SkPaint_Reference?cl=9919#containsText">containsText</a> succeeds for degree symbol, but cannot find a glyph index
4549corresponding to the <a href="bmh_undocumented?cl=9919#Unicode">Unicode</a> surrogate code point.</div>
4550
4551#### Example Output
4552
4553~~~~
45540x00b0 == has char
45550xd800 != has char
4556~~~~
4557
4558</fiddle-embed></div>
4559
4560### Example
4561
4562<div><fiddle-embed name="904227febfd1c2e264955da0ef66da73"><div><a href="bmh_SkPaint_Reference?cl=9919#containsText">containsText</a> returns true that glyph index is greater than zero, not
4563that it corresponds to an entry in <a href="bmh_undocumented?cl=9919#Typeface">Typeface</a>.</div>
4564
4565#### Example Output
4566
4567~~~~
45680x01ff == has glyph
45690x0000 != has glyph
45700xffff == has glyph
4571~~~~
4572
4573</fiddle-embed></div>
4574
4575### See Also
4576
4577<a href="bmh_SkPaint_Reference?cl=9919#setTextEncoding">setTextEncoding</a> <a href="bmh_undocumented?cl=9919#Typeface">Typeface</a>
4578
4579---
4580
4581<a name="glyphsToUnichars"></a>
4582## glyphsToUnichars
4583
4584<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
4585void glyphsToUnichars(const SkGlyphID glyphs[], int count, SkUnichar text[]) const
4586</pre>
4587
4588Converts <a href="bmh_SkPaint_Reference?cl=9919#glyphs">glyphs</a> into <a href="bmh_SkPaint_Reference?cl=9919#text">text</a> if possible.
4589<a href="bmh_undocumented?cl=9919#Glyph">Glyph</a> values without direct <a href="bmh_undocumented?cl=9919#Unicode">Unicode</a> equivalents are mapped to zero.
4590Uses the <a href="bmh_undocumented?cl=9919#Typeface">Typeface</a>, but is unaffected
4591by <a href="bmh_SkPaint_Reference?cl=9919#Text_Encoding">Text Encoding</a>; the <a href="bmh_SkPaint_Reference?cl=9919#text">text</a> values returned are equivalent to <a href="bmh_SkPaint_Reference?cl=9919#kUTF32_TextEncoding">kUTF32 TextEncoding</a>.
4592
4593Only supported on platforms that use <a href="bmh_undocumented?cl=9919#FreeType">FreeType</a> as the <a href="bmh_undocumented?cl=9919#Engine">Font Engine</a>.
4594
4595### Parameters
4596
4597<table> <tr> <td><code><strong>glyphs </strong></code></td> <td>
4598array of indices into font</td>
4599 </tr> <tr> <td><code><strong>count </strong></code></td> <td>
4600length of glyph array</td>
4601 </tr> <tr> <td><code><strong>text </strong></code></td> <td>
4602storage for character codes, one per glyph</td>
4603 </tr>
4604</table>
4605
4606### Example
4607
4608<div><fiddle-embed name="c12686b0b3e0a87d0a248bbfc57e9492"><div>Convert <a href="bmh_undocumented?cl=9919#UTF_8">UTF-8</a> <a href="bmh_SkPaint_Reference?cl=9919#text">text</a> to <a href="bmh_SkPaint_Reference?cl=9919#glyphs">glyphs</a>; then convert <a href="bmh_SkPaint_Reference?cl=9919#glyphs">glyphs</a> to <a href="bmh_undocumented?cl=9919#Unichar">Unichar</a> code points.</div></fiddle-embed></div>
4609
4610---
4611
4612# <a name="Measure_Text"></a> Measure Text
4613
4614<a name="measureText"></a>
4615## measureText
4616
4617<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
4618SkScalar measureText(const void* text, size_t length, SkRect* bounds) const
4619</pre>
4620
4621Returns the advance width of <a href="bmh_SkPaint_Reference?cl=9919#text">text</a> if <a href="bmh_SkPaint_Reference?cl=9919#kVerticalText_Flag">kVerticalText Flag</a> is clear,
4622and the height of <a href="bmh_SkPaint_Reference?cl=9919#text">text</a> if <a href="bmh_SkPaint_Reference?cl=9919#kVerticalText_Flag">kVerticalText Flag</a> is set.
4623The advance is the normal distance to move before drawing additional <a href="bmh_SkPaint_Reference?cl=9919#text">text</a>.
4624Uses <a href="bmh_SkPaint_Reference?cl=9919#Text_Encoding">Text Encoding</a> to decode <a href="bmh_SkPaint_Reference?cl=9919#text">text</a>, <a href="bmh_undocumented?cl=9919#Typeface">Typeface</a> to get the font metrics,
4625and <a href="bmh_SkPaint_Reference?cl=9919#Text_Size">Text Size</a>, <a href="bmh_SkPaint_Reference?cl=9919#Text_Scale_X">Text Scale X</a>, <a href="bmh_SkPaint_Reference?cl=9919#Text_Skew_X">Text Skew X</a>, <a href="bmh_SkPaint_Reference?cl=9919#Stroke_Width">Stroke Width</a>, and
4626<a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a> to scale the metrics and <a href="bmh_SkPaint_Reference?cl=9919#bounds">bounds</a>.
4627Returns the bounding box of <a href="bmh_SkPaint_Reference?cl=9919#text">text</a> if <a href="bmh_SkPaint_Reference?cl=9919#bounds">bounds</a> is not nullptr.
4628The bounding box is computed as if the <a href="bmh_SkPaint_Reference?cl=9919#text">text</a> was drawn at the origin.
4629
4630### Parameters
4631
4632<table> <tr> <td><code><strong>text </strong></code></td> <td>
4633character codes or glyph indices to be measured</td>
4634 </tr> <tr> <td><code><strong>length </strong></code></td> <td>
4635number of bytes of <a href="bmh_SkPaint_Reference?cl=9919#text">text</a> to measure</td>
4636 </tr> <tr> <td><code><strong>bounds </strong></code></td> <td>
4637returns bounding box relative to (0, 0) if not nullptr</td>
4638 </tr>
4639</table>
4640
4641### Return Value
4642
4643advance width or height
4644
4645### Example
4646
4647<div><fiddle-embed name="06084f609184470135a9cd9ebc5af149"></fiddle-embed></div>
4648
4649---
4650
4651<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
4652SkScalar measureText(const void* text, size_t length) const
4653</pre>
4654
4655Returns the advance width of <a href="bmh_SkPaint_Reference?cl=9919#text">text</a> if <a href="bmh_SkPaint_Reference?cl=9919#kVerticalText_Flag">kVerticalText Flag</a> is clear,
4656and the height of <a href="bmh_SkPaint_Reference?cl=9919#text">text</a> if <a href="bmh_SkPaint_Reference?cl=9919#kVerticalText_Flag">kVerticalText Flag</a> is set.
4657The advance is the normal distance to move before drawing additional <a href="bmh_SkPaint_Reference?cl=9919#text">text</a>.
4658Uses <a href="bmh_SkPaint_Reference?cl=9919#Text_Encoding">Text Encoding</a> to decode <a href="bmh_SkPaint_Reference?cl=9919#text">text</a>, <a href="bmh_undocumented?cl=9919#Typeface">Typeface</a> to get the font metrics,
4659and <a href="bmh_SkPaint_Reference?cl=9919#Text_Size">Text Size</a> to scale the metrics.
4660Does not scale the advance or bounds by <a href="bmh_SkPaint_Reference?cl=9919#Fake_Bold">Fake Bold</a> or <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a>.
4661
4662### Parameters
4663
4664<table> <tr> <td><code><strong>text </strong></code></td> <td>
4665character codes or glyph indices to be measured</td>
4666 </tr> <tr> <td><code><strong>length </strong></code></td> <td>
4667number of bytes of <a href="bmh_SkPaint_Reference?cl=9919#text">text</a> to measure</td>
4668 </tr>
4669</table>
4670
4671### Return Value
4672
4673advance width or height
4674
4675### Example
4676
4677<div><fiddle-embed name="f1139a5ddd17fd47c2f45f6e642cac76">
4678
4679#### Example Output
4680
4681~~~~
4682default width = 5
4683double width = 10
4684~~~~
4685
4686</fiddle-embed></div>
4687
4688---
4689
4690<a name="breakText"></a>
4691## breakText
4692
4693<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
4694size_t breakText(const void* text, size_t length, SkScalar maxWidth,
4695 SkScalar* measuredWidth = NULL) const
4696</pre>
4697
4698Returns the bytes of <a href="bmh_SkPaint_Reference?cl=9919#text">text</a> that fit within <a href="bmh_SkPaint_Reference?cl=9919#maxWidth">maxWidth</a>.
4699If <a href="bmh_SkPaint_Reference?cl=9919#kVerticalText_Flag">kVerticalText Flag</a> is clear, the <a href="bmh_SkPaint_Reference?cl=9919#text">text</a> fragment fits if its advance width is less than or
4700equal to <a href="bmh_SkPaint_Reference?cl=9919#maxWidth">maxWidth</a>.
4701If <a href="bmh_SkPaint_Reference?cl=9919#kVerticalText_Flag">kVerticalText Flag</a> is set, the <a href="bmh_SkPaint_Reference?cl=9919#text">text</a> fragment fits if its advance height is less than or
4702equal to <a href="bmh_SkPaint_Reference?cl=9919#maxWidth">maxWidth</a>.
4703Measures only while the advance is less than or equal to <a href="bmh_SkPaint_Reference?cl=9919#maxWidth">maxWidth</a>.
4704Returns the advance or the <a href="bmh_SkPaint_Reference?cl=9919#text">text</a> fragment in <a href="bmh_SkPaint_Reference?cl=9919#measuredWidth">measuredWidth</a> if it not nullptr.
4705Uses <a href="bmh_SkPaint_Reference?cl=9919#Text_Encoding">Text Encoding</a> to decode <a href="bmh_SkPaint_Reference?cl=9919#text">text</a>, <a href="bmh_undocumented?cl=9919#Typeface">Typeface</a> to get the font metrics,
4706and <a href="bmh_SkPaint_Reference?cl=9919#Text_Size">Text Size</a> to scale the metrics.
4707Does not scale the advance or bounds by <a href="bmh_SkPaint_Reference?cl=9919#Fake_Bold">Fake Bold</a> or <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a>.
4708
4709### Parameters
4710
4711<table> <tr> <td><code><strong>text </strong></code></td> <td>
4712character codes or glyph indices to be measured</td>
4713 </tr> <tr> <td><code><strong>length </strong></code></td> <td>
4714number of bytes of <a href="bmh_SkPaint_Reference?cl=9919#text">text</a> to measure</td>
4715 </tr> <tr> <td><code><strong>maxWidth </strong></code></td> <td>
4716advance limit; <a href="bmh_SkPaint_Reference?cl=9919#text">text</a> is measured while advance is less than <a href="bmh_SkPaint_Reference?cl=9919#maxWidth">maxWidth</a></td>
4717 </tr> <tr> <td><code><strong>measuredWidth </strong></code></td> <td>
4718returns the width of the <a href="bmh_SkPaint_Reference?cl=9919#text">text</a> less than or equal to <a href="bmh_SkPaint_Reference?cl=9919#maxWidth">maxWidth</a></td>
4719 </tr>
4720</table>
4721
4722### Return Value
4723
4724bytes of <a href="bmh_SkPaint_Reference?cl=9919#text">text</a> that fit, always less than or equal to <a href="bmh_SkPaint_Reference?cl=9919#length">length</a>
4725
4726### Example
4727
4728<div><fiddle-embed name="fd0033470ccbd5c7059670fdbf96cffc"><div><a href="bmh_undocumented?cl=9919#Line">Line</a> under "" shows desired width, shorter than available characters.
4729<a href="bmh_undocumented?cl=9919#Line">Line</a> under "" shows measured width after breaking <a href="bmh_SkPaint_Reference?cl=9919#text">text</a>.</div></fiddle-embed></div>
4730
4731---
4732
4733<a name="getTextWidths"></a>
4734## getTextWidths
4735
4736<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
4737int getTextWidths(const void* text, size_t byteLength, SkScalar widths[],
4738 SkRect bounds[] = NULL) const
4739</pre>
4740
4741Retrieves the advance and <a href="bmh_SkPaint_Reference?cl=9919#bounds">bounds</a> for each glyph in <a href="bmh_SkPaint_Reference?cl=9919#text">text</a>, and returns
4742the glyph count in <a href="bmh_SkPaint_Reference?cl=9919#text">text</a>.
4743Both <a href="bmh_SkPaint_Reference?cl=9919#widths">widths</a> and <a href="bmh_SkPaint_Reference?cl=9919#bounds">bounds</a> may be nullptr.
4744If <a href="bmh_SkPaint_Reference?cl=9919#widths">widths</a> is not nullptr, <a href="bmh_SkPaint_Reference?cl=9919#widths">widths</a> must be an array of glyph count entries.
4745if <a href="bmh_SkPaint_Reference?cl=9919#bounds">bounds</a> is not nullptr, <a href="bmh_SkPaint_Reference?cl=9919#bounds">bounds</a> must be an array of glyph count entries.
4746If <a href="bmh_SkPaint_Reference?cl=9919#kVerticalText_Flag">kVerticalText Flag</a> is clear, <a href="bmh_SkPaint_Reference?cl=9919#widths">widths</a> returns the horizontal advance.
4747If <a href="bmh_SkPaint_Reference?cl=9919#kVerticalText_Flag">kVerticalText Flag</a> is set, <a href="bmh_SkPaint_Reference?cl=9919#widths">widths</a> returns the vertical advance.
4748Uses <a href="bmh_SkPaint_Reference?cl=9919#Text_Encoding">Text Encoding</a> to decode <a href="bmh_SkPaint_Reference?cl=9919#text">text</a>, <a href="bmh_undocumented?cl=9919#Typeface">Typeface</a> to get the font metrics,
4749and <a href="bmh_SkPaint_Reference?cl=9919#Text_Size">Text Size</a> to scale the <a href="bmh_SkPaint_Reference?cl=9919#widths">widths</a> and <a href="bmh_SkPaint_Reference?cl=9919#bounds">bounds</a>.
4750Does not scale the advance by <a href="bmh_SkPaint_Reference?cl=9919#Fake_Bold">Fake Bold</a> or <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a>.
4751Does include <a href="bmh_SkPaint_Reference?cl=9919#Fake_Bold">Fake Bold</a> and <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a> in the <a href="bmh_SkPaint_Reference?cl=9919#bounds">bounds</a>.
4752
4753### Parameters
4754
4755<table> <tr> <td><code><strong>text </strong></code></td> <td>
4756character codes or glyph indices to be measured</td>
4757 </tr> <tr> <td><code><strong>byteLength </strong></code></td> <td>
4758number of bytes of <a href="bmh_SkPaint_Reference?cl=9919#text">text</a> to measure</td>
4759 </tr> <tr> <td><code><strong>widths </strong></code></td> <td>
4760returns <a href="bmh_SkPaint_Reference?cl=9919#text">text</a> advances for each glyph; may be nullptr</td>
4761 </tr> <tr> <td><code><strong>bounds </strong></code></td> <td>
4762returns <a href="bmh_SkPaint_Reference?cl=9919#bounds">bounds</a> for each glyph relative to (0, 0); may be nullptr</td>
4763 </tr>
4764</table>
4765
4766### Return Value
4767
4768glyph count in <a href="bmh_SkPaint_Reference?cl=9919#text">text</a>
4769
4770### Example
4771
4772<div><fiddle-embed name="6b9e101f49e9c2c28755c5bdcef64dfb"><div>Bounds of glyphs increase for stroked <a href="bmh_SkPaint_Reference?cl=9919#text">text</a>, but <a href="bmh_SkPaint_Reference?cl=9919#text">text</a> advance remains the same.
4773The underlines show the <a href="bmh_SkPaint_Reference?cl=9919#text">text</a> advance, spaced to keep them distinct.</div></fiddle-embed></div>
4774
4775---
4776
4777# <a name="Text_Path"></a> Text Path
4778<a href="bmh_SkPaint_Reference?cl=9919#Text_Path">Text Path</a> describes the geometry of glyphs used to draw text.
4779
4780<a name="getTextPath"></a>
4781## getTextPath
4782
4783<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
4784void getTextPath(const void* text, size_t length, SkScalar x, SkScalar y,
4785 SkPath* path) const
4786</pre>
4787
4788Returns the geometry as <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> equivalent to the drawn <a href="bmh_SkPaint_Reference?cl=9919#text">text</a>.
4789Uses <a href="bmh_SkPaint_Reference?cl=9919#Text_Encoding">Text Encoding</a> to decode <a href="bmh_SkPaint_Reference?cl=9919#text">text</a>, <a href="bmh_undocumented?cl=9919#Typeface">Typeface</a> to get the glyph paths,
4790and <a href="bmh_SkPaint_Reference?cl=9919#Text_Size">Text Size</a>, <a href="bmh_SkPaint_Reference?cl=9919#Fake_Bold">Fake Bold</a>, and <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a> to scale and modify the glyph paths.
4791All of the glyph paths are stored in <a href="bmh_SkPaint_Reference?cl=9919#path">path</a>.
Cary Clarkbad5ad72017-08-03 17:14:08 -04004792Uses <a href="bmh_SkPaint_Reference?cl=9919#x">x</a>, <a href="bmh_SkPaint_Reference?cl=9919#y">y</a>, and <a href="bmh_SkPaint_Reference?cl=9919#Text_Align">Text Align</a> to position <a href="bmh_SkPaint_Reference?cl=9919#path">path</a>.
Cary Clark12799e12017-07-28 15:18:29 -04004793
4794### Parameters
4795
4796<table> <tr> <td><code><strong>text </strong></code></td> <td>
4797character codes or glyph indices</td>
4798 </tr> <tr> <td><code><strong>length </strong></code></td> <td>
4799number of bytes of <a href="bmh_SkPaint_Reference?cl=9919#text">text</a></td>
4800 </tr> <tr> <td><code><strong>x </strong></code></td> <td>
4801x-coordinate of the origin of the <a href="bmh_SkPaint_Reference?cl=9919#text">text</a></td>
4802 </tr> <tr> <td><code><strong>y </strong></code></td> <td>
4803y-coordinate of the origin of the <a href="bmh_SkPaint_Reference?cl=9919#text">text</a></td>
4804 </tr> <tr> <td><code><strong>path </strong></code></td> <td>
4805geometry of the glyphs</td>
4806 </tr>
4807</table>
4808
4809### Example
4810
4811<div><fiddle-embed name="7c9e6a399f898d68026c1f0865e6f73e"><div><a href="bmh_undocumented?cl=9919#Text">Text</a> is added to <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>, offset, and subtracted from <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>, then added at
4812the offset location. The result is rendered with one draw call.</div></fiddle-embed></div>
4813
4814---
4815
4816<a name="getPosTextPath"></a>
4817## getPosTextPath
4818
4819<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
4820void getPosTextPath(const void* text, size_t length, const SkPoint pos[],
4821 SkPath* path) const
4822</pre>
4823
4824Returns the geometry as <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> equivalent to the drawn <a href="bmh_SkPaint_Reference?cl=9919#text">text</a>.
4825Uses <a href="bmh_SkPaint_Reference?cl=9919#Text_Encoding">Text Encoding</a> to decode <a href="bmh_SkPaint_Reference?cl=9919#text">text</a>, <a href="bmh_undocumented?cl=9919#Typeface">Typeface</a> to get the glyph paths,
4826and <a href="bmh_SkPaint_Reference?cl=9919#Text_Size">Text Size</a>, <a href="bmh_SkPaint_Reference?cl=9919#Fake_Bold">Fake Bold</a>, and <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a> to scale and modify the glyph paths.
4827All of the glyph paths are stored in <a href="bmh_SkPaint_Reference?cl=9919#path">path</a>.
4828Uses <a href="bmh_SkPaint_Reference?cl=9919#pos">pos</a> array and <a href="bmh_SkPaint_Reference?cl=9919#Text_Align">Text Align</a> to position <a href="bmh_SkPaint_Reference?cl=9919#path">path</a>.
4829<a href="bmh_SkPaint_Reference?cl=9919#pos">pos</a> contains a position for each glyph.
4830
4831### Parameters
4832
4833<table> <tr> <td><code><strong>text </strong></code></td> <td>
4834character codes or glyph indices</td>
4835 </tr> <tr> <td><code><strong>length </strong></code></td> <td>
4836number of bytes of <a href="bmh_SkPaint_Reference?cl=9919#text">text</a></td>
4837 </tr> <tr> <td><code><strong>pos </strong></code></td> <td>
4838positions of each glyph</td>
4839 </tr> <tr> <td><code><strong>path </strong></code></td> <td>
4840geometry of the glyphs</td>
4841 </tr>
4842</table>
4843
4844### Example
4845
4846<div><fiddle-embed name="7f27c93472aa99a7542fb3493076f072"><div>Simplifies three glyphs to eliminate overlaps, and strokes the result.</div></fiddle-embed></div>
4847
4848---
4849
4850# <a name="Text_Intercepts"></a> Text Intercepts
4851<a href="bmh_SkPaint_Reference?cl=9919#Text_Intercepts">Text Intercepts</a> describe the intersection of drawn text glyphs with a pair
4852of lines parallel to the text advance. <a href="bmh_SkPaint_Reference?cl=9919#Text_Intercepts">Text Intercepts</a> permits creating a
4853underline that skips descenders.
4854
4855<a name="getTextIntercepts"></a>
4856## getTextIntercepts
4857
4858<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
4859int getTextIntercepts(const void* text, size_t length, SkScalar x, SkScalar y,
4860 const SkScalar bounds[2], SkScalar* intervals) const
4861</pre>
4862
4863Returns the number of <a href="bmh_SkPaint_Reference?cl=9919#intervals">intervals</a> that intersect <a href="bmh_SkPaint_Reference?cl=9919#bounds">bounds</a>.
4864<a href="bmh_SkPaint_Reference?cl=9919#bounds">bounds</a> describes a pair of lines parallel to the <a href="bmh_SkPaint_Reference?cl=9919#text">text</a> advance.
4865The return count is zero or a multiple of two, and is at most twice the number of glyphs in
4866the string.
4867Uses <a href="bmh_SkPaint_Reference?cl=9919#Text_Encoding">Text Encoding</a> to decode <a href="bmh_SkPaint_Reference?cl=9919#text">text</a>, <a href="bmh_undocumented?cl=9919#Typeface">Typeface</a> to get the glyph paths,
4868and <a href="bmh_SkPaint_Reference?cl=9919#Text_Size">Text Size</a>, <a href="bmh_SkPaint_Reference?cl=9919#Fake_Bold">Fake Bold</a>, and <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a> to scale and modify the glyph paths.
4869Uses <a href="bmh_SkPaint_Reference?cl=9919#x">x</a>, <a href="bmh_SkPaint_Reference?cl=9919#y">y</a>, and <a href="bmh_SkPaint_Reference?cl=9919#Text_Align">Text Align</a> to position <a href="bmh_SkPaint_Reference?cl=9919#intervals">intervals</a>.
4870Pass nullptr for <a href="bmh_SkPaint_Reference?cl=9919#intervals">intervals</a> to determine the size of the interval array.
4871<a href="bmh_SkPaint_Reference?cl=9919#intervals">intervals</a> are cached to improve performance for multiple calls.
4872
4873### Parameters
4874
4875<table> <tr> <td><code><strong>text </strong></code></td> <td>
4876character codes or glyph indices</td>
4877 </tr> <tr> <td><code><strong>length </strong></code></td> <td>
4878number of bytes of <a href="bmh_SkPaint_Reference?cl=9919#text">text</a></td>
4879 </tr> <tr> <td><code><strong>x </strong></code></td> <td>
4880x-coordinate of the origin of the <a href="bmh_SkPaint_Reference?cl=9919#text">text</a></td>
4881 </tr> <tr> <td><code><strong>y </strong></code></td> <td>
4882y-coordinate of the origin of the <a href="bmh_SkPaint_Reference?cl=9919#text">text</a></td>
4883 </tr> <tr> <td><code><strong>bounds </strong></code></td> <td>
4884lower and upper line parallel to the advance</td>
4885 </tr> <tr> <td><code><strong>intervals </strong></code></td> <td>
4886returned intersections; may be nullptr</td>
4887 </tr>
4888</table>
4889
4890### Return Value
4891
4892number of intersections; may be zero
4893
4894### Example
4895
4896<div><fiddle-embed name="2a0b80ed20d193c688085b79deb5bdc9"><div>Underline uses intercepts to draw on either side of the glyph descender.</div></fiddle-embed></div>
4897
4898---
4899
4900<a name="getPosTextIntercepts"></a>
4901## getPosTextIntercepts
4902
4903<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
4904int getPosTextIntercepts(const void* text, size_t length, const SkPoint pos[],
4905 const SkScalar bounds[2], SkScalar* intervals) const
4906</pre>
4907
4908Returns the number of <a href="bmh_SkPaint_Reference?cl=9919#intervals">intervals</a> that intersect <a href="bmh_SkPaint_Reference?cl=9919#bounds">bounds</a>.
4909<a href="bmh_SkPaint_Reference?cl=9919#bounds">bounds</a> describes a pair of lines parallel to the <a href="bmh_SkPaint_Reference?cl=9919#text">text</a> advance.
4910The return count is zero or a multiple of two, and is at most twice the number of glyphs in
4911the string.
4912Uses <a href="bmh_SkPaint_Reference?cl=9919#Text_Encoding">Text Encoding</a> to decode <a href="bmh_SkPaint_Reference?cl=9919#text">text</a>, <a href="bmh_undocumented?cl=9919#Typeface">Typeface</a> to get the glyph paths,
4913and <a href="bmh_SkPaint_Reference?cl=9919#Text_Size">Text Size</a>, <a href="bmh_SkPaint_Reference?cl=9919#Fake_Bold">Fake Bold</a>, and <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a> to scale and modify the glyph paths.
4914Uses <a href="bmh_SkPaint_Reference?cl=9919#pos">pos</a> array and <a href="bmh_SkPaint_Reference?cl=9919#Text_Align">Text Align</a> to position <a href="bmh_SkPaint_Reference?cl=9919#intervals">intervals</a>.
4915Pass nullptr for <a href="bmh_SkPaint_Reference?cl=9919#intervals">intervals</a> to determine the size of the interval array.
4916<a href="bmh_SkPaint_Reference?cl=9919#intervals">intervals</a> are cached to improve performance for multiple calls.
4917
4918### Parameters
4919
4920<table> <tr> <td><code><strong>text </strong></code></td> <td>
4921character codes or glyph indices</td>
4922 </tr> <tr> <td><code><strong>length </strong></code></td> <td>
4923number of bytes of <a href="bmh_SkPaint_Reference?cl=9919#text">text</a></td>
4924 </tr> <tr> <td><code><strong>pos </strong></code></td> <td>
4925positions of each glyph</td>
4926 </tr> <tr> <td><code><strong>bounds </strong></code></td> <td>
4927lower and upper line parallel to the advance</td>
4928 </tr> <tr> <td><code><strong>intervals </strong></code></td> <td>
4929returned intersections; may be nullptr</td>
4930 </tr>
4931</table>
4932
4933### Return Value
4934
4935The number of intersections; may be zero
4936
4937### Example
4938
4939<div><fiddle-embed name="98b2dfc552d0540a7c041fe7a2839bd7"><div><a href="bmh_undocumented?cl=9919#Text">Text</a> intercepts draw on either side of, but not inside, glyphs in a run.</div></fiddle-embed></div>
4940
4941---
4942
4943<a name="getPosTextHIntercepts"></a>
4944## getPosTextHIntercepts
4945
4946<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
4947int getPosTextHIntercepts(const void* text, size_t length, const SkScalar xpos[],
4948 SkScalar constY, const SkScalar bounds[2],
4949 SkScalar* intervals) const
4950</pre>
4951
4952Returns the number of <a href="bmh_SkPaint_Reference?cl=9919#intervals">intervals</a> that intersect <a href="bmh_SkPaint_Reference?cl=9919#bounds">bounds</a>.
4953<a href="bmh_SkPaint_Reference?cl=9919#bounds">bounds</a> describes a pair of lines parallel to the <a href="bmh_SkPaint_Reference?cl=9919#text">text</a> advance.
4954The return count is zero or a multiple of two, and is at most twice the number of glyphs in
4955the string.
4956Uses <a href="bmh_SkPaint_Reference?cl=9919#Text_Encoding">Text Encoding</a> to decode <a href="bmh_SkPaint_Reference?cl=9919#text">text</a>, <a href="bmh_undocumented?cl=9919#Typeface">Typeface</a> to get the glyph paths,
4957and <a href="bmh_SkPaint_Reference?cl=9919#Text_Size">Text Size</a>, <a href="bmh_SkPaint_Reference?cl=9919#Fake_Bold">Fake Bold</a>, and <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a> to scale and modify the glyph paths.
4958Uses <a href="bmh_SkPaint_Reference?cl=9919#xpos">xpos</a> array, <a href="bmh_SkPaint_Reference?cl=9919#constY">constY</a>, and <a href="bmh_SkPaint_Reference?cl=9919#Text_Align">Text Align</a> to position <a href="bmh_SkPaint_Reference?cl=9919#intervals">intervals</a>.
4959Pass nullptr for <a href="bmh_SkPaint_Reference?cl=9919#intervals">intervals</a> to determine the size of the interval array.
4960<a href="bmh_SkPaint_Reference?cl=9919#intervals">intervals</a> are cached to improve performance for multiple calls.
4961
4962### Parameters
4963
4964<table> <tr> <td><code><strong>text </strong></code></td> <td>
4965character codes or glyph indices</td>
4966 </tr> <tr> <td><code><strong>length </strong></code></td> <td>
4967number of bytes of <a href="bmh_SkPaint_Reference?cl=9919#text">text</a></td>
4968 </tr> <tr> <td><code><strong>xpos </strong></code></td> <td>
4969positions of each glyph in x</td>
4970 </tr> <tr> <td><code><strong>constY </strong></code></td> <td>
4971position of each glyph in y</td>
4972 </tr> <tr> <td><code><strong>bounds </strong></code></td> <td>
4973lower and upper line parallel to the advance</td>
4974 </tr> <tr> <td><code><strong>intervals </strong></code></td> <td>
4975returned intersections; may be nullptr</td>
4976 </tr>
4977</table>
4978
4979### Return Value
4980
4981number of intersections; may be zero
4982
4983### Example
4984
4985<div><fiddle-embed name="dc9851c43acc3716aca8c9a4d40d452d"><div><a href="bmh_undocumented?cl=9919#Text">Text</a> intercepts do not take stroke thickness into consideration.</div></fiddle-embed></div>
4986
4987---
4988
4989<a name="getTextBlobIntercepts"></a>
4990## getTextBlobIntercepts
4991
4992<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
4993int getTextBlobIntercepts(const SkTextBlob* blob, const SkScalar bounds[2],
4994 SkScalar* intervals) const
4995</pre>
4996
4997Returns the number of <a href="bmh_SkPaint_Reference?cl=9919#intervals">intervals</a> that intersect <a href="bmh_SkPaint_Reference?cl=9919#bounds">bounds</a>.
4998<a href="bmh_SkPaint_Reference?cl=9919#bounds">bounds</a> describes a pair of lines parallel to the text advance.
4999The return count is zero or a multiple of two, and is at most twice the number of glyphs in
5000the string.
5001Uses <a href="bmh_SkPaint_Reference?cl=9919#Text_Encoding">Text Encoding</a> to decode text, <a href="bmh_undocumented?cl=9919#Typeface">Typeface</a> to get the glyph paths,
5002and <a href="bmh_SkPaint_Reference?cl=9919#Text_Size">Text Size</a>, <a href="bmh_SkPaint_Reference?cl=9919#Fake_Bold">Fake Bold</a>, and <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a> to scale and modify the glyph paths.
5003Uses pos array and <a href="bmh_SkPaint_Reference?cl=9919#Text_Align">Text Align</a> to position <a href="bmh_SkPaint_Reference?cl=9919#intervals">intervals</a>.
5004Pass nullptr for <a href="bmh_SkPaint_Reference?cl=9919#intervals">intervals</a> to determine the size of the interval array.
5005<a href="bmh_SkPaint_Reference?cl=9919#intervals">intervals</a> are cached to improve performance for multiple calls.
5006
5007### Parameters
5008
5009<table> <tr> <td><code><strong>blob </strong></code></td> <td>
5010glyphs, positions, and text paint attributes</td>
5011 </tr> <tr> <td><code><strong>bounds </strong></code></td> <td>
5012lower and upper line parallel to the advance</td>
5013 </tr> <tr> <td><code><strong>intervals </strong></code></td> <td>
5014returned intersections; may be nullptr</td>
5015 </tr>
5016</table>
5017
5018### Return Value
5019
5020number of intersections; may be zero
5021
5022### Example
5023
5024<div><fiddle-embed name="4961b05f4f26cf270ab4948a57876341"></fiddle-embed></div>
5025
5026---
5027
5028<a name="nothingToDraw"></a>
5029## nothingToDraw
5030
5031<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
5032bool nothingToDraw() const
5033</pre>
5034
Cary Clarkbad5ad72017-08-03 17:14:08 -04005035Returns true if <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> prevents all drawing;
5036otherwise, the <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> may or may not allow drawing.
Cary Clark12799e12017-07-28 15:18:29 -04005037
5038Returns true if <a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a> and <a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a> are enabled,
5039and computed <a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a> is zero.
5040
5041### Return Value
5042
5043true if <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> prevents all drawing
5044
5045### Example
5046
5047<div><fiddle-embed name="fc5a771b915ac341f56554f01d282831">
5048
5049#### Example Output
5050
5051~~~~
5052initial nothing to draw: false
5053blend dst nothing to draw: true
5054blend src over nothing to draw: false
5055alpha 0 nothing to draw: true
5056~~~~
5057
5058</fiddle-embed></div>
5059
5060---
5061
5062# <a name="Fast_Bounds"></a> Fast Bounds
5063<a href="bmh_SkPaint_Reference?cl=9919#Fast_Bounds">Fast Bounds</a> methods conservatively outset a drawing bounds by additional area
5064<a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> may draw to.
5065
5066<a name="canComputeFastBounds"></a>
5067## canComputeFastBounds
5068
5069<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
5070bool canComputeFastBounds() const
5071</pre>
5072
5073Returns true if <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> does not include elements requiring extensive computation
5074to compute <a href="bmh_undocumented?cl=9919#Device">Device</a> bounds of drawn geometry. For instance, <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> with <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a>
5075always returns false.
5076
5077### Return Value
5078
5079true if <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> allows for fast computation of bounds
5080
5081---
5082
5083<a name="computeFastBounds"></a>
5084## computeFastBounds
5085
5086<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
5087const SkRect& computeFastBounds(const SkRect& orig, SkRect* storage) const
5088</pre>
5089
5090Only call this if <a href="bmh_SkPaint_Reference?cl=9919#canComputeFastBounds">canComputeFastBounds</a> returned true. This takes a
5091raw rectangle (the raw bounds of a shape), and adjusts it for stylistic
5092effects in the paint (e.g. stroking). If needed, it uses the <a href="bmh_SkPaint_Reference?cl=9919#storage">storage</a>
5093rect parameter. It returns the adjusted bounds that can then be used
5094for <a href="bmh_SkCanvas_Reference?cl=9919#quickReject">SkCanvas::quickReject</a> tests.
5095
5096The returned rect will either be <a href="bmh_SkPaint_Reference?cl=9919#orig">orig</a> or <a href="bmh_SkPaint_Reference?cl=9919#storage">storage</a>, thus the caller
5097should not rely on <a href="bmh_SkPaint_Reference?cl=9919#storage">storage</a> being set to the result, but should always
5098use the retured value. It is legal for <a href="bmh_SkPaint_Reference?cl=9919#orig">orig</a> and <a href="bmh_SkPaint_Reference?cl=9919#storage">storage</a> to be the same
5099rect.
5100
5101### Parameters
5102
5103<table> <tr> <td><code><strong>orig </strong></code></td> <td>
5104geometry modified by <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> when drawn</td>
5105 </tr> <tr> <td><code><strong>storage </strong></code></td> <td>
5106computed bounds of geometry; may not be nullptr</td>
5107 </tr>
5108</table>
5109
5110### Return Value
5111
5112fast computed bounds
5113
5114---
5115
5116<a name="computeFastStrokeBounds"></a>
5117## computeFastStrokeBounds
5118
5119<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
5120const SkRect& computeFastStrokeBounds(const SkRect& orig, SkRect* storage) const
5121</pre>
5122
5123### Parameters
5124
5125<table> <tr> <td><code><strong>orig </strong></code></td> <td>
5126geometry modified by <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> when drawn</td>
5127 </tr> <tr> <td><code><strong>storage </strong></code></td> <td>
5128computed bounds of geometry</td>
5129 </tr>
5130</table>
5131
5132### Return Value
5133
5134fast computed bounds
5135
5136---
5137
5138<a name="doComputeFastBounds"></a>
5139## doComputeFastBounds
5140
5141<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
5142const SkRect& doComputeFastBounds(const SkRect& orig, SkRect* storage,
5143 Style style) const
5144</pre>
5145
5146Take the <a href="bmh_SkPaint_Reference?cl=9919#style">style</a> explicitly, so the caller can force us to be stroked
5147without having to make a copy of the paint just to change that field.
5148
5149### Parameters
5150
5151<table> <tr> <td><code><strong>orig </strong></code></td> <td>
5152geometry modified by <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> when drawn</td>
5153 </tr> <tr> <td><code><strong>storage </strong></code></td> <td>
5154computed bounds of geometry</td>
5155 </tr> <tr> <td><code><strong>style </strong></code></td> <td>
5156overrides <a href="bmh_SkPaint_Reference?cl=9919#Style">Style</a></td>
5157 </tr>
5158</table>
5159
5160### Return Value
5161
5162fast computed bounds
5163
5164---
5165
5166<a name="toString"></a>
5167## toString
5168
5169<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0">
5170void toString(SkString* str) const;
5171</pre>
5172
5173Converts <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> to machine parsable form in developer mode.
5174
5175### Parameters
5176
5177<table> <tr> <td><code><strong>str </strong></code></td> <td>
5178storage for string containing parsable <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a></td>
5179 </tr>
5180</table>
5181
5182### Example
5183
5184<div><fiddle-embed name="5670c04b4562908169a776c48c92d104">
5185
5186#### Example Output
5187
5188~~~~
5189text size = 12
5190~~~~
5191
5192</fiddle-embed></div>
5193
5194---
5195