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