1SkPaint Reference 2=== 3 4 5<a name='SkPaint'></a> 6 7--- 8 9<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> 10class <a href='SkPaint_Reference#SkPaint'>SkPaint</a> { 11 12 <a href='#SkPaint_empty_constructor'>SkPaint()</a>; 13 <a href='#SkPaint_copy_const_SkPaint'>SkPaint</a>(const <a href='SkPaint_Reference#SkPaint'>SkPaint</a>& <a href='SkPaint_Reference#Paint'>paint</a>); 14 <a href='#SkPaint_move_SkPaint'>SkPaint</a>(<a href='SkPaint_Reference#SkPaint'>SkPaint</a>&& <a href='SkPaint_Reference#Paint'>paint</a>); 15 <a href='#SkPaint_destructor'>~SkPaint()</a>; 16 <a href='SkPaint_Reference#SkPaint'>SkPaint</a>& <a href='#SkPaint_copy_operator'>operator=</a>(const <a href='SkPaint_Reference#SkPaint'>SkPaint</a>& <a href='SkPaint_Reference#Paint'>paint</a>); 17 <a href='SkPaint_Reference#SkPaint'>SkPaint</a>& <a href='#SkPaint_move_operator'>operator=</a>(<a href='SkPaint_Reference#SkPaint'>SkPaint</a>&& <a href='SkPaint_Reference#Paint'>paint</a>); 18 friend bool <a href='#SkPaint_equal_operator'>operator==</a>(const <a href='SkPaint_Reference#SkPaint'>SkPaint</a>& a, const <a href='SkPaint_Reference#SkPaint'>SkPaint</a>& b); 19 friend bool <a href='#SkPaint_notequal_operator'>operator!=</a>(const <a href='SkPaint_Reference#SkPaint'>SkPaint</a>& a, const <a href='SkPaint_Reference#SkPaint'>SkPaint</a>& b); 20 uint32_t <a href='#SkPaint_getHash'>getHash</a>() const; 21 void <a href='#SkPaint_reset'>reset()</a>; 22 void <a href='#SkPaint_setHinting'>setHinting</a>(<a href='undocumented#SkFontHinting'>SkFontHinting</a> hintingLevel); 23 <a href='undocumented#SkFontHinting'>SkFontHinting</a> <a href='#SkPaint_getHinting'>getHinting</a>() const; 24 25 enum <a href='#SkPaint_Flags'>Flags</a> { 26 <a href='#SkPaint_kAntiAlias_Flag'>kAntiAlias_Flag</a> = 0x01, 27 <a href='#SkPaint_kDither_Flag'>kDither_Flag</a> = 0x04, 28 <a href='#SkPaint_kFakeBoldText_Flag'>kFakeBoldText_Flag</a> = 0x20, 29 <a href='#SkPaint_kLinearText_Flag'>kLinearText_Flag</a> = 0x40, 30 <a href='#SkPaint_kSubpixelText_Flag'>kSubpixelText_Flag</a> = 0x80, 31 <a href='#SkPaint_kLCDRenderText_Flag'>kLCDRenderText_Flag</a> = 0x200, 32 <a href='#SkPaint_kEmbeddedBitmapText_Flag'>kEmbeddedBitmapText_Flag</a> = 0x400, 33 <a href='#SkPaint_kAutoHinting_Flag'>kAutoHinting_Flag</a> = 0x800, 34 <a href='#SkPaint_kAllFlags'>kAllFlags</a> = 0xFFFF, 35 }; 36 37 uint32_t <a href='#SkPaint_getFlags'>getFlags</a>() const; 38 void <a href='#SkPaint_setFlags'>setFlags</a>(uint32_t flags); 39 bool <a href='#SkPaint_isAntiAlias'>isAntiAlias</a>() const; 40 void <a href='#SkPaint_setAntiAlias'>setAntiAlias</a>(bool aa); 41 bool <a href='#SkPaint_isDither'>isDither</a>() const; 42 void <a href='#SkPaint_setDither'>setDither</a>(bool dither); 43 bool <a href='#SkPaint_isLinearText'>isLinearText</a>() const; 44 void <a href='#SkPaint_setLinearText'>setLinearText</a>(bool linearText); 45 bool <a href='#SkPaint_isSubpixelText'>isSubpixelText</a>() const; 46 void <a href='#SkPaint_setSubpixelText'>setSubpixelText</a>(bool subpixelText); 47 bool <a href='#SkPaint_isLCDRenderText'>isLCDRenderText</a>() const; 48 void <a href='#SkPaint_setLCDRenderText'>setLCDRenderText</a>(bool lcdText); 49 bool <a href='#SkPaint_isEmbeddedBitmapText'>isEmbeddedBitmapText</a>() const; 50 void <a href='#SkPaint_setEmbeddedBitmapText'>setEmbeddedBitmapText</a>(bool useEmbeddedBitmapText); 51 bool <a href='#SkPaint_isAutohinted'>isAutohinted</a>() const; 52 void <a href='#SkPaint_setAutohinted'>setAutohinted</a>(bool useAutohinter); 53 bool <a href='#SkPaint_isFakeBoldText'>isFakeBoldText</a>() const; 54 void <a href='#SkPaint_setFakeBoldText'>setFakeBoldText</a>(bool fakeBoldText); 55 <a href='undocumented#SkFilterQuality'>SkFilterQuality</a> <a href='#SkPaint_getFilterQuality'>getFilterQuality</a>() const; 56 void <a href='#SkPaint_setFilterQuality'>setFilterQuality</a>(<a href='undocumented#SkFilterQuality'>SkFilterQuality</a> quality); 57 58 enum <a href='#SkPaint_Style'>Style</a> : uint8_t { 59 <a href='#SkPaint_kFill_Style'>kFill_Style</a>, 60 <a href='#SkPaint_kStroke_Style'>kStroke_Style</a>, 61 <a href='#SkPaint_kStrokeAndFill_Style'>kStrokeAndFill_Style</a>, 62 }; 63 64 static constexpr int <a href='#SkPaint_kStyleCount'>kStyleCount</a> = <a href='#SkPaint_kStrokeAndFill_Style'>kStrokeAndFill_Style</a> + 1 65 <a href='#SkPaint_Style'>Style</a> <a href='#SkPaint_getStyle'>getStyle</a>() const; 66 void <a href='#SkPaint_setStyle'>setStyle</a>(<a href='#SkPaint_Style'>Style</a> style); 67 <a href='SkColor_Reference#SkColor'>SkColor</a> <a href='#SkPaint_getColor'>getColor</a>() const; 68 <a href='SkColor4f_Reference#SkColor4f'>SkColor4f</a> <a href='#SkPaint_getColor4f'>getColor4f</a>() const; 69 void <a href='#SkPaint_setColor'>setColor</a>(<a href='SkColor_Reference#SkColor'>SkColor</a> <a href='SkColor_Reference#Color'>color</a>); 70 void <a href='#SkPaint_setColor4f'>setColor4f</a>(const <a href='SkColor4f_Reference#SkColor4f'>SkColor4f</a>& <a href='SkColor_Reference#Color'>color</a>, <a href='undocumented#SkColorSpace'>SkColorSpace</a>* colorSpace); 71 uint8_t <a href='#SkPaint_getAlpha'>getAlpha</a>() const; 72 void <a href='#SkPaint_setAlpha'>setAlpha</a>(<a href='undocumented#U8CPU'>U8CPU</a> a); 73 void <a href='#SkPaint_setARGB'>setARGB</a>(<a href='undocumented#U8CPU'>U8CPU</a> a, <a href='undocumented#U8CPU'>U8CPU</a> r, <a href='undocumented#U8CPU'>U8CPU</a> g, <a href='undocumented#U8CPU'>U8CPU</a> b); 74 <a href='undocumented#SkScalar'>SkScalar</a> <a href='#SkPaint_getStrokeWidth'>getStrokeWidth</a>() const; 75 void <a href='#SkPaint_setStrokeWidth'>setStrokeWidth</a>(<a href='undocumented#SkScalar'>SkScalar</a> width); 76 <a href='undocumented#SkScalar'>SkScalar</a> <a href='#SkPaint_getStrokeMiter'>getStrokeMiter</a>() const; 77 void <a href='#SkPaint_setStrokeMiter'>setStrokeMiter</a>(<a href='undocumented#SkScalar'>SkScalar</a> miter); 78 79 enum <a href='#SkPaint_Cap'>Cap</a> { 80 <a href='#SkPaint_kButt_Cap'>kButt_Cap</a>, 81 <a href='#SkPaint_kRound_Cap'>kRound_Cap</a>, 82 <a href='#SkPaint_kSquare_Cap'>kSquare_Cap</a>, 83 <a href='#SkPaint_kLast_Cap'>kLast_Cap</a> = <a href='#SkPaint_kSquare_Cap'>kSquare_Cap</a>, 84 <a href='#SkPaint_kDefault_Cap'>kDefault_Cap</a> = <a href='#SkPaint_kButt_Cap'>kButt_Cap</a>, 85 }; 86 87 static constexpr int <a href='#SkPaint_kCapCount'>kCapCount</a> = <a href='#SkPaint_kLast_Cap'>kLast_Cap</a> + 1 88 enum <a href='#SkPaint_Join'>Join</a> : uint8_t { 89 <a href='#SkPaint_kMiter_Join'>kMiter_Join</a>, 90 <a href='#SkPaint_kRound_Join'>kRound_Join</a>, 91 <a href='#SkPaint_kBevel_Join'>kBevel_Join</a>, 92 <a href='#SkPaint_kLast_Join'>kLast_Join</a> = <a href='#SkPaint_kBevel_Join'>kBevel_Join</a>, 93 <a href='#SkPaint_kDefault_Join'>kDefault_Join</a> = <a href='#SkPaint_kMiter_Join'>kMiter_Join</a>, 94 }; 95 96 static constexpr int <a href='#SkPaint_kJoinCount'>kJoinCount</a> = <a href='#SkPaint_kLast_Join'>kLast_Join</a> + 1 97 <a href='#SkPaint_Cap'>Cap</a> <a href='#SkPaint_getStrokeCap'>getStrokeCap</a>() const; 98 void <a href='#SkPaint_setStrokeCap'>setStrokeCap</a>(<a href='#SkPaint_Cap'>Cap</a> cap); 99 <a href='#SkPaint_Join'>Join</a> <a href='#SkPaint_getStrokeJoin'>getStrokeJoin</a>() const; 100 void <a href='#SkPaint_setStrokeJoin'>setStrokeJoin</a>(<a href='#SkPaint_Join'>Join</a> join); 101 bool <a href='#SkPaint_getFillPath'>getFillPath</a>(const <a href='SkPath_Reference#SkPath'>SkPath</a>& src, <a href='SkPath_Reference#SkPath'>SkPath</a>* dst, const <a href='SkRect_Reference#SkRect'>SkRect</a>* cullRect, 102 <a href='undocumented#SkScalar'>SkScalar</a> resScale = 1) const; 103 bool <a href='#SkPaint_getFillPath'>getFillPath</a>(const <a href='SkPath_Reference#SkPath'>SkPath</a>& src, <a href='SkPath_Reference#SkPath'>SkPath</a>* dst) const; 104 <a href='undocumented#SkShader'>SkShader</a>* <a href='#SkPaint_getShader'>getShader</a>() const; 105 <a href='undocumented#sk_sp'>sk_sp</a><<a href='undocumented#SkShader'>SkShader</a>> <a href='#SkPaint_refShader'>refShader</a>() const; 106 void <a href='#SkPaint_setShader'>setShader</a>(<a href='undocumented#sk_sp'>sk_sp</a><<a href='undocumented#SkShader'>SkShader</a>> <a href='undocumented#Shader'>shader</a>); 107 <a href='undocumented#SkColorFilter'>SkColorFilter</a>* <a href='#SkPaint_getColorFilter'>getColorFilter</a>() const; 108 <a href='undocumented#sk_sp'>sk_sp</a><<a href='undocumented#SkColorFilter'>SkColorFilter</a>> <a href='#SkPaint_refColorFilter'>refColorFilter</a>() const; 109 void <a href='#SkPaint_setColorFilter'>setColorFilter</a>(<a href='undocumented#sk_sp'>sk_sp</a><<a href='undocumented#SkColorFilter'>SkColorFilter</a>> colorFilter); 110 <a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a> <a href='#SkPaint_getBlendMode'>getBlendMode</a>() const; 111 bool <a href='#SkPaint_isSrcOver'>isSrcOver</a>() const; 112 void <a href='#SkPaint_setBlendMode'>setBlendMode</a>(<a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a> mode); 113 <a href='undocumented#SkPathEffect'>SkPathEffect</a>* <a href='#SkPaint_getPathEffect'>getPathEffect</a>() const; 114 <a href='undocumented#sk_sp'>sk_sp</a><<a href='undocumented#SkPathEffect'>SkPathEffect</a>> <a href='#SkPaint_refPathEffect'>refPathEffect</a>() const; 115 void <a href='#SkPaint_setPathEffect'>setPathEffect</a>(<a href='undocumented#sk_sp'>sk_sp</a><<a href='undocumented#SkPathEffect'>SkPathEffect</a>> pathEffect); 116 <a href='undocumented#SkMaskFilter'>SkMaskFilter</a>* <a href='#SkPaint_getMaskFilter'>getMaskFilter</a>() const; 117 <a href='undocumented#sk_sp'>sk_sp</a><<a href='undocumented#SkMaskFilter'>SkMaskFilter</a>> <a href='#SkPaint_refMaskFilter'>refMaskFilter</a>() const; 118 void <a href='#SkPaint_setMaskFilter'>setMaskFilter</a>(<a href='undocumented#sk_sp'>sk_sp</a><<a href='undocumented#SkMaskFilter'>SkMaskFilter</a>> maskFilter); 119 <a href='undocumented#SkTypeface'>SkTypeface</a>* <a href='#SkPaint_getTypeface'>getTypeface</a>() const; 120 <a href='undocumented#sk_sp'>sk_sp</a><<a href='undocumented#SkTypeface'>SkTypeface</a>> <a href='#SkPaint_refTypeface'>refTypeface</a>() const; 121 void <a href='#SkPaint_setTypeface'>setTypeface</a>(<a href='undocumented#sk_sp'>sk_sp</a><<a href='undocumented#SkTypeface'>SkTypeface</a>> <a href='undocumented#Typeface'>typeface</a>); 122 <a href='undocumented#SkImageFilter'>SkImageFilter</a>* <a href='#SkPaint_getImageFilter'>getImageFilter</a>() const; 123 <a href='undocumented#sk_sp'>sk_sp</a><<a href='undocumented#SkImageFilter'>SkImageFilter</a>> <a href='#SkPaint_refImageFilter'>refImageFilter</a>() const; 124 void <a href='#SkPaint_setImageFilter'>setImageFilter</a>(<a href='undocumented#sk_sp'>sk_sp</a><<a href='undocumented#SkImageFilter'>SkImageFilter</a>> imageFilter); 125 <a href='undocumented#SkDrawLooper'>SkDrawLooper</a>* <a href='#SkPaint_getDrawLooper'>getDrawLooper</a>() const; 126 <a href='undocumented#sk_sp'>sk_sp</a><<a href='undocumented#SkDrawLooper'>SkDrawLooper</a>> <a href='#SkPaint_refDrawLooper'>refDrawLooper</a>() const; 127 void <a href='#SkPaint_setDrawLooper'>setDrawLooper</a>(<a href='undocumented#sk_sp'>sk_sp</a><<a href='undocumented#SkDrawLooper'>SkDrawLooper</a>> drawLooper); 128 <a href='undocumented#SkScalar'>SkScalar</a> <a href='#SkPaint_getTextSize'>getTextSize</a>() const; 129 void <a href='#SkPaint_setTextSize'>setTextSize</a>(<a href='undocumented#SkScalar'>SkScalar</a> textSize); 130 <a href='undocumented#SkScalar'>SkScalar</a> <a href='#SkPaint_getTextScaleX'>getTextScaleX</a>() const; 131 void <a href='#SkPaint_setTextScaleX'>setTextScaleX</a>(<a href='undocumented#SkScalar'>SkScalar</a> scaleX); 132 <a href='undocumented#SkScalar'>SkScalar</a> <a href='#SkPaint_getTextSkewX'>getTextSkewX</a>() const; 133 void <a href='#SkPaint_setTextSkewX'>setTextSkewX</a>(<a href='undocumented#SkScalar'>SkScalar</a> skewX); 134 <a href='undocumented#SkTextEncoding'>SkTextEncoding</a> <a href='#SkPaint_getTextEncoding'>getTextEncoding</a>() const; 135 void <a href='#SkPaint_setTextEncoding'>setTextEncoding</a>(<a href='undocumented#SkTextEncoding'>SkTextEncoding</a> encoding); 136 137 typedef <a href='undocumented#SkFontMetrics'>SkFontMetrics</a> <a href='#SkPaint_FontMetrics'>FontMetrics</a>; 138 139 <a href='undocumented#SkScalar'>SkScalar</a> <a href='#SkPaint_getFontMetrics'>getFontMetrics</a>(<a href='undocumented#SkFontMetrics'>SkFontMetrics</a>* metrics) const; 140 <a href='undocumented#SkScalar'>SkScalar</a> <a href='#SkPaint_getFontSpacing'>getFontSpacing</a>() const; 141 int <a href='#SkPaint_textToGlyphs'>textToGlyphs</a>(const void* <a href='undocumented#Text'>text</a>, size_t byteLength, 142 <a href='undocumented#SkGlyphID'>SkGlyphID</a> <a href='undocumented#Glyph'>glyphs</a>[]) const; 143 bool <a href='#SkPaint_containsText'>containsText</a>(const void* <a href='undocumented#Text'>text</a>, size_t byteLength) const; 144 void <a href='#SkPaint_glyphsToUnichars'>glyphsToUnichars</a>(const <a href='undocumented#SkGlyphID'>SkGlyphID</a> <a href='undocumented#Glyph'>glyphs</a>[], int count, <a href='undocumented#SkUnichar'>SkUnichar</a> <a href='undocumented#Text'>text</a>[]) const; 145 int <a href='#SkPaint_countText'>countText</a>(const void* <a href='undocumented#Text'>text</a>, size_t byteLength) const; 146 <a href='undocumented#SkScalar'>SkScalar</a> <a href='#SkPaint_measureText'>measureText</a>(const void* <a href='undocumented#Text'>text</a>, size_t length, <a href='SkRect_Reference#SkRect'>SkRect</a>* bounds) const; 147 <a href='undocumented#SkScalar'>SkScalar</a> <a href='#SkPaint_measureText'>measureText</a>(const void* <a href='undocumented#Text'>text</a>, size_t length) const; 148 int <a href='#SkPaint_getTextWidths'>getTextWidths</a>(const void* <a href='undocumented#Text'>text</a>, size_t byteLength, <a href='undocumented#SkScalar'>SkScalar</a> widths[], 149 <a href='SkRect_Reference#SkRect'>SkRect</a> bounds[] = nullptr) const; 150 void <a href='#SkPaint_getTextPath'>getTextPath</a>(const void* <a href='undocumented#Text'>text</a>, size_t length, <a href='undocumented#SkScalar'>SkScalar</a> x, <a href='undocumented#SkScalar'>SkScalar</a> y, 151 <a href='SkPath_Reference#SkPath'>SkPath</a>* <a href='SkPath_Reference#Path'>path</a>) const; 152 void <a href='#SkPaint_getPosTextPath'>getPosTextPath</a>(const void* <a href='undocumented#Text'>text</a>, size_t length, 153 const <a href='SkPoint_Reference#SkPoint'>SkPoint</a> pos[], <a href='SkPath_Reference#SkPath'>SkPath</a>* <a href='SkPath_Reference#Path'>path</a>) const; 154 bool <a href='#SkPaint_nothingToDraw'>nothingToDraw</a>() const; 155}; 156 157</pre> 158 159<a href='SkPaint_Reference#Paint'>Paint</a> controls options applied when drawing and measuring. <a href='SkPaint_Reference#Paint'>Paint</a> collects all 160options outside of the <a href='#Canvas_Clip'>Canvas_Clip</a> and <a href='#Canvas_Matrix'>Canvas_Matrix</a>. 161 162Various options apply to <a href='undocumented#Text'>text</a>, strokes and fills, and images. 163 164Some options may not be implemented on all platforms; in these cases, setting 165the option has no effect. Some options are conveniences that duplicate <a href='SkCanvas_Reference#Canvas'>Canvas</a> 166functionality; for instance, <a href='#Text_Size'>text size</a> is identical to <a href='SkMatrix_Reference#Matrix'>matrix</a> scale. 167 168<a href='SkPaint_Reference#Paint'>Paint</a> options are rarely exclusive; each option modifies a stage of the drawing 169pipeline and multiple pipeline stages may be affected by a single <a href='SkPaint_Reference#Paint'>Paint</a>. 170 171<a href='SkPaint_Reference#Paint'>Paint</a> collects effects and filters that describe single-pass and multiple-pass 172algorithms that alter the drawing geometry, <a href='SkColor_Reference#Color'>color</a>, and transparency. For instance, 173<a href='SkPaint_Reference#Paint'>Paint</a> does not directly implement dashing or blur, but contains the objects that do so. 174 175The objects contained by <a href='SkPaint_Reference#Paint'>Paint</a> are opaque, and cannot be edited outside of the <a href='SkPaint_Reference#Paint'>Paint</a> 176to affect it. The implementation is free to defer computations associated with the 177<a href='SkPaint_Reference#Paint'>Paint</a>, or ignore them altogether. For instance, some GPU implementations draw all 178<a href='SkPath_Reference#Path'>Path</a> geometries with <a href='#Paint_Anti_Alias'>Anti_Aliasing</a>, regardless of how <a href='SkPaint_Reference#SkPaint'>SkPaint</a>::<a href='#SkPaint_kAntiAlias_Flag'>kAntiAlias_Flag</a> 179is set in <a href='SkPaint_Reference#Paint'>Paint</a>. 180 181<a href='SkPaint_Reference#Paint'>Paint</a> describes a single <a href='SkColor_Reference#Color'>color</a>, a single <a href='SkFont_Reference#Font'>font</a>, a single <a href='SkImage_Reference#Image'>image</a> quality, and so on. 182Multiple colors are drawn either by using multiple paints or with objects like 183<a href='undocumented#Shader'>Shader</a> attached to <a href='SkPaint_Reference#Paint'>Paint</a>. 184 185<a name='SkPaint_empty_constructor'></a> 186 187--- 188 189<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 190<a href='#SkPaint_empty_constructor'>SkPaint()</a> 191</pre> 192 193Constructs <a href='SkPaint_Reference#Paint'>Paint</a> with default values. 194 195| attribute | default value | 196| --- | --- | 197| <a href='#Paint_Anti_Alias'>Anti_Alias</a> | false | 198| <a href='#Blend_Mode'>Blend_Mode</a> | <a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a>::<a href='#SkBlendMode_kSrcOver'>kSrcOver</a> | 199| <a href='SkColor_Reference#Color'>Color</a> | <a href='SkColor_Reference#SK_ColorBLACK'>SK_ColorBLACK</a> | 200| <a href='#Color_Alpha'>Color_Alpha</a> | 255 | 201| <a href='#Color_Filter'>Color_Filter</a> | nullptr | 202| Dither | false | 203| <a href='#Draw_Looper'>Draw_Looper</a> | nullptr | 204| <a href='#Filter_Quality'>Filter_Quality</a> | <a href='undocumented#kNone_SkFilterQuality'>kNone_SkFilterQuality</a> | 205| <a href='#Font_Force_Hinting'>Font_Force_Hinting</a> | false | 206| <a href='#Font_Embedded_Bitmaps'>Font_Embedded_Bitmaps</a> | false | 207| <a href='#Font_Embolden'>Font_Embolden</a> | false | 208| <a href='#Font_Hinting'>Font_Hinting</a> | <a href='undocumented#SkFontHinting'>SkFontHinting</a>::<a href='#SkFontHinting_kNormal'>kNormal</a> | 209| <a href='#Font_Hinting_Spacing'>Font_Hinting_Spacing</a> | false | 210| <a href='#Font_Anti_Alias'>Font_Anti_Alias</a> | false | 211| <a href='#Font_Linear'>Font_Linear</a> | false | 212| <a href='#Font_Scale_X'>Font_Scale_X</a> | 1 | 213| <a href='#Font_Size'>Font_Size</a> | 12 | 214| <a href='#Font_Skew_X'>Font_Skew_X</a> | 0 | 215| <a href='#Font_Subpixel'>Font_Subpixel</a> | false | 216| <a href='#Image_Filter'>Image_Filter</a> | nullptr | 217| <a href='#Paint_Miter_Limit'>Miter_Limit</a> | 4 | 218| <a href='#Mask_Filter'>Mask_Filter</a> | nullptr | 219| <a href='#Path_Effect'>Path_Effect</a> | nullptr | 220| <a href='undocumented#Shader'>Shader</a> | nullptr | 221| <a href='#SkPaint_Style'>Style</a> | <a href='#SkPaint_kFill_Style'>kFill_Style</a> | 222| <a href='#Text_Encoding'>Text_Encoding</a> | <a href='undocumented#kUTF8_SkTextEncoding'>kUTF8_SkTextEncoding</a> | 223| <a href='undocumented#Typeface'>Typeface</a> | nullptr | 224| <a href='#Paint_Stroke_Cap'>Stroke_Cap</a> | <a href='#SkPaint_kButt_Cap'>kButt_Cap</a> | 225| <a href='#Paint_Stroke_Join'>Stroke_Join</a> | <a href='#SkPaint_kMiter_Join'>kMiter_Join</a> | 226| <a href='#Paint_Stroke_Width'>Stroke_Width</a> | 0 | 227 228The flags, <a href='undocumented#Text'>text</a> <a href='undocumented#Size'>size</a>, hinting, and miter limit may be overridden at compile time by defining 229<a href='SkPaint_Reference#Paint'>paint</a> default values. The overrides may be included in "SkUserConfig.h" or predefined by the 230build system. 231 232### Return Value 233 234default initialized <a href='SkPaint_Reference#Paint'>Paint</a> 235 236### Example 237 238<div><fiddle-embed name="c4b2186d85c142a481298f7144295ffd"></fiddle-embed></div> 239 240<a name='SkPaint_copy_const_SkPaint'></a> 241 242--- 243 244<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 245<a href='#SkPaint_copy_const_SkPaint'>SkPaint</a>(const <a href='SkPaint_Reference#SkPaint'>SkPaint</a>& <a href='SkPaint_Reference#Paint'>paint</a>) 246</pre> 247 248Makes a shallow copy of <a href='SkPaint_Reference#SkPaint'>SkPaint</a>. <a href='undocumented#SkTypeface'>SkTypeface</a>, <a href='undocumented#SkPathEffect'>SkPathEffect</a>, <a href='undocumented#SkShader'>SkShader</a>, 249<a href='undocumented#SkMaskFilter'>SkMaskFilter</a>, <a href='undocumented#SkColorFilter'>SkColorFilter</a>, <a href='undocumented#SkDrawLooper'>SkDrawLooper</a>, and <a href='undocumented#SkImageFilter'>SkImageFilter</a> are shared 250between the original <a href='#SkPaint_copy_const_SkPaint_paint'>paint</a> and the copy. Objects containing <a href='undocumented#SkRefCnt'>SkRefCnt</a> increment 251their references by one. 252 253The referenced objects <a href='undocumented#SkPathEffect'>SkPathEffect</a>, <a href='undocumented#SkShader'>SkShader</a>, <a href='undocumented#SkMaskFilter'>SkMaskFilter</a>, <a href='undocumented#SkColorFilter'>SkColorFilter</a>, 254<a href='undocumented#SkDrawLooper'>SkDrawLooper</a>, and <a href='undocumented#SkImageFilter'>SkImageFilter</a> cannot be modified after they are created. 255This prevents objects with <a href='undocumented#SkRefCnt'>SkRefCnt</a> from being modified once <a href='SkPaint_Reference#SkPaint'>SkPaint</a> refers to them. 256 257### Parameters 258 259<table> <tr> <td><a name='SkPaint_copy_const_SkPaint_paint'><code><strong>paint</strong></code></a></td> 260 <td>original to copy</td> 261 </tr> 262</table> 263 264### Return Value 265 266shallow copy of <a href='#SkPaint_copy_const_SkPaint_paint'>paint</a> 267 268### Example 269 270<div><fiddle-embed name="b99971ad0ef243d617925289d963b62d"> 271 272#### Example Output 273 274~~~~ 275SK_ColorRED == paint1.getColor() 276SK_ColorBLUE == paint2.getColor() 277~~~~ 278 279</fiddle-embed></div> 280 281<a name='SkPaint_move_SkPaint'></a> 282 283--- 284 285<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 286<a href='#SkPaint_move_SkPaint'>SkPaint</a>(<a href='SkPaint_Reference#SkPaint'>SkPaint</a>&& <a href='SkPaint_Reference#Paint'>paint</a>) 287</pre> 288 289Implements a move constructor to avoid increasing the reference counts 290of objects referenced by the <a href='#SkPaint_move_SkPaint_paint'>paint</a>. 291 292After the call, <a href='#SkPaint_move_SkPaint_paint'>paint</a> is undefined, and can be safely destructed. 293 294### Parameters 295 296<table> <tr> <td><a name='SkPaint_move_SkPaint_paint'><code><strong>paint</strong></code></a></td> 297 <td>original to move</td> 298 </tr> 299</table> 300 301### Return Value 302 303content of <a href='#SkPaint_move_SkPaint_paint'>paint</a> 304 305### Example 306 307<div><fiddle-embed name="8ed1488a503cd5282b86a51614aa90b1"> 308 309#### Example Output 310 311~~~~ 312path effect unique: true 313~~~~ 314 315</fiddle-embed></div> 316 317<a name='SkPaint_reset'></a> 318 319--- 320 321<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 322void <a href='#SkPaint_reset'>reset()</a> 323</pre> 324 325Sets all <a href='SkPaint_Reference#SkPaint'>SkPaint</a> contents to their initial values. This is equivalent to replacing 326<a href='SkPaint_Reference#SkPaint'>SkPaint</a> with the result of <a href='#SkPaint_empty_constructor'>SkPaint()</a>. 327 328### Example 329 330<div><fiddle-embed name="ef269937ade7e7353635121d9a64f9f7"> 331 332#### Example Output 333 334~~~~ 335paint1 == paint2 336~~~~ 337 338</fiddle-embed></div> 339 340<a name='SkPaint_destructor'></a> 341 342--- 343 344<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 345<a href='#SkPaint_destructor'>~SkPaint()</a> 346</pre> 347 348Decreases <a href='SkPaint_Reference#SkPaint'>SkPaint</a> <a href='undocumented#SkRefCnt'>SkRefCnt</a> of owned objects: <a href='undocumented#SkTypeface'>SkTypeface</a>, <a href='undocumented#SkPathEffect'>SkPathEffect</a>, <a href='undocumented#SkShader'>SkShader</a>, 349<a href='undocumented#SkMaskFilter'>SkMaskFilter</a>, <a href='undocumented#SkColorFilter'>SkColorFilter</a>, <a href='undocumented#SkDrawLooper'>SkDrawLooper</a>, and <a href='undocumented#SkImageFilter'>SkImageFilter</a>. If the 350objects containing <a href='undocumented#SkRefCnt'>SkRefCnt</a> go to zero, they are deleted. 351 352<a name='Management'></a> 353 354<a name='SkPaint_copy_operator'></a> 355 356--- 357 358<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 359<a href='SkPaint_Reference#SkPaint'>SkPaint</a>& <a href='#SkPaint_copy_operator'>operator=</a>(const <a href='SkPaint_Reference#SkPaint'>SkPaint</a>& <a href='SkPaint_Reference#Paint'>paint</a>) 360</pre> 361 362Makes a shallow copy of <a href='SkPaint_Reference#SkPaint'>SkPaint</a>. <a href='undocumented#SkTypeface'>SkTypeface</a>, <a href='undocumented#SkPathEffect'>SkPathEffect</a>, <a href='undocumented#SkShader'>SkShader</a>, 363<a href='undocumented#SkMaskFilter'>SkMaskFilter</a>, <a href='undocumented#SkColorFilter'>SkColorFilter</a>, <a href='undocumented#SkDrawLooper'>SkDrawLooper</a>, and <a href='undocumented#SkImageFilter'>SkImageFilter</a> are shared 364between the original <a href='#SkPaint_copy_operator_paint'>paint</a> and the copy. Objects containing <a href='undocumented#SkRefCnt'>SkRefCnt</a> in the 365prior destination are decreased by one, and the referenced objects are deleted if the 366resulting count is zero. Objects containing <a href='undocumented#SkRefCnt'>SkRefCnt</a> in the parameter <a href='#SkPaint_copy_operator_paint'>paint</a> 367are increased by one. <a href='#SkPaint_copy_operator_paint'>paint</a> is unmodified. 368 369### Parameters 370 371<table> <tr> <td><a name='SkPaint_copy_operator_paint'><code><strong>paint</strong></code></a></td> 372 <td>original to copy</td> 373 </tr> 374</table> 375 376### Return Value 377 378content of <a href='#SkPaint_copy_operator_paint'>paint</a> 379 380### Example 381 382<div><fiddle-embed name="b476a9088f80dece176ed577807d3992"> 383 384#### Example Output 385 386~~~~ 387SK_ColorRED == paint1.getColor() 388SK_ColorRED == paint2.getColor() 389~~~~ 390 391</fiddle-embed></div> 392 393<a name='SkPaint_move_operator'></a> 394 395--- 396 397<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 398<a href='SkPaint_Reference#SkPaint'>SkPaint</a>& <a href='#SkPaint_move_operator'>operator=</a>(<a href='SkPaint_Reference#SkPaint'>SkPaint</a>&& <a href='SkPaint_Reference#Paint'>paint</a>) 399</pre> 400 401Moves the <a href='#SkPaint_move_operator_paint'>paint</a> to avoid increasing the reference counts 402of objects referenced by the <a href='#SkPaint_move_operator_paint'>paint</a> parameter. Objects containing <a href='undocumented#SkRefCnt'>SkRefCnt</a> in the 403prior destination are decreased by one; those objects are deleted if the resulting count 404is zero. 405 406After the call, <a href='#SkPaint_move_operator_paint'>paint</a> is undefined, and can be safely destructed. 407 408### Parameters 409 410<table> <tr> <td><a name='SkPaint_move_operator_paint'><code><strong>paint</strong></code></a></td> 411 <td>original to move</td> 412 </tr> 413</table> 414 415### Return Value 416 417content of <a href='#SkPaint_move_operator_paint'>paint</a> 418 419### Example 420 421<div><fiddle-embed name="9fb7459b097d713f5f1fe5675afe14f5"> 422 423#### Example Output 424 425~~~~ 426SK_ColorRED == paint2.getColor() 427~~~~ 428 429</fiddle-embed></div> 430 431<a name='SkPaint_equal_operator'></a> 432 433--- 434 435<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 436bool <a href='#SkPaint_equal_operator'>operator==</a>(const <a href='SkPaint_Reference#SkPaint'>SkPaint</a>& a, const <a href='SkPaint_Reference#SkPaint'>SkPaint</a>& b) 437</pre> 438 439Compares <a href='#SkPaint_equal_operator_a'>a</a> and <a href='#SkPaint_equal_operator_b'>b</a>, and returns true if <a href='#SkPaint_equal_operator_a'>a</a> and <a href='#SkPaint_equal_operator_b'>b</a> are equivalent. May return false 440if <a href='undocumented#SkTypeface'>SkTypeface</a>, <a href='undocumented#SkPathEffect'>SkPathEffect</a>, <a href='undocumented#SkShader'>SkShader</a>, <a href='undocumented#SkMaskFilter'>SkMaskFilter</a>, <a href='undocumented#SkColorFilter'>SkColorFilter</a>, 441<a href='undocumented#SkDrawLooper'>SkDrawLooper</a>, or <a href='undocumented#SkImageFilter'>SkImageFilter</a> have identical contents but different pointers. 442 443### Parameters 444 445<table> <tr> <td><a name='SkPaint_equal_operator_a'><code><strong>a</strong></code></a></td> 446 <td><a href='SkPaint_Reference#SkPaint'>SkPaint</a> to compare</td> 447 </tr> 448 <tr> <td><a name='SkPaint_equal_operator_b'><code><strong>b</strong></code></a></td> 449 <td><a href='SkPaint_Reference#SkPaint'>SkPaint</a> to compare</td> 450 </tr> 451</table> 452 453### Return Value 454 455true if <a href='SkPaint_Reference#SkPaint'>SkPaint</a> pair are equivalent 456 457### Example 458 459<div><fiddle-embed name="7481a948e34672720337a631830586dd"> 460 461#### Example Output 462 463~~~~ 464paint1 == paint2 465paint1 != paint2 466~~~~ 467 468</fiddle-embed></div> 469 470### See Also 471 472<a href='#SkPaint_notequal_operator'>operator!=</a>(const <a href='SkPaint_Reference#SkPaint'>SkPaint</a>& <a href='#SkPaint_equal_operator_a'>a</a>, const <a href='SkPaint_Reference#SkPaint'>SkPaint</a>& <a href='#SkPaint_equal_operator_b'>b</a>) 473 474<a name='SkPaint_notequal_operator'></a> 475 476--- 477 478<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 479bool <a href='#SkPaint_notequal_operator'>operator!=</a>(const <a href='SkPaint_Reference#SkPaint'>SkPaint</a>& a, const <a href='SkPaint_Reference#SkPaint'>SkPaint</a>& b) 480</pre> 481 482Compares <a href='#SkPaint_notequal_operator_a'>a</a> and <a href='#SkPaint_notequal_operator_b'>b</a>, and returns true if <a href='#SkPaint_notequal_operator_a'>a</a> and <a href='#SkPaint_notequal_operator_b'>b</a> are not equivalent. May return true 483if <a href='undocumented#SkTypeface'>SkTypeface</a>, <a href='undocumented#SkPathEffect'>SkPathEffect</a>, <a href='undocumented#SkShader'>SkShader</a>, <a href='undocumented#SkMaskFilter'>SkMaskFilter</a>, <a href='undocumented#SkColorFilter'>SkColorFilter</a>, 484<a href='undocumented#SkDrawLooper'>SkDrawLooper</a>, or <a href='undocumented#SkImageFilter'>SkImageFilter</a> have identical contents but different pointers. 485 486### Parameters 487 488<table> <tr> <td><a name='SkPaint_notequal_operator_a'><code><strong>a</strong></code></a></td> 489 <td><a href='SkPaint_Reference#SkPaint'>SkPaint</a> to compare</td> 490 </tr> 491 <tr> <td><a name='SkPaint_notequal_operator_b'><code><strong>b</strong></code></a></td> 492 <td><a href='SkPaint_Reference#SkPaint'>SkPaint</a> to compare</td> 493 </tr> 494</table> 495 496### Return Value 497 498true if <a href='SkPaint_Reference#SkPaint'>SkPaint</a> pair are not equivalent 499 500### Example 501 502<div><fiddle-embed name="b6c8484b1187f555b435ad5369833be4"> 503 504#### Example Output 505 506~~~~ 507paint1 == paint2 508paint1 == paint2 509~~~~ 510 511</fiddle-embed></div> 512 513### See Also 514 515<a href='#SkPaint_equal_operator'>operator==</a>(const <a href='SkPaint_Reference#SkPaint'>SkPaint</a>& <a href='#SkPaint_notequal_operator_a'>a</a>, const <a href='SkPaint_Reference#SkPaint'>SkPaint</a>& <a href='#SkPaint_notequal_operator_b'>b</a>) 516 517<a name='SkPaint_getHash'></a> 518 519--- 520 521<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 522uint32_t <a href='#SkPaint_getHash'>getHash</a>()const 523</pre> 524 525Returns a hash generated from <a href='SkPaint_Reference#SkPaint'>SkPaint</a> values and pointers. 526Identical hashes guarantee that the paints are 527equivalent, but differing hashes do not guarantee that the paints have differing 528contents. 529 530If <a href='#SkPaint_equal_operator'>operator==</a>(const <a href='SkPaint_Reference#SkPaint'>SkPaint</a>& a, const <a href='SkPaint_Reference#SkPaint'>SkPaint</a>& b) returns true for two paints, 531their hashes are also equal. 532 533The hash returned is platform and implementation specific. 534 535### Return Value 536 537a shallow hash 538 539### Example 540 541<div><fiddle-embed name="7f7e1b701361912b344f90ae6b530393"> 542 543#### Example Output 544 545~~~~ 546paint1 == paint2 547paint1.getHash() == paint2.getHash() 548~~~~ 549 550</fiddle-embed></div> 551 552<a name='Hinting'></a> 553 554<a name='SkPaint_setHinting'></a> 555 556--- 557 558<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 559void <a href='#SkPaint_setHinting'>setHinting</a>(<a href='undocumented#SkFontHinting'>SkFontHinting</a> hintingLevel) 560</pre> 561 562Sets level of <a href='undocumented#Glyph'>glyph</a> outline adjustment. 563Does not check for valid values of <a href='#SkPaint_setHinting_hintingLevel'>hintingLevel</a>. 564 565### Parameters 566 567<table> <tr> <td><a name='SkPaint_setHinting_hintingLevel'><code><strong>hintingLevel</strong></code></a></td> 568 <td>one of: <a href='undocumented#SkFontHinting'>SkFontHinting</a>::<a href='#SkFontHinting_kNone'>kNone</a>, <a href='undocumented#SkFontHinting'>SkFontHinting</a>::<a href='#SkFontHinting_kSlight'>kSlight</a>,</td> 569 </tr> 570</table> 571 572<a href='undocumented#SkFontHinting'>SkFontHinting</a>::<a href='#SkFontHinting_kNormal'>kNormal</a>, <a href='undocumented#SkFontHinting'>SkFontHinting</a>::<a href='#SkFontHinting_kFull'>kFull</a> 573 574### Example 575 576<div><fiddle-embed name="bb179ec5698ec1398ff18f3657ab73f7"> 577 578#### Example Output 579 580~~~~ 581paint1 == paint2 582~~~~ 583 584</fiddle-embed></div> 585 586<a name='SkPaint_getHinting'></a> 587 588--- 589 590<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 591<a href='undocumented#SkFontHinting'>SkFontHinting</a> <a href='#SkPaint_getHinting'>getHinting</a>()const 592</pre> 593 594Returns level of <a href='undocumented#Glyph'>glyph</a> outline adjustment. 595 596### Return Value 597 598one of: <a href='undocumented#SkFontHinting'>SkFontHinting</a>::<a href='#SkFontHinting_kNone'>kNone</a>, <a href='undocumented#SkFontHinting'>SkFontHinting</a>::<a href='#SkFontHinting_kSlight'>kSlight</a>, <a href='undocumented#SkFontHinting'>SkFontHinting</a>::<a href='#SkFontHinting_kNormal'>kNormal</a>, 599 600<a href='undocumented#SkFontHinting'>SkFontHinting</a>::<a href='#SkFontHinting_kFull'>kFull</a> 601 602### Example 603 604<div><fiddle-embed name="b56b70c7ea2453c41bfa58b626953bed"> 605 606#### Example Output 607 608~~~~ 609SkFontHinting::kNormal == paint.getHinting() 610~~~~ 611 612</fiddle-embed></div> 613 614<a name='Flags'></a> 615 616<a name='SkPaint_Flags'></a> 617 618--- 619 620<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> 621 enum <a href='#SkPaint_Flags'>Flags</a> { 622 <a href='#SkPaint_kAntiAlias_Flag'>kAntiAlias_Flag</a> = 0x01, 623 <a href='#SkPaint_kDither_Flag'>kDither_Flag</a> = 0x04, 624 <a href='#SkPaint_kFakeBoldText_Flag'>kFakeBoldText_Flag</a> = 0x20, 625 <a href='#SkPaint_kLinearText_Flag'>kLinearText_Flag</a> = 0x40, 626 <a href='#SkPaint_kSubpixelText_Flag'>kSubpixelText_Flag</a> = 0x80, 627 <a href='#SkPaint_kLCDRenderText_Flag'>kLCDRenderText_Flag</a> = 0x200, 628 <a href='#SkPaint_kEmbeddedBitmapText_Flag'>kEmbeddedBitmapText_Flag</a> = 0x400, 629 <a href='#SkPaint_kAutoHinting_Flag'>kAutoHinting_Flag</a> = 0x800, 630 <a href='#SkPaint_kAllFlags'>kAllFlags</a> = 0xFFFF, 631 }; 632 633</pre> 634 635The bit values stored in <a href='#SkPaint_Flags'>Flags</a>. 636The default value for <a href='#SkPaint_Flags'>Flags</a>, normally zero, can be changed at compile time 637with a custom definition of <a href='undocumented#SkPaintDefaults_Flags'>SkPaintDefaults_Flags</a>. 638All flags can be read and written explicitly; <a href='#SkPaint_Flags'>Flags</a> allows manipulating 639multiple settings at once. 640 641### Constants 642 643<table style='border-collapse: collapse; width: 62.5em'> 644 <tr><th style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>Const</th> 645<th style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>Value</th> 646<th style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>Description</th></tr> 647 <tr style='background-color: #f0f0f0; '> 648 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkPaint_kAntiAlias_Flag'><code>SkPaint::kAntiAlias_Flag</code></a></td> 649 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>0x0001</td> 650 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 651mask for setting Anti_Alias</td> 652 </tr> 653 <tr> 654 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkPaint_kDither_Flag'><code>SkPaint::kDither_Flag</code></a></td> 655 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>0x0004</td> 656 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 657mask for setting Dither</td> 658 </tr> 659 <tr style='background-color: #f0f0f0; '> 660 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkPaint_kFakeBoldText_Flag'><code>SkPaint::kFakeBoldText_Flag</code></a></td> 661 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>0x0020</td> 662 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 663mask for setting Font_Embolden</td> 664 </tr> 665 <tr> 666 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkPaint_kLinearText_Flag'><code>SkPaint::kLinearText_Flag</code></a></td> 667 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>0x0040</td> 668 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 669mask for setting Font_Linear</td> 670 </tr> 671 <tr style='background-color: #f0f0f0; '> 672 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkPaint_kSubpixelText_Flag'><code>SkPaint::kSubpixelText_Flag</code></a></td> 673 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>0x0080</td> 674 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 675mask for setting Font_Subpixel</td> 676 </tr> 677 <tr> 678 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkPaint_kLCDRenderText_Flag'><code>SkPaint::kLCDRenderText_Flag</code></a></td> 679 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>0x0200</td> 680 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 681mask for setting Font_Anti_Alias</td> 682 </tr> 683 <tr style='background-color: #f0f0f0; '> 684 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkPaint_kEmbeddedBitmapText_Flag'><code>SkPaint::kEmbeddedBitmapText_Flag</code></a></td> 685 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>0x0400</td> 686 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 687mask for setting Font_Embedded_Bitmaps</td> 688 </tr> 689 <tr> 690 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkPaint_kAutoHinting_Flag'><code>SkPaint::kAutoHinting_Flag</code></a></td> 691 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>0x0800</td> 692 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 693mask for setting Font_Force_Hinting</td> 694 </tr> 695 <tr style='background-color: #f0f0f0; '> 696 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkPaint_kAllFlags'><code>SkPaint::kAllFlags</code></a></td> 697 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>0xFFFF</td> 698 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 699mask of all <a href='#SkPaint_Flags'>Flags</a>, including private flags and flags reserved for future use 700</td> 701 </tr> 702<a href='#SkPaint_Flags'>Flags</a> default to all flags clear, disabling the associated feature. 703</table> 704 705<a name='SkPaint_getFlags'></a> 706 707--- 708 709<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 710uint32_t <a href='#SkPaint_getFlags'>getFlags</a>()const 711</pre> 712 713Returns <a href='SkPaint_Reference#Paint'>paint</a> settings described by <a href='SkPaint_Reference#SkPaint'>SkPaint</a>::<a href='#SkPaint_Flags'>Flags</a>. Each setting uses one 714bit, and can be tested with <a href='SkPaint_Reference#SkPaint'>SkPaint</a>::<a href='#SkPaint_Flags'>Flags</a> members. 715 716### Return Value 717 718zero, one, or more bits described by <a href='SkPaint_Reference#SkPaint'>SkPaint</a>::<a href='#SkPaint_Flags'>Flags</a> 719 720### Example 721 722<div><fiddle-embed name="8a3f8c309533388b01aa66e1267f322d"> 723 724#### Example Output 725 726~~~~ 727(SkPaint::kAntiAlias_Flag & paint.getFlags()) != 0 728~~~~ 729 730</fiddle-embed></div> 731 732<a name='SkPaint_setFlags'></a> 733 734--- 735 736<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 737void <a href='#SkPaint_setFlags'>setFlags</a>(uint32_t flags) 738</pre> 739 740Replaces <a href='SkPaint_Reference#SkPaint'>SkPaint</a>::<a href='#SkPaint_Flags'>Flags</a> with <a href='#SkPaint_setFlags_flags'>flags</a>, the union of the <a href='SkPaint_Reference#SkPaint'>SkPaint</a>::<a href='#SkPaint_Flags'>Flags</a> members. 741All <a href='SkPaint_Reference#SkPaint'>SkPaint</a>::<a href='#SkPaint_Flags'>Flags</a> members may be cleared, or one or more may be set. 742 743### Parameters 744 745<table> <tr> <td><a name='SkPaint_setFlags_flags'><code><strong>flags</strong></code></a></td> 746 <td>union of <a href='SkPaint_Reference#SkPaint'>SkPaint</a>::<a href='#SkPaint_Flags'>Flags</a> for <a href='SkPaint_Reference#SkPaint'>SkPaint</a></td> 747 </tr> 748</table> 749 750### Example 751 752<div><fiddle-embed name="54baed3f6bc4b9c31ba664e27767fdc7"> 753 754#### Example Output 755 756~~~~ 757paint.isAntiAlias() 758paint.isDither() 759~~~~ 760 761</fiddle-embed></div> 762 763<a name='Anti_Alias'></a> 764 765--- 766 767<a href='#Paint_Anti_Alias'>Anti_Alias</a> drawing approximates partial <a href='undocumented#Pixel'>pixel</a> coverage with transparency. 768If <a href='#SkPaint_kAntiAlias_Flag'>kAntiAlias_Flag</a> is clear, <a href='undocumented#Pixel'>pixel</a> centers contained by the shape edge are drawn opaque. 769If <a href='#SkPaint_kAntiAlias_Flag'>kAntiAlias_Flag</a> is set, pixels are drawn with <a href='#Color_Alpha'>Color_Alpha</a> equal to their coverage. 770 771The rule for <a href='undocumented#Alias'>Aliased</a> pixels is inconsistent across platforms. A shape edge 772passing through the <a href='undocumented#Pixel'>pixel</a> center may, but is not required to, draw the <a href='undocumented#Pixel'>pixel</a>. 773 774<a href='#Raster_Engine'>Raster_Engine</a> draws <a href='undocumented#Alias'>Aliased</a> pixels whose centers are on or to the right of the start of an 775active <a href='SkPath_Reference#Path'>Path</a> edge, and whose center is to the left of the end of the active <a href='SkPath_Reference#Path'>Path</a> edge. 776 777A platform may only support <a href='#Paint_Anti_Alias'>Anti_Aliased</a> drawing. Some GPU-backed platforms use 778<a href='undocumented#Supersampling'>Supersampling</a> to <a href='#Paint_Anti_Alias'>Anti_Alias</a> all drawing, and have no mechanism to selectively 779<a href='undocumented#Alias'>Alias</a>. 780 781The amount of coverage computed for <a href='#Paint_Anti_Alias'>Anti_Aliased</a> pixels also varies across platforms. 782 783<a href='#Paint_Anti_Alias'>Anti_Alias</a> is disabled by default. 784<a href='#Paint_Anti_Alias'>Anti_Alias</a> can be enabled by default by setting <a href='undocumented#SkPaintDefaults_Flags'>SkPaintDefaults_Flags</a> to <a href='#SkPaint_kAntiAlias_Flag'>kAntiAlias_Flag</a> 785at compile time. 786 787### Example 788 789<div><fiddle-embed name="a6575a49467ce8d28bb01cc7638fa04d"><div>A red <a href='undocumented#Line'>line</a> is drawn with transparency on the edges to make it look smoother. 790A blue <a href='undocumented#Line'>line</a> draws only where the <a href='undocumented#Pixel'>pixel</a> centers are contained. 791The <a href='undocumented#Line'>lines</a> are drawn into <a href='SkBitmap_Reference#Bitmap'>Bitmap</a>, then drawn magnified to make the 792<a href='undocumented#Alias'>Aliasing</a> easier to see. 793</div></fiddle-embed></div> 794 795<a name='SkPaint_isAntiAlias'></a> 796 797--- 798 799<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 800bool <a href='#SkPaint_isAntiAlias'>isAntiAlias</a>()const 801</pre> 802 803Returns true if pixels on the active edges of <a href='SkPath_Reference#SkPath'>SkPath</a> may be drawn with partial transparency. 804 805Equivalent to <a href='#SkPaint_getFlags'>getFlags</a>() masked with <a href='#SkPaint_kAntiAlias_Flag'>kAntiAlias_Flag</a>. 806 807### Return Value 808 809<a href='#SkPaint_kAntiAlias_Flag'>kAntiAlias_Flag</a> state 810 811### Example 812 813<div><fiddle-embed name="d7d5f4f7da7acd5104a652f490c6f7b8"> 814 815#### Example Output 816 817~~~~ 818paint.isAntiAlias() == !!(paint.getFlags() & SkPaint::kAntiAlias_Flag) 819paint.isAntiAlias() == !!(paint.getFlags() & SkPaint::kAntiAlias_Flag) 820~~~~ 821 822</fiddle-embed></div> 823 824<a name='SkPaint_setAntiAlias'></a> 825 826--- 827 828<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 829void <a href='#SkPaint_setAntiAlias'>setAntiAlias</a>(bool aa) 830</pre> 831 832Requests, but does not require, that edge pixels draw opaque or with 833partial transparency. 834 835Sets <a href='#SkPaint_kAntiAlias_Flag'>kAntiAlias_Flag</a> if <a href='#SkPaint_setAntiAlias_aa'>aa</a> is true. 836Clears <a href='#SkPaint_kAntiAlias_Flag'>kAntiAlias_Flag</a> if <a href='#SkPaint_setAntiAlias_aa'>aa</a> is false. 837 838### Parameters 839 840<table> <tr> <td><a name='SkPaint_setAntiAlias_aa'><code><strong>aa</strong></code></a></td> 841 <td>setting for <a href='#SkPaint_kAntiAlias_Flag'>kAntiAlias_Flag</a></td> 842 </tr> 843</table> 844 845### Example 846 847<div><fiddle-embed name="c2ff148374d01cbef845b223e725905c"> 848 849#### Example Output 850 851~~~~ 852paint1 == paint2 853~~~~ 854 855</fiddle-embed></div> 856 857<a name='Dither'></a> 858 859--- 860 861Dither increases fidelity by adjusting the <a href='SkColor_Reference#Color'>color</a> of adjacent pixels. 862This can help to smooth <a href='SkColor_Reference#Color'>color</a> transitions and reducing banding in gradients. 863Dithering lessens visible banding from <a href='SkImageInfo_Reference#kRGB_565_SkColorType'>kRGB_565_SkColorType</a> 864and <a href='SkImageInfo_Reference#kRGBA_8888_SkColorType'>kRGBA_8888_SkColorType</a> gradients, 865and improves rendering into a <a href='SkImageInfo_Reference#kRGB_565_SkColorType'>kRGB_565_SkColorType</a> <a href='SkSurface_Reference#Surface'>Surface</a>. 866 867Dithering is always enabled for linear gradients drawing into 868<a href='SkImageInfo_Reference#kRGB_565_SkColorType'>kRGB_565_SkColorType</a> <a href='SkSurface_Reference#Surface'>Surface</a> and <a href='SkImageInfo_Reference#kRGBA_8888_SkColorType'>kRGBA_8888_SkColorType</a> <a href='SkSurface_Reference#Surface'>Surface</a>. 869Dither cannot be enabled for <a href='SkImageInfo_Reference#kAlpha_8_SkColorType'>kAlpha_8_SkColorType</a> <a href='SkSurface_Reference#Surface'>Surface</a> and 870<a href='SkImageInfo_Reference#kRGBA_F16_SkColorType'>kRGBA_F16_SkColorType</a> <a href='SkSurface_Reference#Surface'>Surface</a>. 871 872Dither is disabled by default. 873Dither can be enabled by default by setting <a href='undocumented#SkPaintDefaults_Flags'>SkPaintDefaults_Flags</a> to <a href='#SkPaint_kDither_Flag'>kDither_Flag</a> 874at compile time. 875 876Some platform implementations may ignore dithering. Set <code>SK_IGNORE_GPU_DITHER</code>to ignore Dither on <a href='#GPU_Surface'>GPU_Surface</a>. 877 878### Example 879 880<div><fiddle-embed name="8b26507690b71462f44642b911890bbf"><div>Dithering in the bottom half more closely approximates the requested <a href='SkColor_Reference#Color'>color</a> by 881alternating nearby colors from <a href='undocumented#Pixel'>pixel</a> to <a href='undocumented#Pixel'>pixel</a>. 882</div></fiddle-embed></div> 883 884### Example 885 886<div><fiddle-embed name="76d4d4a7931a48495e4d5f54e073be53"><div>Dithering introduces subtle adjustments to <a href='SkColor_Reference#Color'>color</a> to smooth gradients. 887Drawing the gradient repeatedly with <a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a>::<a href='#SkBlendMode_kPlus'>kPlus</a> exaggerates the 888dither, making it easier to see. 889</div></fiddle-embed></div> 890 891### See Also 892 893Gradient <a href='SkImageInfo_Reference#kRGB_565_SkColorType'>kRGB_565_SkColorType</a> 894 895<a name='SkPaint_isDither'></a> 896 897--- 898 899<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 900bool <a href='#SkPaint_isDither'>isDither</a>()const 901</pre> 902 903Returns true if <a href='SkColor_Reference#Color'>color</a> error may be distributed to smooth <a href='SkColor_Reference#Color'>color</a> transition. 904 905Equivalent to <a href='#SkPaint_getFlags'>getFlags</a>() masked with <a href='#SkPaint_kDither_Flag'>kDither_Flag</a>. 906 907### Return Value 908 909<a href='#SkPaint_kDither_Flag'>kDither_Flag</a> state 910 911### Example 912 913<div><fiddle-embed name="f4ce93f6c5e7335436a985377fd980c0"> 914 915#### Example Output 916 917~~~~ 918paint.isDither() == !!(paint.getFlags() & SkPaint::kDither_Flag) 919paint.isDither() == !!(paint.getFlags() & SkPaint::kDither_Flag) 920~~~~ 921 922</fiddle-embed></div> 923 924<a name='SkPaint_setDither'></a> 925 926--- 927 928<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 929void <a href='#SkPaint_setDither'>setDither</a>(bool dither) 930</pre> 931 932Requests, but does not require, to distribute <a href='SkColor_Reference#Color'>color</a> error. 933 934Sets <a href='#SkPaint_kDither_Flag'>kDither_Flag</a> if <a href='#SkPaint_setDither_dither'>dither</a> is true. 935Clears <a href='#SkPaint_kDither_Flag'>kDither_Flag</a> if <a href='#SkPaint_setDither_dither'>dither</a> is false. 936 937### Parameters 938 939<table> <tr> <td><a name='SkPaint_setDither_dither'><code><strong>dither</strong></code></a></td> 940 <td>setting for <a href='#SkPaint_kDither_Flag'>kDither_Flag</a></td> 941 </tr> 942</table> 943 944### Example 945 946<div><fiddle-embed name="69b7162e8324d9239dd02dd9ada2bdff"> 947 948#### Example Output 949 950~~~~ 951paint1 == paint2 952~~~~ 953 954</fiddle-embed></div> 955 956### See Also 957 958<a href='SkImageInfo_Reference#kRGB_565_SkColorType'>kRGB_565_SkColorType</a> 959 960<a name='Device_Text'></a> 961 962--- 963 964<a href='#Font_Anti_Alias'>Font_Anti_Alias</a> and <a href='#Font_Subpixel'>Font_Subpixel</a> increase the precision of <a href='undocumented#Glyph'>glyph</a> position. 965 966When set, <a href='#SkPaint_Flags'>Flags</a> <a href='#SkPaint_kLCDRenderText_Flag'>kLCDRenderText_Flag</a> takes advantage of the organization of RGB stripes that 967create a <a href='SkColor_Reference#Color'>color</a>, and relies 968on the small <a href='undocumented#Size'>size</a> of the stripe and visual perception to make the <a href='SkColor_Reference#Color'>color</a> fringing imperceptible. 969<a href='#Font_Anti_Alias'>Font_Anti_Alias</a> can be enabled on devices that orient stripes horizontally or vertically, and that order 970the <a href='SkColor_Reference#Color'>color</a> components as RGB or BGR. 971 972<a href='#SkPaint_Flags'>Flags</a> <a href='#SkPaint_kSubpixelText_Flag'>kSubpixelText_Flag</a> uses the <a href='undocumented#Pixel'>pixel</a> transparency to represent a fractional offset. 973As the opaqueness 974of the <a href='SkColor_Reference#Color'>color</a> increases, the edge of the <a href='undocumented#Glyph'>glyph</a> appears to move towards the outside of the <a href='undocumented#Pixel'>pixel</a>. 975 976Either or both techniques can be enabled. 977<a href='#SkPaint_kLCDRenderText_Flag'>kLCDRenderText_Flag</a> and <a href='#SkPaint_kSubpixelText_Flag'>kSubpixelText_Flag</a> are clear by default. 978<a href='#Font_Anti_Alias'>Font_Anti_Alias</a> or <a href='#Font_Subpixel'>Font_Subpixel</a> can be enabled by default by setting <a href='undocumented#SkPaintDefaults_Flags'>SkPaintDefaults_Flags</a> to 979<a href='#SkPaint_kLCDRenderText_Flag'>kLCDRenderText_Flag</a> or <a href='#SkPaint_kSubpixelText_Flag'>kSubpixelText_Flag</a> (or both) at compile time. 980 981### Example 982 983<div><fiddle-embed name="4606ae1be792d6bc46d496432f050ee9"><div>Four commas are drawn normally and with combinations of <a href='#Font_Anti_Alias'>Font_Anti_Alias</a> and <a href='#Font_Subpixel'>Font_Subpixel</a>. 984When <a href='#Font_Subpixel'>Font_Subpixel</a> is disabled, the comma <a href='undocumented#Glyph'>Glyphs</a> are identical, but not evenly spaced. 985When <a href='#Font_Subpixel'>Font_Subpixel</a> is enabled, the comma <a href='undocumented#Glyph'>Glyphs</a> are unique, but appear evenly spaced. 986</div></fiddle-embed></div> 987 988<a name='Linear_Text'></a> 989 990<a href='#Font_Linear'>Font_Linear</a> selects whether <a href='undocumented#Text'>text</a> is rendered as a <a href='undocumented#Glyph'>Glyph</a> or as a <a href='SkPath_Reference#Path'>Path</a>. 991If <a href='#Font_Linear'>Font_Linear</a> is set, it has the same effect as setting Hinting to <a href='undocumented#SkFontHinting'>SkFontHinting</a>::<a href='#SkFontHinting_kNormal'>kNormal</a>. 992If <a href='#Font_Linear'>Font_Linear</a> is clear, it is the same as setting Hinting to <a href='undocumented#SkFontHinting'>SkFontHinting</a>::<a href='#SkFontHinting_kNone'>kNone</a>. 993 994<a name='SkPaint_isLinearText'></a> 995 996--- 997 998<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 999bool <a href='#SkPaint_isLinearText'>isLinearText</a>()const 1000</pre> 1001 1002Returns true if <a href='undocumented#Text'>text</a> is converted to <a href='SkPath_Reference#SkPath'>SkPath</a> before drawing and measuring. 1003 1004Equivalent to <a href='#SkPaint_getFlags'>getFlags</a>() masked with <a href='#SkPaint_kLinearText_Flag'>kLinearText_Flag</a>. 1005 1006### Return Value 1007 1008<a href='#SkPaint_kLinearText_Flag'>kLinearText_Flag</a> state 1009 1010### Example 1011 1012<div><fiddle-embed name="2890ad644f980637837e6fcb386fb462"></fiddle-embed></div> 1013 1014### See Also 1015 1016<a href='#SkPaint_setLinearText'>setLinearText</a> Hinting 1017 1018<a name='SkPaint_setLinearText'></a> 1019 1020--- 1021 1022<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1023void <a href='#SkPaint_setLinearText'>setLinearText</a>(bool linearText) 1024</pre> 1025 1026Requests, but does not require, that <a href='undocumented#Glyph'>glyphs</a> are converted to <a href='SkPath_Reference#SkPath'>SkPath</a> 1027before drawing and measuring. 1028By default, <a href='#SkPaint_kLinearText_Flag'>kLinearText_Flag</a> is clear. 1029 1030Sets <a href='#SkPaint_kLinearText_Flag'>kLinearText_Flag</a> if <a href='#SkPaint_setLinearText_linearText'>linearText</a> is true. 1031Clears <a href='#SkPaint_kLinearText_Flag'>kLinearText_Flag</a> if <a href='#SkPaint_setLinearText_linearText'>linearText</a> is false. 1032 1033### Parameters 1034 1035<table> <tr> <td><a name='SkPaint_setLinearText_linearText'><code><strong>linearText</strong></code></a></td> 1036 <td>setting for <a href='#SkPaint_kLinearText_Flag'>kLinearText_Flag</a></td> 1037 </tr> 1038</table> 1039 1040### Example 1041 1042<div><fiddle-embed name="c93bb912f3bddfb4d96d3ad70ada552b"></fiddle-embed></div> 1043 1044### See Also 1045 1046<a href='#SkPaint_isLinearText'>isLinearText</a> Hinting 1047 1048<a name='Subpixel_Text'></a> 1049 1050<a href='#SkPaint_Flags'>Flags</a> <a href='#SkPaint_kSubpixelText_Flag'>kSubpixelText_Flag</a> uses the <a href='undocumented#Pixel'>pixel</a> transparency to represent a fractional offset. 1051As the opaqueness 1052of the <a href='SkColor_Reference#Color'>color</a> increases, the edge of the <a href='undocumented#Glyph'>glyph</a> appears to move towards the outside of the <a href='undocumented#Pixel'>pixel</a>. 1053 1054<a name='SkPaint_isSubpixelText'></a> 1055 1056--- 1057 1058<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1059bool <a href='#SkPaint_isSubpixelText'>isSubpixelText</a>()const 1060</pre> 1061 1062Returns true if <a href='undocumented#Glyph'>glyphs</a> at different <a href='SkFont_Reference#Subpixel'>sub-pixel</a> positions may differ on <a href='undocumented#Pixel'>pixel</a> edge coverage. 1063 1064Equivalent to <a href='#SkPaint_getFlags'>getFlags</a>() masked with <a href='#SkPaint_kSubpixelText_Flag'>kSubpixelText_Flag</a>. 1065 1066### Return Value 1067 1068<a href='#SkPaint_kSubpixelText_Flag'>kSubpixelText_Flag</a> state 1069 1070### Example 1071 1072<div><fiddle-embed name="abe9afc0932e2199324ae6cbb396e67c"> 1073 1074#### Example Output 1075 1076~~~~ 1077paint.isSubpixelText() == !!(paint.getFlags() & SkPaint::kSubpixelText_Flag) 1078paint.isSubpixelText() == !!(paint.getFlags() & SkPaint::kSubpixelText_Flag) 1079~~~~ 1080 1081</fiddle-embed></div> 1082 1083<a name='SkPaint_setSubpixelText'></a> 1084 1085--- 1086 1087<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1088void <a href='#SkPaint_setSubpixelText'>setSubpixelText</a>(bool subpixelText) 1089</pre> 1090 1091Requests, but does not require, that <a href='undocumented#Glyph'>glyphs</a> respect <a href='SkFont_Reference#Subpixel'>sub-pixel</a> positioning. 1092 1093Sets <a href='#SkPaint_kSubpixelText_Flag'>kSubpixelText_Flag</a> if <a href='#SkPaint_setSubpixelText_subpixelText'>subpixelText</a> is true. 1094Clears <a href='#SkPaint_kSubpixelText_Flag'>kSubpixelText_Flag</a> if <a href='#SkPaint_setSubpixelText_subpixelText'>subpixelText</a> is false. 1095 1096### Parameters 1097 1098<table> <tr> <td><a name='SkPaint_setSubpixelText_subpixelText'><code><strong>subpixelText</strong></code></a></td> 1099 <td>setting for <a href='#SkPaint_kSubpixelText_Flag'>kSubpixelText_Flag</a></td> 1100 </tr> 1101</table> 1102 1103### Example 1104 1105<div><fiddle-embed name="a77bbc1a4e3be9a8ab0f842f877c5ee4"> 1106 1107#### Example Output 1108 1109~~~~ 1110paint1 == paint2 1111~~~~ 1112 1113</fiddle-embed></div> 1114 1115<a name='LCD_Text'></a> 1116 1117When set, <a href='#Font_Anti_Alias'>Font_Anti_Alias</a> takes advantage of the organization of RGB stripes that 1118create a <a href='SkColor_Reference#Color'>color</a>, and relies 1119on the small <a href='undocumented#Size'>size</a> of the stripe and visual perception to make the <a href='SkColor_Reference#Color'>color</a> fringing imperceptible. 1120<a href='#Font_Anti_Alias'>Font_Anti_Alias</a> can be enabled on devices that orient stripes horizontally or vertically, and that order 1121the <a href='SkColor_Reference#Color'>color</a> components as RGB or BGR. 1122 1123<a name='SkPaint_isLCDRenderText'></a> 1124 1125--- 1126 1127<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1128bool <a href='#SkPaint_isLCDRenderText'>isLCDRenderText</a>()const 1129</pre> 1130 1131Returns true if <a href='undocumented#Glyph'>glyphs</a> may use LCD striping to improve <a href='undocumented#Glyph'>glyph</a> edges. 1132 1133Returns true if <a href='SkPaint_Reference#SkPaint'>SkPaint</a>::<a href='#SkPaint_Flags'>Flags</a> <a href='#SkPaint_kLCDRenderText_Flag'>kLCDRenderText_Flag</a> is set. 1134 1135### Return Value 1136 1137<a href='#SkPaint_kLCDRenderText_Flag'>kLCDRenderText_Flag</a> state 1138 1139### Example 1140 1141<div><fiddle-embed name="68e1fd95dd2fd06a333899d2bd2396b9"> 1142 1143#### Example Output 1144 1145~~~~ 1146paint.isLCDRenderText() == !!(paint.getFlags() & SkPaint::kLCDRenderText_Flag) 1147paint.isLCDRenderText() == !!(paint.getFlags() & SkPaint::kLCDRenderText_Flag) 1148~~~~ 1149 1150</fiddle-embed></div> 1151 1152<a name='SkPaint_setLCDRenderText'></a> 1153 1154--- 1155 1156<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1157void <a href='#SkPaint_setLCDRenderText'>setLCDRenderText</a>(bool lcdText) 1158</pre> 1159 1160Requests, but does not require, that <a href='undocumented#Glyph'>glyphs</a> use LCD striping for <a href='undocumented#Glyph'>glyph</a> edges. 1161 1162Sets <a href='#SkPaint_kLCDRenderText_Flag'>kLCDRenderText_Flag</a> if <a href='#SkPaint_setLCDRenderText_lcdText'>lcdText</a> is true. 1163Clears <a href='#SkPaint_kLCDRenderText_Flag'>kLCDRenderText_Flag</a> if <a href='#SkPaint_setLCDRenderText_lcdText'>lcdText</a> is false. 1164 1165### Parameters 1166 1167<table> <tr> <td><a name='SkPaint_setLCDRenderText_lcdText'><code><strong>lcdText</strong></code></a></td> 1168 <td>setting for <a href='#SkPaint_kLCDRenderText_Flag'>kLCDRenderText_Flag</a></td> 1169 </tr> 1170</table> 1171 1172### Example 1173 1174<div><fiddle-embed name="50dedf8450159571a3edaf4f0050defe"> 1175 1176#### Example Output 1177 1178~~~~ 1179paint1 == paint2 1180~~~~ 1181 1182</fiddle-embed></div> 1183 1184<a name='Embedded_Bitmaps'></a> 1185 1186--- 1187 1188<a href='#Font_Embedded_Bitmaps'>Font_Embedded_Bitmaps</a> allows selecting custom sized <a href='SkBitmap_Reference#Bitmap'>bitmap</a> <a href='undocumented#Glyph'>Glyphs</a>. 1189<a href='#SkPaint_Flags'>Flags</a> <a href='#SkPaint_kEmbeddedBitmapText_Flag'>kEmbeddedBitmapText_Flag</a> when set chooses an embedded <a href='SkBitmap_Reference#Bitmap'>bitmap</a> <a href='undocumented#Glyph'>glyph</a> over an outline contained 1190in a <a href='SkFont_Reference#Font'>font</a> if the platform supports this option. 1191 1192FreeType selects the <a href='SkBitmap_Reference#Bitmap'>bitmap</a> <a href='undocumented#Glyph'>glyph</a> if available when <a href='#SkPaint_kEmbeddedBitmapText_Flag'>kEmbeddedBitmapText_Flag</a> is set, and selects 1193the outline <a href='undocumented#Glyph'>glyph</a> if <a href='#SkPaint_kEmbeddedBitmapText_Flag'>kEmbeddedBitmapText_Flag</a> is clear. 1194Windows may select the <a href='SkBitmap_Reference#Bitmap'>bitmap</a> <a href='undocumented#Glyph'>glyph</a> but is not required to do so. 1195<a href='#OS_X'>OS_X</a> and iOS do not support this option. 1196 1197<a href='#Font_Embedded_Bitmaps'>Font_Embedded_Bitmaps</a> is disabled by default. 1198<a href='#Font_Embedded_Bitmaps'>Font_Embedded_Bitmaps</a> can be enabled by default by setting <a href='undocumented#SkPaintDefaults_Flags'>SkPaintDefaults_Flags</a> to 1199<a href='#SkPaint_kEmbeddedBitmapText_Flag'>kEmbeddedBitmapText_Flag</a> at compile time. 1200 1201### Example 1202 1203<pre style="padding: 1em 1em 1em 1em; font-size: 13px width: 62.5em; background-color: #f0f0f0"> 1204<div>The "hintgasp" TrueType font in the Skia resources/fonts directory 1205 includes an embedded bitmap Glyph at odd font sizes. This example works 1206 on platforms that use FreeType as their Font_Engine. 1207 Windows may, but is not required to, return a bitmap glyph if 1208 kEmbeddedBitmapText_Flag is set.</div>SkBitmap bitmap; 1209 bitmap.allocN32Pixels(30, 15); 1210 bitmap.eraseColor(0); 1211 SkCanvas offscreen(bitmap); 1212 SkPaint paint; 1213 paint.setAntiAlias(true); 1214 paint.setTextSize(13); 1215 paint.setTypeface(MakeResourceAsTypeface("fonts/hintgasp.ttf")); 1216 for (bool embedded : { false, true}) { 1217 paint.setEmbeddedBitmapText(embedded); 1218 offscreen.drawString("A", embedded ? 5 : 15, 15, paint); 1219 } 1220 canvas->drawBitmap(bitmap, 0, 0); 1221 canvas->scale(10, 10); 1222 canvas->drawBitmap(bitmap, -2, 1); 1223 1224</pre> 1225 1226<a name='SkPaint_isEmbeddedBitmapText'></a> 1227 1228--- 1229 1230<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1231bool <a href='#SkPaint_isEmbeddedBitmapText'>isEmbeddedBitmapText</a>()const 1232</pre> 1233 1234Returns true if <a href='SkFont_Reference#Font'>font</a> engine may return <a href='undocumented#Glyph'>glyphs</a> from <a href='SkFont_Reference#Font'>font</a> <a href='SkBitmap_Reference#Bitmap'>bitmaps</a> instead of from outlines. 1235 1236Equivalent to <a href='#SkPaint_getFlags'>getFlags</a>() masked with <a href='#SkPaint_kEmbeddedBitmapText_Flag'>kEmbeddedBitmapText_Flag</a>. 1237 1238### Return Value 1239 1240<a href='#SkPaint_kEmbeddedBitmapText_Flag'>kEmbeddedBitmapText_Flag</a> state 1241 1242### Example 1243 1244<div><fiddle-embed name="eba10b27b790e87183ae451b3fc5c4b1"> 1245 1246#### Example Output 1247 1248~~~~ 1249paint.isEmbeddedBitmapText() == !!(paint.getFlags() & SkPaint::kEmbeddedBitmapText_Flag) 1250paint.isEmbeddedBitmapText() == !!(paint.getFlags() & SkPaint::kEmbeddedBitmapText_Flag) 1251~~~~ 1252 1253</fiddle-embed></div> 1254 1255<a name='SkPaint_setEmbeddedBitmapText'></a> 1256 1257--- 1258 1259<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1260void <a href='#SkPaint_setEmbeddedBitmapText'>setEmbeddedBitmapText</a>(bool useEmbeddedBitmapText) 1261</pre> 1262 1263Requests, but does not require, to use <a href='SkBitmap_Reference#Bitmap'>bitmaps</a> in fonts instead of outlines. 1264 1265Sets <a href='#SkPaint_kEmbeddedBitmapText_Flag'>kEmbeddedBitmapText_Flag</a> if <a href='#SkPaint_setEmbeddedBitmapText_useEmbeddedBitmapText'>useEmbeddedBitmapText</a> is true. 1266Clears <a href='#SkPaint_kEmbeddedBitmapText_Flag'>kEmbeddedBitmapText_Flag</a> if <a href='#SkPaint_setEmbeddedBitmapText_useEmbeddedBitmapText'>useEmbeddedBitmapText</a> is false. 1267 1268### Parameters 1269 1270<table> <tr> <td><a name='SkPaint_setEmbeddedBitmapText_useEmbeddedBitmapText'><code><strong>useEmbeddedBitmapText</strong></code></a></td> 1271 <td>setting for <a href='#SkPaint_kEmbeddedBitmapText_Flag'>kEmbeddedBitmapText_Flag</a></td> 1272 </tr> 1273</table> 1274 1275### Example 1276 1277<div><fiddle-embed name="246dffdd93a484ba4ad7ecf71198a5d4"> 1278 1279#### Example Output 1280 1281~~~~ 1282paint1 == paint2 1283~~~~ 1284 1285</fiddle-embed></div> 1286 1287<a name='Automatic_Hinting'></a> 1288 1289If Hinting is set to <a href='undocumented#SkFontHinting'>SkFontHinting</a>::<a href='#SkFontHinting_kNormal'>kNormal</a> or <a href='undocumented#SkFontHinting'>SkFontHinting</a>::<a href='#SkFontHinting_kFull'>kFull</a>, <a href='#Font_Force_Hinting'>Font_Force_Hinting</a> 1290instructs the <a href='#Font_Manager'>Font_Manager</a> to always hint <a href='undocumented#Glyph'>Glyphs</a>. 1291<a href='#Font_Force_Hinting'>Font_Force_Hinting</a> has no effect if Hinting is set to <a href='undocumented#SkFontHinting'>SkFontHinting</a>::<a href='#SkFontHinting_kNone'>kNone</a> or 1292<a href='undocumented#SkFontHinting'>SkFontHinting</a>::<a href='#SkFontHinting_kSlight'>kSlight</a>. 1293 1294<a href='#Font_Force_Hinting'>Font_Force_Hinting</a> only affects platforms that use FreeType as the <a href='#Font_Manager'>Font_Manager</a>. 1295 1296<a name='SkPaint_isAutohinted'></a> 1297 1298--- 1299 1300<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1301bool <a href='#SkPaint_isAutohinted'>isAutohinted</a>()const 1302</pre> 1303 1304Returns true if <a href='SkPaint_Reference#SkPaint'>SkPaint</a>::Hinting is set to <a href='undocumented#SkFontHinting'>SkFontHinting</a>::<a href='#SkFontHinting_kNormal'>kNormal</a> or 1305<a href='undocumented#SkFontHinting'>SkFontHinting</a>::<a href='#SkFontHinting_kFull'>kFull</a>, and if platform uses FreeType as the <a href='SkFont_Reference#Font'>font</a> manager. 1306If true, instructs the <a href='SkFont_Reference#Font'>font</a> manager to always hint <a href='undocumented#Glyph'>glyphs</a>. 1307 1308Equivalent to <a href='#SkPaint_getFlags'>getFlags</a>() masked with <a href='#SkPaint_kAutoHinting_Flag'>kAutoHinting_Flag</a>. 1309 1310### Return Value 1311 1312<a href='#SkPaint_kAutoHinting_Flag'>kAutoHinting_Flag</a> state 1313 1314### Example 1315 1316<div><fiddle-embed name="aa4781afbe3b90e7ef56a287e5b9ce1e"> 1317 1318#### Example Output 1319 1320~~~~ 1321paint.isAutohinted() == !!(paint.getFlags() & SkPaint::kAutoHinting_Flag) 1322paint.isAutohinted() == !!(paint.getFlags() & SkPaint::kAutoHinting_Flag) 1323~~~~ 1324 1325</fiddle-embed></div> 1326 1327### See Also 1328 1329<a href='#SkPaint_setAutohinted'>setAutohinted</a> Hinting 1330 1331<a name='SkPaint_setAutohinted'></a> 1332 1333--- 1334 1335<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1336void <a href='#SkPaint_setAutohinted'>setAutohinted</a>(bool useAutohinter) 1337</pre> 1338 1339Sets whether to always hint <a href='undocumented#Glyph'>glyphs</a>. 1340If <a href='SkPaint_Reference#SkPaint'>SkPaint</a>::Hinting is set to <a href='undocumented#SkFontHinting'>SkFontHinting</a>::<a href='#SkFontHinting_kNormal'>kNormal</a> or <a href='undocumented#SkFontHinting'>SkFontHinting</a>::<a href='#SkFontHinting_kFull'>kFull</a> 1341and <a href='#SkPaint_setAutohinted_useAutohinter'>useAutohinter</a> is set, instructs the <a href='undocumented#Font_Manager'>font manager</a> to always hint <a href='undocumented#Glyph'>glyphs</a>. 1342<a href='#SkPaint_setAutohinted_useAutohinter'>useAutohinter</a> has no effect if <a href='SkPaint_Reference#SkPaint'>SkPaint</a>::Hinting is set to <a href='undocumented#SkFontHinting'>SkFontHinting</a>::<a href='#SkFontHinting_kNone'>kNone</a> or 1343<a href='undocumented#SkFontHinting'>SkFontHinting</a>::<a href='#SkFontHinting_kSlight'>kSlight</a>. 1344 1345Only affects platforms that use FreeType as the <a href='undocumented#Font_Manager'>font manager</a>. 1346 1347Sets <a href='#SkPaint_kAutoHinting_Flag'>kAutoHinting_Flag</a> if <a href='#SkPaint_setAutohinted_useAutohinter'>useAutohinter</a> is true. 1348Clears <a href='#SkPaint_kAutoHinting_Flag'>kAutoHinting_Flag</a> if <a href='#SkPaint_setAutohinted_useAutohinter'>useAutohinter</a> is false. 1349 1350### Parameters 1351 1352<table> <tr> <td><a name='SkPaint_setAutohinted_useAutohinter'><code><strong>useAutohinter</strong></code></a></td> 1353 <td>setting for <a href='#SkPaint_kAutoHinting_Flag'>kAutoHinting_Flag</a></td> 1354 </tr> 1355</table> 1356 1357### Example 1358 1359<div><fiddle-embed name="4e185306d7de9390fe8445eed0139309"></fiddle-embed></div> 1360 1361### See Also 1362 1363<a href='#SkPaint_isAutohinted'>isAutohinted</a> Hinting 1364 1365<a name='Fake_Bold'></a> 1366 1367--- 1368 1369<a href='#Font_Embolden'>Font_Embolden</a> approximates the bold <a href='SkFont_Reference#Font'>font</a> style accompanying a normal <a href='SkFont_Reference#Font'>font</a> when a bold <a href='SkFont_Reference#Font'>font</a> face 1370is not available. Skia does not provide <a href='SkFont_Reference#Font'>font</a> substitution; it is up to the client to find the 1371bold <a href='SkFont_Reference#Font'>font</a> face using the platform <a href='#Font_Manager'>Font_Manager</a>. 1372 1373Use <a href='#Paint_Text_Skew_X'>Text_Skew_X</a> to approximate an italic <a href='SkFont_Reference#Font'>font</a> style when the italic <a href='SkFont_Reference#Font'>font</a> face 1374is not available. 1375 1376A FreeType based port may define SK_USE_FREETYPE_EMBOLDEN at compile time to direct 1377the <a href='SkFont_Reference#Font_Engine'>font engine</a> to create the bold <a href='undocumented#Glyph'>Glyphs</a>. Otherwise, the extra bold is computed 1378by increasing the <a href='#Stroke_Width'>stroke width</a> and setting the <a href='#SkPaint_Style'>Style</a> to <a href='#SkPaint_kStrokeAndFill_Style'>kStrokeAndFill_Style</a> as needed. 1379 1380<a href='#Font_Embolden'>Font_Embolden</a> is disabled by default. 1381 1382### Example 1383 1384<div><fiddle-embed name="e811f4829a2daaaeaad3795504a7e02a"></fiddle-embed></div> 1385 1386<a name='SkPaint_isFakeBoldText'></a> 1387 1388--- 1389 1390<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1391bool <a href='#SkPaint_isFakeBoldText'>isFakeBoldText</a>()const 1392</pre> 1393 1394Returns true if approximate bold by increasing the stroke width when creating <a href='undocumented#Glyph'>glyph</a> <a href='SkBitmap_Reference#Bitmap'>bitmaps</a> 1395from outlines. 1396 1397Equivalent to <a href='#SkPaint_getFlags'>getFlags</a>() masked with <a href='#SkPaint_kFakeBoldText_Flag'>kFakeBoldText_Flag</a>. 1398 1399### Return Value 1400 1401<a href='#SkPaint_kFakeBoldText_Flag'>kFakeBoldText_Flag</a> state 1402 1403### Example 1404 1405<div><fiddle-embed name="f54d1f85b16073b80b9eef2e1a1d151d"> 1406 1407#### Example Output 1408 1409~~~~ 1410paint.isFakeBoldText() == !!(paint.getFlags() & SkPaint::kFakeBoldText_Flag) 1411paint.isFakeBoldText() == !!(paint.getFlags() & SkPaint::kFakeBoldText_Flag) 1412~~~~ 1413 1414</fiddle-embed></div> 1415 1416<a name='SkPaint_setFakeBoldText'></a> 1417 1418--- 1419 1420<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1421void <a href='#SkPaint_setFakeBoldText'>setFakeBoldText</a>(bool fakeBoldText) 1422</pre> 1423 1424Increases <a href='#Stroke_Width'>stroke width</a> when creating <a href='undocumented#Glyph'>glyph</a> <a href='SkBitmap_Reference#Bitmap'>bitmaps</a> to approximate a bold <a href='undocumented#Typeface'>typeface</a>. 1425 1426Sets <a href='#SkPaint_kFakeBoldText_Flag'>kFakeBoldText_Flag</a> if <a href='#SkPaint_setFakeBoldText_fakeBoldText'>fakeBoldText</a> is true. 1427Clears <a href='#SkPaint_kFakeBoldText_Flag'>kFakeBoldText_Flag</a> if <a href='#SkPaint_setFakeBoldText_fakeBoldText'>fakeBoldText</a> is false. 1428 1429### Parameters 1430 1431<table> <tr> <td><a name='SkPaint_setFakeBoldText_fakeBoldText'><code><strong>fakeBoldText</strong></code></a></td> 1432 <td>setting for <a href='#SkPaint_kFakeBoldText_Flag'>kFakeBoldText_Flag</a></td> 1433 </tr> 1434</table> 1435 1436### Example 1437 1438<div><fiddle-embed name="594d47858eb11028cb626515a520910a"> 1439 1440#### Example Output 1441 1442~~~~ 1443paint1 == paint2 1444~~~~ 1445 1446</fiddle-embed></div> 1447 1448<a name='Filter_Quality_Methods'></a> 1449 1450--- 1451 1452<a href='#Filter_Quality'>Filter_Quality</a> trades speed for <a href='SkImage_Reference#Image'>image</a> filtering when the <a href='SkImage_Reference#Image'>image</a> is scaled. 1453A lower <a href='#Filter_Quality'>Filter_Quality</a> draws faster, but has less fidelity. 1454A higher <a href='#Filter_Quality'>Filter_Quality</a> draws slower, but looks better. 1455If the <a href='SkImage_Reference#Image'>image</a> is drawn without scaling, the <a href='#Filter_Quality'>Filter_Quality</a> choice will not result 1456in a noticeable difference. 1457 1458<a href='#Filter_Quality'>Filter_Quality</a> is used in <a href='SkPaint_Reference#Paint'>Paint</a> passed as a parameter to 1459 1460<table> <tr> 1461 <td><a href='SkCanvas_Reference#SkCanvas'>SkCanvas</a>::<a href='#SkCanvas_drawBitmap'>drawBitmap</a></td> 1462 </tr> <tr> 1463 <td><a href='SkCanvas_Reference#SkCanvas'>SkCanvas</a>::<a href='#SkCanvas_drawBitmapRect'>drawBitmapRect</a></td> 1464 </tr> <tr> 1465 <td><a href='SkCanvas_Reference#SkCanvas'>SkCanvas</a>::<a href='#SkCanvas_drawImage'>drawImage</a></td> 1466 </tr> <tr> 1467 <td><a href='SkCanvas_Reference#SkCanvas'>SkCanvas</a>::<a href='#SkCanvas_drawImageRect'>drawImageRect</a></td> 1468 </tr> 1469</table> 1470 1471and when <a href='SkPaint_Reference#Paint'>Paint</a> has a <a href='undocumented#Shader'>Shader</a> specialization that uses <a href='SkImage_Reference#Image'>Image</a> or <a href='SkBitmap_Reference#Bitmap'>Bitmap</a>. 1472 1473<a href='#Filter_Quality'>Filter_Quality</a> is <a href='undocumented#kNone_SkFilterQuality'>kNone_SkFilterQuality</a> by default. 1474 1475### Example 1476 1477<div><fiddle-embed name="69369cff2f5b145a6f616092513266a0"></fiddle-embed></div> 1478 1479<a name='SkPaint_getFilterQuality'></a> 1480 1481--- 1482 1483<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1484<a href='undocumented#SkFilterQuality'>SkFilterQuality</a> <a href='#SkPaint_getFilterQuality'>getFilterQuality</a>()const 1485</pre> 1486 1487Returns <a href='undocumented#SkFilterQuality'>SkFilterQuality</a>, the <a href='SkImage_Reference#Image'>image</a> filtering level. A lower setting 1488draws faster; a higher setting looks better when the <a href='SkImage_Reference#Image'>image</a> is scaled. 1489 1490### Return Value 1491 1492one of: <a href='undocumented#kNone_SkFilterQuality'>kNone_SkFilterQuality</a>, <a href='undocumented#kLow_SkFilterQuality'>kLow_SkFilterQuality</a>, 1493 1494<a href='undocumented#kMedium_SkFilterQuality'>kMedium_SkFilterQuality</a>, <a href='undocumented#kHigh_SkFilterQuality'>kHigh_SkFilterQuality</a> 1495 1496### Example 1497 1498<div><fiddle-embed name="d4ca1f23809b6835c4ba46ea98a86900"> 1499 1500#### Example Output 1501 1502~~~~ 1503kNone_SkFilterQuality == paint.getFilterQuality() 1504~~~~ 1505 1506</fiddle-embed></div> 1507 1508<a name='SkPaint_setFilterQuality'></a> 1509 1510--- 1511 1512<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1513void <a href='#SkPaint_setFilterQuality'>setFilterQuality</a>(<a href='undocumented#SkFilterQuality'>SkFilterQuality</a> quality) 1514</pre> 1515 1516Sets <a href='undocumented#SkFilterQuality'>SkFilterQuality</a>, the <a href='SkImage_Reference#Image'>image</a> filtering level. A lower setting 1517draws faster; a higher setting looks better when the <a href='SkImage_Reference#Image'>image</a> is scaled. 1518Does not check to see if <a href='#SkPaint_setFilterQuality_quality'>quality</a> is valid. 1519 1520### Parameters 1521 1522<table> <tr> <td><a name='SkPaint_setFilterQuality_quality'><code><strong>quality</strong></code></a></td> 1523 <td>one of: <a href='undocumented#kNone_SkFilterQuality'>kNone_SkFilterQuality</a>, <a href='undocumented#kLow_SkFilterQuality'>kLow_SkFilterQuality</a>,</td> 1524 </tr> 1525</table> 1526 1527<a href='undocumented#kMedium_SkFilterQuality'>kMedium_SkFilterQuality</a>, <a href='undocumented#kHigh_SkFilterQuality'>kHigh_SkFilterQuality</a> 1528 1529### Example 1530 1531<div><fiddle-embed name="e4288fabf24ee60b645e8bb6ea0afadf"> 1532 1533#### Example Output 1534 1535~~~~ 1536kHigh_SkFilterQuality == paint.getFilterQuality() 1537~~~~ 1538 1539</fiddle-embed></div> 1540 1541### See Also 1542 1543<a href='undocumented#SkFilterQuality'>SkFilterQuality</a> <a href='#Image_Scaling'>Image_Scaling</a> 1544 1545<a name='Color_Methods'></a> 1546 1547--- 1548 1549| name | description | 1550| --- | --- | 1551| <a href='#SkPaint_getColor'>getColor</a> | returns <a href='#Color_Alpha'>Color_Alpha</a> and RGB, one drawing <a href='SkColor_Reference#Color'>color</a> | 1552| <a href='#SkPaint_setColor'>setColor</a> | sets <a href='#Color_Alpha'>Color_Alpha</a> and RGB, one drawing <a href='SkColor_Reference#Color'>color</a> | 1553 1554<a href='SkColor_Reference#Color'>Color</a> specifies the red, blue, green, and <a href='#Color_Alpha'>Color_Alpha</a> 1555values used to draw a filled or stroked shape in a 32-bit value. Each component 1556occupies 8-bits, ranging from zero: no contribution; to 255: full intensity. 1557All values in any combination are valid. 1558 1559<a href='SkColor_Reference#Color'>Color</a> is not <a href='undocumented#Premultiply'>Premultiplied</a>; <a href='#Color_Alpha'>Color_Alpha</a> sets the transparency independent of 1560RGB: red, blue, and green. 1561 1562The bit positions of <a href='#Color_Alpha'>Color_Alpha</a> and RGB are independent of the bit 1563positions on the output <a href='undocumented#Device'>device</a>, which may have more or fewer bits, and may have 1564a different arrangement. 1565 1566| bit positions | <a href='#Color_Alpha'>Color_Alpha</a> | red | blue | green | 1567| --- | --- | --- | --- | --- | 1568| | 31 - 24 | 23 - 16 | 15 - 8 | 7 - 0 | 1569 1570### Example 1571 1572<div><fiddle-embed name="214b559d75c65a7bef6ef4be1f860053"></fiddle-embed></div> 1573 1574<a name='SkPaint_getColor'></a> 1575 1576--- 1577 1578<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1579<a href='SkColor_Reference#SkColor'>SkColor</a> <a href='#SkPaint_getColor'>getColor</a>()const 1580</pre> 1581 1582Retrieves <a href='SkColor_Reference#Alpha'>alpha</a> and RGB, <a href='undocumented#Unpremultiply'>unpremultiplied</a>, packed into 32 bits. 1583Use helpers <a href='SkColor_Reference#SkColorGetA'>SkColorGetA</a>(), <a href='SkColor_Reference#SkColorGetR'>SkColorGetR</a>(), <a href='SkColor_Reference#SkColorGetG'>SkColorGetG</a>(), and <a href='SkColor_Reference#SkColorGetB'>SkColorGetB</a>() to extract 1584a <a href='SkColor_Reference#Color'>color</a> component. 1585 1586### Return Value 1587 1588<a href='undocumented#Unpremultiply'>unpremultiplied</a> ARGB 1589 1590### Example 1591 1592<div><fiddle-embed name="72d41f890203109a41f589a7403acae9"> 1593 1594#### Example Output 1595 1596~~~~ 1597Yellow is 100% red, 100% green, and 0% blue. 1598~~~~ 1599 1600</fiddle-embed></div> 1601 1602### See Also 1603 1604<a href='#SkPaint_getColor4f'>getColor4f</a> <a href='SkColor_Reference#SkColor'>SkColor</a> 1605 1606<a name='SkPaint_getColor4f'></a> 1607 1608--- 1609 1610<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1611<a href='SkColor4f_Reference#SkColor4f'>SkColor4f</a> <a href='#SkPaint_getColor4f'>getColor4f</a>()const 1612</pre> 1613 1614Retrieves <a href='SkColor_Reference#Alpha'>alpha</a> and RGB, <a href='undocumented#Unpremultiply'>unpremultiplied</a>, as four floating <a href='SkPoint_Reference#Point'>point</a> values. RGB are 1615are extended sRGB values (sRGB gamut, and encoded with the sRGB transfer function). 1616 1617### Return Value 1618 1619<a href='undocumented#Unpremultiply'>unpremultiplied</a> RGBA 1620 1621### Example 1622 1623<div><fiddle-embed name="8512ea2176f36e8f1aeef311ff228790"> 1624 1625#### Example Output 1626 1627~~~~ 1628Yellow is 100% red, 100% green, and 0% blue. 1629~~~~ 1630 1631</fiddle-embed></div> 1632 1633### See Also 1634 1635<a href='#SkPaint_getColor'>getColor</a> <a href='SkColor_Reference#SkColor'>SkColor</a> 1636 1637<a name='SkPaint_setColor'></a> 1638 1639--- 1640 1641<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1642void <a href='#SkPaint_setColor'>setColor</a>(<a href='SkColor_Reference#SkColor'>SkColor</a> <a href='SkColor_Reference#Color'>color</a>) 1643</pre> 1644 1645Sets <a href='SkColor_Reference#Alpha'>alpha</a> and RGB used when stroking and filling. The <a href='#SkPaint_setColor_color'>color</a> is a 32-bit value, 1646<a href='undocumented#Unpremultiply'>unpremultiplied</a>, packing 8-bit components for <a href='SkColor_Reference#Alpha'>alpha</a>, red, blue, and green. 1647 1648### Parameters 1649 1650<table> <tr> <td><a name='SkPaint_setColor_color'><code><strong>color</strong></code></a></td> 1651 <td><a href='undocumented#Unpremultiply'>unpremultiplied</a> ARGB</td> 1652 </tr> 1653</table> 1654 1655### Example 1656 1657<div><fiddle-embed name="6e70f18300bd676a3c056ceb6b62f8df"> 1658 1659#### Example Output 1660 1661~~~~ 1662green1 == green2 1663~~~~ 1664 1665</fiddle-embed></div> 1666 1667### See Also 1668 1669<a href='SkColor_Reference#SkColor'>SkColor</a> <a href='#SkPaint_setColor4f'>setColor4f</a> <a href='#SkPaint_setARGB'>setARGB</a> <a href='SkColor_Reference#SkColorSetARGB'>SkColorSetARGB</a> 1670 1671<a name='SkPaint_setColor4f'></a> 1672 1673--- 1674 1675<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1676void <a href='#SkPaint_setColor4f'>setColor4f</a>(const <a href='SkColor4f_Reference#SkColor4f'>SkColor4f</a>& <a href='SkColor_Reference#Color'>color</a>, <a href='undocumented#SkColorSpace'>SkColorSpace</a>* colorSpace) 1677</pre> 1678 1679Sets <a href='SkColor_Reference#Alpha'>alpha</a> and RGB used when stroking and filling. The <a href='#SkPaint_setColor4f_color'>color</a> is four floating 1680<a href='SkPoint_Reference#Point'>point</a> values, <a href='undocumented#Unpremultiply'>unpremultiplied</a>. The <a href='#SkPaint_setColor4f_color'>color</a> values are interpreted as being in 1681the <a href='#SkPaint_setColor4f_colorSpace'>colorSpace</a>. If <a href='#SkPaint_setColor4f_colorSpace'>colorSpace</a> is nullptr, then <a href='#SkPaint_setColor4f_color'>color</a> is assumed to be in the 1682sRGB <a href='undocumented#Color_Space'>color space</a>. 1683 1684### Parameters 1685 1686<table> <tr> <td><a name='SkPaint_setColor4f_color'><code><strong>color</strong></code></a></td> 1687 <td><a href='undocumented#Unpremultiply'>unpremultiplied</a> RGBA</td> 1688 </tr> 1689 <tr> <td><a name='SkPaint_setColor4f_colorSpace'><code><strong>colorSpace</strong></code></a></td> 1690 <td><a href='undocumented#SkColorSpace'>SkColorSpace</a> describing the encoding of <a href='#SkPaint_setColor4f_color'>color</a></td> 1691 </tr> 1692</table> 1693 1694### Example 1695 1696<div><fiddle-embed name="fa60859e3d03bdc117a05b32e093a8f1"> 1697 1698#### Example Output 1699 1700~~~~ 1701green1 == green2 1702~~~~ 1703 1704</fiddle-embed></div> 1705 1706### See Also 1707 1708<a href='SkColor_Reference#SkColor'>SkColor</a> <a href='#SkPaint_setColor'>setColor</a> <a href='#SkPaint_setARGB'>setARGB</a> <a href='SkColor_Reference#SkColorSetARGB'>SkColorSetARGB</a> 1709 1710<a name='Alpha_Methods'></a> 1711 1712<a href='#Color_Alpha'>Color_Alpha</a> sets the transparency independent of RGB: red, blue, and green. 1713 1714<a name='SkPaint_getAlpha'></a> 1715 1716--- 1717 1718<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1719uint8_t <a href='#SkPaint_getAlpha'>getAlpha</a>()const 1720</pre> 1721 1722Retrieves <a href='SkColor_Reference#Alpha'>alpha</a> from the <a href='SkColor_Reference#Color'>color</a> used when stroking and filling. 1723 1724### Return Value 1725 1726<a href='SkColor_Reference#Alpha'>alpha</a> ranging from zero, fully transparent, to 255, fully opaque 1727 1728### Example 1729 1730<div><fiddle-embed name="9a85bb62fe3d877b18fb7f952c4fa7f7"> 1731 1732#### Example Output 1733 1734~~~~ 1735255 == paint.getAlpha() 1736~~~~ 1737 1738</fiddle-embed></div> 1739 1740<a name='SkPaint_setAlpha'></a> 1741 1742--- 1743 1744<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1745void <a href='#SkPaint_setAlpha'>setAlpha</a>(<a href='undocumented#U8CPU'>U8CPU</a> a) 1746</pre> 1747 1748Replaces <a href='SkColor_Reference#Alpha'>alpha</a>, leaving RGB 1749unchanged. An out of range value triggers an assert in the debug 1750build. <a href='#SkPaint_setAlpha_a'>a</a> is <a href='#SkPaint_setAlpha_a'>a</a> value from zero to 255. 1751<a href='#SkPaint_setAlpha_a'>a</a> set to zero makes <a href='SkColor_Reference#Color'>color</a> fully transparent; <a href='#SkPaint_setAlpha_a'>a</a> set to 255 makes <a href='SkColor_Reference#Color'>color</a> 1752fully opaque. 1753 1754### Parameters 1755 1756<table> <tr> <td><a name='SkPaint_setAlpha_a'><code><strong>a</strong></code></a></td> 1757 <td><a href='SkColor_Reference#Alpha'>alpha</a> component of <a href='SkColor_Reference#Color'>color</a></td> 1758 </tr> 1759</table> 1760 1761### Example 1762 1763<div><fiddle-embed name="6ddc0360512dfb9947e75c17e6a8103d"> 1764 1765#### Example Output 1766 1767~~~~ 17680x44112233 == paint.getColor() 1769~~~~ 1770 1771</fiddle-embed></div> 1772 1773<a name='SkPaint_setARGB'></a> 1774 1775--- 1776 1777<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1778void <a href='#SkPaint_setARGB'>setARGB</a>(<a href='undocumented#U8CPU'>U8CPU</a> a, <a href='undocumented#U8CPU'>U8CPU</a> r, <a href='undocumented#U8CPU'>U8CPU</a> g, <a href='undocumented#U8CPU'>U8CPU</a> b) 1779</pre> 1780 1781Sets <a href='SkColor_Reference#Color'>color</a> used when drawing solid fills. The <a href='SkColor_Reference#Color'>color</a> components range from 0 to 255. 1782The <a href='SkColor_Reference#Color'>color</a> is <a href='undocumented#Unpremultiply'>unpremultiplied</a>; <a href='SkColor_Reference#Alpha'>alpha</a> sets the transparency independent of RGB. 1783 1784### Parameters 1785 1786<table> <tr> <td><a name='SkPaint_setARGB_a'><code><strong>a</strong></code></a></td> 1787 <td>amount of <a href='SkColor_Reference#Alpha'>alpha</a>, from fully transparent (0) to fully opaque (255)</td> 1788 </tr> 1789 <tr> <td><a name='SkPaint_setARGB_r'><code><strong>r</strong></code></a></td> 1790 <td>amount of red, from no red (0) to full red (255)</td> 1791 </tr> 1792 <tr> <td><a name='SkPaint_setARGB_g'><code><strong>g</strong></code></a></td> 1793 <td>amount of green, from no green (0) to full green (255)</td> 1794 </tr> 1795 <tr> <td><a name='SkPaint_setARGB_b'><code><strong>b</strong></code></a></td> 1796 <td>amount of blue, from no blue (0) to full blue (255)</td> 1797 </tr> 1798</table> 1799 1800### Example 1801 1802<div><fiddle-embed name="cb62e4755789ed32f7120dc55984959d"> 1803 1804#### Example Output 1805 1806~~~~ 1807transRed1 == transRed2 1808~~~~ 1809 1810</fiddle-embed></div> 1811 1812### See Also 1813 1814<a href='#SkPaint_setColor'>setColor</a> <a href='SkColor_Reference#SkColorSetARGB'>SkColorSetARGB</a> 1815 1816<a name='Style'></a> 1817 1818--- 1819 1820<a href='#SkPaint_Style'>Style</a> specifies if the geometry is filled, stroked, or both filled and stroked. 1821Some shapes ignore <a href='#SkPaint_Style'>Style</a> and are always drawn filled or stroked. 1822 1823<a name='Style_Fill'></a> 1824 1825Set <a href='#SkPaint_Style'>Style</a> to <a href='#SkPaint_kFill_Style'>kFill_Style</a> to fill the shape. 1826The fill covers the area inside the geometry for most shapes. 1827 1828<a name='Style_Stroke'></a> 1829 1830Set <a href='#SkPaint_Style'>Style</a> to <a href='#SkPaint_kStroke_Style'>kStroke_Style</a> to stroke the shape. 1831 1832The stroke covers the area described by following the shape edge with a pen or brush of 1833<a href='#Paint_Stroke_Width'>Stroke_Width</a>. The area covered where the shape starts and stops is described by <a href='#Paint_Stroke_Cap'>Stroke_Cap</a>. 1834The area covered where the shape turns a corner is described by <a href='#Paint_Stroke_Join'>Stroke_Join</a>. 1835The stroke is centered on the shape; it extends equally on either side of the shape edge.As <a href='#Paint_Stroke_Width'>Stroke_Width</a> gets smaller, the drawn <a href='SkPath_Reference#Path'>path</a> frame is thinner. <a href='#Paint_Stroke_Width'>Stroke_Width</a> less than one 1836may have gaps, and if <a href='#SkPaint_kAntiAlias_Flag'>kAntiAlias_Flag</a> is set, <a href='#Color_Alpha'>Color_Alpha</a> will increase to visually decrease coverage. 1837 1838### See Also 1839 1840<a href='#Path_Fill_Type'>Path_Fill_Type</a> <a href='#Path_Effect'>Path_Effect</a> <a href='#Paint_Style_Fill'>Style_Fill</a> <a href='#Paint_Style_Stroke'>Style_Stroke</a> 1841 1842<a name='Hairline'></a> 1843 1844--- 1845 1846<a href='#Paint_Stroke_Width'>Stroke_Width</a> of zero has a special meaning and switches drawing to use Hairline. 1847Hairline draws the thinnest continuous frame. If <a href='#SkPaint_kAntiAlias_Flag'>kAntiAlias_Flag</a> is clear, adjacent pixels 1848flow horizontally, vertically,or diagonally. 1849 1850<a href='SkPath_Reference#Path'>Path</a> drawing with Hairline may hit the same <a href='undocumented#Pixel'>pixel</a> more than once. For instance, <a href='SkPath_Reference#Path'>Path</a> containing 1851two <a href='undocumented#Line'>lines</a> in one <a href='#Path_Overview_Contour'>Path_Contour</a> will draw the corner <a href='SkPoint_Reference#Point'>point</a> once, but may both <a href='undocumented#Line'>lines</a> may draw the adjacent 1852<a href='undocumented#Pixel'>pixel</a>. If <a href='#SkPaint_kAntiAlias_Flag'>kAntiAlias_Flag</a> is set, transparency is applied twice, resulting in a darker <a href='undocumented#Pixel'>pixel</a>. Some 1853GPU-backed implementations apply transparency at a later drawing stage, avoiding double hit pixels 1854while stroking. 1855 1856### See Also 1857 1858<a href='#Path_Fill_Type'>Path_Fill_Type</a> <a href='#Path_Effect'>Path_Effect</a> <a href='#Paint_Style_Fill'>Style_Fill</a> <a href='#Paint_Style_Stroke'>Style_Stroke</a> 1859 1860<a name='SkPaint_Style'></a> 1861 1862--- 1863 1864<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> 1865 enum <a href='#SkPaint_Style'>Style</a> : uint8_t { 1866 <a href='#SkPaint_kFill_Style'>kFill_Style</a>, 1867 <a href='#SkPaint_kStroke_Style'>kStroke_Style</a>, 1868 <a href='#SkPaint_kStrokeAndFill_Style'>kStrokeAndFill_Style</a>, 1869 }; 1870 1871</pre> 1872 1873<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> 1874 static constexpr int <a href='#SkPaint_kStyleCount'>kStyleCount</a> = <a href='#SkPaint_kStrokeAndFill_Style'>kStrokeAndFill_Style</a> + 1; 1875</pre> 1876 1877Set <a href='#SkPaint_Style'>Style</a> to fill, stroke, or both fill and stroke geometry. 1878The stroke and fill 1879share all <a href='SkPaint_Reference#Paint'>paint</a> attributes; for instance, they are drawn with the same <a href='SkColor_Reference#Color'>color</a>. 1880 1881Use <a href='#SkPaint_kStrokeAndFill_Style'>kStrokeAndFill_Style</a> to avoid hitting the same pixels twice with a stroke draw and 1882a fill draw. 1883 1884### Constants 1885 1886<table style='border-collapse: collapse; width: 62.5em'> 1887 <tr><th style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>Const</th> 1888<th style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>Value</th> 1889<th style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>Description</th></tr> 1890 <tr style='background-color: #f0f0f0; '> 1891 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkPaint_kFill_Style'><code>SkPaint::kFill_Style</code></a></td> 1892 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>0</td> 1893 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 1894Applies to <a href='SkRect_Reference#Rect'>Rect</a>, <a href='SkRegion_Reference#Region'>Region</a>, <a href='#RRect'>Round_Rect</a>, <a href='undocumented#Circle'>Circles</a>, <a href='undocumented#Oval'>Ovals</a>, <a href='SkPath_Reference#Path'>Path</a>, and <a href='undocumented#Text'>Text</a>. 1895<a href='SkBitmap_Reference#Bitmap'>Bitmap</a>, <a href='SkImage_Reference#Image'>Image</a>, <a href='undocumented#Patch'>Patches</a>, <a href='SkRegion_Reference#Region'>Region</a>, <a href='undocumented#Sprite'>Sprites</a>, and <a href='undocumented#Vertices'>Vertices</a> are painted as if 1896<a href='#SkPaint_kFill_Style'>kFill_Style</a> is set, and ignore the set <a href='#SkPaint_Style'>Style</a>. 1897The <a href='#Path_Fill_Type'>Path_Fill_Type</a> specifies additional rules to fill the area outside the <a href='SkPath_Reference#Path'>path</a> edge, 1898and to create an unfilled hole inside the shape. 1899<a href='#SkPaint_Style'>Style</a> is set to <a href='#SkPaint_kFill_Style'>kFill_Style</a> by default. 1900</td> 1901 </tr> 1902 <tr> 1903 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkPaint_kStroke_Style'><code>SkPaint::kStroke_Style</code></a></td> 1904 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>1</td> 1905 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 1906Applies to <a href='SkRect_Reference#Rect'>Rect</a>, <a href='SkRegion_Reference#Region'>Region</a>, <a href='#RRect'>Round_Rect</a>, <a href='undocumented#Arc'>Arcs</a>, <a href='undocumented#Circle'>Circles</a>, <a href='undocumented#Oval'>Ovals</a>, <a href='SkPath_Reference#Path'>Path</a>, and <a href='undocumented#Text'>Text</a>. 1907<a href='undocumented#Arc'>Arcs</a>, <a href='undocumented#Line'>Lines</a>, and <a href='SkPoint_Reference#Point'>points</a>, are always drawn as if <a href='#SkPaint_kStroke_Style'>kStroke_Style</a> is set, 1908and ignore the set <a href='#SkPaint_Style'>Style</a>. 1909The stroke construction is unaffected by the <a href='#Path_Fill_Type'>Path_Fill_Type</a>. 1910</td> 1911 </tr> 1912 <tr style='background-color: #f0f0f0; '> 1913 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkPaint_kStrokeAndFill_Style'><code>SkPaint::kStrokeAndFill_Style</code></a></td> 1914 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>2</td> 1915 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 1916Applies to <a href='SkRect_Reference#Rect'>Rect</a>, <a href='SkRegion_Reference#Region'>Region</a>, <a href='#RRect'>Round_Rect</a>, <a href='undocumented#Circle'>Circles</a>, <a href='undocumented#Oval'>Ovals</a>, <a href='SkPath_Reference#Path'>Path</a>, and <a href='undocumented#Text'>Text</a>. 1917<a href='SkPath_Reference#Path'>Path</a> is treated as if it is set to <a href='SkPath_Reference#SkPath'>SkPath</a>::<a href='#SkPath_kWinding_FillType'>kWinding_FillType</a>, 1918and the set <a href='#Path_Fill_Type'>Path_Fill_Type</a> is ignored. 1919</td> 1920 </tr> 1921 <tr> 1922 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkPaint_kStyleCount'><code>SkPaint::kStyleCount</code></a></td> 1923 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>3</td> 1924 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 1925May be used to verify that <a href='#SkPaint_Style'>Style</a> is a legal value. 1926</td> 1927 </tr> 1928</table> 1929 1930<a name='SkPaint_getStyle'></a> 1931 1932--- 1933 1934<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1935<a href='#SkPaint_Style'>Style</a> <a href='#SkPaint_getStyle'>getStyle</a>()const 1936</pre> 1937 1938Returns whether the geometry is filled, stroked, or filled and stroked. 1939 1940### Return Value 1941 1942one of:<a href='#SkPaint_kFill_Style'>kFill_Style</a>, <a href='#SkPaint_kStroke_Style'>kStroke_Style</a>, <a href='#SkPaint_kStrokeAndFill_Style'>kStrokeAndFill_Style</a> 1943 1944### Example 1945 1946<div><fiddle-embed name="1c5e18c3c0102d2dac86a78ba8c8ce01"> 1947 1948#### Example Output 1949 1950~~~~ 1951SkPaint::kFill_Style == paint.getStyle() 1952~~~~ 1953 1954</fiddle-embed></div> 1955 1956### See Also 1957 1958<a href='#SkPaint_Style'>Style</a> <a href='#SkPaint_setStyle'>setStyle</a> 1959 1960<a name='SkPaint_setStyle'></a> 1961 1962--- 1963 1964<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1965void <a href='#SkPaint_setStyle'>setStyle</a>(<a href='#SkPaint_Style'>Style</a> style) 1966</pre> 1967 1968Sets whether the geometry is filled, stroked, or filled and stroked. 1969Has no effect if <a href='#SkPaint_setStyle_style'>style</a> is not a legal <a href='SkPaint_Reference#SkPaint'>SkPaint</a>::<a href='#SkPaint_Style'>Style</a> value. 1970 1971### Parameters 1972 1973<table> <tr> <td><a name='SkPaint_setStyle_style'><code><strong>style</strong></code></a></td> 1974 <td>one of: <a href='#SkPaint_kFill_Style'>kFill_Style</a>, <a href='#SkPaint_kStroke_Style'>kStroke_Style</a>, <a href='#SkPaint_kStrokeAndFill_Style'>kStrokeAndFill_Style</a></td> 1975 </tr> 1976</table> 1977 1978### Example 1979 1980<div><fiddle-embed name="c7bb6248e4735b8d1a32d02fba40d344"></fiddle-embed></div> 1981 1982### See Also 1983 1984<a href='#SkPaint_Style'>Style</a> <a href='#SkPaint_getStyle'>getStyle</a> 1985 1986<a name='Stroke_Width'></a> 1987 1988--- 1989 1990<a href='#Paint_Stroke_Width'>Stroke_Width</a> sets the width for stroking. The width is the thickness 1991of the stroke perpendicular to the <a href='SkPath_Reference#Path_Direction'>path direction</a> when the <a href='SkPaint_Reference#Paint'>paint style</a> is 1992set to <a href='#SkPaint_kStroke_Style'>kStroke_Style</a> or <a href='#SkPaint_kStrokeAndFill_Style'>kStrokeAndFill_Style</a>. 1993 1994When width is greater than zero, the stroke encompasses as many pixels partially 1995or fully as needed. When the width equals zero, the <a href='SkPaint_Reference#Paint'>paint</a> enables hairlines; 1996the stroke is always one <a href='undocumented#Pixel'>pixel</a> wide. 1997 1998The stroke dimensions are scaled by the <a href='SkCanvas_Reference#Canvas_Matrix'>canvas matrix</a>, but Hairline stroke 1999remains one <a href='undocumented#Pixel'>pixel</a> wide regardless of scaling. 2000 2001The default width for the <a href='SkPaint_Reference#Paint'>paint</a> is zero. 2002 2003### Example 2004 2005<div><fiddle-embed name="5112c7209a19e035c61cef33a624a652" gpu="true"><div>The pixels hit to represent thin <a href='undocumented#Line'>lines</a> vary with the angle of the 2006<a href='undocumented#Line'>line</a> and the platform implementation. 2007</div></fiddle-embed></div> 2008 2009<a name='SkPaint_getStrokeWidth'></a> 2010 2011--- 2012 2013<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 2014<a href='undocumented#SkScalar'>SkScalar</a> <a href='#SkPaint_getStrokeWidth'>getStrokeWidth</a>()const 2015</pre> 2016 2017Returns the thickness of the pen used by <a href='SkPaint_Reference#SkPaint'>SkPaint</a> to 2018outline the shape. 2019 2020### Return Value 2021 2022zero for hairline, greater than zero for pen thickness 2023 2024### Example 2025 2026<div><fiddle-embed name="99aa73f64df8bbf06e656cd891a81b9e"> 2027 2028#### Example Output 2029 2030~~~~ 20310 == paint.getStrokeWidth() 2032~~~~ 2033 2034</fiddle-embed></div> 2035 2036<a name='SkPaint_setStrokeWidth'></a> 2037 2038--- 2039 2040<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 2041void <a href='#SkPaint_setStrokeWidth'>setStrokeWidth</a>(<a href='undocumented#SkScalar'>SkScalar</a> width) 2042</pre> 2043 2044Sets the thickness of the pen used by the <a href='SkPaint_Reference#Paint'>paint</a> to 2045outline the shape. 2046Has no effect if <a href='#SkPaint_setStrokeWidth_width'>width</a> is less than zero. 2047 2048### Parameters 2049 2050<table> <tr> <td><a name='SkPaint_setStrokeWidth_width'><code><strong>width</strong></code></a></td> 2051 <td>zero thickness for hairline; greater than zero for pen thickness</td> 2052 </tr> 2053</table> 2054 2055### Example 2056 2057<div><fiddle-embed name="0c4446c0870b5c7b5a2efe77ff92afb8"> 2058 2059#### Example Output 2060 2061~~~~ 20625 == paint.getStrokeWidth() 2063~~~~ 2064 2065</fiddle-embed></div> 2066 2067<a name='Miter_Limit'></a> 2068 2069--- 2070 2071<a href='#Paint_Miter_Limit'>Miter_Limit</a> specifies the maximum miter length, 2072relative to the <a href='#Stroke_Width'>stroke width</a>. 2073 2074<a href='#Paint_Miter_Limit'>Miter_Limit</a> is used when the <a href='#Paint_Stroke_Join'>Stroke_Join</a> 2075is set to <a href='#SkPaint_kMiter_Join'>kMiter_Join</a>, and the <a href='#SkPaint_Style'>Style</a> is either <a href='#SkPaint_kStroke_Style'>kStroke_Style</a> 2076or <a href='#SkPaint_kStrokeAndFill_Style'>kStrokeAndFill_Style</a>. 2077 2078If the miter at a corner exceeds this limit, <a href='#SkPaint_kMiter_Join'>kMiter_Join</a> 2079is replaced with <a href='#SkPaint_kBevel_Join'>kBevel_Join</a>. 2080 2081<a href='#Paint_Miter_Limit'>Miter_Limit</a> can be computed from the corner angle using: 2082<code><a href='#Miter_Limit'>miter limit</a> = 1 / sin ( angle / 2 )</code>. 2083 2084<a href='#Paint_Miter_Limit'>Miter_Limit</a> default value is 4. 2085The default may be changed at compile time by setting <a href='undocumented#SkPaintDefaults_MiterLimit'>SkPaintDefaults_MiterLimit</a> 2086in "SkUserConfig.h" or as a define supplied by the build environment. 2087 2088Here are some miter limits and the angles that triggers them. 2089 2090| <a href='#Miter_Limit'>miter limit</a> | angle in degrees | 2091| --- | --- | 2092| 10 | 11.48 | 2093| 9 | 12.76 | 2094| 8 | 14.36 | 2095| 7 | 16.43 | 2096| 6 | 19.19 | 2097| 5 | 23.07 | 2098| 4 | 28.96 | 2099| 3 | 38.94 | 2100| 2 | 60 | 2101| 1 | 180 | 2102 2103### Example 2104 2105<div><fiddle-embed name="5de2de0f00354e59074a9bb1a42d5a63"><div>This example draws a stroked corner and the miter length beneath. 2106When the <a href='#Miter_Limit'>miter limit</a> is decreased slightly, the miter join is replaced 2107by a bevel join. 2108</div></fiddle-embed></div> 2109 2110<a name='SkPaint_getStrokeMiter'></a> 2111 2112--- 2113 2114<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 2115<a href='undocumented#SkScalar'>SkScalar</a> <a href='#SkPaint_getStrokeMiter'>getStrokeMiter</a>()const 2116</pre> 2117 2118Returns the limit at which a sharp corner is drawn beveled. 2119 2120### Return Value 2121 2122zero and greater miter limit 2123 2124### Example 2125 2126<div><fiddle-embed name="50da74a43b725f07a914df588c867d36"> 2127 2128#### Example Output 2129 2130~~~~ 2131default miter limit == 4 2132~~~~ 2133 2134</fiddle-embed></div> 2135 2136### See Also 2137 2138<a href='#Paint_Miter_Limit'>Miter_Limit</a> <a href='#SkPaint_setStrokeMiter'>setStrokeMiter</a> <a href='#SkPaint_Join'>Join</a> 2139 2140<a name='SkPaint_setStrokeMiter'></a> 2141 2142--- 2143 2144<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 2145void <a href='#SkPaint_setStrokeMiter'>setStrokeMiter</a>(<a href='undocumented#SkScalar'>SkScalar</a> miter) 2146</pre> 2147 2148Sets the limit at which a sharp corner is drawn beveled. 2149Valid values are zero and greater. 2150Has no effect if <a href='#SkPaint_setStrokeMiter_miter'>miter</a> is less than zero. 2151 2152### Parameters 2153 2154<table> <tr> <td><a name='SkPaint_setStrokeMiter_miter'><code><strong>miter</strong></code></a></td> 2155 <td>zero and greater <a href='#Miter_Limit'>miter limit</a></td> 2156 </tr> 2157</table> 2158 2159### Example 2160 2161<div><fiddle-embed name="700b284dbc97785c6a9c9636088713ad"> 2162 2163#### Example Output 2164 2165~~~~ 2166default miter limit == 8 2167~~~~ 2168 2169</fiddle-embed></div> 2170 2171### See Also 2172 2173<a href='#Paint_Miter_Limit'>Miter_Limit</a> <a href='#SkPaint_getStrokeMiter'>getStrokeMiter</a> <a href='#SkPaint_Join'>Join</a> 2174 2175<a name='Stroke_Cap'></a> 2176 2177<a name='SkPaint_Cap'></a> 2178 2179--- 2180 2181<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> 2182 enum <a href='#SkPaint_Cap'>Cap</a> { 2183 <a href='#SkPaint_kButt_Cap'>kButt_Cap</a>, 2184 <a href='#SkPaint_kRound_Cap'>kRound_Cap</a>, 2185 <a href='#SkPaint_kSquare_Cap'>kSquare_Cap</a>, 2186 <a href='#SkPaint_kLast_Cap'>kLast_Cap</a> = <a href='#SkPaint_kSquare_Cap'>kSquare_Cap</a>, 2187 <a href='#SkPaint_kDefault_Cap'>kDefault_Cap</a> = <a href='#SkPaint_kButt_Cap'>kButt_Cap</a>, 2188 }; 2189 2190</pre> 2191 2192<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> 2193 static constexpr int <a href='#SkPaint_kCapCount'>kCapCount</a> = <a href='#SkPaint_kLast_Cap'>kLast_Cap</a> + 1; 2194</pre> 2195 2196<a href='#Paint_Stroke_Cap'>Stroke_Cap</a> draws at the beginning and end of an open <a href='#Path_Overview_Contour'>Path_Contour</a>. 2197 2198### Constants 2199 2200<table style='border-collapse: collapse; width: 62.5em'> 2201 <tr><th style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>Const</th> 2202<th style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>Value</th> 2203<th style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>Description</th></tr> 2204 <tr style='background-color: #f0f0f0; '> 2205 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkPaint_kButt_Cap'><code>SkPaint::kButt_Cap</code></a></td> 2206 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>0</td> 2207 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 2208Does not extend the stroke past the beginning or the end. 2209</td> 2210 </tr> 2211 <tr> 2212 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkPaint_kRound_Cap'><code>SkPaint::kRound_Cap</code></a></td> 2213 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>1</td> 2214 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 2215Adds a <a href='undocumented#Circle'>circle</a> with a diameter equal to <a href='#Paint_Stroke_Width'>Stroke_Width</a> at the beginning 2216and end. 2217</td> 2218 </tr> 2219 <tr style='background-color: #f0f0f0; '> 2220 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkPaint_kSquare_Cap'><code>SkPaint::kSquare_Cap</code></a></td> 2221 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>2</td> 2222 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 2223Adds a square with sides equal to <a href='#Paint_Stroke_Width'>Stroke_Width</a> at the beginning 2224and end. The square sides are parallel to the initial and final direction 2225of the stroke. 2226</td> 2227 </tr> 2228 <tr> 2229 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkPaint_kLast_Cap'><code>SkPaint::kLast_Cap</code></a></td> 2230 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>2</td> 2231 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 2232Equivalent to the largest value for <a href='#Paint_Stroke_Cap'>Stroke_Cap</a>. 2233</td> 2234 </tr> 2235 <tr style='background-color: #f0f0f0; '> 2236 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkPaint_kDefault_Cap'><code>SkPaint::kDefault_Cap</code></a></td> 2237 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>0</td> 2238 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 2239<a href='#Paint_Stroke_Cap'>Stroke_Cap</a> is set to <a href='#SkPaint_kButt_Cap'>kButt_Cap</a> by default. 2240</td> 2241 </tr> 2242 <tr> 2243 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkPaint_kCapCount'><code>SkPaint::kCapCount</code></a></td> 2244 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>3</td> 2245 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 2246May be used to verify that <a href='#Paint_Stroke_Cap'>Stroke_Cap</a> is a legal value. 2247</td> 2248 </tr> 2249</table> 2250 2251Stroke describes the area covered by a pen of <a href='#Paint_Stroke_Width'>Stroke_Width</a> as it 2252follows the <a href='#Path_Overview_Contour'>Path_Contour</a>, moving parallel to the <a href='SkPath_Overview#Contour'>contour</a> direction. 2253 2254If the <a href='#Path_Overview_Contour'>Path_Contour</a> is not terminated by <a href='SkPath_Reference#SkPath'>SkPath</a>::<a href='#SkPath_kClose_Verb'>kClose_Verb</a>, the <a href='SkPath_Overview#Contour'>contour</a> has a 2255visible beginning and end. 2256 2257<a href='#Path_Overview_Contour'>Path_Contour</a> may start and end at the same <a href='SkPoint_Reference#Point'>point</a>; defining <a href='#Path_Overview_Contour_Zero_Length'>Zero_Length_Contour</a>. 2258 2259<a href='#SkPaint_kButt_Cap'>kButt_Cap</a> and <a href='#Path_Overview_Contour_Zero_Length'>Zero_Length_Contour</a> is not drawn. 2260<a href='#SkPaint_kRound_Cap'>kRound_Cap</a> and <a href='#Path_Overview_Contour_Zero_Length'>Zero_Length_Contour</a> draws a <a href='undocumented#Circle'>circle</a> of diameter <a href='#Paint_Stroke_Width'>Stroke_Width</a> 2261at the <a href='SkPath_Overview#Contour'>contour</a> <a href='SkPoint_Reference#Point'>point</a>. 2262<a href='#SkPaint_kSquare_Cap'>kSquare_Cap</a> and <a href='#Path_Overview_Contour_Zero_Length'>Zero_Length_Contour</a> draws an upright square with a side of 2263<a href='#Paint_Stroke_Width'>Stroke_Width</a> at the <a href='SkPath_Overview#Contour'>contour</a> <a href='SkPoint_Reference#Point'>point</a>. 2264 2265<a href='#Paint_Stroke_Cap'>Stroke_Cap</a> is <a href='#SkPaint_kButt_Cap'>kButt_Cap</a> by default. 2266 2267### Example 2268 2269<div><fiddle-embed name="2bffb6384cc20077e632e7d01da045ca"></fiddle-embed></div> 2270 2271<a name='SkPaint_getStrokeCap'></a> 2272 2273--- 2274 2275<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 2276<a href='#SkPaint_Cap'>Cap</a> <a href='#SkPaint_getStrokeCap'>getStrokeCap</a>()const 2277</pre> 2278 2279Returns the geometry drawn at the beginning and end of strokes. 2280 2281### Return Value 2282 2283one of: <a href='#SkPaint_kButt_Cap'>kButt_Cap</a>, <a href='#SkPaint_kRound_Cap'>kRound_Cap</a>, <a href='#SkPaint_kSquare_Cap'>kSquare_Cap</a> 2284 2285### Example 2286 2287<div><fiddle-embed name="aabf9baee8e026fae36fca30e955512b"> 2288 2289#### Example Output 2290 2291~~~~ 2292kButt_Cap == default stroke cap 2293~~~~ 2294 2295</fiddle-embed></div> 2296 2297### See Also 2298 2299<a href='#Paint_Stroke_Cap'>Stroke_Cap</a> <a href='#SkPaint_setStrokeCap'>setStrokeCap</a> 2300 2301<a name='SkPaint_setStrokeCap'></a> 2302 2303--- 2304 2305<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 2306void <a href='#SkPaint_setStrokeCap'>setStrokeCap</a>(<a href='#SkPaint_Cap'>Cap</a> cap) 2307</pre> 2308 2309Sets the geometry drawn at the beginning and end of strokes. 2310 2311### Parameters 2312 2313<table> <tr> <td><a name='SkPaint_setStrokeCap_cap'><code><strong>cap</strong></code></a></td> 2314 <td>one of: <a href='#SkPaint_kButt_Cap'>kButt_Cap</a>, <a href='#SkPaint_kRound_Cap'>kRound_Cap</a>, <a href='#SkPaint_kSquare_Cap'>kSquare_Cap</a>;</td> 2315 </tr> 2316</table> 2317 2318has no effect if <a href='#SkPaint_setStrokeCap_cap'>cap</a> is not valid 2319 2320### Example 2321 2322<div><fiddle-embed name="de83fbd848a4625345b4b87a6e55d98a"> 2323 2324#### Example Output 2325 2326~~~~ 2327kRound_Cap == paint.getStrokeCap() 2328~~~~ 2329 2330</fiddle-embed></div> 2331 2332### See Also 2333 2334<a href='#Paint_Stroke_Cap'>Stroke_Cap</a> <a href='#SkPaint_getStrokeCap'>getStrokeCap</a> 2335 2336<a name='Stroke_Join'></a> 2337 2338<a href='#Paint_Stroke_Join'>Stroke_Join</a> draws at the sharp corners of an open or closed <a href='#Path_Overview_Contour'>Path_Contour</a>. 2339 2340Stroke describes the area covered by a pen of <a href='#Paint_Stroke_Width'>Stroke_Width</a> as it 2341follows the <a href='#Path_Overview_Contour'>Path_Contour</a>, moving parallel to the <a href='SkPath_Overview#Contour'>contour</a> direction. 2342 2343If the <a href='SkPath_Overview#Contour'>contour</a> direction changes abruptly, because the tangent direction leading 2344to the end of a <a href='undocumented#Curve'>curve</a> within the <a href='SkPath_Overview#Contour'>contour</a> does not match the tangent direction of 2345the following <a href='undocumented#Curve'>curve</a>, the pair of <a href='undocumented#Curve'>curves</a> meet at <a href='#Paint_Stroke_Join'>Stroke_Join</a>. 2346 2347### Example 2348 2349<div><fiddle-embed name="917c44b504d3f9308571fd3835d90a0d"></fiddle-embed></div> 2350 2351<a name='SkPaint_Join'></a> 2352 2353--- 2354 2355<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> 2356 enum <a href='#SkPaint_Join'>Join</a> : uint8_t { 2357 <a href='#SkPaint_kMiter_Join'>kMiter_Join</a>, 2358 <a href='#SkPaint_kRound_Join'>kRound_Join</a>, 2359 <a href='#SkPaint_kBevel_Join'>kBevel_Join</a>, 2360 <a href='#SkPaint_kLast_Join'>kLast_Join</a> = <a href='#SkPaint_kBevel_Join'>kBevel_Join</a>, 2361 <a href='#SkPaint_kDefault_Join'>kDefault_Join</a> = <a href='#SkPaint_kMiter_Join'>kMiter_Join</a>, 2362 }; 2363 2364</pre> 2365 2366<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> 2367 static constexpr int <a href='#SkPaint_kJoinCount'>kJoinCount</a> = <a href='#SkPaint_kLast_Join'>kLast_Join</a> + 1; 2368</pre> 2369 2370<a href='#SkPaint_Join'>Join</a> specifies how corners are drawn when a shape is stroked. <a href='#SkPaint_Join'>Join</a> 2371affects the four corners of a stroked rectangle, and the connected segments in a 2372stroked <a href='SkPath_Reference#Path'>path</a>. 2373 2374Choose miter join to draw sharp corners. Choose round join to draw a <a href='undocumented#Circle'>circle</a> with a 2375radius equal to the <a href='#Stroke_Width'>stroke width</a> on top of the corner. Choose bevel join to minimally 2376connect the thick strokes. 2377 2378The <a href='#Fill_Path'>fill path</a> constructed to describe the stroked <a href='SkPath_Reference#Path'>path</a> respects the join setting but may 2379not contain the actual join. For instance, a <a href='#Fill_Path'>fill path</a> constructed with round joins does 2380not necessarily include <a href='undocumented#Circle'>circles</a> at each connected segment. 2381 2382### Constants 2383 2384<table style='border-collapse: collapse; width: 62.5em'> 2385 <tr><th style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>Const</th> 2386<th style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>Value</th> 2387<th style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>Description</th></tr> 2388 <tr style='background-color: #f0f0f0; '> 2389 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkPaint_kMiter_Join'><code>SkPaint::kMiter_Join</code></a></td> 2390 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>0</td> 2391 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 2392Extends the outside corner to the extent allowed by <a href='#Paint_Miter_Limit'>Miter_Limit</a>. 2393If the extension exceeds <a href='#Paint_Miter_Limit'>Miter_Limit</a>, <a href='#SkPaint_kBevel_Join'>kBevel_Join</a> is used instead. 2394</td> 2395 </tr> 2396 <tr> 2397 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkPaint_kRound_Join'><code>SkPaint::kRound_Join</code></a></td> 2398 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>1</td> 2399 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 2400Adds a <a href='undocumented#Circle'>circle</a> with a diameter of <a href='#Paint_Stroke_Width'>Stroke_Width</a> at the sharp corner. 2401</td> 2402 </tr> 2403 <tr style='background-color: #f0f0f0; '> 2404 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkPaint_kBevel_Join'><code>SkPaint::kBevel_Join</code></a></td> 2405 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>2</td> 2406 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 2407Connects the outside edges of the sharp corner. 2408</td> 2409 </tr> 2410 <tr> 2411 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkPaint_kLast_Join'><code>SkPaint::kLast_Join</code></a></td> 2412 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>2</td> 2413 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 2414equivalent to the largest value for Stroke_Join</td> 2415 </tr> 2416 <tr style='background-color: #f0f0f0; '> 2417 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkPaint_kDefault_Join'><code>SkPaint::kDefault_Join</code></a></td> 2418 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>1</td> 2419 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 2420<a href='#Paint_Stroke_Join'>Stroke_Join</a> is set to <a href='#SkPaint_kMiter_Join'>kMiter_Join</a> by default. 2421</td> 2422 </tr> 2423 <tr> 2424 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkPaint_kJoinCount'><code>SkPaint::kJoinCount</code></a></td> 2425 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>3</td> 2426 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 2427May be used to verify that <a href='#Paint_Stroke_Join'>Stroke_Join</a> is a legal value. 2428</td> 2429 </tr> 2430</table> 2431 2432### Example 2433 2434<div><fiddle-embed name="3b1aebacc21c1836a52876b9b0b3905e"></fiddle-embed></div> 2435 2436### See Also 2437 2438<a href='#SkPaint_setStrokeJoin'>setStrokeJoin</a> <a href='#SkPaint_getStrokeJoin'>getStrokeJoin</a> <a href='#SkPaint_setStrokeMiter'>setStrokeMiter</a> <a href='#SkPaint_getStrokeMiter'>getStrokeMiter</a> 2439 2440<a name='SkPaint_getStrokeJoin'></a> 2441 2442--- 2443 2444<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 2445<a href='#SkPaint_Join'>Join</a> <a href='#SkPaint_getStrokeJoin'>getStrokeJoin</a>()const 2446</pre> 2447 2448Returns the geometry drawn at the corners of strokes. 2449 2450### Return Value 2451 2452one of: <a href='#SkPaint_kMiter_Join'>kMiter_Join</a>, <a href='#SkPaint_kRound_Join'>kRound_Join</a>, <a href='#SkPaint_kBevel_Join'>kBevel_Join</a> 2453 2454### Example 2455 2456<div><fiddle-embed name="31bf751d0a8ddf176b871810820d8199"> 2457 2458#### Example Output 2459 2460~~~~ 2461kMiter_Join == default stroke join 2462~~~~ 2463 2464</fiddle-embed></div> 2465 2466### See Also 2467 2468<a href='#Paint_Stroke_Join'>Stroke_Join</a> <a href='#SkPaint_setStrokeJoin'>setStrokeJoin</a> 2469 2470<a name='SkPaint_setStrokeJoin'></a> 2471 2472--- 2473 2474<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 2475void <a href='#SkPaint_setStrokeJoin'>setStrokeJoin</a>(<a href='#SkPaint_Join'>Join</a> join) 2476</pre> 2477 2478Sets the geometry drawn at the corners of strokes. 2479 2480### Parameters 2481 2482<table> <tr> <td><a name='SkPaint_setStrokeJoin_join'><code><strong>join</strong></code></a></td> 2483 <td>one of: <a href='#SkPaint_kMiter_Join'>kMiter_Join</a>, <a href='#SkPaint_kRound_Join'>kRound_Join</a>, <a href='#SkPaint_kBevel_Join'>kBevel_Join</a>;</td> 2484 </tr> 2485</table> 2486 2487otherwise, has no effect 2488 2489### Example 2490 2491<div><fiddle-embed name="48d963ad4286eddf680f9c511eb6da91"> 2492 2493#### Example Output 2494 2495~~~~ 2496kMiter_Join == paint.getStrokeJoin() 2497~~~~ 2498 2499</fiddle-embed></div> 2500 2501### See Also 2502 2503<a href='#Paint_Stroke_Join'>Stroke_Join</a> <a href='#SkPaint_getStrokeJoin'>getStrokeJoin</a> 2504 2505### See Also 2506 2507<a href='#Paint_Miter_Limit'>Miter_Limit</a> 2508 2509<a name='Fill_Path'></a> 2510 2511--- 2512 2513<a href='#Paint_Fill_Path'>Fill_Path</a> creates a <a href='SkPath_Reference#Path'>Path</a> by applying the <a href='#Path_Effect'>Path_Effect</a>, followed by the <a href='#Paint_Style_Stroke'>Style_Stroke</a>. 2514 2515If <a href='SkPaint_Reference#Paint'>Paint</a> contains <a href='#Path_Effect'>Path_Effect</a>, <a href='#Path_Effect'>Path_Effect</a> operates on the source <a href='SkPath_Reference#Path'>Path</a>; the result 2516replaces the destination <a href='SkPath_Reference#Path'>Path</a>. Otherwise, the source <a href='SkPath_Reference#Path'>Path</a> is replaces the 2517destination <a href='SkPath_Reference#Path'>Path</a>. 2518 2519Fill <a href='SkPath_Reference#Path'>Path</a> can request the <a href='#Path_Effect'>Path_Effect</a> to restrict to a culling rectangle, but 2520the <a href='#Path_Effect'>Path_Effect</a> is not required to do so. 2521 2522If <a href='#SkPaint_Style'>Style</a> is <a href='#SkPaint_kStroke_Style'>kStroke_Style</a> or <a href='#SkPaint_kStrokeAndFill_Style'>kStrokeAndFill_Style</a>, 2523and <a href='#Paint_Stroke_Width'>Stroke_Width</a> is greater than zero, the <a href='#Paint_Stroke_Width'>Stroke_Width</a>, <a href='#Paint_Stroke_Cap'>Stroke_Cap</a>, <a href='#Paint_Stroke_Join'>Stroke_Join</a>, 2524and <a href='#Paint_Miter_Limit'>Miter_Limit</a> operate on the destination <a href='SkPath_Reference#Path'>Path</a>, replacing it. 2525 2526Fill <a href='SkPath_Reference#Path'>Path</a> can specify the precision used by <a href='#Paint_Stroke_Width'>Stroke_Width</a> to approximate the stroke geometry. 2527 2528If the <a href='#SkPaint_Style'>Style</a> is <a href='#SkPaint_kStroke_Style'>kStroke_Style</a> and the <a href='#Paint_Stroke_Width'>Stroke_Width</a> is zero, <a href='#SkPaint_getFillPath'>getFillPath</a> 2529returns false since Hairline has no filled equivalent. 2530 2531### See Also 2532 2533<a href='#Paint_Style_Stroke'>Style_Stroke</a> <a href='#Paint_Stroke_Width'>Stroke_Width</a> <a href='#Path_Effect'>Path_Effect</a> 2534 2535<a name='SkPaint_getFillPath'></a> 2536 2537--- 2538 2539<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 2540bool <a href='#SkPaint_getFillPath'>getFillPath</a>(const <a href='SkPath_Reference#SkPath'>SkPath</a>& src, <a href='SkPath_Reference#SkPath'>SkPath</a>* dst, const <a href='SkRect_Reference#SkRect'>SkRect</a>* cullRect, <a href='undocumented#SkScalar'>SkScalar</a> resScale = 1)const 2541</pre> 2542 2543Returns the filled equivalent of the stroked <a href='SkPath_Reference#Path'>path</a>. 2544 2545### Parameters 2546 2547<table> <tr> <td><a name='SkPaint_getFillPath_src'><code><strong>src</strong></code></a></td> 2548 <td><a href='SkPath_Reference#SkPath'>SkPath</a> read to create a filled version</td> 2549 </tr> 2550 <tr> <td><a name='SkPaint_getFillPath_dst'><code><strong>dst</strong></code></a></td> 2551 <td>resulting <a href='SkPath_Reference#SkPath'>SkPath</a>; may be the same as <a href='#SkPaint_getFillPath_src'>src</a>, but may not be nullptr</td> 2552 </tr> 2553 <tr> <td><a name='SkPaint_getFillPath_cullRect'><code><strong>cullRect</strong></code></a></td> 2554 <td>optional limit passed to <a href='undocumented#SkPathEffect'>SkPathEffect</a></td> 2555 </tr> 2556 <tr> <td><a name='SkPaint_getFillPath_resScale'><code><strong>resScale</strong></code></a></td> 2557 <td>if > 1, increase precision, else if (0 < <a href='#SkPaint_getFillPath_resScale'>resScale</a> < 1) reduce precision</td> 2558 </tr> 2559</table> 2560 2561to favor speed and <a href='undocumented#Size'>size</a> 2562 2563### Return Value 2564 2565true if the <a href='SkPath_Reference#Path'>path</a> represents <a href='#Style_Fill'>style fill</a>, or false if it represents hairline 2566 2567### Example 2568 2569<div><fiddle-embed name="cedd6233848198e1fca4d1e14816baaf"><div>A very small <a href='SkPath_Reference#Quad'>Quad</a> stroke is turned into a filled <a href='SkPath_Reference#Path'>path</a> with increasing levels of precision. 2570At the lowest precision, the <a href='SkPath_Reference#Quad'>Quad</a> stroke is approximated by a rectangle. 2571At the highest precision, the filled <a href='SkPath_Reference#Path'>path</a> has high fidelity compared to the original stroke. 2572</div></fiddle-embed></div> 2573 2574<a name='SkPaint_getFillPath_2'></a> 2575 2576--- 2577 2578<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 2579bool <a href='#SkPaint_getFillPath'>getFillPath</a>(const <a href='SkPath_Reference#SkPath'>SkPath</a>& src, <a href='SkPath_Reference#SkPath'>SkPath</a>* dst)const 2580</pre> 2581 2582Returns the filled equivalent of the stroked <a href='SkPath_Reference#Path'>path</a>. 2583 2584Replaces <a href='#SkPaint_getFillPath_2_dst'>dst</a> with the <a href='#SkPaint_getFillPath_2_src'>src</a> <a href='SkPath_Reference#Path'>path</a> modified by <a href='undocumented#SkPathEffect'>SkPathEffect</a> and <a href='#Style_Stroke'>style stroke</a>. 2585<a href='undocumented#SkPathEffect'>SkPathEffect</a>, if any, is not culled. <a href='#Stroke_Width'>stroke width</a> is created with default precision. 2586 2587### Parameters 2588 2589<table> <tr> <td><a name='SkPaint_getFillPath_2_src'><code><strong>src</strong></code></a></td> 2590 <td><a href='SkPath_Reference#SkPath'>SkPath</a> read to create a filled version</td> 2591 </tr> 2592 <tr> <td><a name='SkPaint_getFillPath_2_dst'><code><strong>dst</strong></code></a></td> 2593 <td>resulting <a href='SkPath_Reference#SkPath'>SkPath</a> <a href='#SkPaint_getFillPath_2_dst'>dst</a> may be the same as <a href='#SkPaint_getFillPath_2_src'>src</a>, but may not be nullptr</td> 2594 </tr> 2595</table> 2596 2597### Return Value 2598 2599true if the <a href='SkPath_Reference#Path'>path</a> represents <a href='#Style_Fill'>style fill</a>, or false if it represents hairline 2600 2601### Example 2602 2603<div><fiddle-embed name="e6d8ca0cc17e0b475bd54dd995825468"></fiddle-embed></div> 2604 2605<a name='Shader_Methods'></a> 2606 2607--- 2608 2609<a href='undocumented#Shader'>Shader</a> defines the colors used when drawing a shape. 2610<a href='undocumented#Shader'>Shader</a> may be an <a href='SkImage_Reference#Image'>image</a>, a gradient, or a computed fill. 2611If <a href='SkPaint_Reference#Paint'>Paint</a> has no <a href='undocumented#Shader'>Shader</a>, then <a href='SkColor_Reference#Color'>Color</a> fills the shape. 2612 2613<a href='undocumented#Shader'>Shader</a> is modulated by <a href='#Color_Alpha'>Color_Alpha</a> component of <a href='SkColor_Reference#Color'>Color</a>. 2614If <a href='undocumented#Shader'>Shader</a> object defines only <a href='#Color_Alpha'>Color_Alpha</a>, then <a href='SkColor_Reference#Color'>Color</a> modulated by <a href='#Color_Alpha'>Color_Alpha</a> describes 2615the fill. 2616 2617The drawn transparency can be modified without altering <a href='undocumented#Shader'>Shader</a>, by changing <a href='#Color_Alpha'>Color_Alpha</a>. 2618 2619### Example 2620 2621<div><fiddle-embed name="c015dc2010c15e1c00b4f7330232b0f7"></fiddle-embed></div> 2622 2623If <a href='undocumented#Shader'>Shader</a> generates only <a href='#Color_Alpha'>Color_Alpha</a> then all components of <a href='SkColor_Reference#Color'>Color</a> modulate the output. 2624 2625### Example 2626 2627<div><fiddle-embed name="fe80fd80b98a20823db7fb9a077243c7"></fiddle-embed></div> 2628 2629<a name='SkPaint_getShader'></a> 2630 2631--- 2632 2633<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 2634<a href='undocumented#SkShader'>SkShader</a>* <a href='#SkPaint_getShader'>getShader</a>()const 2635</pre> 2636 2637Returns optional colors used when filling a <a href='SkPath_Reference#Path'>path</a>, such as a gradient. 2638 2639Does not alter <a href='undocumented#SkShader'>SkShader</a> <a href='undocumented#SkRefCnt'>SkRefCnt</a>. 2640 2641### Return Value 2642 2643<a href='undocumented#SkShader'>SkShader</a> if previously set, nullptr otherwise 2644 2645### Example 2646 2647<div><fiddle-embed name="09f15b9fd88882850da2d235eb86292f"> 2648 2649#### Example Output 2650 2651~~~~ 2652nullptr == shader 2653nullptr != shader 2654~~~~ 2655 2656</fiddle-embed></div> 2657 2658<a name='SkPaint_refShader'></a> 2659 2660--- 2661 2662<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 2663<a href='undocumented#sk_sp'>sk_sp</a><<a href='undocumented#SkShader'>SkShader</a>> <a href='#SkPaint_refShader'>refShader</a>()const 2664</pre> 2665 2666Returns optional colors used when filling a <a href='SkPath_Reference#Path'>path</a>, such as a gradient. 2667 2668Increases <a href='undocumented#SkShader'>SkShader</a> <a href='undocumented#SkRefCnt'>SkRefCnt</a> by one. 2669 2670### Return Value 2671 2672<a href='undocumented#SkShader'>SkShader</a> if previously set, nullptr otherwise 2673 2674### Example 2675 2676<div><fiddle-embed name="53da0295972a418cbc9607bbb17feaa8"> 2677 2678#### Example Output 2679 2680~~~~ 2681shader unique: true 2682shader unique: false 2683~~~~ 2684 2685</fiddle-embed></div> 2686 2687<a name='SkPaint_setShader'></a> 2688 2689--- 2690 2691<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 2692void <a href='#SkPaint_setShader'>setShader</a>(<a href='undocumented#sk_sp'>sk_sp</a><<a href='undocumented#SkShader'>SkShader</a>> <a href='undocumented#Shader'>shader</a>) 2693</pre> 2694 2695Sets optional colors used when filling a <a href='SkPath_Reference#Path'>path</a>, such as a gradient. 2696 2697Sets <a href='undocumented#SkShader'>SkShader</a> to <a href='#SkPaint_setShader_shader'>shader</a>, decreasing <a href='undocumented#SkRefCnt'>SkRefCnt</a> of the previous <a href='undocumented#SkShader'>SkShader</a>. 2698Increments <a href='#SkPaint_setShader_shader'>shader</a> <a href='undocumented#SkRefCnt'>SkRefCnt</a> by one. 2699 2700### Parameters 2701 2702<table> <tr> <td><a name='SkPaint_setShader_shader'><code><strong>shader</strong></code></a></td> 2703 <td>how geometry is filled with <a href='SkColor_Reference#Color'>color</a>; if nullptr, <a href='SkColor_Reference#Color'>color</a> is used instead</td> 2704 </tr> 2705</table> 2706 2707### Example 2708 2709<div><fiddle-embed name="77e64d5bae9b1ba037fd99252bb4aa58"></fiddle-embed></div> 2710 2711<a name='Color_Filter_Methods'></a> 2712 2713--- 2714 2715<a href='#Color_Filter'>Color_Filter</a> alters the <a href='SkColor_Reference#Color'>color</a> used when drawing a shape. 2716<a href='#Color_Filter'>Color_Filter</a> may apply <a href='#Blend_Mode'>Blend_Mode</a>, transform the <a href='SkColor_Reference#Color'>color</a> through a <a href='SkMatrix_Reference#Matrix'>matrix</a>, or composite multiple filters. 2717If <a href='SkPaint_Reference#Paint'>Paint</a> has no <a href='#Color_Filter'>Color_Filter</a>, the <a href='SkColor_Reference#Color'>color</a> is unaltered. 2718 2719The drawn transparency can be modified without altering <a href='#Color_Filter'>Color_Filter</a>, by changing <a href='#Color_Alpha'>Color_Alpha</a>. 2720 2721### Example 2722 2723<div><fiddle-embed name="5abde56ca2f89a18b8e231abd1b57c56"></fiddle-embed></div> 2724 2725<a name='SkPaint_getColorFilter'></a> 2726 2727--- 2728 2729<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 2730<a href='undocumented#SkColorFilter'>SkColorFilter</a>* <a href='#SkPaint_getColorFilter'>getColorFilter</a>()const 2731</pre> 2732 2733Returns <a href='undocumented#SkColorFilter'>SkColorFilter</a> if set, or nullptr. 2734Does not alter <a href='undocumented#SkColorFilter'>SkColorFilter</a> <a href='undocumented#SkRefCnt'>SkRefCnt</a>. 2735 2736### Return Value 2737 2738<a href='undocumented#SkColorFilter'>SkColorFilter</a> if previously set, nullptr otherwise 2739 2740### Example 2741 2742<div><fiddle-embed name="093bdc627d6b59002670fd290931f6c9"> 2743 2744#### Example Output 2745 2746~~~~ 2747nullptr == color filter 2748nullptr != color filter 2749~~~~ 2750 2751</fiddle-embed></div> 2752 2753<a name='SkPaint_refColorFilter'></a> 2754 2755--- 2756 2757<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 2758<a href='undocumented#sk_sp'>sk_sp</a><<a href='undocumented#SkColorFilter'>SkColorFilter</a>> <a href='#SkPaint_refColorFilter'>refColorFilter</a>()const 2759</pre> 2760 2761Returns <a href='undocumented#SkColorFilter'>SkColorFilter</a> if set, or nullptr. 2762Increases <a href='undocumented#SkColorFilter'>SkColorFilter</a> <a href='undocumented#SkRefCnt'>SkRefCnt</a> by one. 2763 2764### Return Value 2765 2766<a href='undocumented#SkColorFilter'>SkColorFilter</a> if set, or nullptr 2767 2768### Example 2769 2770<div><fiddle-embed name="b588c95fa4c86ddbc4b0546762f08297"> 2771 2772#### Example Output 2773 2774~~~~ 2775color filter unique: true 2776color filter unique: false 2777~~~~ 2778 2779</fiddle-embed></div> 2780 2781<a name='SkPaint_setColorFilter'></a> 2782 2783--- 2784 2785<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 2786void <a href='#SkPaint_setColorFilter'>setColorFilter</a>(<a href='undocumented#sk_sp'>sk_sp</a><<a href='undocumented#SkColorFilter'>SkColorFilter</a>> colorFilter) 2787</pre> 2788 2789Sets <a href='undocumented#SkColorFilter'>SkColorFilter</a> to filter, decreasing <a href='undocumented#SkRefCnt'>SkRefCnt</a> of the previous 2790<a href='undocumented#SkColorFilter'>SkColorFilter</a>. Pass nullptr to clear <a href='undocumented#SkColorFilter'>SkColorFilter</a>. 2791 2792Increments filter <a href='undocumented#SkRefCnt'>SkRefCnt</a> by one. 2793 2794### Parameters 2795 2796<table> <tr> <td><a name='SkPaint_setColorFilter_colorFilter'><code><strong>colorFilter</strong></code></a></td> 2797 <td><a href='undocumented#SkColorFilter'>SkColorFilter</a> to apply to subsequent draw</td> 2798 </tr> 2799</table> 2800 2801### Example 2802 2803<div><fiddle-embed name="c7b786dc9b3501cd0eaba47494b6fa31"></fiddle-embed></div> 2804 2805<a name='Blend_Mode_Methods'></a> 2806 2807--- 2808 2809<a href='#Blend_Mode'>Blend_Mode</a> describes how <a href='SkColor_Reference#Color'>Color</a> combines with the destination <a href='SkColor_Reference#Color'>color</a>. 2810The default setting, <a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a>::<a href='#SkBlendMode_kSrcOver'>kSrcOver</a>, draws the source <a href='SkColor_Reference#Color'>color</a> 2811over the destination <a href='SkColor_Reference#Color'>color</a>. 2812 2813### Example 2814 2815<div><fiddle-embed name="73092d4d06faecea3c204d852a4dd8a8"></fiddle-embed></div> 2816 2817### See Also 2818 2819<a href='#Blend_Mode'>Blend_Mode</a> 2820 2821<a name='SkPaint_getBlendMode'></a> 2822 2823--- 2824 2825<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 2826<a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a> <a href='#SkPaint_getBlendMode'>getBlendMode</a>()const 2827</pre> 2828 2829Returns <a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a>. 2830By default, returns <a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a>::<a href='#SkBlendMode_kSrcOver'>kSrcOver</a>. 2831 2832### Return Value 2833 2834mode used to combine source <a href='SkColor_Reference#Color'>color</a> with destination <a href='SkColor_Reference#Color'>color</a> 2835 2836### Example 2837 2838<div><fiddle-embed name="a1e059c8f6740fa2044cc64152b39dda"> 2839 2840#### Example Output 2841 2842~~~~ 2843kSrcOver == getBlendMode 2844kSrcOver != getBlendMode 2845~~~~ 2846 2847</fiddle-embed></div> 2848 2849<a name='SkPaint_isSrcOver'></a> 2850 2851--- 2852 2853<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 2854bool <a href='#SkPaint_isSrcOver'>isSrcOver</a>()const 2855</pre> 2856 2857Returns true if <a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a> is <a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a>::<a href='#SkBlendMode_kSrcOver'>kSrcOver</a>, the default. 2858 2859### Return Value 2860 2861true if <a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a> is <a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a>::<a href='#SkBlendMode_kSrcOver'>kSrcOver</a> 2862 2863### Example 2864 2865<div><fiddle-embed name="257c9473db7a2b3a0fb2b9e2431e59a6"> 2866 2867#### Example Output 2868 2869~~~~ 2870isSrcOver == true 2871isSrcOver != true 2872~~~~ 2873 2874</fiddle-embed></div> 2875 2876<a name='SkPaint_setBlendMode'></a> 2877 2878--- 2879 2880<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 2881void <a href='#SkPaint_setBlendMode'>setBlendMode</a>(<a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a> mode) 2882</pre> 2883 2884Sets <a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a> to <a href='#SkPaint_setBlendMode_mode'>mode</a>. 2885Does not check for valid input. 2886 2887### Parameters 2888 2889<table> <tr> <td><a name='SkPaint_setBlendMode_mode'><code><strong>mode</strong></code></a></td> 2890 <td><a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a> used to combine source <a href='SkColor_Reference#Color'>color</a> and destination</td> 2891 </tr> 2892</table> 2893 2894### Example 2895 2896<div><fiddle-embed name="257c9473db7a2b3a0fb2b9e2431e59a6"> 2897 2898#### Example Output 2899 2900~~~~ 2901isSrcOver == true 2902isSrcOver != true 2903~~~~ 2904 2905</fiddle-embed></div> 2906 2907<a name='Path_Effect_Methods'></a> 2908 2909--- 2910 2911<a href='#Path_Effect'>Path_Effect</a> modifies the <a href='SkPath_Reference#Path'>path</a> geometry before drawing it. 2912<a href='#Path_Effect'>Path_Effect</a> may implement dashing, custom fill effects and custom stroke effects. 2913If <a href='SkPaint_Reference#Paint'>Paint</a> has no <a href='#Path_Effect'>Path_Effect</a>, the <a href='SkPath_Reference#Path'>path</a> geometry is unaltered when filled or stroked. 2914 2915### Example 2916 2917<div><fiddle-embed name="8cf5684b187d60f09e11c4a48993ea39"></fiddle-embed></div> 2918 2919### See Also 2920 2921<a href='#Path_Effect'>Path_Effect</a> 2922 2923<a name='SkPaint_getPathEffect'></a> 2924 2925--- 2926 2927<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 2928<a href='undocumented#SkPathEffect'>SkPathEffect</a>* <a href='#SkPaint_getPathEffect'>getPathEffect</a>()const 2929</pre> 2930 2931Returns <a href='undocumented#SkPathEffect'>SkPathEffect</a> if set, or nullptr. 2932Does not alter <a href='undocumented#SkPathEffect'>SkPathEffect</a> <a href='undocumented#SkRefCnt'>SkRefCnt</a>. 2933 2934### Return Value 2935 2936<a href='undocumented#SkPathEffect'>SkPathEffect</a> if previously set, nullptr otherwise 2937 2938### Example 2939 2940<div><fiddle-embed name="211a1b14bfa6c4332082c8eab4fbc5fd"> 2941 2942#### Example Output 2943 2944~~~~ 2945nullptr == path effect 2946nullptr != path effect 2947~~~~ 2948 2949</fiddle-embed></div> 2950 2951<a name='SkPaint_refPathEffect'></a> 2952 2953--- 2954 2955<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 2956<a href='undocumented#sk_sp'>sk_sp</a><<a href='undocumented#SkPathEffect'>SkPathEffect</a>> <a href='#SkPaint_refPathEffect'>refPathEffect</a>()const 2957</pre> 2958 2959Returns <a href='undocumented#SkPathEffect'>SkPathEffect</a> if set, or nullptr. 2960Increases <a href='undocumented#SkPathEffect'>SkPathEffect</a> <a href='undocumented#SkRefCnt'>SkRefCnt</a> by one. 2961 2962### Return Value 2963 2964<a href='undocumented#SkPathEffect'>SkPathEffect</a> if previously set, nullptr otherwise 2965 2966### Example 2967 2968<div><fiddle-embed name="f56039b94c702c2704c8c5100e623aca"> 2969 2970#### Example Output 2971 2972~~~~ 2973path effect unique: true 2974path effect unique: false 2975~~~~ 2976 2977</fiddle-embed></div> 2978 2979<a name='SkPaint_setPathEffect'></a> 2980 2981--- 2982 2983<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 2984void <a href='#SkPaint_setPathEffect'>setPathEffect</a>(<a href='undocumented#sk_sp'>sk_sp</a><<a href='undocumented#SkPathEffect'>SkPathEffect</a>> pathEffect) 2985</pre> 2986 2987Sets <a href='undocumented#SkPathEffect'>SkPathEffect</a> to <a href='#SkPaint_setPathEffect_pathEffect'>pathEffect</a>, decreasing <a href='undocumented#SkRefCnt'>SkRefCnt</a> of the previous 2988<a href='undocumented#SkPathEffect'>SkPathEffect</a>. Pass nullptr to leave the <a href='SkPath_Reference#Path'>path</a> geometry unaltered. 2989 2990Increments <a href='#SkPaint_setPathEffect_pathEffect'>pathEffect</a> <a href='undocumented#SkRefCnt'>SkRefCnt</a> by one. 2991 2992### Parameters 2993 2994<table> <tr> <td><a name='SkPaint_setPathEffect_pathEffect'><code><strong>pathEffect</strong></code></a></td> 2995 <td>replace <a href='SkPath_Reference#SkPath'>SkPath</a> with a modification when drawn</td> 2996 </tr> 2997</table> 2998 2999### Example 3000 3001<div><fiddle-embed name="52dd55074ca0b7d520d04e750ca2a0d7"></fiddle-embed></div> 3002 3003<a name='Mask_Filter_Methods'></a> 3004 3005--- 3006 3007<a href='#Mask_Filter'>Mask_Filter</a> uses coverage of the shape drawn to create <a href='#Mask_Alpha'>Mask_Alpha</a>. 3008<a href='#Mask_Filter'>Mask_Filter</a> takes a Mask, and returns a Mask. 3009 3010<a href='#Mask_Filter'>Mask_Filter</a> may change the geometry and transparency of the shape, such as 3011creating a blur effect. Set <a href='#Mask_Filter'>Mask_Filter</a> to nullptr to prevent <a href='#Mask_Filter'>Mask_Filter</a> from 3012modifying the draw. 3013 3014### Example 3015 3016<div><fiddle-embed name="55d7b9d482ac8e17a6153f555a8adb8d"></fiddle-embed></div> 3017 3018<a name='SkPaint_getMaskFilter'></a> 3019 3020--- 3021 3022<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 3023<a href='undocumented#SkMaskFilter'>SkMaskFilter</a>* <a href='#SkPaint_getMaskFilter'>getMaskFilter</a>()const 3024</pre> 3025 3026Returns <a href='undocumented#SkMaskFilter'>SkMaskFilter</a> if set, or nullptr. 3027Does not alter <a href='undocumented#SkMaskFilter'>SkMaskFilter</a> <a href='undocumented#SkRefCnt'>SkRefCnt</a>. 3028 3029### Return Value 3030 3031<a href='undocumented#SkMaskFilter'>SkMaskFilter</a> if previously set, nullptr otherwise 3032 3033### Example 3034 3035<div><fiddle-embed name="5ac4b31371726da87bb7390b385e9fee"> 3036 3037#### Example Output 3038 3039~~~~ 3040nullptr == mask filter 3041nullptr != mask filter 3042~~~~ 3043 3044</fiddle-embed></div> 3045 3046<a name='SkPaint_refMaskFilter'></a> 3047 3048--- 3049 3050<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 3051<a href='undocumented#sk_sp'>sk_sp</a><<a href='undocumented#SkMaskFilter'>SkMaskFilter</a>> <a href='#SkPaint_refMaskFilter'>refMaskFilter</a>()const 3052</pre> 3053 3054Returns <a href='undocumented#SkMaskFilter'>SkMaskFilter</a> if set, or nullptr. 3055 3056Increases <a href='undocumented#SkMaskFilter'>SkMaskFilter</a> <a href='undocumented#SkRefCnt'>SkRefCnt</a> by one. 3057 3058### Return Value 3059 3060<a href='undocumented#SkMaskFilter'>SkMaskFilter</a> if previously set, nullptr otherwise 3061 3062### Example 3063 3064<div><fiddle-embed name="084b0dc3cebd78718c651d58f257f799"> 3065 3066#### Example Output 3067 3068~~~~ 3069mask filter unique: true 3070mask filter unique: false 3071~~~~ 3072 3073</fiddle-embed></div> 3074 3075<a name='SkPaint_setMaskFilter'></a> 3076 3077--- 3078 3079<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 3080void <a href='#SkPaint_setMaskFilter'>setMaskFilter</a>(<a href='undocumented#sk_sp'>sk_sp</a><<a href='undocumented#SkMaskFilter'>SkMaskFilter</a>> maskFilter) 3081</pre> 3082 3083Sets <a href='undocumented#SkMaskFilter'>SkMaskFilter</a> to <a href='#SkPaint_setMaskFilter_maskFilter'>maskFilter</a>, decreasing <a href='undocumented#SkRefCnt'>SkRefCnt</a> of the previous 3084<a href='undocumented#SkMaskFilter'>SkMaskFilter</a>. Pass nullptr to clear <a href='undocumented#SkMaskFilter'>SkMaskFilter</a> and leave <a href='undocumented#SkMaskFilter'>SkMaskFilter</a> effect on 3085<a href='undocumented#Mask_Alpha'>mask alpha</a> unaltered. 3086 3087Increments <a href='#SkPaint_setMaskFilter_maskFilter'>maskFilter</a> <a href='undocumented#SkRefCnt'>SkRefCnt</a> by one. 3088 3089### Parameters 3090 3091<table> <tr> <td><a name='SkPaint_setMaskFilter_maskFilter'><code><strong>maskFilter</strong></code></a></td> 3092 <td>modifies clipping mask generated from drawn geometry</td> 3093 </tr> 3094</table> 3095 3096### Example 3097 3098<div><fiddle-embed name="a993831c40f3e134f809134e3b74e4a6"></fiddle-embed></div> 3099 3100<a name='Typeface_Methods'></a> 3101 3102--- 3103 3104<a href='undocumented#Typeface'>Typeface</a> identifies the <a href='SkFont_Reference#Font'>font</a> used when drawing and measuring <a href='undocumented#Text'>text</a>. 3105<a href='undocumented#Typeface'>Typeface</a> may be specified by name, from a file, or from a <a href='undocumented#Data'>data</a> <a href='SkStream_Reference#Stream'>stream</a>. 3106The default <a href='undocumented#Typeface'>Typeface</a> defers to the platform-specific default <a href='SkFont_Reference#Font'>font</a> 3107implementation. 3108 3109### Example 3110 3111<div><fiddle-embed name="1a7a5062725139760962582f599f1b97"></fiddle-embed></div> 3112 3113<a name='SkPaint_getTypeface'></a> 3114 3115--- 3116 3117<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 3118<a href='undocumented#SkTypeface'>SkTypeface</a>* <a href='#SkPaint_getTypeface'>getTypeface</a>()const 3119</pre> 3120 3121Returns <a href='undocumented#SkTypeface'>SkTypeface</a> if set, or nullptr. 3122Does not alter <a href='undocumented#SkTypeface'>SkTypeface</a> <a href='undocumented#SkRefCnt'>SkRefCnt</a>. 3123 3124### Return Value 3125 3126<a href='undocumented#SkTypeface'>SkTypeface</a> if previously set, nullptr otherwise 3127 3128### Example 3129 3130<div><fiddle-embed name="5ce718e5a184baaac80e7098d7dad67b"> 3131 3132#### Example Output 3133 3134~~~~ 3135nullptr == typeface 3136nullptr != typeface 3137~~~~ 3138 3139</fiddle-embed></div> 3140 3141<a name='SkPaint_refTypeface'></a> 3142 3143--- 3144 3145<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 3146<a href='undocumented#sk_sp'>sk_sp</a><<a href='undocumented#SkTypeface'>SkTypeface</a>> <a href='#SkPaint_refTypeface'>refTypeface</a>()const 3147</pre> 3148 3149Increases <a href='undocumented#SkTypeface'>SkTypeface</a> <a href='undocumented#SkRefCnt'>SkRefCnt</a> by one. 3150 3151### Return Value 3152 3153<a href='undocumented#SkTypeface'>SkTypeface</a> if previously set, nullptr otherwise 3154 3155### Example 3156 3157<div><fiddle-embed name="8b5aa7e555a0dc31be69db7cadf471a1"> 3158 3159#### Example Output 3160 3161~~~~ 3162typeface1 != typeface2 3163typeface1 == typeface2 3164~~~~ 3165 3166</fiddle-embed></div> 3167 3168<a name='SkPaint_setTypeface'></a> 3169 3170--- 3171 3172<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 3173void <a href='#SkPaint_setTypeface'>setTypeface</a>(<a href='undocumented#sk_sp'>sk_sp</a><<a href='undocumented#SkTypeface'>SkTypeface</a>> <a href='undocumented#Typeface'>typeface</a>) 3174</pre> 3175 3176Sets <a href='undocumented#SkTypeface'>SkTypeface</a> to <a href='#SkPaint_setTypeface_typeface'>typeface</a>, decreasing <a href='undocumented#SkRefCnt'>SkRefCnt</a> of the previous <a href='undocumented#SkTypeface'>SkTypeface</a>. 3177Pass nullptr to clear <a href='undocumented#SkTypeface'>SkTypeface</a> and use the default <a href='#SkPaint_setTypeface_typeface'>typeface</a>. Increments 3178<a href='#SkPaint_setTypeface_typeface'>typeface</a> <a href='undocumented#SkRefCnt'>SkRefCnt</a> by one. 3179 3180### Parameters 3181 3182<table> <tr> <td><a name='SkPaint_setTypeface_typeface'><code><strong>typeface</strong></code></a></td> 3183 <td><a href='SkFont_Reference#Font'>font</a> and style used to draw <a href='undocumented#Text'>text</a></td> 3184 </tr> 3185</table> 3186 3187### Example 3188 3189<div><fiddle-embed name="0e6fbb7773cd925b274552f4cd1abef2"></fiddle-embed></div> 3190 3191<a name='Image_Filter_Methods'></a> 3192 3193--- 3194 3195<a href='#Image_Filter'>Image_Filter</a> operates on the <a href='undocumented#Pixel'>pixel</a> representation of the shape, as modified by <a href='SkPaint_Reference#Paint'>Paint</a> 3196with <a href='#Blend_Mode'>Blend_Mode</a> set to <a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a>::<a href='#SkBlendMode_kSrcOver'>kSrcOver</a>. <a href='#Image_Filter'>Image_Filter</a> creates a new <a href='SkBitmap_Reference#Bitmap'>bitmap</a>, 3197which is drawn to the <a href='undocumented#Device'>device</a> using the set <a href='#Blend_Mode'>Blend_Mode</a>. 3198 3199<a href='#Image_Filter'>Image_Filter</a> is higher level than <a href='#Mask_Filter'>Mask_Filter</a>; for instance, an <a href='#Image_Filter'>Image_Filter</a> 3200can operate on all channels of <a href='SkColor_Reference#Color'>Color</a>, while <a href='#Mask_Filter'>Mask_Filter</a> generates <a href='SkColor_Reference#Alpha'>Alpha</a> only. 3201<a href='#Image_Filter'>Image_Filter</a> operates independently of and can be used in combination with 3202<a href='#Mask_Filter'>Mask_Filter</a>. 3203 3204### Example 3205 3206<div><fiddle-embed name="ece04ee3d3761e3425f37c8f06f054c1"></fiddle-embed></div> 3207 3208<a name='SkPaint_getImageFilter'></a> 3209 3210--- 3211 3212<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 3213<a href='undocumented#SkImageFilter'>SkImageFilter</a>* <a href='#SkPaint_getImageFilter'>getImageFilter</a>()const 3214</pre> 3215 3216Returns <a href='undocumented#SkImageFilter'>SkImageFilter</a> if set, or nullptr. 3217Does not alter <a href='undocumented#SkImageFilter'>SkImageFilter</a> <a href='undocumented#SkRefCnt'>SkRefCnt</a>. 3218 3219### Return Value 3220 3221<a href='undocumented#SkImageFilter'>SkImageFilter</a> if previously set, nullptr otherwise 3222 3223### Example 3224 3225<div><fiddle-embed name="c11f8eaa1dd149bc18db21e23ce26904"> 3226 3227#### Example Output 3228 3229~~~~ 3230nullptr == image filter 3231nullptr != image filter 3232~~~~ 3233 3234</fiddle-embed></div> 3235 3236<a name='SkPaint_refImageFilter'></a> 3237 3238--- 3239 3240<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 3241<a href='undocumented#sk_sp'>sk_sp</a><<a href='undocumented#SkImageFilter'>SkImageFilter</a>> <a href='#SkPaint_refImageFilter'>refImageFilter</a>()const 3242</pre> 3243 3244Returns <a href='undocumented#SkImageFilter'>SkImageFilter</a> if set, or nullptr. 3245Increases <a href='undocumented#SkImageFilter'>SkImageFilter</a> <a href='undocumented#SkRefCnt'>SkRefCnt</a> by one. 3246 3247### Return Value 3248 3249<a href='undocumented#SkImageFilter'>SkImageFilter</a> if previously set, nullptr otherwise 3250 3251### Example 3252 3253<div><fiddle-embed name="13f09088b569251547107d14ae989dc1"> 3254 3255#### Example Output 3256 3257~~~~ 3258image filter unique: true 3259image filter unique: false 3260~~~~ 3261 3262</fiddle-embed></div> 3263 3264<a name='SkPaint_setImageFilter'></a> 3265 3266--- 3267 3268<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 3269void <a href='#SkPaint_setImageFilter'>setImageFilter</a>(<a href='undocumented#sk_sp'>sk_sp</a><<a href='undocumented#SkImageFilter'>SkImageFilter</a>> imageFilter) 3270</pre> 3271 3272Sets <a href='undocumented#SkImageFilter'>SkImageFilter</a> to <a href='#SkPaint_setImageFilter_imageFilter'>imageFilter</a>, decreasing <a href='undocumented#SkRefCnt'>SkRefCnt</a> of the previous 3273<a href='undocumented#SkImageFilter'>SkImageFilter</a>. Pass nullptr to clear <a href='undocumented#SkImageFilter'>SkImageFilter</a>, and remove <a href='undocumented#SkImageFilter'>SkImageFilter</a> effect 3274on drawing. 3275 3276Increments <a href='#SkPaint_setImageFilter_imageFilter'>imageFilter</a> <a href='undocumented#SkRefCnt'>SkRefCnt</a> by one. 3277 3278### Parameters 3279 3280<table> <tr> <td><a name='SkPaint_setImageFilter_imageFilter'><code><strong>imageFilter</strong></code></a></td> 3281 <td>how <a href='SkImage_Reference#SkImage'>SkImage</a> is sampled when transformed</td> 3282 </tr> 3283</table> 3284 3285### Example 3286 3287<div><fiddle-embed name="6679d6e4ec632715ee03e68391bd7f9a"></fiddle-embed></div> 3288 3289<a name='Draw_Looper_Methods'></a> 3290 3291--- 3292 3293<a href='#Draw_Looper'>Draw_Looper</a> sets a modifier that communicates state from one <a href='#Draw_Layer'>Draw_Layer</a> 3294to another to construct the draw. 3295 3296<a href='#Draw_Looper'>Draw_Looper</a> draws one or more times, modifying the <a href='SkCanvas_Reference#Canvas'>canvas</a> and <a href='SkPaint_Reference#Paint'>paint</a> each time. 3297<a href='#Draw_Looper'>Draw_Looper</a> may be used to draw multiple colors or create a colored shadow. 3298Set <a href='#Draw_Looper'>Draw_Looper</a> to nullptr to prevent <a href='#Draw_Looper'>Draw_Looper</a> from modifying the draw. 3299 3300### Example 3301 3302<div><fiddle-embed name="84ec12a36e50df5ac565cc7a75ffbe9f"></fiddle-embed></div> 3303 3304<a name='SkPaint_getDrawLooper'></a> 3305 3306--- 3307 3308<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 3309<a href='undocumented#SkDrawLooper'>SkDrawLooper</a>* <a href='#SkPaint_getDrawLooper'>getDrawLooper</a>()const 3310</pre> 3311 3312Returns <a href='undocumented#SkDrawLooper'>SkDrawLooper</a> if set, or nullptr. 3313Does not alter <a href='undocumented#SkDrawLooper'>SkDrawLooper</a> <a href='undocumented#SkRefCnt'>SkRefCnt</a>. 3314 3315### Return Value 3316 3317<a href='undocumented#SkDrawLooper'>SkDrawLooper</a> if previously set, nullptr otherwise 3318 3319### Example 3320 3321<div><fiddle-embed name="af4c5acc7a91e7f23c2af48018903ad4"> 3322 3323#### Example Output 3324 3325~~~~ 3326nullptr == draw looper 3327nullptr != draw looper 3328~~~~ 3329 3330</fiddle-embed></div> 3331 3332<a name='SkPaint_refDrawLooper'></a> 3333 3334--- 3335 3336<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 3337<a href='undocumented#sk_sp'>sk_sp</a><<a href='undocumented#SkDrawLooper'>SkDrawLooper</a>> <a href='#SkPaint_refDrawLooper'>refDrawLooper</a>()const 3338</pre> 3339 3340Returns <a href='undocumented#SkDrawLooper'>SkDrawLooper</a> if set, or nullptr. 3341Increases <a href='undocumented#SkDrawLooper'>SkDrawLooper</a> <a href='undocumented#SkRefCnt'>SkRefCnt</a> by one. 3342 3343### Return Value 3344 3345<a href='undocumented#SkDrawLooper'>SkDrawLooper</a> if previously set, nullptr otherwise 3346 3347### Example 3348 3349<div><fiddle-embed name="2a3782c33f04ed17a725d0e449c6f7c3"> 3350 3351#### Example Output 3352 3353~~~~ 3354draw looper unique: true 3355draw looper unique: false 3356~~~~ 3357 3358</fiddle-embed></div> 3359 3360<a name='SkPaint_setDrawLooper'></a> 3361 3362--- 3363 3364<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 3365void <a href='#SkPaint_setDrawLooper'>setDrawLooper</a>(<a href='undocumented#sk_sp'>sk_sp</a><<a href='undocumented#SkDrawLooper'>SkDrawLooper</a>> drawLooper) 3366</pre> 3367 3368Sets <a href='undocumented#SkDrawLooper'>SkDrawLooper</a> to <a href='#SkPaint_setDrawLooper_drawLooper'>drawLooper</a>, decreasing <a href='undocumented#SkRefCnt'>SkRefCnt</a> of the previous 3369<a href='#SkPaint_setDrawLooper_drawLooper'>drawLooper</a>. Pass nullptr to clear <a href='undocumented#SkDrawLooper'>SkDrawLooper</a> and leave <a href='undocumented#SkDrawLooper'>SkDrawLooper</a> effect on 3370drawing unaltered. 3371 3372Increments <a href='#SkPaint_setDrawLooper_drawLooper'>drawLooper</a> <a href='undocumented#SkRefCnt'>SkRefCnt</a> by one. 3373 3374### Parameters 3375 3376<table> <tr> <td><a name='SkPaint_setDrawLooper_drawLooper'><code><strong>drawLooper</strong></code></a></td> 3377 <td>iterates through drawing one or more time, altering <a href='SkPaint_Reference#SkPaint'>SkPaint</a></td> 3378 </tr> 3379</table> 3380 3381### Example 3382 3383<div><fiddle-embed name="bf10f838b330f0a3a3266d42ea68a638"></fiddle-embed></div> 3384 3385<a name='Text_Size'></a> 3386 3387--- 3388 3389<a href='#Paint_Text_Size'>Text_Size</a> adjusts the overall <a href='#Text_Size'>text size</a> in <a href='SkPoint_Reference#Point'>points</a>. 3390<a href='#Paint_Text_Size'>Text_Size</a> can be set to any positive value or zero. 3391<a href='#Paint_Text_Size'>Text_Size</a> defaults to 12. 3392Set <a href='undocumented#SkPaintDefaults_TextSize'>SkPaintDefaults_TextSize</a> at compile time to change the default setting. 3393 3394### Example 3395 3396<div><fiddle-embed name="91c9a3e498bb9412e4522a95d076ed5f"></fiddle-embed></div> 3397 3398<a name='SkPaint_getTextSize'></a> 3399 3400--- 3401 3402<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 3403<a href='undocumented#SkScalar'>SkScalar</a> <a href='#SkPaint_getTextSize'>getTextSize</a>()const 3404</pre> 3405 3406Returns <a href='undocumented#Text'>text</a> <a href='undocumented#Size'>size</a> in <a href='SkPoint_Reference#Point'>points</a>. 3407 3408### Return Value 3409 3410typographic height of <a href='undocumented#Text'>text</a> 3411 3412### Example 3413 3414<div><fiddle-embed name="983e2a71ba72d4ba8c945420040b8f1c"></fiddle-embed></div> 3415 3416<a name='SkPaint_setTextSize'></a> 3417 3418--- 3419 3420<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 3421void <a href='#SkPaint_setTextSize'>setTextSize</a>(<a href='undocumented#SkScalar'>SkScalar</a> textSize) 3422</pre> 3423 3424Sets <a href='#Text_Size'>text size</a> in <a href='SkPoint_Reference#Point'>points</a>. 3425Has no effect if <a href='#SkPaint_setTextSize_textSize'>textSize</a> is not greater than or equal to zero. 3426 3427### Parameters 3428 3429<table> <tr> <td><a name='SkPaint_setTextSize_textSize'><code><strong>textSize</strong></code></a></td> 3430 <td>typographic height of <a href='undocumented#Text'>text</a></td> 3431 </tr> 3432</table> 3433 3434### Example 3435 3436<div><fiddle-embed name="6510c9e2f57b83c47e67829e7a68d493"></fiddle-embed></div> 3437 3438<a name='Text_Scale_X'></a> 3439 3440--- 3441 3442<a href='#Paint_Text_Scale_X'>Text_Scale_X</a> adjusts the <a href='undocumented#Text'>text</a> horizontal scale. 3443<a href='undocumented#Text'>Text</a> scaling approximates condensed and expanded type faces when the actual face 3444is not available. 3445<a href='#Paint_Text_Scale_X'>Text_Scale_X</a> can be set to any value. 3446<a href='#Paint_Text_Scale_X'>Text_Scale_X</a> defaults to 1. 3447 3448### Example 3449 3450<div><fiddle-embed name="d13d787c1e36f515319fc998411c1d91"></fiddle-embed></div> 3451 3452<a name='SkPaint_getTextScaleX'></a> 3453 3454--- 3455 3456<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 3457<a href='undocumented#SkScalar'>SkScalar</a> <a href='#SkPaint_getTextScaleX'>getTextScaleX</a>()const 3458</pre> 3459 3460Returns <a href='undocumented#Text'>text</a> scale on x-axis. 3461Default value is 1. 3462 3463### Return Value 3464 3465<a href='undocumented#Text'>text</a> horizontal scale 3466 3467### Example 3468 3469<div><fiddle-embed name="5dc8e58f6910cb8e4de9ed60f888188b"></fiddle-embed></div> 3470 3471<a name='SkPaint_setTextScaleX'></a> 3472 3473--- 3474 3475<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 3476void <a href='#SkPaint_setTextScaleX'>setTextScaleX</a>(<a href='undocumented#SkScalar'>SkScalar</a> scaleX) 3477</pre> 3478 3479Sets <a href='undocumented#Text'>text scale</a> on x-axis. 3480Default value is 1. 3481 3482### Parameters 3483 3484<table> <tr> <td><a name='SkPaint_setTextScaleX_scaleX'><code><strong>scaleX</strong></code></a></td> 3485 <td><a href='undocumented#Text'>text</a> horizontal scale</td> 3486 </tr> 3487</table> 3488 3489### Example 3490 3491<div><fiddle-embed name="a75bbdb8bb866b125c4c1dd5e967d470"></fiddle-embed></div> 3492 3493<a name='Text_Skew_X'></a> 3494 3495--- 3496 3497<a href='#Paint_Text_Skew_X'>Text_Skew_X</a> adjusts the <a href='undocumented#Text'>text</a> horizontal slant. 3498<a href='undocumented#Text'>Text</a> skewing approximates italic and oblique type faces when the actual face 3499is not available. 3500<a href='#Paint_Text_Skew_X'>Text_Skew_X</a> can be set to any value. 3501<a href='#Paint_Text_Skew_X'>Text_Skew_X</a> defaults to 0. 3502 3503### Example 3504 3505<div><fiddle-embed name="aff208b0aab265f273045b27e683c17c"></fiddle-embed></div> 3506 3507<a name='SkPaint_getTextSkewX'></a> 3508 3509--- 3510 3511<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 3512<a href='undocumented#SkScalar'>SkScalar</a> <a href='#SkPaint_getTextSkewX'>getTextSkewX</a>()const 3513</pre> 3514 3515Returns <a href='undocumented#Text'>text</a> skew on x-axis. 3516Default value is zero. 3517 3518### Return Value 3519 3520additional shear on x-axis relative to y-axis 3521 3522### Example 3523 3524<div><fiddle-embed name="11c10f466dae0d1639dbb9f6a0040218"></fiddle-embed></div> 3525 3526<a name='SkPaint_setTextSkewX'></a> 3527 3528--- 3529 3530<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 3531void <a href='#SkPaint_setTextSkewX'>setTextSkewX</a>(<a href='undocumented#SkScalar'>SkScalar</a> skewX) 3532</pre> 3533 3534Sets <a href='undocumented#Text'>text skew</a> on x-axis. 3535Default value is zero. 3536 3537### Parameters 3538 3539<table> <tr> <td><a name='SkPaint_setTextSkewX_skewX'><code><strong>skewX</strong></code></a></td> 3540 <td>additional shear on x-axis relative to y-axis</td> 3541 </tr> 3542</table> 3543 3544### Example 3545 3546<div><fiddle-embed name="6bd705a6e0c5f8ee24f302fe531bfabc"></fiddle-embed></div> 3547 3548<a name='Text_Encoding'></a> 3549 3550--- 3551 3552### Example 3553 3554<div><fiddle-embed name="767fa4e7b6300e16a419f9881f0f9d3d"><div>First <a href='undocumented#Line'>line</a> is encoded in UTF-8. 3555Second <a href='undocumented#Line'>line</a> is encoded in UTF-16. 3556Third <a href='undocumented#Line'>line</a> is encoded in UTF-32. 3557Fourth <a href='undocumented#Line'>line</a> has 16-bit <a href='undocumented#Glyph'>glyph</a> indices. 3558</div></fiddle-embed></div> 3559 3560<a name='SkPaint_getTextEncoding'></a> 3561 3562--- 3563 3564<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 3565<a href='undocumented#SkTextEncoding'>SkTextEncoding</a> <a href='#SkPaint_getTextEncoding'>getTextEncoding</a>()const 3566</pre> 3567 3568Returns the <a href='undocumented#Text'>text</a> encoding. <a href='undocumented#Text'>Text</a> encoding describes how to interpret the <a href='undocumented#Text'>text</a> bytes pass 3569to methods like <a href='#SkPaint_measureText'>measureText</a>() and <a href='SkCanvas_Reference#SkCanvas'>SkCanvas</a>::<a href='#SkCanvas_drawText'>drawText</a>(). 3570 3571### Return Value 3572 3573the <a href='undocumented#Text'>text</a> encoding 3574 3575### Example 3576 3577<div><fiddle-embed name="0d21e968e9a4c78c902ae3ef494941a0"> 3578 3579#### Example Output 3580 3581~~~~ 3582kUTF8_SkTextEncoding == text encoding 3583kGlyphID_SkTextEncoding == text encoding 3584~~~~ 3585 3586</fiddle-embed></div> 3587 3588<a name='SkPaint_setTextEncoding'></a> 3589 3590--- 3591 3592<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 3593void <a href='#SkPaint_setTextEncoding'>setTextEncoding</a>(<a href='undocumented#SkTextEncoding'>SkTextEncoding</a> encoding) 3594</pre> 3595 3596Sets the <a href='#Text_Encoding'>text encoding</a>. <a href='undocumented#Text'>Text</a> <a href='#SkPaint_setTextEncoding_encoding'>encoding</a> describes how to interpret the <a href='undocumented#Text'>text</a> bytes pass 3597to methods like <a href='#SkPaint_measureText'>measureText</a>() and <a href='SkCanvas_Reference#SkCanvas'>SkCanvas</a>::<a href='#SkCanvas_drawText'>drawText</a>(). 3598 3599### Parameters 3600 3601<table> <tr> <td><a name='SkPaint_setTextEncoding_encoding'><code><strong>encoding</strong></code></a></td> 3602 <td>the new <a href='#Text_Encoding'>text encoding</a></td> 3603 </tr> 3604</table> 3605 3606### Example 3607 3608<div><fiddle-embed name="a5d1ba0dbf42afb797ffdb07647b5cb9"> 3609 3610#### Example Output 3611 3612~~~~ 36134 != text encoding 3614~~~~ 3615 3616</fiddle-embed></div> 3617 3618<a name='SkPaint_FontMetrics'></a> 3619 3620--- 3621 3622<a name='Font_Metrics'></a> 3623 3624<a name='SkPaint_getFontMetrics'></a> 3625 3626--- 3627 3628<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 3629<a href='undocumented#SkScalar'>SkScalar</a> <a href='#SkPaint_getFontMetrics'>getFontMetrics</a>(<a href='undocumented#SkFontMetrics'>SkFontMetrics</a>* metrics)const 3630</pre> 3631 3632Returns <a href='undocumented#SkFontMetrics'>SkFontMetrics</a> associated with <a href='undocumented#SkTypeface'>SkTypeface</a>. 3633The return value is the recommended spacing between <a href='undocumented#Line'>lines</a>: the sum of <a href='#SkPaint_getFontMetrics_metrics'>metrics</a> 3634descent, ascent, and leading. 3635If <a href='#SkPaint_getFontMetrics_metrics'>metrics</a> is not nullptr, <a href='undocumented#SkFontMetrics'>SkFontMetrics</a> is copied to <a href='#SkPaint_getFontMetrics_metrics'>metrics</a>. 3636Results are scaled by <a href='#Text_Size'>text size</a> but does not take into account 3637dimensions required by <a href='#Text_Scale_X'>text scale x</a>, <a href='#Text_Skew_X'>text skew x</a>, <a href='#Fake_Bold'>fake bold</a>, 3638<a href='#Style_Stroke'>style stroke</a>, and <a href='undocumented#SkPathEffect'>SkPathEffect</a>. 3639 3640### Parameters 3641 3642<table> <tr> <td><a name='SkPaint_getFontMetrics_metrics'><code><strong>metrics</strong></code></a></td> 3643 <td>storage for <a href='undocumented#SkFontMetrics'>SkFontMetrics</a>; may be nullptr</td> 3644 </tr> 3645</table> 3646 3647### Return Value 3648 3649recommended spacing between <a href='undocumented#Line'>lines</a> 3650 3651### Example 3652 3653<div><fiddle-embed name="59d9b8249afa1c2af6186711250ce240"></fiddle-embed></div> 3654 3655### See Also 3656 3657<a href='#Font_Size'>Font_Size</a> <a href='undocumented#Typeface'>Typeface</a> <a href='#Paint_Typeface_Methods'>Typeface_Methods</a> 3658 3659<a name='SkPaint_getFontSpacing'></a> 3660 3661--- 3662 3663<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 3664<a href='undocumented#SkScalar'>SkScalar</a> <a href='#SkPaint_getFontSpacing'>getFontSpacing</a>()const 3665</pre> 3666 3667Returns the recommended spacing between <a href='undocumented#Line'>lines</a>: the sum of metrics 3668descent, ascent, and leading. 3669Result is scaled by <a href='undocumented#Text'>text</a> <a href='undocumented#Size'>size</a> but does not take into account 3670dimensions required by stroking and <a href='undocumented#SkPathEffect'>SkPathEffect</a>. 3671Returns the same result as <a href='#SkPaint_getFontMetrics'>getFontMetrics</a>(). 3672 3673### Return Value 3674 3675recommended spacing between <a href='undocumented#Line'>lines</a> 3676 3677### Example 3678 3679<div><fiddle-embed name="424741e26e1b174e43087d67422ce14f"> 3680 3681#### Example Output 3682 3683~~~~ 3684textSize: 12 fontSpacing: 13.9688 3685textSize: 18 fontSpacing: 20.9531 3686textSize: 24 fontSpacing: 27.9375 3687textSize: 32 fontSpacing: 37.25 3688~~~~ 3689 3690</fiddle-embed></div> 3691 3692<a name='SkPaint_textToGlyphs'></a> 3693 3694--- 3695 3696<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 3697int <a href='#SkPaint_textToGlyphs'>textToGlyphs</a>(const void* <a href='undocumented#Text'>text</a>, size_t byteLength, <a href='undocumented#SkGlyphID'>SkGlyphID</a> <a href='undocumented#Glyph'>glyphs</a>[])const 3698</pre> 3699 3700Converts <a href='#SkPaint_textToGlyphs_text'>text</a> into <a href='undocumented#Glyph'>glyph</a> indices. 3701Returns the number of <a href='undocumented#Glyph'>glyph</a> indices represented by <a href='#SkPaint_textToGlyphs_text'>text</a>. 3702<a href='undocumented#SkTextEncoding'>SkTextEncoding</a> specifies how <a href='#SkPaint_textToGlyphs_text'>text</a> represents characters or <a href='#SkPaint_textToGlyphs_glyphs'>glyphs</a>. 3703<a href='#SkPaint_textToGlyphs_glyphs'>glyphs</a> may be nullptr, to compute the <a href='undocumented#Glyph'>glyph</a> count. 3704 3705Does not check <a href='#SkPaint_textToGlyphs_text'>text</a> for valid character codes or valid <a href='undocumented#Glyph'>glyph</a> indices. 3706 3707If <a href='#SkPaint_textToGlyphs_byteLength'>byteLength</a> equals zero, returns zero. 3708If <a href='#SkPaint_textToGlyphs_byteLength'>byteLength</a> includes a partial character, the partial character is ignored. 3709 3710If <a href='undocumented#SkTextEncoding'>SkTextEncoding</a> is <a href='undocumented#kUTF8_SkTextEncoding'>kUTF8_SkTextEncoding</a> and 3711<a href='#SkPaint_textToGlyphs_text'>text</a> contains an invalid UTF-8 sequence, zero is returned. 3712 3713### Parameters 3714 3715<table> <tr> <td><a name='SkPaint_textToGlyphs_text'><code><strong>text</strong></code></a></td> 3716 <td>character storage encoded with <a href='undocumented#SkTextEncoding'>SkTextEncoding</a></td> 3717 </tr> 3718 <tr> <td><a name='SkPaint_textToGlyphs_byteLength'><code><strong>byteLength</strong></code></a></td> 3719 <td>length of character storage in bytes</td> 3720 </tr> 3721 <tr> <td><a name='SkPaint_textToGlyphs_glyphs'><code><strong>glyphs</strong></code></a></td> 3722 <td>storage for <a href='undocumented#Glyph'>glyph</a> indices; may be nullptr</td> 3723 </tr> 3724</table> 3725 3726### Return Value 3727 3728number of <a href='#SkPaint_textToGlyphs_glyphs'>glyphs</a> represented by <a href='#SkPaint_textToGlyphs_text'>text</a> of length <a href='#SkPaint_textToGlyphs_byteLength'>byteLength</a> 3729 3730### Example 3731 3732<div><fiddle-embed name="d11136d8a74f63009da2a7f550710823"></fiddle-embed></div> 3733 3734<a name='SkPaint_countText'></a> 3735 3736--- 3737 3738<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 3739int <a href='#SkPaint_countText'>countText</a>(const void* <a href='undocumented#Text'>text</a>, size_t byteLength)const 3740</pre> 3741 3742Returns the number of <a href='undocumented#Glyph'>glyphs</a> in <a href='#SkPaint_countText_text'>text</a>. 3743Uses <a href='undocumented#SkTextEncoding'>SkTextEncoding</a> to count the <a href='undocumented#Glyph'>glyphs</a>. 3744Returns the same result as <a href='#SkPaint_textToGlyphs'>textToGlyphs</a>(). 3745 3746### Parameters 3747 3748<table> <tr> <td><a name='SkPaint_countText_text'><code><strong>text</strong></code></a></td> 3749 <td>character storage encoded with <a href='undocumented#SkTextEncoding'>SkTextEncoding</a></td> 3750 </tr> 3751 <tr> <td><a name='SkPaint_countText_byteLength'><code><strong>byteLength</strong></code></a></td> 3752 <td>length of character storage in bytes</td> 3753 </tr> 3754</table> 3755 3756### Return Value 3757 3758number of <a href='undocumented#Glyph'>glyphs</a> represented by <a href='#SkPaint_countText_text'>text</a> of length <a href='#SkPaint_countText_byteLength'>byteLength</a> 3759 3760### Example 3761 3762<div><fiddle-embed name="85436c71aab5410767fc688ab0573e09"> 3763 3764#### Example Output 3765 3766~~~~ 3767count = 5 3768~~~~ 3769 3770</fiddle-embed></div> 3771 3772<a name='SkPaint_containsText'></a> 3773 3774--- 3775 3776<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 3777bool <a href='#SkPaint_containsText'>containsText</a>(const void* <a href='undocumented#Text'>text</a>, size_t byteLength)const 3778</pre> 3779 3780Returns true if all <a href='#SkPaint_containsText_text'>text</a> corresponds to a non-zero <a href='undocumented#Glyph'>glyph</a> index. 3781Returns false if any characters in <a href='#SkPaint_containsText_text'>text</a> are not supported in 3782<a href='undocumented#SkTypeface'>SkTypeface</a>. 3783 3784If <a href='undocumented#SkTextEncoding'>SkTextEncoding</a> is <a href='undocumented#kGlyphID_SkTextEncoding'>kGlyphID_SkTextEncoding</a>, 3785returns true if all <a href='undocumented#Glyph'>glyph</a> indices in <a href='#SkPaint_containsText_text'>text</a> are non-zero; 3786does not check to see if <a href='#SkPaint_containsText_text'>text</a> contains valid <a href='undocumented#Glyph'>glyph</a> indices for <a href='undocumented#SkTypeface'>SkTypeface</a>. 3787 3788Returns true if <a href='#SkPaint_containsText_byteLength'>byteLength</a> is zero. 3789 3790### Parameters 3791 3792<table> <tr> <td><a name='SkPaint_containsText_text'><code><strong>text</strong></code></a></td> 3793 <td>array of characters or <a href='undocumented#Glyph'>glyphs</a></td> 3794 </tr> 3795 <tr> <td><a name='SkPaint_containsText_byteLength'><code><strong>byteLength</strong></code></a></td> 3796 <td>number of bytes in <a href='#SkPaint_containsText_text'>text</a> array</td> 3797 </tr> 3798</table> 3799 3800### Return Value 3801 3802true if all <a href='#SkPaint_containsText_text'>text</a> corresponds to a non-zero <a href='undocumented#Glyph'>glyph</a> index 3803 3804<div><a href='#SkPaint_containsText'>containsText</a> succeeds for degree symbol, but cannot find a <a href='undocumented#Glyph'>glyph</a> index 3805corresponding to the Unicode surrogate code <a href='SkPoint_Reference#Point'>point</a>. 3806</div> 3807 3808#### Example Output 3809 3810~~~~ 38110x00b0 == has char 38120xd800 != has char 3813~~~~ 3814 3815### Example 3816 3817<div><fiddle-embed name="6a68cb3c8b81a5976c81ee004f559247"><div><a href='#SkPaint_containsText'>containsText</a> returns true that <a href='undocumented#Glyph'>glyph</a> index is greater than zero, not 3818that it corresponds to an entry in <a href='undocumented#Typeface'>Typeface</a>. 3819</div> 3820 3821#### Example Output 3822 3823~~~~ 38240x01ff == has glyph 38250x0000 != has glyph 38260xffff == has glyph 3827~~~~ 3828 3829</fiddle-embed></div> 3830 3831### See Also 3832 3833<a href='#SkPaint_setTextEncoding'>setTextEncoding</a> <a href='undocumented#Typeface'>Typeface</a> 3834 3835<a name='SkPaint_glyphsToUnichars'></a> 3836 3837--- 3838 3839<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 3840void <a href='#SkPaint_glyphsToUnichars'>glyphsToUnichars</a>(const <a href='undocumented#SkGlyphID'>SkGlyphID</a> <a href='undocumented#Glyph'>glyphs</a>[], int count, <a href='undocumented#SkUnichar'>SkUnichar</a> <a href='undocumented#Text'>text</a>[])const 3841</pre> 3842 3843Converts <a href='#SkPaint_glyphsToUnichars_glyphs'>glyphs</a> into <a href='#SkPaint_glyphsToUnichars_text'>text</a> if possible. 3844<a href='undocumented#Glyph'>Glyph</a> values without direct Unicode equivalents are mapped to zero. 3845Uses the <a href='undocumented#SkTypeface'>SkTypeface</a>, but is unaffected 3846by <a href='undocumented#SkTextEncoding'>SkTextEncoding</a>; the <a href='#SkPaint_glyphsToUnichars_text'>text</a> values returned are equivalent to <a href='undocumented#kUTF32_SkTextEncoding'>kUTF32_SkTextEncoding</a>. 3847 3848Only supported on platforms that use FreeType as the <a href='SkFont_Reference#Font_Engine'>font engine</a>. 3849 3850### Parameters 3851 3852<table> <tr> <td><a name='SkPaint_glyphsToUnichars_glyphs'><code><strong>glyphs</strong></code></a></td> 3853 <td>array of indices into <a href='SkFont_Reference#Font'>font</a></td> 3854 </tr> 3855 <tr> <td><a name='SkPaint_glyphsToUnichars_count'><code><strong>count</strong></code></a></td> 3856 <td>length of <a href='undocumented#Glyph'>glyph</a> array</td> 3857 </tr> 3858 <tr> <td><a name='SkPaint_glyphsToUnichars_text'><code><strong>text</strong></code></a></td> 3859 <td>storage for character codes, one per <a href='undocumented#Glyph'>glyph</a></td> 3860 </tr> 3861</table> 3862 3863<div>Convert UTF-8 <a href='#SkPaint_glyphsToUnichars_text'>text</a> to <a href='#SkPaint_glyphsToUnichars_glyphs'>glyphs</a>; then convert <a href='#SkPaint_glyphsToUnichars_glyphs'>glyphs</a> to Unichar code <a href='SkPoint_Reference#Point'>points</a>. 3864</div> 3865 3866<a name='Measure_Text'></a> 3867 3868<a name='SkPaint_measureText'></a> 3869 3870--- 3871 3872<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 3873<a href='undocumented#SkScalar'>SkScalar</a> <a href='#SkPaint_measureText'>measureText</a>(const void* <a href='undocumented#Text'>text</a>, size_t length, <a href='SkRect_Reference#SkRect'>SkRect</a>* bounds)const 3874</pre> 3875 3876Returns the advance width of <a href='#SkPaint_measureText_text'>text</a>. 3877The advance is the normal distance to move before drawing additional <a href='#SkPaint_measureText_text'>text</a>. 3878Uses <a href='undocumented#SkTextEncoding'>SkTextEncoding</a> to decode <a href='#SkPaint_measureText_text'>text</a>, <a href='undocumented#SkTypeface'>SkTypeface</a> to get the <a href='#Font_Metrics'>font metrics</a>, 3879and <a href='#Text_Size'>text size</a>, <a href='#Text_Scale_X'>text scale x</a>, <a href='#Text_Skew_X'>text skew x</a>, <a href='#Stroke_Width'>stroke width</a>, and 3880<a href='undocumented#SkPathEffect'>SkPathEffect</a> to scale the metrics and <a href='#SkPaint_measureText_bounds'>bounds</a>. 3881Returns the bounding box of <a href='#SkPaint_measureText_text'>text</a> if <a href='#SkPaint_measureText_bounds'>bounds</a> is not nullptr. 3882The bounding box is computed as if the <a href='#SkPaint_measureText_text'>text</a> was drawn at the origin. 3883 3884### Parameters 3885 3886<table> <tr> <td><a name='SkPaint_measureText_text'><code><strong>text</strong></code></a></td> 3887 <td>character codes or <a href='undocumented#Glyph'>glyph</a> indices to be measured</td> 3888 </tr> 3889 <tr> <td><a name='SkPaint_measureText_length'><code><strong>length</strong></code></a></td> 3890 <td>number of bytes of <a href='#SkPaint_measureText_text'>text</a> to measure</td> 3891 </tr> 3892 <tr> <td><a name='SkPaint_measureText_bounds'><code><strong>bounds</strong></code></a></td> 3893 <td>returns bounding box relative to (0, 0) if not nullptr</td> 3894 </tr> 3895</table> 3896 3897### Return Value 3898 3899advance width or height 3900 3901### Example 3902 3903<div><fiddle-embed name="06084f609184470135a9cd9ebc5af149"></fiddle-embed></div> 3904 3905<a name='SkPaint_measureText_2'></a> 3906 3907--- 3908 3909<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 3910<a href='undocumented#SkScalar'>SkScalar</a> <a href='#SkPaint_measureText'>measureText</a>(const void* <a href='undocumented#Text'>text</a>, size_t length)const 3911</pre> 3912 3913Returns the advance width of <a href='#SkPaint_measureText_2_text'>text</a>. 3914The advance is the normal distance to move before drawing additional <a href='#SkPaint_measureText_2_text'>text</a>. 3915Uses <a href='undocumented#SkTextEncoding'>SkTextEncoding</a> to decode <a href='#SkPaint_measureText_2_text'>text</a>, <a href='undocumented#SkTypeface'>SkTypeface</a> to get the <a href='#Font_Metrics'>font metrics</a>, 3916and <a href='#Text_Size'>text size</a> to scale the metrics. 3917Does not scale the advance or bounds by <a href='#Fake_Bold'>fake bold</a> or <a href='undocumented#SkPathEffect'>SkPathEffect</a>. 3918 3919### Parameters 3920 3921<table> <tr> <td><a name='SkPaint_measureText_2_text'><code><strong>text</strong></code></a></td> 3922 <td>character codes or <a href='undocumented#Glyph'>glyph</a> indices to be measured</td> 3923 </tr> 3924 <tr> <td><a name='SkPaint_measureText_2_length'><code><strong>length</strong></code></a></td> 3925 <td>number of bytes of <a href='#SkPaint_measureText_2_text'>text</a> to measure</td> 3926 </tr> 3927</table> 3928 3929### Return Value 3930 3931advance width or height 3932 3933### Example 3934 3935<div><fiddle-embed name="f1139a5ddd17fd47c2f45f6e642cac76"> 3936 3937#### Example Output 3938 3939~~~~ 3940default width = 5 3941double width = 10 3942~~~~ 3943 3944</fiddle-embed></div> 3945 3946<a name='SkPaint_getTextWidths'></a> 3947 3948--- 3949 3950<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 3951int <a href='#SkPaint_getTextWidths'>getTextWidths</a>(const void* <a href='undocumented#Text'>text</a>, size_t byteLength, <a href='undocumented#SkScalar'>SkScalar</a> widths[], <a href='SkRect_Reference#SkRect'>SkRect</a> bounds[] = nullptr)const 3952</pre> 3953 3954Retrieves the advance and <a href='#SkPaint_getTextWidths_bounds'>bounds</a> for each <a href='undocumented#Glyph'>glyph</a> in <a href='#SkPaint_getTextWidths_text'>text</a>, and returns 3955the <a href='undocumented#Glyph'>glyph</a> count in <a href='#SkPaint_getTextWidths_text'>text</a>. 3956Both <a href='#SkPaint_getTextWidths_widths'>widths</a> and <a href='#SkPaint_getTextWidths_bounds'>bounds</a> may be nullptr. 3957If <a href='#SkPaint_getTextWidths_widths'>widths</a> is not nullptr, <a href='#SkPaint_getTextWidths_widths'>widths</a> must be an array of <a href='undocumented#Glyph'>glyph</a> count entries. 3958if <a href='#SkPaint_getTextWidths_bounds'>bounds</a> is not nullptr, <a href='#SkPaint_getTextWidths_bounds'>bounds</a> must be an array of <a href='undocumented#Glyph'>glyph</a> count entries. 3959Uses <a href='undocumented#SkTextEncoding'>SkTextEncoding</a> to decode <a href='#SkPaint_getTextWidths_text'>text</a>, <a href='undocumented#SkTypeface'>SkTypeface</a> to get the <a href='#Font_Metrics'>font metrics</a>, 3960and <a href='#Text_Size'>text size</a> to scale the <a href='#SkPaint_getTextWidths_widths'>widths</a> and <a href='#SkPaint_getTextWidths_bounds'>bounds</a>. 3961Does not scale the advance by <a href='#Fake_Bold'>fake bold</a> or <a href='undocumented#SkPathEffect'>SkPathEffect</a>. 3962Does include <a href='#Fake_Bold'>fake bold</a> and <a href='undocumented#SkPathEffect'>SkPathEffect</a> in the <a href='#SkPaint_getTextWidths_bounds'>bounds</a>. 3963 3964### Parameters 3965 3966<table> <tr> <td><a name='SkPaint_getTextWidths_text'><code><strong>text</strong></code></a></td> 3967 <td>character codes or <a href='undocumented#Glyph'>glyph</a> indices to be measured</td> 3968 </tr> 3969 <tr> <td><a name='SkPaint_getTextWidths_byteLength'><code><strong>byteLength</strong></code></a></td> 3970 <td>number of bytes of <a href='#SkPaint_getTextWidths_text'>text</a> to measure</td> 3971 </tr> 3972 <tr> <td><a name='SkPaint_getTextWidths_widths'><code><strong>widths</strong></code></a></td> 3973 <td>returns <a href='#SkPaint_getTextWidths_text'>text</a> advances for each <a href='undocumented#Glyph'>glyph</a>; may be nullptr</td> 3974 </tr> 3975 <tr> <td><a name='SkPaint_getTextWidths_bounds'><code><strong>bounds</strong></code></a></td> 3976 <td>returns <a href='#SkPaint_getTextWidths_bounds'>bounds</a> for each <a href='undocumented#Glyph'>glyph</a> relative to (0, 0); may be nullptr</td> 3977 </tr> 3978</table> 3979 3980### Return Value 3981 3982<a href='undocumented#Glyph'>glyph</a> count in <a href='#SkPaint_getTextWidths_text'>text</a> 3983 3984### Example 3985 3986<div><fiddle-embed name="6b9e101f49e9c2c28755c5bdcef64dfb"><div>Bounds of <a href='undocumented#Glyph'>Glyphs</a> increase for stroked <a href='#SkPaint_getTextWidths_text'>text</a>, but <a href='#SkPaint_getTextWidths_text'>text</a> advance remains the same. 3987The underlines show the <a href='#SkPaint_getTextWidths_text'>text</a> advance, spaced to keep them distinct. 3988</div></fiddle-embed></div> 3989 3990<a name='Text_Path'></a> 3991 3992<a href='#Paint_Text_Path'>Text_Path</a> describes the geometry of <a href='undocumented#Glyph'>Glyphs</a> used to draw <a href='undocumented#Text'>text</a>. 3993 3994<a name='SkPaint_getTextPath'></a> 3995 3996--- 3997 3998<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 3999void <a href='#SkPaint_getTextPath'>getTextPath</a>(const void* <a href='undocumented#Text'>text</a>, size_t length, <a href='undocumented#SkScalar'>SkScalar</a> x, <a href='undocumented#SkScalar'>SkScalar</a> y, <a href='SkPath_Reference#SkPath'>SkPath</a>* <a href='SkPath_Reference#Path'>path</a>)const 4000</pre> 4001 4002Returns the geometry as <a href='SkPath_Reference#SkPath'>SkPath</a> equivalent to the drawn <a href='#SkPaint_getTextPath_text'>text</a>. 4003Uses <a href='undocumented#SkTextEncoding'>SkTextEncoding</a> to decode <a href='#SkPaint_getTextPath_text'>text</a>, <a href='undocumented#SkTypeface'>SkTypeface</a> to get the <a href='undocumented#Glyph'>glyph</a> <a href='SkPath_Reference#Path'>paths</a>, 4004and <a href='#Text_Size'>text size</a>, <a href='#Fake_Bold'>fake bold</a>, and <a href='undocumented#SkPathEffect'>SkPathEffect</a> to scale and modify the <a href='undocumented#Glyph'>glyph</a> <a href='SkPath_Reference#Path'>paths</a>. 4005All of the <a href='undocumented#Glyph'>glyph</a> <a href='SkPath_Reference#Path'>paths</a> are stored in <a href='#SkPaint_getTextPath_path'>path</a>. 4006Uses <a href='#SkPaint_getTextPath_x'>x</a>, <a href='#SkPaint_getTextPath_y'>y</a>, to position <a href='#SkPaint_getTextPath_path'>path</a>. 4007 4008### Parameters 4009 4010<table> <tr> <td><a name='SkPaint_getTextPath_text'><code><strong>text</strong></code></a></td> 4011 <td>character codes or <a href='undocumented#Glyph'>glyph</a> indices</td> 4012 </tr> 4013 <tr> <td><a name='SkPaint_getTextPath_length'><code><strong>length</strong></code></a></td> 4014 <td>number of bytes of <a href='#SkPaint_getTextPath_text'>text</a></td> 4015 </tr> 4016 <tr> <td><a name='SkPaint_getTextPath_x'><code><strong>x</strong></code></a></td> 4017 <td>x-axis value of the origin of the <a href='#SkPaint_getTextPath_text'>text</a></td> 4018 </tr> 4019 <tr> <td><a name='SkPaint_getTextPath_y'><code><strong>y</strong></code></a></td> 4020 <td>y-axis value of the origin of the <a href='#SkPaint_getTextPath_text'>text</a></td> 4021 </tr> 4022 <tr> <td><a name='SkPaint_getTextPath_path'><code><strong>path</strong></code></a></td> 4023 <td>geometry of the <a href='undocumented#Glyph'>glyphs</a></td> 4024 </tr> 4025</table> 4026 4027### Example 4028 4029<div><fiddle-embed name="7c9e6a399f898d68026c1f0865e6f73e"><div><a href='undocumented#Text'>Text</a> is added to <a href='SkPath_Reference#Path'>Path</a>, offset, and subtracted from <a href='SkPath_Reference#Path'>Path</a>, then added at 4030the offset location. The result is rendered with one draw call. 4031</div></fiddle-embed></div> 4032 4033<a name='SkPaint_getPosTextPath'></a> 4034 4035--- 4036 4037<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 4038void <a href='#SkPaint_getPosTextPath'>getPosTextPath</a>(const void* <a href='undocumented#Text'>text</a>, size_t length, const <a href='SkPoint_Reference#SkPoint'>SkPoint</a> pos[], <a href='SkPath_Reference#SkPath'>SkPath</a>* <a href='SkPath_Reference#Path'>path</a>)const 4039</pre> 4040 4041Returns the geometry as <a href='SkPath_Reference#SkPath'>SkPath</a> equivalent to the drawn <a href='#SkPaint_getPosTextPath_text'>text</a>. 4042Uses <a href='undocumented#SkTextEncoding'>SkTextEncoding</a> to decode <a href='#SkPaint_getPosTextPath_text'>text</a>, <a href='undocumented#SkTypeface'>SkTypeface</a> to get the <a href='undocumented#Glyph'>glyph</a> <a href='SkPath_Reference#Path'>paths</a>, 4043and <a href='#Text_Size'>text size</a>, <a href='#Fake_Bold'>fake bold</a>, and <a href='undocumented#SkPathEffect'>SkPathEffect</a> to scale and modify the <a href='undocumented#Glyph'>glyph</a> <a href='SkPath_Reference#Path'>paths</a>. 4044All of the <a href='undocumented#Glyph'>glyph</a> <a href='SkPath_Reference#Path'>paths</a> are stored in <a href='#SkPaint_getPosTextPath_path'>path</a>. 4045Uses <a href='#SkPaint_getPosTextPath_pos'>pos</a> array to position <a href='#SkPaint_getPosTextPath_path'>path</a>. 4046<a href='#SkPaint_getPosTextPath_pos'>pos</a> contains a position for each <a href='undocumented#Glyph'>glyph</a>. 4047 4048### Parameters 4049 4050<table> <tr> <td><a name='SkPaint_getPosTextPath_text'><code><strong>text</strong></code></a></td> 4051 <td>character codes or <a href='undocumented#Glyph'>glyph</a> indices</td> 4052 </tr> 4053 <tr> <td><a name='SkPaint_getPosTextPath_length'><code><strong>length</strong></code></a></td> 4054 <td>number of bytes of <a href='#SkPaint_getPosTextPath_text'>text</a></td> 4055 </tr> 4056 <tr> <td><a name='SkPaint_getPosTextPath_pos'><code><strong>pos</strong></code></a></td> 4057 <td>positions of each <a href='undocumented#Glyph'>glyph</a></td> 4058 </tr> 4059 <tr> <td><a name='SkPaint_getPosTextPath_path'><code><strong>path</strong></code></a></td> 4060 <td>geometry of the <a href='undocumented#Glyph'>glyphs</a></td> 4061 </tr> 4062</table> 4063 4064### Example 4065 4066<div><fiddle-embed name="7f27c93472aa99a7542fb3493076f072"><div>Simplifies three <a href='undocumented#Glyph'>Glyphs</a> to eliminate overlaps, and strokes the result. 4067</div></fiddle-embed></div> 4068 4069<a name='SkPaint_nothingToDraw'></a> 4070 4071--- 4072 4073<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 4074bool <a href='#SkPaint_nothingToDraw'>nothingToDraw</a>()const 4075</pre> 4076 4077Returns true if <a href='SkPaint_Reference#SkPaint'>SkPaint</a> prevents all drawing; 4078otherwise, the <a href='SkPaint_Reference#SkPaint'>SkPaint</a> may or may not allow drawing. 4079 4080Returns true if, for example, <a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a> combined with <a href='SkColor_Reference#Alpha'>alpha</a> computes a 4081new <a href='SkColor_Reference#Alpha'>alpha</a> of zero. 4082 4083### Return Value 4084 4085true if <a href='SkPaint_Reference#SkPaint'>SkPaint</a> prevents all drawing 4086 4087### Example 4088 4089<div><fiddle-embed name="2973b05bfbb6b4c29332c8ac4fcf3995"> 4090 4091#### Example Output 4092 4093~~~~ 4094initial nothing to draw: false 4095blend dst nothing to draw: true 4096blend src over nothing to draw: false 4097alpha 0 nothing to draw: true 4098~~~~ 4099 4100</fiddle-embed></div> 4101 4102<a name='Utility'></a> 4103 4104