2017-07-28 19:18:29 +00:00
SkPaint Reference
===
2018-10-16 14:30:28 +00:00
2018-10-08 18:57:48 +00:00
< a name = 'SkPaint' > < / a >
2017-09-15 06:56:12 +00:00
2018-10-16 14:30:28 +00:00
---
2018-10-08 18:57:48 +00:00
< pre style = "padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0 " >
2018-11-07 19:59:03 +00:00
class < a href = 'SkPaint_Reference#SkPaint' > SkPaint< / a > {
2018-11-29 17:05:25 +00:00
2018-10-08 18:57:48 +00:00
< a href = '#SkPaint_empty_constructor' > SkPaint()< / a > ;
2018-11-29 17:05:25 +00:00
< a href = '#SkPaint_copy_const_SkPaint' > SkPaint< / a > (const < a href = 'SkPaint_Reference#SkPaint' > SkPaint< / a > & < a href = 'SkPaint_Reference#Paint' > paint< / a > );
< a href = '#SkPaint_move_SkPaint' > SkPaint< / a > (< a href = 'SkPaint_Reference#SkPaint' > SkPaint< / a > & & < a href = 'SkPaint_Reference#Paint' > paint< / a > );
< a href = '#SkPaint_destructor' > ~SkPaint()< / a > ;
< 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 > );
< 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 > );
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);
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);
2018-11-09 21:04:58 +00:00
uint32_t < a href = '#SkPaint_getHash' > getHash< / a > () const;
void < a href = '#SkPaint_reset' > reset()< / a > ;
void < a href = '#SkPaint_setHinting' > setHinting< / a > (< a href = 'undocumented#SkFontHinting' > SkFontHinting< / a > hintingLevel);
2018-11-10 04:16:58 +00:00
< a href = 'undocumented#SkFontHinting' > SkFontHinting< / a > < a href = '#SkPaint_getHinting' > getHinting< / a > () const;
2018-10-08 18:57:48 +00:00
2018-11-09 21:04:58 +00:00
enum < a href = '#SkPaint_Flags' > Flags< / a > {
< a href = '#SkPaint_kAntiAlias_Flag' > kAntiAlias_Flag< / a > = 0x01,
< a href = '#SkPaint_kDither_Flag' > kDither_Flag< / a > = 0x04,
< a href = '#SkPaint_kFakeBoldText_Flag' > kFakeBoldText_Flag< / a > = 0x20,
< a href = '#SkPaint_kLinearText_Flag' > kLinearText_Flag< / a > = 0x40,
< a href = '#SkPaint_kSubpixelText_Flag' > kSubpixelText_Flag< / a > = 0x80,
< a href = '#SkPaint_kLCDRenderText_Flag' > kLCDRenderText_Flag< / a > = 0x200,
< a href = '#SkPaint_kEmbeddedBitmapText_Flag' > kEmbeddedBitmapText_Flag< / a > = 0x400,
< a href = '#SkPaint_kAutoHinting_Flag' > kAutoHinting_Flag< / a > = 0x800,
< a href = '#SkPaint_kAllFlags' > kAllFlags< / a > = 0xFFFF,
2018-10-08 18:57:48 +00:00
};
2018-11-09 21:04:58 +00:00
uint32_t < a href = '#SkPaint_getFlags' > getFlags< / a > () const;
void < a href = '#SkPaint_setFlags' > setFlags< / a > (uint32_t flags);
bool < a href = '#SkPaint_isAntiAlias' > isAntiAlias< / a > () const;
void < a href = '#SkPaint_setAntiAlias' > setAntiAlias< / a > (bool aa);
bool < a href = '#SkPaint_isDither' > isDither< / a > () const;
void < a href = '#SkPaint_setDither' > setDither< / a > (bool dither);
bool < a href = '#SkPaint_isLinearText' > isLinearText< / a > () const;
void < a href = '#SkPaint_setLinearText' > setLinearText< / a > (bool linearText);
bool < a href = '#SkPaint_isSubpixelText' > isSubpixelText< / a > () const;
void < a href = '#SkPaint_setSubpixelText' > setSubpixelText< / a > (bool subpixelText);
bool < a href = '#SkPaint_isLCDRenderText' > isLCDRenderText< / a > () const;
void < a href = '#SkPaint_setLCDRenderText' > setLCDRenderText< / a > (bool lcdText);
bool < a href = '#SkPaint_isEmbeddedBitmapText' > isEmbeddedBitmapText< / a > () const;
void < a href = '#SkPaint_setEmbeddedBitmapText' > setEmbeddedBitmapText< / a > (bool useEmbeddedBitmapText);
bool < a href = '#SkPaint_isAutohinted' > isAutohinted< / a > () const;
void < a href = '#SkPaint_setAutohinted' > setAutohinted< / a > (bool useAutohinter);
bool < a href = '#SkPaint_isFakeBoldText' > isFakeBoldText< / a > () const;
void < a href = '#SkPaint_setFakeBoldText' > setFakeBoldText< / a > (bool fakeBoldText);
< a href = 'undocumented#SkFilterQuality' > SkFilterQuality< / a > < a href = '#SkPaint_getFilterQuality' > getFilterQuality< / a > () const;
void < a href = '#SkPaint_setFilterQuality' > setFilterQuality< / a > (< a href = 'undocumented#SkFilterQuality' > SkFilterQuality< / a > quality);
enum < a href = '#SkPaint_Style' > Style< / a > : uint8_t {
2018-10-08 18:57:48 +00:00
< a href = '#SkPaint_kFill_Style' > kFill_Style< / a > ,
< a href = '#SkPaint_kStroke_Style' > kStroke_Style< / a > ,
< a href = '#SkPaint_kStrokeAndFill_Style' > kStrokeAndFill_Style< / a > ,
};
2018-11-29 17:05:25 +00:00
static constexpr int < a href = '#SkPaint_kStyleCount' > kStyleCount< / a > = < a href = '#SkPaint_kStrokeAndFill_Style' > kStrokeAndFill_Style< / a > + 1
2018-11-09 21:04:58 +00:00
< a href = '#SkPaint_Style' > Style< / a > < a href = '#SkPaint_getStyle' > getStyle< / a > () const;
void < a href = '#SkPaint_setStyle' > setStyle< / a > (< a href = '#SkPaint_Style' > Style< / a > style);
< a href = 'SkColor_Reference#SkColor' > SkColor< / a > < a href = '#SkPaint_getColor' > getColor< / a > () const;
< a href = 'SkColor4f_Reference#SkColor4f' > SkColor4f< / a > < a href = '#SkPaint_getColor4f' > getColor4f< / a > () const;
void < a href = '#SkPaint_setColor' > setColor< / a > (< a href = 'SkColor_Reference#SkColor' > SkColor< / a > < a href = 'SkColor_Reference#Color' > color< / a > );
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);
uint8_t < a href = '#SkPaint_getAlpha' > getAlpha< / a > () const;
void < a href = '#SkPaint_setAlpha' > setAlpha< / a > (< a href = 'undocumented#U8CPU' > U8CPU< / a > a);
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);
< a href = 'undocumented#SkScalar' > SkScalar< / a > < a href = '#SkPaint_getStrokeWidth' > getStrokeWidth< / a > () const;
void < a href = '#SkPaint_setStrokeWidth' > setStrokeWidth< / a > (< a href = 'undocumented#SkScalar' > SkScalar< / a > width);
< a href = 'undocumented#SkScalar' > SkScalar< / a > < a href = '#SkPaint_getStrokeMiter' > getStrokeMiter< / a > () const;
void < a href = '#SkPaint_setStrokeMiter' > setStrokeMiter< / a > (< a href = 'undocumented#SkScalar' > SkScalar< / a > miter);
enum < a href = '#SkPaint_Cap' > Cap< / a > {
2018-10-08 18:57:48 +00:00
< a href = '#SkPaint_kButt_Cap' > kButt_Cap< / a > ,
< a href = '#SkPaint_kRound_Cap' > kRound_Cap< / a > ,
< a href = '#SkPaint_kSquare_Cap' > kSquare_Cap< / a > ,
< a href = '#SkPaint_kLast_Cap' > kLast_Cap< / a > = < a href = '#SkPaint_kSquare_Cap' > kSquare_Cap< / a > ,
< a href = '#SkPaint_kDefault_Cap' > kDefault_Cap< / a > = < a href = '#SkPaint_kButt_Cap' > kButt_Cap< / a > ,
};
2018-11-29 17:05:25 +00:00
static constexpr int < a href = '#SkPaint_kCapCount' > kCapCount< / a > = < a href = '#SkPaint_kLast_Cap' > kLast_Cap< / a > + 1
2018-11-09 21:04:58 +00:00
enum < a href = '#SkPaint_Join' > Join< / a > : uint8_t {
2018-10-08 18:57:48 +00:00
< a href = '#SkPaint_kMiter_Join' > kMiter_Join< / a > ,
< a href = '#SkPaint_kRound_Join' > kRound_Join< / a > ,
< a href = '#SkPaint_kBevel_Join' > kBevel_Join< / a > ,
< a href = '#SkPaint_kLast_Join' > kLast_Join< / a > = < a href = '#SkPaint_kBevel_Join' > kBevel_Join< / a > ,
< a href = '#SkPaint_kDefault_Join' > kDefault_Join< / a > = < a href = '#SkPaint_kMiter_Join' > kMiter_Join< / a > ,
};
2018-11-29 17:05:25 +00:00
static constexpr int < a href = '#SkPaint_kJoinCount' > kJoinCount< / a > = < a href = '#SkPaint_kLast_Join' > kLast_Join< / a > + 1
2018-11-09 21:04:58 +00:00
< a href = '#SkPaint_Cap' > Cap< / a > < a href = '#SkPaint_getStrokeCap' > getStrokeCap< / a > () const;
void < a href = '#SkPaint_setStrokeCap' > setStrokeCap< / a > (< a href = '#SkPaint_Cap' > Cap< / a > cap);
< a href = '#SkPaint_Join' > Join< / a > < a href = '#SkPaint_getStrokeJoin' > getStrokeJoin< / a > () const;
void < a href = '#SkPaint_setStrokeJoin' > setStrokeJoin< / a > (< a href = '#SkPaint_Join' > Join< / a > join);
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;
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 = 'undocumented#SkShader' > SkShader< / a > * < a href = '#SkPaint_getShader' > getShader< / a > () const;
< a href = 'undocumented#sk_sp' > sk_sp< / a > < < a href = 'undocumented#SkShader' > SkShader< / a > > < a href = '#SkPaint_refShader' > refShader< / a > () const;
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 > );
< a href = 'undocumented#SkColorFilter' > SkColorFilter< / a > * < a href = '#SkPaint_getColorFilter' > getColorFilter< / a > () const;
< a href = 'undocumented#sk_sp' > sk_sp< / a > < < a href = 'undocumented#SkColorFilter' > SkColorFilter< / a > > < a href = '#SkPaint_refColorFilter' > refColorFilter< / a > () const;
void < a href = '#SkPaint_setColorFilter' > setColorFilter< / a > (< a href = 'undocumented#sk_sp' > sk_sp< / a > < < a href = 'undocumented#SkColorFilter' > SkColorFilter< / a > > colorFilter);
< a href = 'SkBlendMode_Reference#SkBlendMode' > SkBlendMode< / a > < a href = '#SkPaint_getBlendMode' > getBlendMode< / a > () const;
bool < a href = '#SkPaint_isSrcOver' > isSrcOver< / a > () const;
void < a href = '#SkPaint_setBlendMode' > setBlendMode< / a > (< a href = 'SkBlendMode_Reference#SkBlendMode' > SkBlendMode< / a > mode);
< a href = 'undocumented#SkPathEffect' > SkPathEffect< / a > * < a href = '#SkPaint_getPathEffect' > getPathEffect< / a > () const;
< a href = 'undocumented#sk_sp' > sk_sp< / a > < < a href = 'undocumented#SkPathEffect' > SkPathEffect< / a > > < a href = '#SkPaint_refPathEffect' > refPathEffect< / a > () const;
void < a href = '#SkPaint_setPathEffect' > setPathEffect< / a > (< a href = 'undocumented#sk_sp' > sk_sp< / a > < < a href = 'undocumented#SkPathEffect' > SkPathEffect< / a > > pathEffect);
< a href = 'undocumented#SkMaskFilter' > SkMaskFilter< / a > * < a href = '#SkPaint_getMaskFilter' > getMaskFilter< / a > () const;
< a href = 'undocumented#sk_sp' > sk_sp< / a > < < a href = 'undocumented#SkMaskFilter' > SkMaskFilter< / a > > < a href = '#SkPaint_refMaskFilter' > refMaskFilter< / a > () const;
void < a href = '#SkPaint_setMaskFilter' > setMaskFilter< / a > (< a href = 'undocumented#sk_sp' > sk_sp< / a > < < a href = 'undocumented#SkMaskFilter' > SkMaskFilter< / a > > maskFilter);
< a href = 'undocumented#SkTypeface' > SkTypeface< / a > * < a href = '#SkPaint_getTypeface' > getTypeface< / a > () const;
< a href = 'undocumented#sk_sp' > sk_sp< / a > < < a href = 'undocumented#SkTypeface' > SkTypeface< / a > > < a href = '#SkPaint_refTypeface' > refTypeface< / a > () const;
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 > );
< a href = 'undocumented#SkImageFilter' > SkImageFilter< / a > * < a href = '#SkPaint_getImageFilter' > getImageFilter< / a > () const;
< a href = 'undocumented#sk_sp' > sk_sp< / a > < < a href = 'undocumented#SkImageFilter' > SkImageFilter< / a > > < a href = '#SkPaint_refImageFilter' > refImageFilter< / a > () const;
void < a href = '#SkPaint_setImageFilter' > setImageFilter< / a > (< a href = 'undocumented#sk_sp' > sk_sp< / a > < < a href = 'undocumented#SkImageFilter' > SkImageFilter< / a > > imageFilter);
< a href = 'undocumented#SkDrawLooper' > SkDrawLooper< / a > * < a href = '#SkPaint_getDrawLooper' > getDrawLooper< / a > () const;
< a href = 'undocumented#sk_sp' > sk_sp< / a > < < a href = 'undocumented#SkDrawLooper' > SkDrawLooper< / a > > < a href = '#SkPaint_refDrawLooper' > refDrawLooper< / a > () const;
void < a href = '#SkPaint_setDrawLooper' > setDrawLooper< / a > (< a href = 'undocumented#sk_sp' > sk_sp< / a > < < a href = 'undocumented#SkDrawLooper' > SkDrawLooper< / a > > drawLooper);
< a href = 'undocumented#SkScalar' > SkScalar< / a > < a href = '#SkPaint_getTextSize' > getTextSize< / a > () const;
void < a href = '#SkPaint_setTextSize' > setTextSize< / a > (< a href = 'undocumented#SkScalar' > SkScalar< / a > textSize);
< a href = 'undocumented#SkScalar' > SkScalar< / a > < a href = '#SkPaint_getTextScaleX' > getTextScaleX< / a > () const;
void < a href = '#SkPaint_setTextScaleX' > setTextScaleX< / a > (< a href = 'undocumented#SkScalar' > SkScalar< / a > scaleX);
< a href = 'undocumented#SkScalar' > SkScalar< / a > < a href = '#SkPaint_getTextSkewX' > getTextSkewX< / a > () const;
void < a href = '#SkPaint_setTextSkewX' > setTextSkewX< / a > (< a href = 'undocumented#SkScalar' > SkScalar< / a > skewX);
2018-12-06 13:41:14 +00:00
< a href = 'undocumented#SkTextEncoding' > SkTextEncoding< / a > < a href = '#SkPaint_getTextEncoding' > getTextEncoding< / a > () const;
void < a href = '#SkPaint_setTextEncoding' > setTextEncoding< / a > (< a href = 'undocumented#SkTextEncoding' > SkTextEncoding< / a > encoding);
2018-11-09 21:04:58 +00:00
typedef < a href = 'undocumented#SkFontMetrics' > SkFontMetrics< / a > < a href = '#SkPaint_FontMetrics' > FontMetrics< / a > ;
< a href = 'undocumented#SkScalar' > SkScalar< / a > < a href = '#SkPaint_getFontMetrics' > getFontMetrics< / a > (< a href = 'undocumented#SkFontMetrics' > SkFontMetrics< / a > * metrics) const;
< a href = 'undocumented#SkScalar' > SkScalar< / a > < a href = '#SkPaint_getFontSpacing' > getFontSpacing< / a > () const;
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;
bool < a href = '#SkPaint_containsText' > containsText< / a > (const void* < a href = 'undocumented#Text' > text< / a > , size_t byteLength) const;
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;
int < a href = '#SkPaint_countText' > countText< / a > (const void* < a href = 'undocumented#Text' > text< / a > , size_t byteLength) const;
< 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;
< a href = 'undocumented#SkScalar' > SkScalar< / a > < a href = '#SkPaint_measureText' > measureText< / a > (const void* < a href = 'undocumented#Text' > text< / a > , size_t length) const;
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;
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;
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;
bool < a href = '#SkPaint_nothingToDraw' > nothingToDraw< / a > () const;
2018-10-08 18:57:48 +00:00
};
2018-11-29 17:05:25 +00:00
2018-10-08 18:57:48 +00:00
< / pre >
2018-11-09 21:04:58 +00:00
< a href = 'SkPaint_Reference#Paint' > Paint< / a > controls options applied when drawing and measuring. < a href = 'SkPaint_Reference#Paint' > Paint< / a > collects all
options outside of the < a href = '#Canvas_Clip' > Canvas_Clip< / a > and < a href = '#Canvas_Matrix' > Canvas_Matrix< / a > .
2018-10-08 18:57:48 +00:00
2018-11-09 21:04:58 +00:00
Various options apply to < a href = 'undocumented#Text' > text< / a > , strokes and fills, and images.
2018-10-08 18:57:48 +00:00
2018-11-09 21:04:58 +00:00
Some options may not be implemented on all platforms; in these cases, setting
the option has no effect. Some options are conveniences that duplicate < a href = 'SkCanvas_Reference#Canvas' > Canvas< / a >
functionality; for instance, < a href = '#Text_Size' > text size< / a > is identical to < a href = 'SkMatrix_Reference#Matrix' > matrix< / a > scale.
2018-10-08 18:57:48 +00:00
2018-11-09 21:04:58 +00:00
< a href = 'SkPaint_Reference#Paint' > Paint< / a > options are rarely exclusive; each option modifies a stage of the drawing
pipeline and multiple pipeline stages may be affected by a single < a href = 'SkPaint_Reference#Paint' > Paint< / a > .
2018-10-08 18:57:48 +00:00
2018-11-09 21:04:58 +00:00
< a href = 'SkPaint_Reference#Paint' > Paint< / a > collects effects and filters that describe single-pass and multiple-pass
algorithms that alter the drawing geometry, < a href = 'SkColor_Reference#Color' > color< / a > , and transparency. For instance,
< a href = 'SkPaint_Reference#Paint' > Paint< / a > does not directly implement dashing or blur, but contains the objects that do so.
2018-10-08 18:57:48 +00:00
2018-11-09 21:04:58 +00:00
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 >
to affect it. The implementation is free to defer computations associated with the
< a href = 'SkPaint_Reference#Paint' > Paint< / a > , or ignore them altogether. For instance, some GPU implementations draw all
< 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 >
is set in < a href = 'SkPaint_Reference#Paint' > Paint< / a > .
2018-10-08 18:57:48 +00:00
2018-11-29 17:05:25 +00:00
< 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.
2018-11-09 21:04:58 +00:00
Multiple colors are drawn either by using multiple paints or with objects like
< a href = 'undocumented#Shader' > Shader< / a > attached to < a href = 'SkPaint_Reference#Paint' > Paint< / a > .
2018-05-16 11:07:07 +00:00
< a name = 'SkPaint_empty_constructor' > < / a >
2018-10-16 14:30:28 +00:00
---
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-11-07 19:59:03 +00:00
< a href = '#SkPaint_empty_constructor' > SkPaint()< / a >
2017-07-28 19:18:29 +00:00
< / pre >
2018-11-09 21:04:58 +00:00
Constructs < a href = 'SkPaint_Reference#Paint' > Paint< / a > with default values.
2017-07-28 19:18:29 +00:00
| attribute | default value |
| --- | --- |
2018-11-07 19:59:03 +00:00
| < a href = '#Paint_Anti_Alias' > Anti_Alias< / a > | false |
| < a href = '#Blend_Mode' > Blend_Mode< / a > | < a href = 'SkBlendMode_Reference#SkBlendMode' > SkBlendMode< / a > ::< a href = '#SkBlendMode_kSrcOver' > kSrcOver< / a > |
| < a href = 'SkColor_Reference#Color' > Color< / a > | < a href = 'SkColor_Reference#SK_ColorBLACK' > SK_ColorBLACK< / a > |
| < a href = '#Color_Alpha' > Color_Alpha< / a > | 255 |
| < a href = '#Color_Filter' > Color_Filter< / a > | nullptr |
| Dither | false |
| < a href = '#Draw_Looper' > Draw_Looper< / a > | nullptr |
| < a href = '#Filter_Quality' > Filter_Quality< / a > | < a href = 'undocumented#kNone_SkFilterQuality' > kNone_SkFilterQuality< / a > |
2018-12-06 13:41:14 +00:00
| < a href = '#Font_Force_Hinting' > Font_Force_Hinting< / a > | false |
| < a href = '#Font_Embedded_Bitmaps' > Font_Embedded_Bitmaps< / a > | false |
| < a href = '#Font_Embolden' > Font_Embolden< / a > | false |
| < a href = '#Font_Hinting' > Font_Hinting< / a > | < a href = 'undocumented#SkFontHinting' > SkFontHinting< / a > ::< a href = '#SkFontHinting_kNormal' > kNormal< / a > |
| < a href = '#Font_Hinting_Spacing' > Font_Hinting_Spacing< / a > | false |
| < a href = '#Font_Anti_Alias' > Font_Anti_Alias< / a > | false |
| < a href = '#Font_Linear' > Font_Linear< / a > | false |
| < a href = '#Font_Scale_X' > Font_Scale_X< / a > | 1 |
| < a href = '#Font_Size' > Font_Size< / a > | 12 |
| < a href = '#Font_Skew_X' > Font_Skew_X< / a > | 0 |
| < a href = '#Font_Subpixel' > Font_Subpixel< / a > | false |
2018-11-07 19:59:03 +00:00
| < a href = '#Image_Filter' > Image_Filter< / a > | nullptr |
| < a href = '#Paint_Miter_Limit' > Miter_Limit< / a > | 4 |
| < a href = '#Mask_Filter' > Mask_Filter< / a > | nullptr |
| < a href = '#Path_Effect' > Path_Effect< / a > | nullptr |
2018-05-16 11:07:07 +00:00
| < a href = 'undocumented#Shader' > Shader< / a > | nullptr |
2018-11-07 19:59:03 +00:00
| < a href = '#SkPaint_Style' > Style< / a > | < a href = '#SkPaint_kFill_Style' > kFill_Style< / a > |
2019-05-07 19:38:46 +00:00
| < a href = '#Text_Encoding' > Text_Encoding< / a > | < a href = 'undocumented#SkTextEncoding::kUTF8' > SkTextEncoding::kUTF8< / a > |
2018-05-16 11:07:07 +00:00
| < a href = 'undocumented#Typeface' > Typeface< / a > | nullptr |
2018-11-07 19:59:03 +00:00
| < a href = '#Paint_Stroke_Cap' > Stroke_Cap< / a > | < a href = '#SkPaint_kButt_Cap' > kButt_Cap< / a > |
| < a href = '#Paint_Stroke_Join' > Stroke_Join< / a > | < a href = '#SkPaint_kMiter_Join' > kMiter_Join< / a > |
| < a href = '#Paint_Stroke_Width' > Stroke_Width< / a > | 0 |
2017-07-28 19:18:29 +00:00
2018-11-09 21:04:58 +00:00
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
< a href = 'SkPaint_Reference#Paint' > paint< / a > default values. The overrides may be included in "SkUserConfig.h" or predefined by the
build system.
2017-07-28 19:18:29 +00:00
### Return Value
2018-11-07 19:59:03 +00:00
default initialized < a href = 'SkPaint_Reference#Paint' > Paint< / a >
2017-07-28 19:18:29 +00:00
### Example
< div > < fiddle-embed name = "c4b2186d85c142a481298f7144295ffd" > < / fiddle-embed > < / div >
2018-05-16 11:07:07 +00:00
< a name = 'SkPaint_copy_const_SkPaint' > < / a >
2018-10-16 14:30:28 +00:00
---
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-11-29 17:05:25 +00:00
< a href = '#SkPaint_copy_const_SkPaint' > SkPaint< / a > (const < a href = 'SkPaint_Reference#SkPaint' > SkPaint< / a > & < a href = 'SkPaint_Reference#Paint' > paint< / a > )
2017-07-28 19:18:29 +00:00
< / pre >
2018-10-31 16:14:03 +00:00
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 > ,
2018-11-09 21:04:58 +00:00
< 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
between the original < a href = '#SkPaint_copy_const_SkPaint_paint' > paint< / a > and the copy. Objects containing < a href = 'undocumented#SkRefCnt' > SkRefCnt< / a > increment
2017-08-03 21:14:08 +00:00
their references by one.
2017-07-28 19:18:29 +00:00
2018-10-31 16:14:03 +00:00
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 > ,
2018-11-09 21:04:58 +00:00
< a href = 'undocumented#SkDrawLooper' > SkDrawLooper< / a > , and < a href = 'undocumented#SkImageFilter' > SkImageFilter< / a > cannot be modified after they are created.
This prevents objects with < a href = 'undocumented#SkRefCnt' > SkRefCnt< / a > from being modified once < a href = 'SkPaint_Reference#SkPaint' > SkPaint< / a > refers to them.
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkPaint_copy_const_SkPaint_paint' > < code > < strong > paint< / strong > < / code > < / a > < / td >
< td > original to copy< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Return Value
2018-11-07 19:59:03 +00:00
shallow copy of < a href = '#SkPaint_copy_const_SkPaint_paint' > paint< / a >
2017-07-28 19:18:29 +00:00
### Example
2018-07-05 05:35:27 +00:00
< div > < fiddle-embed name = "b99971ad0ef243d617925289d963b62d" >
2017-07-28 19:18:29 +00:00
#### Example Output
~~~~
SK_ColorRED == paint1.getColor()
SK_ColorBLUE == paint2.getColor()
~~~~
< / fiddle-embed > < / div >
2018-05-16 11:07:07 +00:00
< a name = 'SkPaint_move_SkPaint' > < / a >
2018-10-16 14:30:28 +00:00
---
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-11-29 17:05:25 +00:00
< a href = '#SkPaint_move_SkPaint' > SkPaint< / a > (< a href = 'SkPaint_Reference#SkPaint' > SkPaint< / a > & & < a href = 'SkPaint_Reference#Paint' > paint< / a > )
2017-07-28 19:18:29 +00:00
< / pre >
2017-09-14 15:25:39 +00:00
Implements a move constructor to avoid increasing the reference counts
2018-11-07 19:59:03 +00:00
of objects referenced by the < a href = '#SkPaint_move_SkPaint_paint' > paint< / a > .
2017-07-28 19:18:29 +00:00
2018-11-09 21:04:58 +00:00
After the call, < a href = '#SkPaint_move_SkPaint_paint' > paint< / a > is undefined, and can be safely destructed.
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkPaint_move_SkPaint_paint' > < code > < strong > paint< / strong > < / code > < / a > < / td >
< td > original to move< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Return Value
2018-11-07 19:59:03 +00:00
content of < a href = '#SkPaint_move_SkPaint_paint' > paint< / a >
2017-07-28 19:18:29 +00:00
### Example
2018-07-18 20:21:51 +00:00
< div > < fiddle-embed name = "8ed1488a503cd5282b86a51614aa90b1" >
2017-07-28 19:18:29 +00:00
#### Example Output
~~~~
path effect unique: true
~~~~
< / fiddle-embed > < / div >
2018-05-16 11:07:07 +00:00
< a name = 'SkPaint_reset' > < / a >
2018-10-16 14:30:28 +00:00
---
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-11-07 19:59:03 +00:00
void < a href = '#SkPaint_reset' > reset()< / a >
2017-07-28 19:18:29 +00:00
< / pre >
2018-11-09 21:04:58 +00:00
Sets all < a href = 'SkPaint_Reference#SkPaint' > SkPaint< / a > contents to their initial values. This is equivalent to replacing
< a href = 'SkPaint_Reference#SkPaint' > SkPaint< / a > with the result of < a href = '#SkPaint_empty_constructor' > SkPaint()< / a > .
2017-07-28 19:18:29 +00:00
### Example
< div > < fiddle-embed name = "ef269937ade7e7353635121d9a64f9f7" >
#### Example Output
~~~~
paint1 == paint2
~~~~
< / fiddle-embed > < / div >
2018-05-16 11:07:07 +00:00
< a name = 'SkPaint_destructor' > < / a >
2018-10-16 14:30:28 +00:00
---
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-11-29 17:05:25 +00:00
< a href = '#SkPaint_destructor' > ~SkPaint()< / a >
2017-07-28 19:18:29 +00:00
< / pre >
2018-11-09 21:04:58 +00:00
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 > ,
< 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
objects containing < a href = 'undocumented#SkRefCnt' > SkRefCnt< / a > go to zero, they are deleted.
2017-07-28 19:18:29 +00:00
2018-10-16 14:30:28 +00:00
< a name = 'Management' > < / a >
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a name = 'SkPaint_copy_operator' > < / a >
2018-10-16 14:30:28 +00:00
---
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-11-29 17:05:25 +00:00
< 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 > )
2017-07-28 19:18:29 +00:00
< / pre >
2018-10-31 16:14:03 +00:00
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 > ,
2018-11-09 21:04:58 +00:00
< 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
between the original < a href = '#SkPaint_copy_operator_paint' > paint< / a > and the copy. Objects containing < a href = 'undocumented#SkRefCnt' > SkRefCnt< / a > in the
2017-07-28 19:18:29 +00:00
prior destination are decreased by one, and the referenced objects are deleted if the
2018-11-09 21:04:58 +00:00
resulting count is zero. Objects containing < a href = 'undocumented#SkRefCnt' > SkRefCnt< / a > in the parameter < a href = '#SkPaint_copy_operator_paint' > paint< / a >
are increased by one. < a href = '#SkPaint_copy_operator_paint' > paint< / a > is unmodified.
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkPaint_copy_operator_paint' > < code > < strong > paint< / strong > < / code > < / a > < / td >
< td > original to copy< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Return Value
2018-11-07 19:59:03 +00:00
content of < a href = '#SkPaint_copy_operator_paint' > paint< / a >
2017-07-28 19:18:29 +00:00
### Example
< div > < fiddle-embed name = "b476a9088f80dece176ed577807d3992" >
#### Example Output
~~~~
SK_ColorRED == paint1.getColor()
SK_ColorRED == paint2.getColor()
~~~~
< / fiddle-embed > < / div >
2018-05-16 11:07:07 +00:00
< a name = 'SkPaint_move_operator' > < / a >
2018-10-16 14:30:28 +00:00
---
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-11-29 17:05:25 +00:00
< 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 > )
2017-07-28 19:18:29 +00:00
< / pre >
2018-11-09 21:04:58 +00:00
Moves the < a href = '#SkPaint_move_operator_paint' > paint< / a > to avoid increasing the reference counts
of objects referenced by the < a href = '#SkPaint_move_operator_paint' > paint< / a > parameter. Objects containing < a href = 'undocumented#SkRefCnt' > SkRefCnt< / a > in the
2017-08-03 21:14:08 +00:00
prior destination are decreased by one; those objects are deleted if the resulting count
is zero.
2017-07-28 19:18:29 +00:00
2018-11-09 21:04:58 +00:00
After the call, < a href = '#SkPaint_move_operator_paint' > paint< / a > is undefined, and can be safely destructed.
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkPaint_move_operator_paint' > < code > < strong > paint< / strong > < / code > < / a > < / td >
< td > original to move< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Return Value
2018-11-07 19:59:03 +00:00
content of < a href = '#SkPaint_move_operator_paint' > paint< / a >
2017-07-28 19:18:29 +00:00
### Example
2018-07-19 03:49:13 +00:00
< div > < fiddle-embed name = "9fb7459b097d713f5f1fe5675afe14f5" >
2017-07-28 19:18:29 +00:00
#### Example Output
~~~~
SK_ColorRED == paint2.getColor()
~~~~
< / fiddle-embed > < / div >
2018-05-16 11:07:07 +00:00
< a name = 'SkPaint_equal_operator' > < / a >
2018-10-16 14:30:28 +00:00
---
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-11-29 17:05:25 +00:00
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)
2017-07-28 19:18:29 +00:00
< / pre >
2018-11-09 21:04:58 +00:00
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
2018-10-31 16:14:03 +00:00
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 > ,
2018-11-09 21:04:58 +00:00
< a href = 'undocumented#SkDrawLooper' > SkDrawLooper< / a > , or < a href = 'undocumented#SkImageFilter' > SkImageFilter< / a > have identical contents but different pointers.
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkPaint_equal_operator_a' > < code > < strong > a< / strong > < / code > < / a > < / td >
2018-11-09 21:04:58 +00:00
< td > < a href = 'SkPaint_Reference#SkPaint' > SkPaint< / a > to compare< / td >
2018-05-16 11:07:07 +00:00
< / tr >
< tr > < td > < a name = 'SkPaint_equal_operator_b' > < code > < strong > b< / strong > < / code > < / a > < / td >
2018-11-09 21:04:58 +00:00
< td > < a href = 'SkPaint_Reference#SkPaint' > SkPaint< / a > to compare< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Return Value
2018-11-09 21:04:58 +00:00
true if < a href = 'SkPaint_Reference#SkPaint' > SkPaint< / a > pair are equivalent
2017-07-28 19:18:29 +00:00
### Example
< div > < fiddle-embed name = "7481a948e34672720337a631830586dd" >
#### Example Output
~~~~
paint1 == paint2
paint1 != paint2
~~~~
< / fiddle-embed > < / div >
2018-03-20 19:53:27 +00:00
### See Also
2018-11-29 17:05:25 +00:00
< 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 > )
2018-03-20 19:53:27 +00:00
2018-05-16 11:07:07 +00:00
< a name = 'SkPaint_notequal_operator' > < / a >
2018-10-16 14:30:28 +00:00
---
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-11-29 17:05:25 +00:00
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)
2017-07-28 19:18:29 +00:00
< / pre >
2018-11-09 21:04:58 +00:00
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
2018-10-31 16:14:03 +00:00
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 > ,
2018-11-09 21:04:58 +00:00
< a href = 'undocumented#SkDrawLooper' > SkDrawLooper< / a > , or < a href = 'undocumented#SkImageFilter' > SkImageFilter< / a > have identical contents but different pointers.
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkPaint_notequal_operator_a' > < code > < strong > a< / strong > < / code > < / a > < / td >
2018-11-09 21:04:58 +00:00
< td > < a href = 'SkPaint_Reference#SkPaint' > SkPaint< / a > to compare< / td >
2018-05-16 11:07:07 +00:00
< / tr >
< tr > < td > < a name = 'SkPaint_notequal_operator_b' > < code > < strong > b< / strong > < / code > < / a > < / td >
2018-11-09 21:04:58 +00:00
< td > < a href = 'SkPaint_Reference#SkPaint' > SkPaint< / a > to compare< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Return Value
2018-11-09 21:04:58 +00:00
true if < a href = 'SkPaint_Reference#SkPaint' > SkPaint< / a > pair are not equivalent
2017-07-28 19:18:29 +00:00
### Example
2018-07-08 05:32:09 +00:00
< div > < fiddle-embed name = "b6c8484b1187f555b435ad5369833be4" >
2017-07-28 19:18:29 +00:00
#### Example Output
~~~~
paint1 == paint2
paint1 == paint2
~~~~
< / fiddle-embed > < / div >
2018-03-20 19:53:27 +00:00
### See Also
2018-11-29 17:05:25 +00:00
< 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 > )
2018-03-20 19:53:27 +00:00
2018-05-16 11:07:07 +00:00
< a name = 'SkPaint_getHash' > < / a >
2018-10-16 14:30:28 +00:00
---
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-11-29 17:05:25 +00:00
uint32_t < a href = '#SkPaint_getHash' > getHash< / a > ()const
2017-07-28 19:18:29 +00:00
< / pre >
2018-11-09 21:04:58 +00:00
Returns a hash generated from < a href = 'SkPaint_Reference#SkPaint' > SkPaint< / a > values and pointers.
2017-07-28 19:18:29 +00:00
Identical hashes guarantee that the paints are
equivalent, but differing hashes do not guarantee that the paints have differing
contents.
2018-11-29 17:05:25 +00:00
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,
2017-07-28 19:18:29 +00:00
their hashes are also equal.
The hash returned is platform and implementation specific.
### Return Value
a shallow hash
### Example
2018-07-18 20:21:51 +00:00
< div > < fiddle-embed name = "7f7e1b701361912b344f90ae6b530393" >
2017-07-28 19:18:29 +00:00
#### Example Output
~~~~
paint1 == paint2
paint1.getHash() == paint2.getHash()
~~~~
< / fiddle-embed > < / div >
2018-10-16 14:30:28 +00:00
< a name = 'Hinting' > < / a >
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a name = 'SkPaint_setHinting' > < / a >
2018-10-16 14:30:28 +00:00
---
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-11-09 21:04:58 +00:00
void < a href = '#SkPaint_setHinting' > setHinting< / a > (< a href = 'undocumented#SkFontHinting' > SkFontHinting< / a > hintingLevel)
2017-07-28 19:18:29 +00:00
< / pre >
2018-11-09 21:04:58 +00:00
Sets level of < a href = 'undocumented#Glyph' > glyph< / a > outline adjustment.
2018-05-16 11:07:07 +00:00
Does not check for valid values of < a href = '#SkPaint_setHinting_hintingLevel' > hintingLevel< / a > .
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkPaint_setHinting_hintingLevel' > < code > < strong > hintingLevel< / strong > < / code > < / a > < / td >
2018-11-08 18:31:39 +00:00
< 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 >
2018-11-06 05:32:09 +00:00
< / tr >
< / table >
2018-11-08 18:31:39 +00:00
< a href = 'undocumented#SkFontHinting' > SkFontHinting< / a > ::< a href = '#SkFontHinting_kNormal' > kNormal< / a > , < a href = 'undocumented#SkFontHinting' > SkFontHinting< / a > ::< a href = '#SkFontHinting_kFull' > kFull< / a >
2018-11-06 05:32:09 +00:00
### Example
2018-12-02 05:59:00 +00:00
< div > < fiddle-embed name = "bb179ec5698ec1398ff18f3657ab73f7" >
2018-11-06 05:32:09 +00:00
#### Example Output
~~~~
paint1 == paint2
~~~~
< / fiddle-embed > < / div >
2018-11-10 04:16:58 +00:00
< a name = 'SkPaint_getHinting' > < / a >
---
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-11-29 17:05:25 +00:00
< a href = 'undocumented#SkFontHinting' > SkFontHinting< / a > < a href = '#SkPaint_getHinting' > getHinting< / a > ()const
2018-11-10 04:16:58 +00:00
< / pre >
Returns level of < a href = 'undocumented#Glyph' > glyph< / a > outline adjustment.
### Return Value
2018-11-15 13:25:12 +00:00
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 > ,
2018-11-10 04:16:58 +00:00
2018-11-15 13:25:12 +00:00
< a href = 'undocumented#SkFontHinting' > SkFontHinting< / a > ::< a href = '#SkFontHinting_kFull' > kFull< / a >
2018-11-10 04:16:58 +00:00
2018-11-15 13:25:12 +00:00
### Example
2018-11-10 04:16:58 +00:00
2018-11-15 13:25:12 +00:00
< div > < fiddle-embed name = "b56b70c7ea2453c41bfa58b626953bed" >
2018-11-10 04:16:58 +00:00
2018-11-15 13:25:12 +00:00
#### Example Output
2018-11-10 04:16:58 +00:00
2018-11-15 13:25:12 +00:00
~~~~
SkFontHinting::kNormal == paint.getHinting()
~~~~
2018-11-10 04:16:58 +00:00
2018-11-15 13:25:12 +00:00
< / fiddle-embed > < / div >
2018-11-10 04:16:58 +00:00
2017-07-28 19:18:29 +00:00
### Constants
2018-05-16 11:07:07 +00:00
< table style = 'border-collapse: collapse; width: 62.5em' >
< tr >< th style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > Const</ th >
< th style = 'text-align: center; border: 2px solid #dddddd ; padding: 8px; ' > Value</ th >
< th style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > Description</ th ></ tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a name = 'SkPaint_kAntiAlias_Flag' >< code > SkPaint::kAntiAlias_Flag</ code ></ a ></ td >
< td style = 'text-align: center; border: 2px solid #dddddd ; padding: 8px; ' > 0x0001</ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >
2018-05-17 16:17:28 +00:00
mask for setting Anti_Alias< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< tr >
2018-05-16 11:07:07 +00:00
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a name = 'SkPaint_kDither_Flag' >< code > SkPaint::kDither_Flag</ code ></ a ></ td >
< td style = 'text-align: center; border: 2px solid #dddddd ; padding: 8px; ' > 0x0004</ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >
mask for setting Dither< / td >
2017-07-28 19:18:29 +00:00
< / tr >
2018-05-16 11:07:07 +00:00
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a name = 'SkPaint_kFakeBoldText_Flag' >< code > SkPaint::kFakeBoldText_Flag</ code ></ a ></ td >
< td style = 'text-align: center; border: 2px solid #dddddd ; padding: 8px; ' > 0x0020</ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >
2018-12-06 13:41:14 +00:00
mask for setting Font_Embolden< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< tr >
2018-05-16 11:07:07 +00:00
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a name = 'SkPaint_kLinearText_Flag' >< code > SkPaint::kLinearText_Flag</ code ></ a ></ td >
< td style = 'text-align: center; border: 2px solid #dddddd ; padding: 8px; ' > 0x0040</ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >
2018-12-06 13:41:14 +00:00
mask for setting Font_Linear< / td >
2017-07-28 19:18:29 +00:00
< / tr >
2018-05-16 11:07:07 +00:00
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a name = 'SkPaint_kSubpixelText_Flag' >< code > SkPaint::kSubpixelText_Flag</ code ></ a ></ td >
< td style = 'text-align: center; border: 2px solid #dddddd ; padding: 8px; ' > 0x0080</ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >
2018-12-06 13:41:14 +00:00
mask for setting Font_Subpixel< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< tr >
2018-05-16 11:07:07 +00:00
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a name = 'SkPaint_kLCDRenderText_Flag' >< code > SkPaint::kLCDRenderText_Flag</ code ></ a ></ td >
< td style = 'text-align: center; border: 2px solid #dddddd ; padding: 8px; ' > 0x0200</ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >
2018-12-06 13:41:14 +00:00
mask for setting Font_Anti_Alias< / td >
2017-07-28 19:18:29 +00:00
< / tr >
2018-05-16 11:07:07 +00:00
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a name = 'SkPaint_kEmbeddedBitmapText_Flag' >< code > SkPaint::kEmbeddedBitmapText_Flag</ code ></ a ></ td >
< td style = 'text-align: center; border: 2px solid #dddddd ; padding: 8px; ' > 0x0400</ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >
mask for setting Font_Embedded_Bitmaps< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< tr >
2018-05-16 11:07:07 +00:00
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a name = 'SkPaint_kAutoHinting_Flag' >< code > SkPaint::kAutoHinting_Flag</ code ></ a ></ td >
< td style = 'text-align: center; border: 2px solid #dddddd ; padding: 8px; ' > 0x0800</ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >
2018-12-06 13:41:14 +00:00
mask for setting Font_Force_Hinting< / td >
2017-07-28 19:18:29 +00:00
< / tr >
2018-05-16 11:07:07 +00:00
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a name = 'SkPaint_kAllFlags' >< code > SkPaint::kAllFlags</ code ></ a ></ td >
< td style = 'text-align: center; border: 2px solid #dddddd ; padding: 8px; ' > 0xFFFF</ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >
2018-11-09 21:04:58 +00:00
mask of all < a href = '#SkPaint_Flags' > Flags< / a > , including private flags and flags reserved for future use
2018-11-07 19:59:03 +00:00
< / td >
2017-07-28 19:18:29 +00:00
< / tr >
2018-11-09 21:04:58 +00:00
< a href = '#SkPaint_Flags' > Flags< / a > default to all flags clear, disabling the associated feature.
2018-05-16 11:07:07 +00:00
< / table >
2018-03-20 19:53:27 +00:00
2018-05-16 11:07:07 +00:00
< a name = 'SkPaint_getFlags' > < / a >
2018-10-16 14:30:28 +00:00
---
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-11-29 17:05:25 +00:00
uint32_t < a href = '#SkPaint_getFlags' > getFlags< / a > ()const
2017-07-28 19:18:29 +00:00
< / pre >
2018-11-09 21:04:58 +00:00
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
bit, and can be tested with < a href = 'SkPaint_Reference#SkPaint' > SkPaint< / a > ::< a href = '#SkPaint_Flags' > Flags< / a > members.
2017-07-28 19:18:29 +00:00
### Return Value
2018-10-31 16:14:03 +00:00
zero, one, or more bits described by < a href = 'SkPaint_Reference#SkPaint' > SkPaint< / a > ::< a href = '#SkPaint_Flags' > Flags< / a >
2017-07-28 19:18:29 +00:00
### Example
< div > < fiddle-embed name = "8a3f8c309533388b01aa66e1267f322d" >
#### Example Output
~~~~
(SkPaint::kAntiAlias_Flag & paint.getFlags()) != 0
~~~~
< / fiddle-embed > < / div >
2018-05-16 11:07:07 +00:00
< a name = 'SkPaint_setFlags' > < / a >
2018-10-16 14:30:28 +00:00
---
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-11-09 21:04:58 +00:00
void < a href = '#SkPaint_setFlags' > setFlags< / a > (uint32_t flags)
2017-07-28 19:18:29 +00:00
< / pre >
2018-11-09 21:04:58 +00:00
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.
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.
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkPaint_setFlags_flags' > < code > < strong > flags< / strong > < / code > < / a > < / td >
2018-11-09 21:04:58 +00:00
< 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 >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
< div > < fiddle-embed name = "54baed3f6bc4b9c31ba664e27767fdc7" >
#### Example Output
~~~~
paint.isAntiAlias()
paint.isDither()
~~~~
< / fiddle-embed > < / div >
2018-10-16 14:30:28 +00:00
< a name = 'Anti_Alias' > < / a >
2017-07-28 19:18:29 +00:00
2018-10-16 14:30:28 +00:00
---
2018-02-01 14:37:32 +00:00
2018-11-09 21:04:58 +00:00
< a href = '#Paint_Anti_Alias' > Anti_Alias< / a > drawing approximates partial < a href = 'undocumented#Pixel' > pixel< / a > coverage with transparency.
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.
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.
2017-07-28 19:18:29 +00:00
2018-11-09 21:04:58 +00:00
The rule for < a href = 'undocumented#Alias' > Aliased< / a > pixels is inconsistent across platforms. A shape edge
passing through the < a href = 'undocumented#Pixel' > pixel< / a > center may, but is not required to, draw the < a href = 'undocumented#Pixel' > pixel< / a > .
2017-07-28 19:18:29 +00:00
2018-11-09 21:04:58 +00:00
< 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
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.
2017-07-28 19:18:29 +00:00
2018-11-09 21:04:58 +00:00
A platform may only support < a href = '#Paint_Anti_Alias' > Anti_Aliased< / a > drawing. Some GPU-backed platforms use
< a href = 'undocumented#Supersampling' > Supersampling< / a > to < a href = '#Paint_Anti_Alias' > Anti_Alias< / a > all drawing, and have no mechanism to selectively
2018-05-16 11:07:07 +00:00
< a href = 'undocumented#Alias' > Alias< / a > .
2017-07-28 19:18:29 +00:00
2018-11-09 21:04:58 +00:00
The amount of coverage computed for < a href = '#Paint_Anti_Alias' > Anti_Aliased< / a > pixels also varies across platforms.
2017-07-28 19:18:29 +00:00
2018-11-09 21:04:58 +00:00
< a href = '#Paint_Anti_Alias' > Anti_Alias< / a > is disabled by default.
< 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 >
at compile time.
2017-07-28 19:18:29 +00:00
### Example
2018-11-09 21:04:58 +00:00
< 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.
A blue < a href = 'undocumented#Line' > line< / a > draws only where the < a href = 'undocumented#Pixel' > pixel< / a > centers are contained.
The < a href = 'undocumented#Line' > lines< / a > are drawn into < a href = 'SkBitmap_Reference#Bitmap' > Bitmap< / a > , then drawn magnified to make the
< a href = 'undocumented#Alias' > Aliasing< / a > easier to see.
2018-03-05 18:26:16 +00:00
< / div > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a name = 'SkPaint_isAntiAlias' > < / a >
2018-10-16 14:30:28 +00:00
---
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-11-29 17:05:25 +00:00
bool < a href = '#SkPaint_isAntiAlias' > isAntiAlias< / a > ()const
2017-07-28 19:18:29 +00:00
< / pre >
2018-11-09 21:04:58 +00:00
Returns true if pixels on the active edges of < a href = 'SkPath_Reference#SkPath' > SkPath< / a > may be drawn with partial transparency.
2017-07-28 19:18:29 +00:00
2018-11-09 21:04:58 +00:00
Equivalent to < a href = '#SkPaint_getFlags' > getFlags< / a > () masked with < a href = '#SkPaint_kAntiAlias_Flag' > kAntiAlias_Flag< / a > .
2017-07-28 19:18:29 +00:00
### Return Value
2018-11-09 21:04:58 +00:00
< a href = '#SkPaint_kAntiAlias_Flag' > kAntiAlias_Flag< / a > state
2017-07-28 19:18:29 +00:00
### Example
2018-07-06 05:23:23 +00:00
< div > < fiddle-embed name = "d7d5f4f7da7acd5104a652f490c6f7b8" >
2017-07-28 19:18:29 +00:00
#### Example Output
~~~~
paint.isAntiAlias() == !!(paint.getFlags() & SkPaint::kAntiAlias_Flag)
paint.isAntiAlias() == !!(paint.getFlags() & SkPaint::kAntiAlias_Flag)
~~~~
< / fiddle-embed > < / div >
2018-05-16 11:07:07 +00:00
< a name = 'SkPaint_setAntiAlias' > < / a >
2018-10-16 14:30:28 +00:00
---
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-11-09 21:04:58 +00:00
void < a href = '#SkPaint_setAntiAlias' > setAntiAlias< / a > (bool aa)
2017-07-28 19:18:29 +00:00
< / pre >
2018-11-20 05:34:36 +00:00
Requests, but does not require, that edge pixels draw opaque or with
2017-07-28 19:18:29 +00:00
partial transparency.
2018-11-09 21:04:58 +00:00
Sets < a href = '#SkPaint_kAntiAlias_Flag' > kAntiAlias_Flag< / a > if < a href = '#SkPaint_setAntiAlias_aa' > aa< / a > is true.
Clears < a href = '#SkPaint_kAntiAlias_Flag' > kAntiAlias_Flag< / a > if < a href = '#SkPaint_setAntiAlias_aa' > aa< / a > is false.
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkPaint_setAntiAlias_aa' > < code > < strong > aa< / strong > < / code > < / a > < / td >
2018-10-31 16:14:03 +00:00
< td > setting for < a href = '#SkPaint_kAntiAlias_Flag' > kAntiAlias_Flag< / a > < / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
2018-07-06 05:23:23 +00:00
< div > < fiddle-embed name = "c2ff148374d01cbef845b223e725905c" >
2017-07-28 19:18:29 +00:00
#### Example Output
~~~~
paint1 == paint2
~~~~
< / fiddle-embed > < / div >
2018-10-16 14:30:28 +00:00
< a name = 'Dither' > < / a >
2017-07-28 19:18:29 +00:00
2018-10-16 14:30:28 +00:00
---
2018-02-01 14:37:32 +00:00
2018-11-09 21:04:58 +00:00
Dither increases fidelity by adjusting the < a href = 'SkColor_Reference#Color' > color< / a > of adjacent pixels.
This can help to smooth < a href = 'SkColor_Reference#Color' > color< / a > transitions and reducing banding in gradients.
Dithering lessens visible banding from < a href = 'SkImageInfo_Reference#kRGB_565_SkColorType' > kRGB_565_SkColorType< / a >
and < a href = 'SkImageInfo_Reference#kRGBA_8888_SkColorType' > kRGBA_8888_SkColorType< / a > gradients,
and improves rendering into a < a href = 'SkImageInfo_Reference#kRGB_565_SkColorType' > kRGB_565_SkColorType< / a > < a href = 'SkSurface_Reference#Surface' > Surface< / a > .
2017-07-28 19:18:29 +00:00
2018-11-09 21:04:58 +00:00
Dithering is always enabled for linear gradients drawing into
< 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 > .
Dither cannot be enabled for < a href = 'SkImageInfo_Reference#kAlpha_8_SkColorType' > kAlpha_8_SkColorType< / a > < a href = 'SkSurface_Reference#Surface' > Surface< / a > and
2018-05-16 11:07:07 +00:00
< a href = 'SkImageInfo_Reference#kRGBA_F16_SkColorType' > kRGBA_F16_SkColorType< / a > < a href = 'SkSurface_Reference#Surface' > Surface< / a > .
2017-07-28 19:18:29 +00:00
2018-11-09 21:04:58 +00:00
Dither is disabled by default.
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 >
at compile time.
2017-07-28 19:18:29 +00:00
2018-11-09 21:04:58 +00:00
Some platform implementations may ignore dithering. Set < code > SK_IGNORE_GPU_DITHER< / code > to ignore Dither on < a href = '#GPU_Surface' > GPU_Surface< / a > .
2017-07-28 19:18:29 +00:00
### Example
2018-11-09 21:04:58 +00:00
< div > < fiddle-embed name = "8b26507690b71462f44642b911890bbf" > < div > Dithering in the bottom half more closely approximates the requested < a href = 'SkColor_Reference#Color' > color< / a > by
alternating nearby colors from < a href = 'undocumented#Pixel' > pixel< / a > to < a href = 'undocumented#Pixel' > pixel< / a > .
2018-03-05 18:26:16 +00:00
< / div > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
### Example
2018-11-09 21:04:58 +00:00
< div > < fiddle-embed name = "76d4d4a7931a48495e4d5f54e073be53" > < div > Dithering introduces subtle adjustments to < a href = 'SkColor_Reference#Color' > color< / a > to smooth gradients.
Drawing the gradient repeatedly with < a href = 'SkBlendMode_Reference#SkBlendMode' > SkBlendMode< / a > ::< a href = '#SkBlendMode_kPlus' > kPlus< / a > exaggerates the
dither, making it easier to see.
2018-03-05 18:26:16 +00:00
< / div > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
2018-10-16 14:30:28 +00:00
### See Also
Gradient < a href = 'SkImageInfo_Reference#kRGB_565_SkColorType' > kRGB_565_SkColorType< / a >
2018-05-16 11:07:07 +00:00
< a name = 'SkPaint_isDither' > < / a >
2018-10-16 14:30:28 +00:00
---
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-11-29 17:05:25 +00:00
bool < a href = '#SkPaint_isDither' > isDither< / a > ()const
2017-07-28 19:18:29 +00:00
< / pre >
2018-11-09 21:04:58 +00:00
Returns true if < a href = 'SkColor_Reference#Color' > color< / a > error may be distributed to smooth < a href = 'SkColor_Reference#Color' > color< / a > transition.
2018-05-03 06:27:39 +00:00
2018-11-09 21:04:58 +00:00
Equivalent to < a href = '#SkPaint_getFlags' > getFlags< / a > () masked with < a href = '#SkPaint_kDither_Flag' > kDither_Flag< / a > .
2017-07-28 19:18:29 +00:00
### Return Value
2018-11-09 21:04:58 +00:00
< a href = '#SkPaint_kDither_Flag' > kDither_Flag< / a > state
2017-07-28 19:18:29 +00:00
### Example
< div > < fiddle-embed name = "f4ce93f6c5e7335436a985377fd980c0" >
#### Example Output
~~~~
paint.isDither() == !!(paint.getFlags() & SkPaint::kDither_Flag)
paint.isDither() == !!(paint.getFlags() & SkPaint::kDither_Flag)
~~~~
< / fiddle-embed > < / div >
2018-05-16 11:07:07 +00:00
< a name = 'SkPaint_setDither' > < / a >
2018-10-16 14:30:28 +00:00
---
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-11-09 21:04:58 +00:00
void < a href = '#SkPaint_setDither' > setDither< / a > (bool dither)
2017-07-28 19:18:29 +00:00
< / pre >
2018-11-09 21:04:58 +00:00
Requests, but does not require, to distribute < a href = 'SkColor_Reference#Color' > color< / a > error.
2017-07-28 19:18:29 +00:00
2018-11-09 21:04:58 +00:00
Sets < a href = '#SkPaint_kDither_Flag' > kDither_Flag< / a > if < a href = '#SkPaint_setDither_dither' > dither< / a > is true.
Clears < a href = '#SkPaint_kDither_Flag' > kDither_Flag< / a > if < a href = '#SkPaint_setDither_dither' > dither< / a > is false.
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkPaint_setDither_dither' > < code > < strong > dither< / strong > < / code > < / a > < / td >
2018-10-31 16:14:03 +00:00
< td > setting for < a href = '#SkPaint_kDither_Flag' > kDither_Flag< / a > < / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
< div > < fiddle-embed name = "69b7162e8324d9239dd02dd9ada2bdff" >
#### Example Output
~~~~
paint1 == paint2
~~~~
< / fiddle-embed > < / div >
### See Also
2018-05-16 11:07:07 +00:00
< a href = 'SkImageInfo_Reference#kRGB_565_SkColorType' > kRGB_565_SkColorType< / a >
2017-07-28 19:18:29 +00:00
2018-10-16 14:30:28 +00:00
< a name = 'Device_Text' > < / a >
2017-07-28 19:18:29 +00:00
2018-10-16 14:30:28 +00:00
---
2018-02-01 14:37:32 +00:00
2018-12-06 13:41:14 +00:00
< 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.
2017-07-28 19:18:29 +00:00
2018-11-09 21:04:58 +00:00
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
create a < a href = 'SkColor_Reference#Color' > color< / a > , and relies
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.
2018-12-06 13:41:14 +00:00
< a href = '#Font_Anti_Alias' > Font_Anti_Alias< / a > can be enabled on devices that orient stripes horizontally or vertically, and that order
2018-11-09 21:04:58 +00:00
the < a href = 'SkColor_Reference#Color' > color< / a > components as RGB or BGR.
2017-07-28 19:18:29 +00:00
2018-11-09 21:04:58 +00:00
< 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.
As the opaqueness
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 > .
2017-07-28 19:18:29 +00:00
2018-11-09 21:04:58 +00:00
Either or both techniques can be enabled.
< a href = '#SkPaint_kLCDRenderText_Flag' > kLCDRenderText_Flag< / a > and < a href = '#SkPaint_kSubpixelText_Flag' > kSubpixelText_Flag< / a > are clear by default.
2018-12-06 13:41:14 +00:00
< 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
2018-11-09 21:04:58 +00:00
< a href = '#SkPaint_kLCDRenderText_Flag' > kLCDRenderText_Flag< / a > or < a href = '#SkPaint_kSubpixelText_Flag' > kSubpixelText_Flag< / a > (or both) at compile time.
2017-07-28 19:18:29 +00:00
### Example
2018-12-06 13:41:14 +00:00
< 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 > .
When < a href = '#Font_Subpixel' > Font_Subpixel< / a > is disabled, the comma < a href = 'undocumented#Glyph' > Glyphs< / a > are identical, but not evenly spaced.
When < a href = '#Font_Subpixel' > Font_Subpixel< / a > is enabled, the comma < a href = 'undocumented#Glyph' > Glyphs< / a > are unique, but appear evenly spaced.
2018-03-05 18:26:16 +00:00
< / div > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
2018-10-16 14:30:28 +00:00
< a name = 'Linear_Text' > < / a >
2017-07-28 19:18:29 +00:00
2018-12-06 13:41:14 +00:00
< 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 > .
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 > .
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 > .
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a name = 'SkPaint_isLinearText' > < / a >
2018-10-16 14:30:28 +00:00
---
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-11-29 17:05:25 +00:00
bool < a href = '#SkPaint_isLinearText' > isLinearText< / a > ()const
2017-07-28 19:18:29 +00:00
< / pre >
2018-11-09 21:04:58 +00:00
Returns true if < a href = 'undocumented#Text' > text< / a > is converted to < a href = 'SkPath_Reference#SkPath' > SkPath< / a > before drawing and measuring.
2017-07-28 19:18:29 +00:00
2018-11-09 21:04:58 +00:00
Equivalent to < a href = '#SkPaint_getFlags' > getFlags< / a > () masked with < a href = '#SkPaint_kLinearText_Flag' > kLinearText_Flag< / a > .
2017-07-28 19:18:29 +00:00
### Return Value
2018-11-09 21:04:58 +00:00
< a href = '#SkPaint_kLinearText_Flag' > kLinearText_Flag< / a > state
2017-07-28 19:18:29 +00:00
### Example
< div > < fiddle-embed name = "2890ad644f980637837e6fcb386fb462" > < / fiddle-embed > < / div >
### See Also
2018-11-15 13:25:12 +00:00
< a href = '#SkPaint_setLinearText' > setLinearText< / a > Hinting
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a name = 'SkPaint_setLinearText' > < / a >
2018-10-16 14:30:28 +00:00
---
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-11-09 21:04:58 +00:00
void < a href = '#SkPaint_setLinearText' > setLinearText< / a > (bool linearText)
2017-07-28 19:18:29 +00:00
< / pre >
2018-11-20 05:34:36 +00:00
Requests, but does not require, that < a href = 'undocumented#Glyph' > glyphs< / a > are converted to < a href = 'SkPath_Reference#SkPath' > SkPath< / a >
before drawing and measuring.
2018-11-09 21:04:58 +00:00
By default, < a href = '#SkPaint_kLinearText_Flag' > kLinearText_Flag< / a > is clear.
2017-07-28 19:18:29 +00:00
2018-11-09 21:04:58 +00:00
Sets < a href = '#SkPaint_kLinearText_Flag' > kLinearText_Flag< / a > if < a href = '#SkPaint_setLinearText_linearText' > linearText< / a > is true.
Clears < a href = '#SkPaint_kLinearText_Flag' > kLinearText_Flag< / a > if < a href = '#SkPaint_setLinearText_linearText' > linearText< / a > is false.
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkPaint_setLinearText_linearText' > < code > < strong > linearText< / strong > < / code > < / a > < / td >
2018-10-31 16:14:03 +00:00
< td > setting for < a href = '#SkPaint_kLinearText_Flag' > kLinearText_Flag< / a > < / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
2018-07-18 20:21:51 +00:00
< div > < fiddle-embed name = "c93bb912f3bddfb4d96d3ad70ada552b" > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
### See Also
2018-11-15 13:25:12 +00:00
< a href = '#SkPaint_isLinearText' > isLinearText< / a > Hinting
2017-07-28 19:18:29 +00:00
2018-10-16 14:30:28 +00:00
< a name = 'Subpixel_Text' > < / a >
2017-07-28 19:18:29 +00:00
2018-11-09 21:04:58 +00:00
< 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.
As the opaqueness
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 > .
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a name = 'SkPaint_isSubpixelText' > < / a >
2018-10-16 14:30:28 +00:00
---
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-11-29 17:05:25 +00:00
bool < a href = '#SkPaint_isSubpixelText' > isSubpixelText< / a > ()const
2017-07-28 19:18:29 +00:00
< / pre >
2018-12-06 13:41:14 +00:00
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.
2017-07-28 19:18:29 +00:00
2018-11-09 21:04:58 +00:00
Equivalent to < a href = '#SkPaint_getFlags' > getFlags< / a > () masked with < a href = '#SkPaint_kSubpixelText_Flag' > kSubpixelText_Flag< / a > .
2017-07-28 19:18:29 +00:00
### Return Value
2018-11-09 21:04:58 +00:00
< a href = '#SkPaint_kSubpixelText_Flag' > kSubpixelText_Flag< / a > state
2017-07-28 19:18:29 +00:00
### Example
< div > < fiddle-embed name = "abe9afc0932e2199324ae6cbb396e67c" >
#### Example Output
~~~~
paint.isSubpixelText() == !!(paint.getFlags() & SkPaint::kSubpixelText_Flag)
paint.isSubpixelText() == !!(paint.getFlags() & SkPaint::kSubpixelText_Flag)
~~~~
< / fiddle-embed > < / div >
2018-05-16 11:07:07 +00:00
< a name = 'SkPaint_setSubpixelText' > < / a >
2018-10-16 14:30:28 +00:00
---
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-11-09 21:04:58 +00:00
void < a href = '#SkPaint_setSubpixelText' > setSubpixelText< / a > (bool subpixelText)
2017-07-28 19:18:29 +00:00
< / pre >
2018-12-06 13:41:14 +00:00
Requests, but does not require, that < a href = 'undocumented#Glyph' > glyphs< / a > respect < a href = 'SkFont_Reference#Subpixel' > sub-pixel< / a > positioning.
2017-07-28 19:18:29 +00:00
2018-11-09 21:04:58 +00:00
Sets < a href = '#SkPaint_kSubpixelText_Flag' > kSubpixelText_Flag< / a > if < a href = '#SkPaint_setSubpixelText_subpixelText' > subpixelText< / a > is true.
Clears < a href = '#SkPaint_kSubpixelText_Flag' > kSubpixelText_Flag< / a > if < a href = '#SkPaint_setSubpixelText_subpixelText' > subpixelText< / a > is false.
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkPaint_setSubpixelText_subpixelText' > < code > < strong > subpixelText< / strong > < / code > < / a > < / td >
2018-10-31 16:14:03 +00:00
< td > setting for < a href = '#SkPaint_kSubpixelText_Flag' > kSubpixelText_Flag< / a > < / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
< div > < fiddle-embed name = "a77bbc1a4e3be9a8ab0f842f877c5ee4" >
#### Example Output
~~~~
paint1 == paint2
~~~~
< / fiddle-embed > < / div >
2018-10-16 14:30:28 +00:00
< a name = 'LCD_Text' > < / a >
2017-07-28 19:18:29 +00:00
2018-12-06 13:41:14 +00:00
When set, < a href = '#Font_Anti_Alias' > Font_Anti_Alias< / a > takes advantage of the organization of RGB stripes that
2018-11-09 21:04:58 +00:00
create a < a href = 'SkColor_Reference#Color' > color< / a > , and relies
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.
2018-12-06 13:41:14 +00:00
< a href = '#Font_Anti_Alias' > Font_Anti_Alias< / a > can be enabled on devices that orient stripes horizontally or vertically, and that order
2018-11-09 21:04:58 +00:00
the < a href = 'SkColor_Reference#Color' > color< / a > components as RGB or BGR.
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a name = 'SkPaint_isLCDRenderText' > < / a >
2018-10-16 14:30:28 +00:00
---
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-11-29 17:05:25 +00:00
bool < a href = '#SkPaint_isLCDRenderText' > isLCDRenderText< / a > ()const
2017-07-28 19:18:29 +00:00
< / pre >
2018-11-09 21:04:58 +00:00
Returns true if < a href = 'undocumented#Glyph' > glyphs< / a > may use LCD striping to improve < a href = 'undocumented#Glyph' > glyph< / a > edges.
2017-07-28 19:18:29 +00:00
2018-11-09 21:04:58 +00:00
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.
2017-07-28 19:18:29 +00:00
### Return Value
2018-11-09 21:04:58 +00:00
< a href = '#SkPaint_kLCDRenderText_Flag' > kLCDRenderText_Flag< / a > state
2017-07-28 19:18:29 +00:00
### Example
2018-07-09 05:28:19 +00:00
< div > < fiddle-embed name = "68e1fd95dd2fd06a333899d2bd2396b9" >
2017-07-28 19:18:29 +00:00
#### Example Output
~~~~
paint.isLCDRenderText() == !!(paint.getFlags() & SkPaint::kLCDRenderText_Flag)
paint.isLCDRenderText() == !!(paint.getFlags() & SkPaint::kLCDRenderText_Flag)
~~~~
< / fiddle-embed > < / div >
2018-05-16 11:07:07 +00:00
< a name = 'SkPaint_setLCDRenderText' > < / a >
2018-10-16 14:30:28 +00:00
---
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-11-09 21:04:58 +00:00
void < a href = '#SkPaint_setLCDRenderText' > setLCDRenderText< / a > (bool lcdText)
2017-07-28 19:18:29 +00:00
< / pre >
2018-11-09 21:04:58 +00:00
Requests, but does not require, that < a href = 'undocumented#Glyph' > glyphs< / a > use LCD striping for < a href = 'undocumented#Glyph' > glyph< / a > edges.
2017-07-28 19:18:29 +00:00
2018-11-09 21:04:58 +00:00
Sets < a href = '#SkPaint_kLCDRenderText_Flag' > kLCDRenderText_Flag< / a > if < a href = '#SkPaint_setLCDRenderText_lcdText' > lcdText< / a > is true.
Clears < a href = '#SkPaint_kLCDRenderText_Flag' > kLCDRenderText_Flag< / a > if < a href = '#SkPaint_setLCDRenderText_lcdText' > lcdText< / a > is false.
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkPaint_setLCDRenderText_lcdText' > < code > < strong > lcdText< / strong > < / code > < / a > < / td >
2018-10-31 16:14:03 +00:00
< td > setting for < a href = '#SkPaint_kLCDRenderText_Flag' > kLCDRenderText_Flag< / a > < / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
2018-07-16 05:29:00 +00:00
< div > < fiddle-embed name = "50dedf8450159571a3edaf4f0050defe" >
2017-07-28 19:18:29 +00:00
#### Example Output
~~~~
paint1 == paint2
~~~~
< / fiddle-embed > < / div >
2018-12-06 13:41:14 +00:00
< a name = 'Embedded_Bitmaps' > < / a >
2017-07-28 19:18:29 +00:00
2018-10-16 14:30:28 +00:00
---
2018-02-01 14:37:32 +00:00
2018-12-06 13:41:14 +00:00
< 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 > .
2018-11-09 21:04:58 +00:00
< 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
2018-11-29 17:05:25 +00:00
in a < a href = 'SkFont_Reference#Font' > font< / a > if the platform supports this option.
2017-07-28 19:18:29 +00:00
2018-11-09 21:04:58 +00:00
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
the outline < a href = 'undocumented#Glyph' > glyph< / a > if < a href = '#SkPaint_kEmbeddedBitmapText_Flag' > kEmbeddedBitmapText_Flag< / a > is clear.
Windows may select the < a href = 'SkBitmap_Reference#Bitmap' > bitmap< / a > < a href = 'undocumented#Glyph' > glyph< / a > but is not required to do so.
< a href = '#OS_X' > OS_X< / a > and iOS do not support this option.
2017-07-28 19:18:29 +00:00
2018-12-06 13:41:14 +00:00
< a href = '#Font_Embedded_Bitmaps' > Font_Embedded_Bitmaps< / a > is disabled by default.
< 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
2018-11-09 21:04:58 +00:00
< a href = '#SkPaint_kEmbeddedBitmapText_Flag' > kEmbeddedBitmapText_Flag< / a > at compile time.
2017-07-28 19:18:29 +00:00
### Example
2017-11-27 15:44:06 +00:00
< pre style = "padding: 1em 1em 1em 1em; font-size: 13px width: 62.5em; background-color: #f0f0f0 " >
2018-03-05 18:26:16 +00:00
< div > The "hintgasp" TrueType font in the Skia resources/fonts directory
2017-11-27 15:44:06 +00:00
includes an embedded bitmap Glyph at odd font sizes. This example works
on platforms that use FreeType as their Font_Engine.
Windows may, but is not required to, return a bitmap glyph if
kEmbeddedBitmapText_Flag is set.< / div > SkBitmap bitmap;
bitmap.allocN32Pixels(30, 15);
bitmap.eraseColor(0);
SkCanvas offscreen(bitmap);
SkPaint paint;
paint.setAntiAlias(true);
paint.setTextSize(13);
2017-12-08 19:25:14 +00:00
paint.setTypeface(MakeResourceAsTypeface("fonts/hintgasp.ttf"));
2017-11-27 15:44:06 +00:00
for (bool embedded : { false, true}) {
paint.setEmbeddedBitmapText(embedded);
offscreen.drawString("A", embedded ? 5 : 15, 15, paint);
}
canvas->drawBitmap(bitmap, 0, 0);
canvas->scale(10, 10);
canvas->drawBitmap(bitmap, -2, 1);
2018-03-05 18:26:16 +00:00
2017-11-27 15:44:06 +00:00
< / pre >
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a name = 'SkPaint_isEmbeddedBitmapText' > < / a >
2018-10-16 14:30:28 +00:00
---
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-11-29 17:05:25 +00:00
bool < a href = '#SkPaint_isEmbeddedBitmapText' > isEmbeddedBitmapText< / a > ()const
2017-07-28 19:18:29 +00:00
< / pre >
2018-11-29 17:05:25 +00:00
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.
2017-07-28 19:18:29 +00:00
2018-11-09 21:04:58 +00:00
Equivalent to < a href = '#SkPaint_getFlags' > getFlags< / a > () masked with < a href = '#SkPaint_kEmbeddedBitmapText_Flag' > kEmbeddedBitmapText_Flag< / a > .
2017-07-28 19:18:29 +00:00
### Return Value
2018-11-09 21:04:58 +00:00
< a href = '#SkPaint_kEmbeddedBitmapText_Flag' > kEmbeddedBitmapText_Flag< / a > state
2017-07-28 19:18:29 +00:00
### Example
< div > < fiddle-embed name = "eba10b27b790e87183ae451b3fc5c4b1" >
#### Example Output
~~~~
paint.isEmbeddedBitmapText() == !!(paint.getFlags() & SkPaint::kEmbeddedBitmapText_Flag)
paint.isEmbeddedBitmapText() == !!(paint.getFlags() & SkPaint::kEmbeddedBitmapText_Flag)
~~~~
< / fiddle-embed > < / div >
2018-05-16 11:07:07 +00:00
< a name = 'SkPaint_setEmbeddedBitmapText' > < / a >
2018-10-16 14:30:28 +00:00
---
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-11-09 21:04:58 +00:00
void < a href = '#SkPaint_setEmbeddedBitmapText' > setEmbeddedBitmapText< / a > (bool useEmbeddedBitmapText)
2017-07-28 19:18:29 +00:00
< / pre >
2018-11-09 21:04:58 +00:00
Requests, but does not require, to use < a href = 'SkBitmap_Reference#Bitmap' > bitmaps< / a > in fonts instead of outlines.
2017-07-28 19:18:29 +00:00
2018-11-09 21:04:58 +00:00
Sets < a href = '#SkPaint_kEmbeddedBitmapText_Flag' > kEmbeddedBitmapText_Flag< / a > if < a href = '#SkPaint_setEmbeddedBitmapText_useEmbeddedBitmapText' > useEmbeddedBitmapText< / a > is true.
Clears < a href = '#SkPaint_kEmbeddedBitmapText_Flag' > kEmbeddedBitmapText_Flag< / a > if < a href = '#SkPaint_setEmbeddedBitmapText_useEmbeddedBitmapText' > useEmbeddedBitmapText< / a > is false.
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkPaint_setEmbeddedBitmapText_useEmbeddedBitmapText' > < code > < strong > useEmbeddedBitmapText< / strong > < / code > < / a > < / td >
2018-10-31 16:14:03 +00:00
< td > setting for < a href = '#SkPaint_kEmbeddedBitmapText_Flag' > kEmbeddedBitmapText_Flag< / a > < / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
< div > < fiddle-embed name = "246dffdd93a484ba4ad7ecf71198a5d4" >
#### Example Output
~~~~
paint1 == paint2
~~~~
< / fiddle-embed > < / div >
2018-10-16 14:30:28 +00:00
< a name = 'Automatic_Hinting' > < / a >
2018-02-01 14:37:32 +00:00
2018-12-06 13:41:14 +00:00
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 >
2018-11-09 21:04:58 +00:00
instructs the < a href = '#Font_Manager' > Font_Manager< / a > to always hint < a href = 'undocumented#Glyph' > Glyphs< / a > .
2018-12-06 13:41:14 +00:00
< 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
2018-11-09 21:04:58 +00:00
< a href = 'undocumented#SkFontHinting' > SkFontHinting< / a > ::< a href = '#SkFontHinting_kSlight' > kSlight< / a > .
2017-07-28 19:18:29 +00:00
2018-12-06 13:41:14 +00:00
< a href = '#Font_Force_Hinting' > Font_Force_Hinting< / a > only affects platforms that use FreeType as the < a href = '#Font_Manager' > Font_Manager< / a > .
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a name = 'SkPaint_isAutohinted' > < / a >
2018-10-16 14:30:28 +00:00
---
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-11-29 17:05:25 +00:00
bool < a href = '#SkPaint_isAutohinted' > isAutohinted< / a > ()const
2017-07-28 19:18:29 +00:00
< / pre >
2018-11-15 13:25:12 +00:00
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
2018-11-29 17:05:25 +00:00
< 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.
If true, instructs the < a href = 'SkFont_Reference#Font' > font< / a > manager to always hint < a href = 'undocumented#Glyph' > glyphs< / a > .
2017-07-28 19:18:29 +00:00
2018-11-09 21:04:58 +00:00
Equivalent to < a href = '#SkPaint_getFlags' > getFlags< / a > () masked with < a href = '#SkPaint_kAutoHinting_Flag' > kAutoHinting_Flag< / a > .
2017-07-28 19:18:29 +00:00
### Return Value
2018-11-09 21:04:58 +00:00
< a href = '#SkPaint_kAutoHinting_Flag' > kAutoHinting_Flag< / a > state
2017-07-28 19:18:29 +00:00
### Example
< div > < fiddle-embed name = "aa4781afbe3b90e7ef56a287e5b9ce1e" >
#### Example Output
~~~~
paint.isAutohinted() == !!(paint.getFlags() & SkPaint::kAutoHinting_Flag)
paint.isAutohinted() == !!(paint.getFlags() & SkPaint::kAutoHinting_Flag)
~~~~
< / fiddle-embed > < / div >
### See Also
2018-11-15 13:25:12 +00:00
< a href = '#SkPaint_setAutohinted' > setAutohinted< / a > Hinting
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a name = 'SkPaint_setAutohinted' > < / a >
2018-10-16 14:30:28 +00:00
---
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-11-09 21:04:58 +00:00
void < a href = '#SkPaint_setAutohinted' > setAutohinted< / a > (bool useAutohinter)
2017-07-28 19:18:29 +00:00
< / pre >
2018-10-31 16:14:03 +00:00
Sets whether to always hint < a href = 'undocumented#Glyph' > glyphs< / a > .
2018-11-15 13:25:12 +00:00
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 >
2018-11-09 21:04:58 +00:00
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 > .
2018-12-06 13:41:14 +00:00
< 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
2018-11-09 21:04:58 +00:00
< a href = 'undocumented#SkFontHinting' > SkFontHinting< / a > ::< a href = '#SkFontHinting_kSlight' > kSlight< / a > .
2017-07-28 19:18:29 +00:00
2018-10-31 16:14:03 +00:00
Only affects platforms that use FreeType as the < a href = 'undocumented#Font_Manager' > font manager< / a > .
2017-07-28 19:18:29 +00:00
2018-11-09 21:04:58 +00:00
Sets < a href = '#SkPaint_kAutoHinting_Flag' > kAutoHinting_Flag< / a > if < a href = '#SkPaint_setAutohinted_useAutohinter' > useAutohinter< / a > is true.
Clears < a href = '#SkPaint_kAutoHinting_Flag' > kAutoHinting_Flag< / a > if < a href = '#SkPaint_setAutohinted_useAutohinter' > useAutohinter< / a > is false.
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkPaint_setAutohinted_useAutohinter' > < code > < strong > useAutohinter< / strong > < / code > < / a > < / td >
2018-10-31 16:14:03 +00:00
< td > setting for < a href = '#SkPaint_kAutoHinting_Flag' > kAutoHinting_Flag< / a > < / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
< div > < fiddle-embed name = "4e185306d7de9390fe8445eed0139309" > < / fiddle-embed > < / div >
### See Also
2018-11-15 13:25:12 +00:00
< a href = '#SkPaint_isAutohinted' > isAutohinted< / a > Hinting
2017-07-28 19:18:29 +00:00
2018-10-16 14:30:28 +00:00
< a name = 'Fake_Bold' > < / a >
2017-07-28 19:18:29 +00:00
2018-10-16 14:30:28 +00:00
---
2018-02-01 14:37:32 +00:00
2018-12-06 13:41:14 +00:00
< 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
2018-11-29 17:05:25 +00:00
is not available. Skia does not provide < a href = 'SkFont_Reference#Font' > font< / a > substitution; it is up to the client to find the
bold < a href = 'SkFont_Reference#Font' > font< / a > face using the platform < a href = '#Font_Manager' > Font_Manager< / a > .
2017-07-28 19:18:29 +00:00
2018-11-29 17:05:25 +00:00
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
2018-11-09 21:04:58 +00:00
is not available.
2017-07-28 19:18:29 +00:00
2018-11-09 21:04:58 +00:00
A FreeType based port may define SK_USE_FREETYPE_EMBOLDEN at compile time to direct
2018-11-29 17:05:25 +00:00
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
2018-11-09 21:04:58 +00:00
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.
2017-07-28 19:18:29 +00:00
2018-12-06 13:41:14 +00:00
< a href = '#Font_Embolden' > Font_Embolden< / a > is disabled by default.
2017-07-28 19:18:29 +00:00
### Example
< div > < fiddle-embed name = "e811f4829a2daaaeaad3795504a7e02a" > < / fiddle-embed > < / div >
2018-05-16 11:07:07 +00:00
< a name = 'SkPaint_isFakeBoldText' > < / a >
2018-10-16 14:30:28 +00:00
---
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-11-29 17:05:25 +00:00
bool < a href = '#SkPaint_isFakeBoldText' > isFakeBoldText< / a > ()const
2017-07-28 19:18:29 +00:00
< / pre >
2018-11-07 19:59:03 +00:00
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 >
2017-07-28 19:18:29 +00:00
from outlines.
2018-11-09 21:04:58 +00:00
Equivalent to < a href = '#SkPaint_getFlags' > getFlags< / a > () masked with < a href = '#SkPaint_kFakeBoldText_Flag' > kFakeBoldText_Flag< / a > .
2017-07-28 19:18:29 +00:00
### Return Value
2018-11-09 21:04:58 +00:00
< a href = '#SkPaint_kFakeBoldText_Flag' > kFakeBoldText_Flag< / a > state
2017-07-28 19:18:29 +00:00
### Example
< div > < fiddle-embed name = "f54d1f85b16073b80b9eef2e1a1d151d" >
#### Example Output
~~~~
paint.isFakeBoldText() == !!(paint.getFlags() & SkPaint::kFakeBoldText_Flag)
paint.isFakeBoldText() == !!(paint.getFlags() & SkPaint::kFakeBoldText_Flag)
~~~~
< / fiddle-embed > < / div >
2018-05-16 11:07:07 +00:00
< a name = 'SkPaint_setFakeBoldText' > < / a >
2018-10-16 14:30:28 +00:00
---
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-11-09 21:04:58 +00:00
void < a href = '#SkPaint_setFakeBoldText' > setFakeBoldText< / a > (bool fakeBoldText)
2017-07-28 19:18:29 +00:00
< / pre >
2018-11-09 21:04:58 +00:00
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 > .
2017-07-28 19:18:29 +00:00
2018-11-09 21:04:58 +00:00
Sets < a href = '#SkPaint_kFakeBoldText_Flag' > kFakeBoldText_Flag< / a > if < a href = '#SkPaint_setFakeBoldText_fakeBoldText' > fakeBoldText< / a > is true.
Clears < a href = '#SkPaint_kFakeBoldText_Flag' > kFakeBoldText_Flag< / a > if < a href = '#SkPaint_setFakeBoldText_fakeBoldText' > fakeBoldText< / a > is false.
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkPaint_setFakeBoldText_fakeBoldText' > < code > < strong > fakeBoldText< / strong > < / code > < / a > < / td >
2018-10-31 16:14:03 +00:00
< td > setting for < a href = '#SkPaint_kFakeBoldText_Flag' > kFakeBoldText_Flag< / a > < / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
< div > < fiddle-embed name = "594d47858eb11028cb626515a520910a" >
#### Example Output
~~~~
paint1 == paint2
~~~~
< / fiddle-embed > < / div >
2018-10-16 14:30:28 +00:00
< a name = 'Filter_Quality_Methods' > < / a >
2017-07-28 19:18:29 +00:00
2018-10-16 14:30:28 +00:00
---
2018-02-01 14:37:32 +00:00
2018-11-09 21:04:58 +00:00
< 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.
A lower < a href = '#Filter_Quality' > Filter_Quality< / a > draws faster, but has less fidelity.
A higher < a href = '#Filter_Quality' > Filter_Quality< / a > draws slower, but looks better.
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
in a noticeable difference.
2017-07-28 19:18:29 +00:00
2018-11-09 21:04:58 +00:00
< a href = '#Filter_Quality' > Filter_Quality< / a > is used in < a href = 'SkPaint_Reference#Paint' > Paint< / a > passed as a parameter to
2017-07-28 19:18:29 +00:00
< table > < tr >
2018-11-07 19:59:03 +00:00
< td > < a href = 'SkCanvas_Reference#SkCanvas' > SkCanvas< / a > ::< a href = '#SkCanvas_drawBitmap' > drawBitmap< / a > < / td >
2018-05-16 11:07:07 +00:00
< / tr > < tr >
2018-11-07 19:59:03 +00:00
< td > < a href = 'SkCanvas_Reference#SkCanvas' > SkCanvas< / a > ::< a href = '#SkCanvas_drawBitmapRect' > drawBitmapRect< / a > < / td >
2018-05-16 11:07:07 +00:00
< / tr > < tr >
2018-11-07 19:59:03 +00:00
< td > < a href = 'SkCanvas_Reference#SkCanvas' > SkCanvas< / a > ::< a href = '#SkCanvas_drawImage' > drawImage< / a > < / td >
2018-05-16 11:07:07 +00:00
< / tr > < tr >
2018-11-07 19:59:03 +00:00
< td > < a href = 'SkCanvas_Reference#SkCanvas' > SkCanvas< / a > ::< a href = '#SkCanvas_drawImageRect' > drawImageRect< / a > < / td >
2018-05-16 11:07:07 +00:00
< / tr >
2017-07-28 19:18:29 +00:00
< / table >
2018-11-09 21:04:58 +00:00
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 > .
2017-07-28 19:18:29 +00:00
2018-11-09 21:04:58 +00:00
< a href = '#Filter_Quality' > Filter_Quality< / a > is < a href = 'undocumented#kNone_SkFilterQuality' > kNone_SkFilterQuality< / a > by default.
2017-07-28 19:18:29 +00:00
### Example
2018-05-03 06:27:39 +00:00
< div > < fiddle-embed name = "69369cff2f5b145a6f616092513266a0" > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a name = 'SkPaint_getFilterQuality' > < / a >
2018-10-16 14:30:28 +00:00
---
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-11-29 17:05:25 +00:00
< a href = 'undocumented#SkFilterQuality' > SkFilterQuality< / a > < a href = '#SkPaint_getFilterQuality' > getFilterQuality< / a > ()const
2017-07-28 19:18:29 +00:00
< / pre >
2018-11-09 21:04:58 +00:00
Returns < a href = 'undocumented#SkFilterQuality' > SkFilterQuality< / a > , the < a href = 'SkImage_Reference#Image' > image< / a > filtering level. A lower setting
draws faster; a higher setting looks better when the < a href = 'SkImage_Reference#Image' > image< / a > is scaled.
2017-07-28 19:18:29 +00:00
### Return Value
2018-05-16 11:07:07 +00:00
one of: < a href = 'undocumented#kNone_SkFilterQuality' > kNone_SkFilterQuality< / a > , < a href = 'undocumented#kLow_SkFilterQuality' > kLow_SkFilterQuality< / a > ,
2018-10-31 16:14:03 +00:00
2018-05-16 11:07:07 +00:00
< a href = 'undocumented#kMedium_SkFilterQuality' > kMedium_SkFilterQuality< / a > , < a href = 'undocumented#kHigh_SkFilterQuality' > kHigh_SkFilterQuality< / a >
2017-07-28 19:18:29 +00:00
### Example
< div > < fiddle-embed name = "d4ca1f23809b6835c4ba46ea98a86900" >
#### Example Output
~~~~
kNone_SkFilterQuality == paint.getFilterQuality()
~~~~
< / fiddle-embed > < / div >
2018-05-16 11:07:07 +00:00
< a name = 'SkPaint_setFilterQuality' > < / a >
2018-10-16 14:30:28 +00:00
---
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-11-09 21:04:58 +00:00
void < a href = '#SkPaint_setFilterQuality' > setFilterQuality< / a > (< a href = 'undocumented#SkFilterQuality' > SkFilterQuality< / a > quality)
2017-07-28 19:18:29 +00:00
< / pre >
2018-11-09 21:04:58 +00:00
Sets < a href = 'undocumented#SkFilterQuality' > SkFilterQuality< / a > , the < a href = 'SkImage_Reference#Image' > image< / a > filtering level. A lower setting
draws faster; a higher setting looks better when the < a href = 'SkImage_Reference#Image' > image< / a > is scaled.
Does not check to see if < a href = '#SkPaint_setFilterQuality_quality' > quality< / a > is valid.
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkPaint_setFilterQuality_quality' > < code > < strong > quality< / strong > < / code > < / a > < / td >
2018-10-31 16:14:03 +00:00
< td > one of: < a href = 'undocumented#kNone_SkFilterQuality' > kNone_SkFilterQuality< / a > , < a href = 'undocumented#kLow_SkFilterQuality' > kLow_SkFilterQuality< / a > ,< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
2018-10-31 16:14:03 +00:00
< a href = 'undocumented#kMedium_SkFilterQuality' > kMedium_SkFilterQuality< / a > , < a href = 'undocumented#kHigh_SkFilterQuality' > kHigh_SkFilterQuality< / a >
2017-07-28 19:18:29 +00:00
### Example
< div > < fiddle-embed name = "e4288fabf24ee60b645e8bb6ea0afadf" >
#### Example Output
~~~~
kHigh_SkFilterQuality == paint.getFilterQuality()
~~~~
< / fiddle-embed > < / div >
### See Also
2018-11-07 19:59:03 +00:00
< a href = 'undocumented#SkFilterQuality' > SkFilterQuality< / a > < a href = '#Image_Scaling' > Image_Scaling< / a >
2017-07-28 19:18:29 +00:00
2018-10-16 14:30:28 +00:00
< a name = 'Color_Methods' > < / a >
2017-07-28 19:18:29 +00:00
2018-10-16 14:30:28 +00:00
---
2017-07-28 19:18:29 +00:00
2018-01-30 15:08:57 +00:00
| name | description |
| --- | --- |
2018-11-09 21:04:58 +00:00
| < 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 > |
| < 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 > |
2018-01-30 15:08:57 +00:00
2018-11-09 21:04:58 +00:00
< a href = 'SkColor_Reference#Color' > Color< / a > specifies the red, blue, green, and < a href = '#Color_Alpha' > Color_Alpha< / a >
values used to draw a filled or stroked shape in a 32-bit value. Each component
occupies 8-bits, ranging from zero: no contribution; to 255: full intensity.
All values in any combination are valid.
2018-01-30 15:08:57 +00:00
2018-11-09 21:04:58 +00:00
< 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
RGB: red, blue, and green.
2017-07-28 19:18:29 +00:00
2018-11-09 21:04:58 +00:00
The bit positions of < a href = '#Color_Alpha' > Color_Alpha< / a > and RGB are independent of the bit
positions on the output < a href = 'undocumented#Device' > device< / a > , which may have more or fewer bits, and may have
a different arrangement.
2017-07-28 19:18:29 +00:00
2018-11-07 19:59:03 +00:00
| bit positions | < a href = '#Color_Alpha' > Color_Alpha< / a > | red | blue | green |
2017-07-28 19:18:29 +00:00
| --- | --- | --- | --- | --- |
| | 31 - 24 | 23 - 16 | 15 - 8 | 7 - 0 |
### Example
2018-07-19 03:49:13 +00:00
< div > < fiddle-embed name = "214b559d75c65a7bef6ef4be1f860053" > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a name = 'SkPaint_getColor' > < / a >
2018-10-16 14:30:28 +00:00
---
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-11-29 17:05:25 +00:00
< a href = 'SkColor_Reference#SkColor' > SkColor< / a > < a href = '#SkPaint_getColor' > getColor< / a > ()const
2017-07-28 19:18:29 +00:00
< / pre >
2018-11-09 21:04:58 +00:00
Retrieves < a href = 'SkColor_Reference#Alpha' > alpha< / a > and RGB, < a href = 'undocumented#Unpremultiply' > unpremultiplied< / a > , packed into 32 bits.
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
a < a href = 'SkColor_Reference#Color' > color< / a > component.
2017-07-28 19:18:29 +00:00
### Return Value
2018-11-09 21:04:58 +00:00
< a href = 'undocumented#Unpremultiply' > unpremultiplied< / a > ARGB
2017-07-28 19:18:29 +00:00
### Example
2018-07-11 05:28:17 +00:00
< div > < fiddle-embed name = "72d41f890203109a41f589a7403acae9" >
2017-07-28 19:18:29 +00:00
#### Example Output
~~~~
Yellow is 100% red, 100% green, and 0% blue.
~~~~
< / fiddle-embed > < / div >
### See Also
2018-09-05 15:39:01 +00:00
< a href = '#SkPaint_getColor4f' > getColor4f< / a > < a href = 'SkColor_Reference#SkColor' > SkColor< / a >
< a name = 'SkPaint_getColor4f' > < / a >
2018-10-16 14:30:28 +00:00
---
2018-09-05 15:39:01 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-11-29 17:05:25 +00:00
< a href = 'SkColor4f_Reference#SkColor4f' > SkColor4f< / a > < a href = '#SkPaint_getColor4f' > getColor4f< / a > ()const
2018-09-05 15:39:01 +00:00
< / pre >
2018-11-09 21:04:58 +00:00
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
2018-09-05 15:39:01 +00:00
are extended sRGB values (sRGB gamut, and encoded with the sRGB transfer function).
### Return Value
2018-11-09 21:04:58 +00:00
< a href = 'undocumented#Unpremultiply' > unpremultiplied< / a > RGBA
2018-09-05 15:39:01 +00:00
### Example
< div > < fiddle-embed name = "8512ea2176f36e8f1aeef311ff228790" >
#### Example Output
~~~~
Yellow is 100% red, 100% green, and 0% blue.
~~~~
< / fiddle-embed > < / div >
### See Also
< a href = '#SkPaint_getColor' > getColor< / a > < a href = 'SkColor_Reference#SkColor' > SkColor< / a >
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a name = 'SkPaint_setColor' > < / a >
2018-10-16 14:30:28 +00:00
---
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-11-07 19:59:03 +00:00
void < a href = '#SkPaint_setColor' > setColor< / a > (< a href = 'SkColor_Reference#SkColor' > SkColor< / a > < a href = 'SkColor_Reference#Color' > color< / a > )
2017-07-28 19:18:29 +00:00
< / pre >
2018-11-09 21:04:58 +00:00
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,
< a href = 'undocumented#Unpremultiply' > unpremultiplied< / a > , packing 8-bit components for < a href = 'SkColor_Reference#Alpha' > alpha< / a > , red, blue, and green.
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkPaint_setColor_color' > < code > < strong > color< / strong > < / code > < / a > < / td >
2018-11-09 21:04:58 +00:00
< td > < a href = 'undocumented#Unpremultiply' > unpremultiplied< / a > ARGB< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
2018-07-04 05:33:26 +00:00
< div > < fiddle-embed name = "6e70f18300bd676a3c056ceb6b62f8df" >
2017-07-28 19:18:29 +00:00
#### Example Output
~~~~
green1 == green2
~~~~
< / fiddle-embed > < / div >
### See Also
2018-09-05 15:39:01 +00:00
< 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 >
< a name = 'SkPaint_setColor4f' > < / a >
2018-10-16 14:30:28 +00:00
---
2018-09-05 15:39:01 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-11-09 21:04:58 +00:00
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)
2018-09-05 15:39:01 +00:00
< / pre >
2018-11-09 21:04:58 +00:00
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
< 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
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
2018-10-31 16:14:03 +00:00
sRGB < a href = 'undocumented#Color_Space' > color space< / a > .
2018-09-05 15:39:01 +00:00
### Parameters
< table > < tr > < td > < a name = 'SkPaint_setColor4f_color' > < code > < strong > color< / strong > < / code > < / a > < / td >
2018-11-09 21:04:58 +00:00
< td > < a href = 'undocumented#Unpremultiply' > unpremultiplied< / a > RGBA< / td >
2018-09-05 15:39:01 +00:00
< / tr >
< tr > < td > < a name = 'SkPaint_setColor4f_colorSpace' > < code > < strong > colorSpace< / strong > < / code > < / a > < / td >
2018-11-09 21:04:58 +00:00
< td > < a href = 'undocumented#SkColorSpace' > SkColorSpace< / a > describing the encoding of < a href = '#SkPaint_setColor4f_color' > color< / a > < / td >
2018-09-05 15:39:01 +00:00
< / tr >
< / table >
### Example
< div > < fiddle-embed name = "fa60859e3d03bdc117a05b32e093a8f1" >
#### Example Output
~~~~
green1 == green2
~~~~
< / fiddle-embed > < / div >
### See Also
< 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 >
2017-07-28 19:18:29 +00:00
2018-10-16 14:30:28 +00:00
< a name = 'Alpha_Methods' > < / a >
2017-07-28 19:18:29 +00:00
2018-11-09 21:04:58 +00:00
< a href = '#Color_Alpha' > Color_Alpha< / a > sets the transparency independent of RGB: red, blue, and green.
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a name = 'SkPaint_getAlpha' > < / a >
2018-10-16 14:30:28 +00:00
---
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-11-29 17:05:25 +00:00
uint8_t < a href = '#SkPaint_getAlpha' > getAlpha< / a > ()const
2017-07-28 19:18:29 +00:00
< / pre >
2018-11-09 21:04:58 +00:00
Retrieves < a href = 'SkColor_Reference#Alpha' > alpha< / a > from the < a href = 'SkColor_Reference#Color' > color< / a > used when stroking and filling.
2017-07-28 19:18:29 +00:00
### Return Value
2018-11-09 21:04:58 +00:00
< a href = 'SkColor_Reference#Alpha' > alpha< / a > ranging from zero, fully transparent, to 255, fully opaque
2017-07-28 19:18:29 +00:00
### Example
2018-07-18 20:21:51 +00:00
< div > < fiddle-embed name = "9a85bb62fe3d877b18fb7f952c4fa7f7" >
2017-07-28 19:18:29 +00:00
#### Example Output
~~~~
255 == paint.getAlpha()
~~~~
< / fiddle-embed > < / div >
2018-05-16 11:07:07 +00:00
< a name = 'SkPaint_setAlpha' > < / a >
2018-10-16 14:30:28 +00:00
---
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-11-09 21:04:58 +00:00
void < a href = '#SkPaint_setAlpha' > setAlpha< / a > (< a href = 'undocumented#U8CPU' > U8CPU< / a > a)
2017-07-28 19:18:29 +00:00
< / pre >
2018-11-09 21:04:58 +00:00
Replaces < a href = 'SkColor_Reference#Alpha' > alpha< / a > , leaving RGB
2017-07-28 19:18:29 +00:00
unchanged. An out of range value triggers an assert in the debug
2018-11-09 21:04:58 +00:00
build. < a href = '#SkPaint_setAlpha_a' > a< / a > is < a href = '#SkPaint_setAlpha_a' > a< / a > value from zero to 255.
< 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 >
2017-07-28 19:18:29 +00:00
fully opaque.
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkPaint_setAlpha_a' > < code > < strong > a< / strong > < / code > < / a > < / td >
2018-11-09 21:04:58 +00:00
< td > < a href = 'SkColor_Reference#Alpha' > alpha< / a > component of < a href = 'SkColor_Reference#Color' > color< / a > < / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
2018-07-19 03:49:13 +00:00
< div > < fiddle-embed name = "6ddc0360512dfb9947e75c17e6a8103d" >
2017-07-28 19:18:29 +00:00
#### Example Output
~~~~
0x44112233 == paint.getColor()
~~~~
< / fiddle-embed > < / div >
2018-05-16 11:07:07 +00:00
< a name = 'SkPaint_setARGB' > < / a >
2018-10-16 14:30:28 +00:00
---
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-11-09 21:04:58 +00:00
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)
2017-07-28 19:18:29 +00:00
< / pre >
2018-11-09 21:04:58 +00:00
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.
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.
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkPaint_setARGB_a' > < code > < strong > a< / strong > < / code > < / a > < / td >
2018-11-09 21:04:58 +00:00
< td > amount of < a href = 'SkColor_Reference#Alpha' > alpha< / a > , from fully transparent (0) to fully opaque (255)< / td >
2018-05-16 11:07:07 +00:00
< / tr >
< tr > < td > < a name = 'SkPaint_setARGB_r' > < code > < strong > r< / strong > < / code > < / a > < / td >
2018-05-17 16:17:28 +00:00
< td > amount of red, from no red (0) to full red (255)< / td >
2018-05-16 11:07:07 +00:00
< / tr >
< tr > < td > < a name = 'SkPaint_setARGB_g' > < code > < strong > g< / strong > < / code > < / a > < / td >
2018-05-17 16:17:28 +00:00
< td > amount of green, from no green (0) to full green (255)< / td >
2018-05-16 11:07:07 +00:00
< / tr >
< tr > < td > < a name = 'SkPaint_setARGB_b' > < code > < strong > b< / strong > < / code > < / a > < / td >
2018-05-17 16:17:28 +00:00
< td > amount of blue, from no blue (0) to full blue (255)< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
2018-07-11 05:28:17 +00:00
< div > < fiddle-embed name = "cb62e4755789ed32f7120dc55984959d" >
2017-07-28 19:18:29 +00:00
#### Example Output
~~~~
transRed1 == transRed2
~~~~
< / fiddle-embed > < / div >
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkPaint_setColor' > setColor< / a > < a href = 'SkColor_Reference#SkColorSetARGB' > SkColorSetARGB< / a >
2017-07-28 19:18:29 +00:00
2018-10-16 14:30:28 +00:00
< a name = 'Style' > < / a >
2017-07-28 19:18:29 +00:00
2018-10-16 14:30:28 +00:00
---
2018-02-01 14:37:32 +00:00
2018-11-09 21:04:58 +00:00
< a href = '#SkPaint_Style' > Style< / a > specifies if the geometry is filled, stroked, or both filled and stroked.
Some shapes ignore < a href = '#SkPaint_Style' > Style< / a > and are always drawn filled or stroked.
2017-07-28 19:18:29 +00:00
2018-10-16 14:30:28 +00:00
< a name = 'Style_Fill' > < / a >
2018-11-09 21:04:58 +00:00
Set < a href = '#SkPaint_Style' > Style< / a > to < a href = '#SkPaint_kFill_Style' > kFill_Style< / a > to fill the shape.
The fill covers the area inside the geometry for most shapes.
2017-07-28 19:18:29 +00:00
2018-10-16 14:30:28 +00:00
< a name = 'Style_Stroke' > < / a >
2017-07-28 19:18:29 +00:00
2018-11-09 21:04:58 +00:00
Set < a href = '#SkPaint_Style' > Style< / a > to < a href = '#SkPaint_kStroke_Style' > kStroke_Style< / a > to stroke the shape.
2017-07-28 19:18:29 +00:00
2018-11-09 21:04:58 +00:00
The stroke covers the area described by following the shape edge with a pen or brush of
< 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 > .
The area covered where the shape turns a corner is described by < a href = '#Paint_Stroke_Join' > Stroke_Join< / a > .
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
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.
2017-07-28 19:18:29 +00:00
2018-10-16 14:30:28 +00:00
### See Also
2018-11-07 19:59:03 +00:00
< 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 >
2018-10-16 14:30:28 +00:00
< a name = 'Hairline' > < / a >
---
2017-07-28 19:18:29 +00:00
2018-11-09 21:04:58 +00:00
< a href = '#Paint_Stroke_Width' > Stroke_Width< / a > of zero has a special meaning and switches drawing to use Hairline.
Hairline draws the thinnest continuous frame. If < a href = '#SkPaint_kAntiAlias_Flag' > kAntiAlias_Flag< / a > is clear, adjacent pixels
flow horizontally, vertically,or diagonally.
2017-07-28 19:18:29 +00:00
2018-11-09 21:04:58 +00:00
< 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
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
< 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
GPU-backed implementations apply transparency at a later drawing stage, avoiding double hit pixels
while stroking.
2017-07-28 19:18:29 +00:00
2018-10-16 14:30:28 +00:00
### See Also
2018-11-07 19:59:03 +00:00
< 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 >
2018-10-16 14:30:28 +00:00
< a name = 'SkPaint_Style' > < / a >
---
2017-07-28 19:18:29 +00:00
2017-11-27 15:44:06 +00:00
< pre style = "padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0 " >
2018-11-09 21:04:58 +00:00
enum < a href = '#SkPaint_Style' > Style< / a > : uint8_t {
2018-10-08 18:57:48 +00:00
< a href = '#SkPaint_kFill_Style' > kFill_Style< / a > ,
< a href = '#SkPaint_kStroke_Style' > kStroke_Style< / a > ,
< a href = '#SkPaint_kStrokeAndFill_Style' > kStrokeAndFill_Style< / a > ,
2018-04-03 12:43:27 +00:00
};
2018-11-29 17:05:25 +00:00
2018-10-16 14:30:28 +00:00
< / pre >
2018-04-26 12:32:37 +00:00
2018-10-16 14:30:28 +00:00
< pre style = "padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0 " >
2018-10-08 18:57:48 +00:00
static constexpr int < a href = '#SkPaint_kStyleCount' > kStyleCount< / a > = < a href = '#SkPaint_kStrokeAndFill_Style' > kStrokeAndFill_Style< / a > + 1;
2018-03-05 18:26:16 +00:00
< / pre >
2017-07-28 19:18:29 +00:00
2018-11-09 21:04:58 +00:00
Set < a href = '#SkPaint_Style' > Style< / a > to fill, stroke, or both fill and stroke geometry.
The stroke and fill
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 > .
2017-07-28 19:18:29 +00:00
2018-11-09 21:04:58 +00:00
Use < a href = '#SkPaint_kStrokeAndFill_Style' > kStrokeAndFill_Style< / a > to avoid hitting the same pixels twice with a stroke draw and
a fill draw.
2017-07-28 19:18:29 +00:00
### Constants
2018-05-16 11:07:07 +00:00
< table style = 'border-collapse: collapse; width: 62.5em' >
< tr >< th style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > Const</ th >
< th style = 'text-align: center; border: 2px solid #dddddd ; padding: 8px; ' > Value</ th >
< th style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > Description</ th ></ tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a name = 'SkPaint_kFill_Style' >< code > SkPaint::kFill_Style</ code ></ a ></ td >
< td style = 'text-align: center; border: 2px solid #dddddd ; padding: 8px; ' > 0</ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >
2018-11-09 21:04:58 +00:00
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 > .
< 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
< a href = '#SkPaint_kFill_Style' > kFill_Style< / a > is set, and ignore the set < a href = '#SkPaint_Style' > Style< / a > .
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,
and to create an unfilled hole inside the shape.
< a href = '#SkPaint_Style' > Style< / a > is set to < a href = '#SkPaint_kFill_Style' > kFill_Style< / a > by default.
2018-03-05 18:26:16 +00:00
< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< tr >
2018-05-16 11:07:07 +00:00
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a name = 'SkPaint_kStroke_Style' >< code > SkPaint::kStroke_Style</ code ></ a ></ td >
< td style = 'text-align: center; border: 2px solid #dddddd ; padding: 8px; ' > 1</ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >
2018-11-09 21:04:58 +00:00
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 > .
< 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,
and ignore the set < a href = '#SkPaint_Style' > Style< / a > .
The stroke construction is unaffected by the < a href = '#Path_Fill_Type' > Path_Fill_Type< / a > .
2018-03-05 18:26:16 +00:00
< / td >
2017-07-28 19:18:29 +00:00
< / tr >
2018-05-16 11:07:07 +00:00
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a name = 'SkPaint_kStrokeAndFill_Style' >< code > SkPaint::kStrokeAndFill_Style</ code ></ a ></ td >
< td style = 'text-align: center; border: 2px solid #dddddd ; padding: 8px; ' > 2</ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >
2018-11-09 21:04:58 +00:00
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 > .
< 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 > ,
and the set < a href = '#Path_Fill_Type' > Path_Fill_Type< / a > is ignored.
2018-03-05 18:26:16 +00:00
< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< tr >
2018-05-16 11:07:07 +00:00
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a name = 'SkPaint_kStyleCount' >< code > SkPaint::kStyleCount</ code ></ a ></ td >
< td style = 'text-align: center; border: 2px solid #dddddd ; padding: 8px; ' > 3</ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >
2018-11-09 21:04:58 +00:00
May be used to verify that < a href = '#SkPaint_Style' > Style< / a > is a legal value.
2018-03-05 18:26:16 +00:00
< / td >
2017-07-28 19:18:29 +00:00
< / tr >
2018-05-16 11:07:07 +00:00
< / table >
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a name = 'SkPaint_getStyle' > < / a >
2018-10-16 14:30:28 +00:00
---
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-11-29 17:05:25 +00:00
< a href = '#SkPaint_Style' > Style< / a > < a href = '#SkPaint_getStyle' > getStyle< / a > ()const
2017-07-28 19:18:29 +00:00
< / pre >
2018-07-11 20:18:41 +00:00
Returns whether the geometry is filled, stroked, or filled and stroked.
2017-07-28 19:18:29 +00:00
### Return Value
2018-10-31 16:14:03 +00:00
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 >
2017-07-28 19:18:29 +00:00
### Example
< div > < fiddle-embed name = "1c5e18c3c0102d2dac86a78ba8c8ce01" >
#### Example Output
~~~~
SkPaint::kFill_Style == paint.getStyle()
~~~~
< / fiddle-embed > < / div >
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkPaint_Style' > Style< / a > < a href = '#SkPaint_setStyle' > setStyle< / a >
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a name = 'SkPaint_setStyle' > < / a >
2018-10-16 14:30:28 +00:00
---
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-11-09 21:04:58 +00:00
void < a href = '#SkPaint_setStyle' > setStyle< / a > (< a href = '#SkPaint_Style' > Style< / a > style)
2017-07-28 19:18:29 +00:00
< / pre >
Sets whether the geometry is filled, stroked, or filled and stroked.
2018-11-09 21:04:58 +00:00
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.
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkPaint_setStyle_style' > < code > < strong > style< / strong > < / code > < / a > < / td >
2018-10-31 16:14:03 +00:00
< 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 >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
< div > < fiddle-embed name = "c7bb6248e4735b8d1a32d02fba40d344" > < / fiddle-embed > < / div >
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkPaint_Style' > Style< / a > < a href = '#SkPaint_getStyle' > getStyle< / a >
2017-07-28 19:18:29 +00:00
2018-10-16 14:30:28 +00:00
< a name = 'Stroke_Width' > < / a >
2017-07-28 19:18:29 +00:00
2018-10-16 14:30:28 +00:00
---
2018-02-01 14:37:32 +00:00
2018-11-09 21:04:58 +00:00
< a href = '#Paint_Stroke_Width' > Stroke_Width< / a > sets the width for stroking. The width is the thickness
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
set to < a href = '#SkPaint_kStroke_Style' > kStroke_Style< / a > or < a href = '#SkPaint_kStrokeAndFill_Style' > kStrokeAndFill_Style< / a > .
2017-07-28 19:18:29 +00:00
2018-11-09 21:04:58 +00:00
When width is greater than zero, the stroke encompasses as many pixels partially
or fully as needed. When the width equals zero, the < a href = 'SkPaint_Reference#Paint' > paint< / a > enables hairlines;
the stroke is always one < a href = 'undocumented#Pixel' > pixel< / a > wide.
2017-07-28 19:18:29 +00:00
2018-11-09 21:04:58 +00:00
The stroke dimensions are scaled by the < a href = 'SkCanvas_Reference#Canvas_Matrix' > canvas matrix< / a > , but Hairline stroke
remains one < a href = 'undocumented#Pixel' > pixel< / a > wide regardless of scaling.
2017-07-28 19:18:29 +00:00
2018-11-09 21:04:58 +00:00
The default width for the < a href = 'SkPaint_Reference#Paint' > paint< / a > is zero.
2017-07-28 19:18:29 +00:00
### Example
2018-11-09 21:04:58 +00:00
< 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
< a href = 'undocumented#Line' > line< / a > and the platform implementation.
2018-03-05 18:26:16 +00:00
< / div > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a name = 'SkPaint_getStrokeWidth' > < / a >
2018-10-16 14:30:28 +00:00
---
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-11-29 17:05:25 +00:00
< a href = 'undocumented#SkScalar' > SkScalar< / a > < a href = '#SkPaint_getStrokeWidth' > getStrokeWidth< / a > ()const
2017-07-28 19:18:29 +00:00
< / pre >
2018-11-09 21:04:58 +00:00
Returns the thickness of the pen used by < a href = 'SkPaint_Reference#SkPaint' > SkPaint< / a > to
2017-07-28 19:18:29 +00:00
outline the shape.
### Return Value
2018-10-31 16:14:03 +00:00
zero for hairline, greater than zero for pen thickness
2017-07-28 19:18:29 +00:00
### Example
2018-07-06 05:23:23 +00:00
< div > < fiddle-embed name = "99aa73f64df8bbf06e656cd891a81b9e" >
2017-07-28 19:18:29 +00:00
#### Example Output
~~~~
0 == paint.getStrokeWidth()
~~~~
< / fiddle-embed > < / div >
2018-05-16 11:07:07 +00:00
< a name = 'SkPaint_setStrokeWidth' > < / a >
2018-10-16 14:30:28 +00:00
---
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-11-09 21:04:58 +00:00
void < a href = '#SkPaint_setStrokeWidth' > setStrokeWidth< / a > (< a href = 'undocumented#SkScalar' > SkScalar< / a > width)
2017-07-28 19:18:29 +00:00
< / pre >
2018-11-09 21:04:58 +00:00
Sets the thickness of the pen used by the < a href = 'SkPaint_Reference#Paint' > paint< / a > to
2018-01-04 21:11:51 +00:00
outline the shape.
2018-11-09 21:04:58 +00:00
Has no effect if < a href = '#SkPaint_setStrokeWidth_width' > width< / a > is less than zero.
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkPaint_setStrokeWidth_width' > < code > < strong > width< / strong > < / code > < / a > < / td >
2018-10-31 16:14:03 +00:00
< td > zero thickness for hairline; greater than zero for pen thickness< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
< div > < fiddle-embed name = "0c4446c0870b5c7b5a2efe77ff92afb8" >
#### Example Output
~~~~
5 == paint.getStrokeWidth()
~~~~
< / fiddle-embed > < / div >
2018-10-16 14:30:28 +00:00
< a name = 'Miter_Limit' > < / a >
2017-07-28 19:18:29 +00:00
2018-10-16 14:30:28 +00:00
---
2018-02-01 14:37:32 +00:00
2018-11-09 21:04:58 +00:00
< a href = '#Paint_Miter_Limit' > Miter_Limit< / a > specifies the maximum miter length,
relative to the < a href = '#Stroke_Width' > stroke width< / a > .
2017-07-28 19:18:29 +00:00
2018-11-09 21:04:58 +00:00
< a href = '#Paint_Miter_Limit' > Miter_Limit< / a > is used when the < a href = '#Paint_Stroke_Join' > Stroke_Join< / a >
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 >
or < a href = '#SkPaint_kStrokeAndFill_Style' > kStrokeAndFill_Style< / a > .
2017-07-28 19:18:29 +00:00
2018-11-09 21:04:58 +00:00
If the miter at a corner exceeds this limit, < a href = '#SkPaint_kMiter_Join' > kMiter_Join< / a >
is replaced with < a href = '#SkPaint_kBevel_Join' > kBevel_Join< / a > .
2017-07-28 19:18:29 +00:00
2018-11-09 21:04:58 +00:00
< a href = '#Paint_Miter_Limit' > Miter_Limit< / a > can be computed from the corner angle using:
2018-11-07 19:59:03 +00:00
< code > < a href = '#Miter_Limit' > miter limit< / a > = 1 / sin ( angle / 2 )< / code > .
2017-07-28 19:18:29 +00:00
2018-11-09 21:04:58 +00:00
< a href = '#Paint_Miter_Limit' > Miter_Limit< / a > default value is 4.
The default may be changed at compile time by setting < a href = 'undocumented#SkPaintDefaults_MiterLimit' > SkPaintDefaults_MiterLimit< / a >
in "SkUserConfig.h" or as a define supplied by the build environment.
2017-07-28 19:18:29 +00:00
2018-11-09 21:04:58 +00:00
Here are some miter limits and the angles that triggers them.
2017-07-28 19:18:29 +00:00
2018-11-07 19:59:03 +00:00
| < a href = '#Miter_Limit' > miter limit< / a > | angle in degrees |
2017-07-28 19:18:29 +00:00
| --- | --- |
| 10 | 11.48 |
| 9 | 12.76 |
| 8 | 14.36 |
| 7 | 16.43 |
| 6 | 19.19 |
| 5 | 23.07 |
| 4 | 28.96 |
| 3 | 38.94 |
| 2 | 60 |
| 1 | 180 |
### Example
2018-07-16 12:12:01 +00:00
< div > < fiddle-embed name = "5de2de0f00354e59074a9bb1a42d5a63" > < div > This example draws a stroked corner and the miter length beneath.
2018-11-07 19:59:03 +00:00
When the < a href = '#Miter_Limit' > miter limit< / a > is decreased slightly, the miter join is replaced
2018-03-05 18:26:16 +00:00
by a bevel join.
< / div > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a name = 'SkPaint_getStrokeMiter' > < / a >
2018-10-16 14:30:28 +00:00
---
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-11-29 17:05:25 +00:00
< a href = 'undocumented#SkScalar' > SkScalar< / a > < a href = '#SkPaint_getStrokeMiter' > getStrokeMiter< / a > ()const
2017-07-28 19:18:29 +00:00
< / pre >
2018-07-11 20:18:41 +00:00
Returns the limit at which a sharp corner is drawn beveled.
2017-07-28 19:18:29 +00:00
### Return Value
2018-11-07 19:59:03 +00:00
zero and greater miter limit
2017-07-28 19:18:29 +00:00
### Example
< div > < fiddle-embed name = "50da74a43b725f07a914df588c867d36" >
#### Example Output
~~~~
default miter limit == 4
~~~~
< / fiddle-embed > < / div >
### See Also
2018-11-07 19:59:03 +00:00
< a href = '#Paint_Miter_Limit' > Miter_Limit< / a > < a href = '#SkPaint_setStrokeMiter' > setStrokeMiter< / a > < a href = '#SkPaint_Join' > Join< / a >
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a name = 'SkPaint_setStrokeMiter' > < / a >
2018-10-16 14:30:28 +00:00
---
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-11-09 21:04:58 +00:00
void < a href = '#SkPaint_setStrokeMiter' > setStrokeMiter< / a > (< a href = 'undocumented#SkScalar' > SkScalar< / a > miter)
2017-07-28 19:18:29 +00:00
< / pre >
2018-07-11 20:18:41 +00:00
Sets the limit at which a sharp corner is drawn beveled.
2017-07-28 19:18:29 +00:00
Valid values are zero and greater.
2018-11-09 21:04:58 +00:00
Has no effect if < a href = '#SkPaint_setStrokeMiter_miter' > miter< / a > is less than zero.
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkPaint_setStrokeMiter_miter' > < code > < strong > miter< / strong > < / code > < / a > < / td >
2018-10-31 16:14:03 +00:00
< td > zero and greater < a href = '#Miter_Limit' > miter limit< / a > < / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
2018-07-08 05:32:09 +00:00
< div > < fiddle-embed name = "700b284dbc97785c6a9c9636088713ad" >
2017-07-28 19:18:29 +00:00
#### Example Output
~~~~
default miter limit == 8
~~~~
< / fiddle-embed > < / div >
### See Also
2018-11-07 19:59:03 +00:00
< a href = '#Paint_Miter_Limit' > Miter_Limit< / a > < a href = '#SkPaint_getStrokeMiter' > getStrokeMiter< / a > < a href = '#SkPaint_Join' > Join< / a >
2017-07-28 19:18:29 +00:00
2018-10-16 14:30:28 +00:00
< a name = 'Stroke_Cap' > < / a >
2017-07-28 19:18:29 +00:00
2018-10-16 14:30:28 +00:00
< a name = 'SkPaint_Cap' > < / a >
2017-07-28 19:18:29 +00:00
2018-10-16 14:30:28 +00:00
---
2017-07-28 19:18:29 +00:00
2017-11-27 15:44:06 +00:00
< pre style = "padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0 " >
2018-05-16 11:07:07 +00:00
enum < a href = '#SkPaint_Cap' > Cap< / a > {
2018-10-08 18:57:48 +00:00
< a href = '#SkPaint_kButt_Cap' > kButt_Cap< / a > ,
< a href = '#SkPaint_kRound_Cap' > kRound_Cap< / a > ,
< a href = '#SkPaint_kSquare_Cap' > kSquare_Cap< / a > ,
< a href = '#SkPaint_kLast_Cap' > kLast_Cap< / a > = < a href = '#SkPaint_kSquare_Cap' > kSquare_Cap< / a > ,
< a href = '#SkPaint_kDefault_Cap' > kDefault_Cap< / a > = < a href = '#SkPaint_kButt_Cap' > kButt_Cap< / a > ,
2018-04-03 12:43:27 +00:00
};
2018-11-29 17:05:25 +00:00
2018-10-16 14:30:28 +00:00
< / pre >
2017-09-21 16:31:06 +00:00
2018-10-16 14:30:28 +00:00
< pre style = "padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0 " >
2018-10-08 18:57:48 +00:00
static constexpr int < a href = '#SkPaint_kCapCount' > kCapCount< / a > = < a href = '#SkPaint_kLast_Cap' > kLast_Cap< / a > + 1;
2018-03-05 18:26:16 +00:00
< / pre >
2017-07-28 19:18:29 +00:00
2018-11-09 21:04:58 +00:00
< 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 > .
2017-07-28 19:18:29 +00:00
### Constants
2018-05-16 11:07:07 +00:00
< table style = 'border-collapse: collapse; width: 62.5em' >
< tr >< th style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > Const</ th >
< th style = 'text-align: center; border: 2px solid #dddddd ; padding: 8px; ' > Value</ th >
< th style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > Description</ th ></ tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a name = 'SkPaint_kButt_Cap' >< code > SkPaint::kButt_Cap</ code ></ a ></ td >
< td style = 'text-align: center; border: 2px solid #dddddd ; padding: 8px; ' > 0</ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >
Does not extend the stroke past the beginning or the end.
2018-03-05 18:26:16 +00:00
< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< tr >
2018-05-16 11:07:07 +00:00
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a name = 'SkPaint_kRound_Cap' >< code > SkPaint::kRound_Cap</ code ></ a ></ td >
< td style = 'text-align: center; border: 2px solid #dddddd ; padding: 8px; ' > 1</ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >
2018-11-09 21:04:58 +00:00
Adds a < a href = 'undocumented#Circle' > circle< / a > with a diameter equal to < a href = '#Paint_Stroke_Width' > Stroke_Width< / a > at the beginning
and end.
2018-03-05 18:26:16 +00:00
< / td >
2017-07-28 19:18:29 +00:00
< / tr >
2018-05-16 11:07:07 +00:00
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a name = 'SkPaint_kSquare_Cap' >< code > SkPaint::kSquare_Cap</ code ></ a ></ td >
< td style = 'text-align: center; border: 2px solid #dddddd ; padding: 8px; ' > 2</ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >
2018-11-09 21:04:58 +00:00
Adds a square with sides equal to < a href = '#Paint_Stroke_Width' > Stroke_Width< / a > at the beginning
and end. The square sides are parallel to the initial and final direction
of the stroke.
2018-03-05 18:26:16 +00:00
< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< tr >
2018-05-16 11:07:07 +00:00
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a name = 'SkPaint_kLast_Cap' >< code > SkPaint::kLast_Cap</ code ></ a ></ td >
< td style = 'text-align: center; border: 2px solid #dddddd ; padding: 8px; ' > 2</ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >
2018-11-07 19:59:03 +00:00
Equivalent to the largest value for < a href = '#Paint_Stroke_Cap' > Stroke_Cap< / a > .
2018-03-05 18:26:16 +00:00
< / td >
2017-07-28 19:18:29 +00:00
< / tr >
2018-05-16 11:07:07 +00:00
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a name = 'SkPaint_kDefault_Cap' >< code > SkPaint::kDefault_Cap</ code ></ a ></ td >
< td style = 'text-align: center; border: 2px solid #dddddd ; padding: 8px; ' > 0</ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >
2018-11-09 21:04:58 +00:00
< a href = '#Paint_Stroke_Cap' > Stroke_Cap< / a > is set to < a href = '#SkPaint_kButt_Cap' > kButt_Cap< / a > by default.
2018-03-05 18:26:16 +00:00
< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< tr >
2018-05-16 11:07:07 +00:00
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a name = 'SkPaint_kCapCount' >< code > SkPaint::kCapCount</ code ></ a ></ td >
< td style = 'text-align: center; border: 2px solid #dddddd ; padding: 8px; ' > 3</ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >
2018-11-09 21:04:58 +00:00
May be used to verify that < a href = '#Paint_Stroke_Cap' > Stroke_Cap< / a > is a legal value.
2018-03-05 18:26:16 +00:00
< / td >
2017-07-28 19:18:29 +00:00
< / tr >
2018-05-16 11:07:07 +00:00
< / table >
2017-07-28 19:18:29 +00:00
2018-11-09 21:04:58 +00:00
Stroke describes the area covered by a pen of < a href = '#Paint_Stroke_Width' > Stroke_Width< / a > as it
follows the < a href = '#Path_Overview_Contour' > Path_Contour< / a > , moving parallel to the < a href = 'SkPath_Overview#Contour' > contour< / a > direction.
2017-07-28 19:18:29 +00:00
2018-11-09 21:04:58 +00:00
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
visible beginning and end.
2017-07-28 19:18:29 +00:00
2018-11-09 21:04:58 +00:00
< 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 > .
2017-07-28 19:18:29 +00:00
2018-11-09 21:04:58 +00:00
< a href = '#SkPaint_kButt_Cap' > kButt_Cap< / a > and < a href = '#Path_Overview_Contour_Zero_Length' > Zero_Length_Contour< / a > is not drawn.
< 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 >
at the < a href = 'SkPath_Overview#Contour' > contour< / a > < a href = 'SkPoint_Reference#Point' > point< / a > .
< 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
< a href = '#Paint_Stroke_Width' > Stroke_Width< / a > at the < a href = 'SkPath_Overview#Contour' > contour< / a > < a href = 'SkPoint_Reference#Point' > point< / a > .
2017-07-28 19:18:29 +00:00
2018-11-09 21:04:58 +00:00
< a href = '#Paint_Stroke_Cap' > Stroke_Cap< / a > is < a href = '#SkPaint_kButt_Cap' > kButt_Cap< / a > by default.
2017-07-28 19:18:29 +00:00
### Example
2017-11-02 21:49:34 +00:00
< div > < fiddle-embed name = "2bffb6384cc20077e632e7d01da045ca" > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a name = 'SkPaint_getStrokeCap' > < / a >
2017-07-28 19:18:29 +00:00
2018-10-16 14:30:28 +00:00
---
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-11-29 17:05:25 +00:00
< a href = '#SkPaint_Cap' > Cap< / a > < a href = '#SkPaint_getStrokeCap' > getStrokeCap< / a > ()const
2017-07-28 19:18:29 +00:00
< / pre >
2018-07-11 20:18:41 +00:00
Returns the geometry drawn at the beginning and end of strokes.
2017-07-28 19:18:29 +00:00
### Return Value
2018-10-31 16:14:03 +00:00
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 >
2017-07-28 19:18:29 +00:00
### Example
< div > < fiddle-embed name = "aabf9baee8e026fae36fca30e955512b" >
#### Example Output
~~~~
kButt_Cap == default stroke cap
~~~~
< / fiddle-embed > < / div >
### See Also
2018-11-07 19:59:03 +00:00
< a href = '#Paint_Stroke_Cap' > Stroke_Cap< / a > < a href = '#SkPaint_setStrokeCap' > setStrokeCap< / a >
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a name = 'SkPaint_setStrokeCap' > < / a >
2018-10-16 14:30:28 +00:00
---
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-11-09 21:04:58 +00:00
void < a href = '#SkPaint_setStrokeCap' > setStrokeCap< / a > (< a href = '#SkPaint_Cap' > Cap< / a > cap)
2017-07-28 19:18:29 +00:00
< / pre >
2018-07-11 20:18:41 +00:00
Sets the geometry drawn at the beginning and end of strokes.
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkPaint_setStrokeCap_cap' > < code > < strong > cap< / strong > < / code > < / a > < / td >
2018-10-31 16:14:03 +00:00
< 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 >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
2018-11-09 21:04:58 +00:00
has no effect if < a href = '#SkPaint_setStrokeCap_cap' > cap< / a > is not valid
2018-10-31 16:14:03 +00:00
2017-07-28 19:18:29 +00:00
### Example
< div > < fiddle-embed name = "de83fbd848a4625345b4b87a6e55d98a" >
#### Example Output
~~~~
kRound_Cap == paint.getStrokeCap()
~~~~
< / fiddle-embed > < / div >
### See Also
2018-11-07 19:59:03 +00:00
< a href = '#Paint_Stroke_Cap' > Stroke_Cap< / a > < a href = '#SkPaint_getStrokeCap' > getStrokeCap< / a >
2017-07-28 19:18:29 +00:00
2018-10-16 14:30:28 +00:00
< a name = 'Stroke_Join' > < / a >
2018-02-01 14:37:32 +00:00
2018-11-09 21:04:58 +00:00
< 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 > .
2017-07-28 19:18:29 +00:00
2018-11-09 21:04:58 +00:00
Stroke describes the area covered by a pen of < a href = '#Paint_Stroke_Width' > Stroke_Width< / a > as it
follows the < a href = '#Path_Overview_Contour' > Path_Contour< / a > , moving parallel to the < a href = 'SkPath_Overview#Contour' > contour< / a > direction.
2017-07-28 19:18:29 +00:00
2018-11-09 21:04:58 +00:00
If the < a href = 'SkPath_Overview#Contour' > contour< / a > direction changes abruptly, because the tangent direction leading
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
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 > .
2017-07-28 19:18:29 +00:00
### Example
2017-11-02 21:49:34 +00:00
< div > < fiddle-embed name = "917c44b504d3f9308571fd3835d90a0d" > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
2018-10-16 14:30:28 +00:00
< a name = 'SkPaint_Join' > < / a >
---
2017-07-28 19:18:29 +00:00
2017-11-27 15:44:06 +00:00
< pre style = "padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0 " >
2018-11-09 21:04:58 +00:00
enum < a href = '#SkPaint_Join' > Join< / a > : uint8_t {
2018-10-08 18:57:48 +00:00
< a href = '#SkPaint_kMiter_Join' > kMiter_Join< / a > ,
< a href = '#SkPaint_kRound_Join' > kRound_Join< / a > ,
< a href = '#SkPaint_kBevel_Join' > kBevel_Join< / a > ,
< a href = '#SkPaint_kLast_Join' > kLast_Join< / a > = < a href = '#SkPaint_kBevel_Join' > kBevel_Join< / a > ,
< a href = '#SkPaint_kDefault_Join' > kDefault_Join< / a > = < a href = '#SkPaint_kMiter_Join' > kMiter_Join< / a > ,
2018-04-03 12:43:27 +00:00
};
2018-11-29 17:05:25 +00:00
2018-10-16 14:30:28 +00:00
< / pre >
2017-09-21 16:31:06 +00:00
2018-10-16 14:30:28 +00:00
< pre style = "padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0 " >
2018-10-08 18:57:48 +00:00
static constexpr int < a href = '#SkPaint_kJoinCount' > kJoinCount< / a > = < a href = '#SkPaint_kLast_Join' > kLast_Join< / a > + 1;
2018-03-05 18:26:16 +00:00
< / pre >
2017-07-28 19:18:29 +00:00
2018-11-09 21:04:58 +00:00
< a href = '#SkPaint_Join' > Join< / a > specifies how corners are drawn when a shape is stroked. < a href = '#SkPaint_Join' > Join< / a >
affects the four corners of a stroked rectangle, and the connected segments in a
stroked < a href = 'SkPath_Reference#Path' > path< / a > .
2017-07-28 19:18:29 +00:00
2018-11-09 21:04:58 +00:00
Choose miter join to draw sharp corners. Choose round join to draw a < a href = 'undocumented#Circle' > circle< / a > with a
radius equal to the < a href = '#Stroke_Width' > stroke width< / a > on top of the corner. Choose bevel join to minimally
connect the thick strokes.
2017-07-28 19:18:29 +00:00
2018-11-09 21:04:58 +00:00
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
not contain the actual join. For instance, a < a href = '#Fill_Path' > fill path< / a > constructed with round joins does
not necessarily include < a href = 'undocumented#Circle' > circles< / a > at each connected segment.
2017-07-28 19:18:29 +00:00
### Constants
2018-05-16 11:07:07 +00:00
< table style = 'border-collapse: collapse; width: 62.5em' >
< tr >< th style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > Const</ th >
< th style = 'text-align: center; border: 2px solid #dddddd ; padding: 8px; ' > Value</ th >
< th style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' > Description</ th ></ tr >
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a name = 'SkPaint_kMiter_Join' >< code > SkPaint::kMiter_Join</ code ></ a ></ td >
< td style = 'text-align: center; border: 2px solid #dddddd ; padding: 8px; ' > 0</ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >
2018-11-07 19:59:03 +00:00
Extends the outside corner to the extent allowed by < a href = '#Paint_Miter_Limit' > Miter_Limit< / a > .
2018-11-09 21:04:58 +00:00
If the extension exceeds < a href = '#Paint_Miter_Limit' > Miter_Limit< / a > , < a href = '#SkPaint_kBevel_Join' > kBevel_Join< / a > is used instead.
2018-03-05 18:26:16 +00:00
< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< tr >
2018-05-16 11:07:07 +00:00
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a name = 'SkPaint_kRound_Join' >< code > SkPaint::kRound_Join</ code ></ a ></ td >
< td style = 'text-align: center; border: 2px solid #dddddd ; padding: 8px; ' > 1</ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >
2018-11-09 21:04:58 +00:00
Adds a < a href = 'undocumented#Circle' > circle< / a > with a diameter of < a href = '#Paint_Stroke_Width' > Stroke_Width< / a > at the sharp corner.
2018-03-05 18:26:16 +00:00
< / td >
2017-07-28 19:18:29 +00:00
< / tr >
2018-05-16 11:07:07 +00:00
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a name = 'SkPaint_kBevel_Join' >< code > SkPaint::kBevel_Join</ code ></ a ></ td >
< td style = 'text-align: center; border: 2px solid #dddddd ; padding: 8px; ' > 2</ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >
Connects the outside edges of the sharp corner.
2018-03-05 18:26:16 +00:00
< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< tr >
2018-05-16 11:07:07 +00:00
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a name = 'SkPaint_kLast_Join' >< code > SkPaint::kLast_Join</ code ></ a ></ td >
< td style = 'text-align: center; border: 2px solid #dddddd ; padding: 8px; ' > 2</ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >
equivalent to the largest value for Stroke_Join< / td >
2017-07-28 19:18:29 +00:00
< / tr >
2018-05-16 11:07:07 +00:00
< tr style = 'background-color: #f0f0f0 ; ' >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a name = 'SkPaint_kDefault_Join' >< code > SkPaint::kDefault_Join</ code ></ a ></ td >
< td style = 'text-align: center; border: 2px solid #dddddd ; padding: 8px; ' > 1</ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >
2018-11-09 21:04:58 +00:00
< a href = '#Paint_Stroke_Join' > Stroke_Join< / a > is set to < a href = '#SkPaint_kMiter_Join' > kMiter_Join< / a > by default.
2018-03-05 18:26:16 +00:00
< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< tr >
2018-05-16 11:07:07 +00:00
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >< a name = 'SkPaint_kJoinCount' >< code > SkPaint::kJoinCount</ code ></ a ></ td >
< td style = 'text-align: center; border: 2px solid #dddddd ; padding: 8px; ' > 3</ td >
< td style = 'text-align: left; border: 2px solid #dddddd ; padding: 8px; ' >
2018-11-09 21:04:58 +00:00
May be used to verify that < a href = '#Paint_Stroke_Join' > Stroke_Join< / a > is a legal value.
2018-03-05 18:26:16 +00:00
< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
< div > < fiddle-embed name = "3b1aebacc21c1836a52876b9b0b3905e" > < / fiddle-embed > < / div >
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkPaint_setStrokeJoin' > setStrokeJoin< / a > < a href = '#SkPaint_getStrokeJoin' > getStrokeJoin< / a > < a href = '#SkPaint_setStrokeMiter' > setStrokeMiter< / a > < a href = '#SkPaint_getStrokeMiter' > getStrokeMiter< / a >
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a name = 'SkPaint_getStrokeJoin' > < / a >
2018-10-16 14:30:28 +00:00
---
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-11-29 17:05:25 +00:00
< a href = '#SkPaint_Join' > Join< / a > < a href = '#SkPaint_getStrokeJoin' > getStrokeJoin< / a > ()const
2017-07-28 19:18:29 +00:00
< / pre >
2018-07-11 20:18:41 +00:00
Returns the geometry drawn at the corners of strokes.
2017-07-28 19:18:29 +00:00
### Return Value
2018-10-31 16:14:03 +00:00
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 >
2017-07-28 19:18:29 +00:00
### Example
2018-07-19 14:50:44 +00:00
< div > < fiddle-embed name = "31bf751d0a8ddf176b871810820d8199" >
2017-07-28 19:18:29 +00:00
#### Example Output
~~~~
kMiter_Join == default stroke join
~~~~
< / fiddle-embed > < / div >
### See Also
2018-11-07 19:59:03 +00:00
< a href = '#Paint_Stroke_Join' > Stroke_Join< / a > < a href = '#SkPaint_setStrokeJoin' > setStrokeJoin< / a >
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a name = 'SkPaint_setStrokeJoin' > < / a >
2018-10-16 14:30:28 +00:00
---
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-11-09 21:04:58 +00:00
void < a href = '#SkPaint_setStrokeJoin' > setStrokeJoin< / a > (< a href = '#SkPaint_Join' > Join< / a > join)
2017-07-28 19:18:29 +00:00
< / pre >
2018-07-11 20:18:41 +00:00
Sets the geometry drawn at the corners of strokes.
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkPaint_setStrokeJoin_join' > < code > < strong > join< / strong > < / code > < / a > < / td >
2018-10-31 16:14:03 +00:00
< 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 >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
2018-10-31 16:14:03 +00:00
otherwise, has no effect
2017-07-28 19:18:29 +00:00
### Example
< div > < fiddle-embed name = "48d963ad4286eddf680f9c511eb6da91" >
#### Example Output
~~~~
kMiter_Join == paint.getStrokeJoin()
~~~~
< / fiddle-embed > < / div >
### See Also
2018-11-07 19:59:03 +00:00
< a href = '#Paint_Stroke_Join' > Stroke_Join< / a > < a href = '#SkPaint_getStrokeJoin' > getStrokeJoin< / a >
2017-07-28 19:18:29 +00:00
### See Also
2018-11-07 19:59:03 +00:00
< a href = '#Paint_Miter_Limit' > Miter_Limit< / a >
2017-07-28 19:18:29 +00:00
2018-10-16 14:30:28 +00:00
< a name = 'Fill_Path' > < / a >
---
2018-02-01 14:37:32 +00:00
2018-11-09 21:04:58 +00:00
< 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 > .
2017-07-28 19:18:29 +00:00
2018-11-09 21:04:58 +00:00
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
replaces the destination < a href = 'SkPath_Reference#Path' > Path< / a > . Otherwise, the source < a href = 'SkPath_Reference#Path' > Path< / a > is replaces the
destination < a href = 'SkPath_Reference#Path' > Path< / a > .
2017-07-28 19:18:29 +00:00
2018-11-09 21:04:58 +00:00
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
the < a href = '#Path_Effect' > Path_Effect< / a > is not required to do so.
2017-07-28 19:18:29 +00:00
2018-11-09 21:04:58 +00:00
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 > ,
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 > ,
and < a href = '#Paint_Miter_Limit' > Miter_Limit< / a > operate on the destination < a href = 'SkPath_Reference#Path' > Path< / a > , replacing it.
2017-07-28 19:18:29 +00:00
2018-11-09 21:04:58 +00:00
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.
2017-07-28 19:18:29 +00:00
2018-11-09 21:04:58 +00:00
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 >
returns false since Hairline has no filled equivalent.
2018-10-16 14:30:28 +00:00
### See Also
2018-11-07 19:59:03 +00:00
< a href = '#Paint_Style_Stroke' > Style_Stroke< / a > < a href = '#Paint_Stroke_Width' > Stroke_Width< / a > < a href = '#Path_Effect' > Path_Effect< / a >
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a name = 'SkPaint_getFillPath' > < / a >
2018-10-16 14:30:28 +00:00
---
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-11-29 17:05:25 +00:00
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
2017-07-28 19:18:29 +00:00
< / pre >
2018-10-31 16:14:03 +00:00
Returns the filled equivalent of the stroked < a href = 'SkPath_Reference#Path' > path< / a > .
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkPaint_getFillPath_src' > < code > < strong > src< / strong > < / code > < / a > < / td >
2018-11-09 21:04:58 +00:00
< td > < a href = 'SkPath_Reference#SkPath' > SkPath< / a > read to create a filled version< / td >
2018-05-16 11:07:07 +00:00
< / tr >
< tr > < td > < a name = 'SkPaint_getFillPath_dst' > < code > < strong > dst< / strong > < / code > < / a > < / td >
2018-11-09 21:04:58 +00:00
< 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 >
2018-05-16 11:07:07 +00:00
< / tr >
< tr > < td > < a name = 'SkPaint_getFillPath_cullRect' > < code > < strong > cullRect< / strong > < / code > < / a > < / td >
2018-10-31 16:14:03 +00:00
< td > optional limit passed to < a href = 'undocumented#SkPathEffect' > SkPathEffect< / a > < / td >
2018-05-16 11:07:07 +00:00
< / tr >
< tr > < td > < a name = 'SkPaint_getFillPath_resScale' > < code > < strong > resScale< / strong > < / code > < / a > < / td >
2018-11-09 21:04:58 +00:00
< td > if > 1, increase precision, else if (0 < < a href = '#SkPaint_getFillPath_resScale' > resScale< / a > < 1 ) reduce precision < / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
2018-10-31 16:14:03 +00:00
to favor speed and < a href = 'undocumented#Size' > size< / a >
2017-07-28 19:18:29 +00:00
### Return Value
2018-11-09 21:04:58 +00:00
true if the < a href = 'SkPath_Reference#Path' > path< / a > represents < a href = '#Style_Fill' > style fill< / a > , or false if it represents hairline
2017-07-28 19:18:29 +00:00
### Example
2018-11-09 21:04:58 +00:00
< 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.
At the lowest precision, the < a href = 'SkPath_Reference#Quad' > Quad< / a > stroke is approximated by a rectangle.
At the highest precision, the filled < a href = 'SkPath_Reference#Path' > path< / a > has high fidelity compared to the original stroke.
2018-03-05 18:26:16 +00:00
< / div > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a name = 'SkPaint_getFillPath_2' > < / a >
2018-01-26 17:56:22 +00:00
2018-10-16 14:30:28 +00:00
---
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-11-29 17:05:25 +00:00
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
2017-07-28 19:18:29 +00:00
< / pre >
2018-10-31 16:14:03 +00:00
Returns the filled equivalent of the stroked < a href = 'SkPath_Reference#Path' > path< / a > .
2017-07-28 19:18:29 +00:00
2018-11-09 21:04:58 +00:00
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 > .
< a href = 'undocumented#SkPathEffect' > SkPathEffect< / a > , if any, is not culled. < a href = '#Stroke_Width' > stroke width< / a > is created with default precision.
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkPaint_getFillPath_2_src' > < code > < strong > src< / strong > < / code > < / a > < / td >
2018-11-09 21:04:58 +00:00
< td > < a href = 'SkPath_Reference#SkPath' > SkPath< / a > read to create a filled version< / td >
2018-05-16 11:07:07 +00:00
< / tr >
< tr > < td > < a name = 'SkPaint_getFillPath_2_dst' > < code > < strong > dst< / strong > < / code > < / a > < / td >
2018-11-09 21:04:58 +00:00
< 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 >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Return Value
2018-11-09 21:04:58 +00:00
true if the < a href = 'SkPath_Reference#Path' > path< / a > represents < a href = '#Style_Fill' > style fill< / a > , or false if it represents hairline
2017-07-28 19:18:29 +00:00
### Example
< div > < fiddle-embed name = "e6d8ca0cc17e0b475bd54dd995825468" > < / fiddle-embed > < / div >
2018-10-16 14:30:28 +00:00
< a name = 'Shader_Methods' > < / a >
2017-07-28 19:18:29 +00:00
2018-10-16 14:30:28 +00:00
---
2018-02-01 14:37:32 +00:00
2018-11-09 21:04:58 +00:00
< a href = 'undocumented#Shader' > Shader< / a > defines the colors used when drawing a shape.
< a href = 'undocumented#Shader' > Shader< / a > may be an < a href = 'SkImage_Reference#Image' > image< / a > , a gradient, or a computed fill.
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.
2017-07-28 19:18:29 +00:00
2018-11-09 21:04:58 +00:00
< 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 > .
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
the fill.
2017-07-28 19:18:29 +00:00
2018-11-09 21:04:58 +00:00
The drawn transparency can be modified without altering < a href = 'undocumented#Shader' > Shader< / a > , by changing < a href = '#Color_Alpha' > Color_Alpha< / a > .
2017-07-28 19:18:29 +00:00
### Example
< div > < fiddle-embed name = "c015dc2010c15e1c00b4f7330232b0f7" > < / fiddle-embed > < / div >
2018-11-09 21:04:58 +00:00
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.
2017-07-28 19:18:29 +00:00
### Example
2018-05-03 06:27:39 +00:00
< div > < fiddle-embed name = "fe80fd80b98a20823db7fb9a077243c7" > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a name = 'SkPaint_getShader' > < / a >
2018-10-16 14:30:28 +00:00
---
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-11-29 17:05:25 +00:00
< a href = 'undocumented#SkShader' > SkShader< / a > * < a href = '#SkPaint_getShader' > getShader< / a > ()const
2017-07-28 19:18:29 +00:00
< / pre >
2018-11-09 21:04:58 +00:00
Returns optional colors used when filling a < a href = 'SkPath_Reference#Path' > path< / a > , such as a gradient.
2017-07-28 19:18:29 +00:00
2018-10-31 16:14:03 +00:00
Does not alter < a href = 'undocumented#SkShader' > SkShader< / a > < a href = 'undocumented#SkRefCnt' > SkRefCnt< / a > .
2017-07-28 19:18:29 +00:00
### Return Value
2018-11-09 21:04:58 +00:00
< a href = 'undocumented#SkShader' > SkShader< / a > if previously set, nullptr otherwise
2017-07-28 19:18:29 +00:00
### Example
< div > < fiddle-embed name = "09f15b9fd88882850da2d235eb86292f" >
#### Example Output
~~~~
nullptr == shader
nullptr != shader
~~~~
< / fiddle-embed > < / div >
2018-05-16 11:07:07 +00:00
< a name = 'SkPaint_refShader' > < / a >
2018-10-16 14:30:28 +00:00
---
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-11-29 17:05:25 +00:00
< a href = 'undocumented#sk_sp' > sk_sp< / a > < < a href = 'undocumented#SkShader' > SkShader< / a > > < a href = '#SkPaint_refShader' > refShader< / a > ()const
2017-07-28 19:18:29 +00:00
< / pre >
2018-11-09 21:04:58 +00:00
Returns optional colors used when filling a < a href = 'SkPath_Reference#Path' > path< / a > , such as a gradient.
2017-07-28 19:18:29 +00:00
2018-11-09 21:04:58 +00:00
Increases < a href = 'undocumented#SkShader' > SkShader< / a > < a href = 'undocumented#SkRefCnt' > SkRefCnt< / a > by one.
2017-07-28 19:18:29 +00:00
### Return Value
2018-11-09 21:04:58 +00:00
< a href = 'undocumented#SkShader' > SkShader< / a > if previously set, nullptr otherwise
2017-07-28 19:18:29 +00:00
### Example
< div > < fiddle-embed name = "53da0295972a418cbc9607bbb17feaa8" >
#### Example Output
~~~~
shader unique: true
shader unique: false
~~~~
< / fiddle-embed > < / div >
2018-05-16 11:07:07 +00:00
< a name = 'SkPaint_setShader' > < / a >
2018-10-16 14:30:28 +00:00
---
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-11-09 21:04:58 +00:00
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 > )
2017-07-28 19:18:29 +00:00
< / pre >
2018-11-09 21:04:58 +00:00
Sets optional colors used when filling a < a href = 'SkPath_Reference#Path' > path< / a > , such as a gradient.
2017-07-28 19:18:29 +00:00
2018-11-09 21:04:58 +00:00
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 > .
Increments < a href = '#SkPaint_setShader_shader' > shader< / a > < a href = 'undocumented#SkRefCnt' > SkRefCnt< / a > by one.
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkPaint_setShader_shader' > < code > < strong > shader< / strong > < / code > < / a > < / td >
2018-11-09 21:04:58 +00:00
< 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 >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
2018-07-16 05:29:00 +00:00
< div > < fiddle-embed name = "77e64d5bae9b1ba037fd99252bb4aa58" > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
2018-10-16 14:30:28 +00:00
< a name = 'Color_Filter_Methods' > < / a >
2017-07-28 19:18:29 +00:00
2018-10-16 14:30:28 +00:00
---
2018-02-01 14:37:32 +00:00
2018-11-09 21:04:58 +00:00
< a href = '#Color_Filter' > Color_Filter< / a > alters the < a href = 'SkColor_Reference#Color' > color< / a > used when drawing a shape.
< 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.
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.
2017-07-28 19:18:29 +00:00
2018-11-09 21:04:58 +00:00
The drawn transparency can be modified without altering < a href = '#Color_Filter' > Color_Filter< / a > , by changing < a href = '#Color_Alpha' > Color_Alpha< / a > .
2017-07-28 19:18:29 +00:00
### Example
< div > < fiddle-embed name = "5abde56ca2f89a18b8e231abd1b57c56" > < / fiddle-embed > < / div >
2018-05-16 11:07:07 +00:00
< a name = 'SkPaint_getColorFilter' > < / a >
2018-10-16 14:30:28 +00:00
---
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-11-29 17:05:25 +00:00
< a href = 'undocumented#SkColorFilter' > SkColorFilter< / a > * < a href = '#SkPaint_getColorFilter' > getColorFilter< / a > ()const
2017-07-28 19:18:29 +00:00
< / pre >
2018-11-09 21:04:58 +00:00
Returns < a href = 'undocumented#SkColorFilter' > SkColorFilter< / a > if set, or nullptr.
2018-10-31 16:14:03 +00:00
Does not alter < a href = 'undocumented#SkColorFilter' > SkColorFilter< / a > < a href = 'undocumented#SkRefCnt' > SkRefCnt< / a > .
2017-07-28 19:18:29 +00:00
### Return Value
2018-11-09 21:04:58 +00:00
< a href = 'undocumented#SkColorFilter' > SkColorFilter< / a > if previously set, nullptr otherwise
2017-07-28 19:18:29 +00:00
### Example
< div > < fiddle-embed name = "093bdc627d6b59002670fd290931f6c9" >
#### Example Output
~~~~
nullptr == color filter
nullptr != color filter
~~~~
< / fiddle-embed > < / div >
2018-05-16 11:07:07 +00:00
< a name = 'SkPaint_refColorFilter' > < / a >
2018-10-16 14:30:28 +00:00
---
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-11-29 17:05:25 +00:00
< a href = 'undocumented#sk_sp' > sk_sp< / a > < < a href = 'undocumented#SkColorFilter' > SkColorFilter< / a > > < a href = '#SkPaint_refColorFilter' > refColorFilter< / a > ()const
2017-07-28 19:18:29 +00:00
< / pre >
2018-11-09 21:04:58 +00:00
Returns < a href = 'undocumented#SkColorFilter' > SkColorFilter< / a > if set, or nullptr.
Increases < a href = 'undocumented#SkColorFilter' > SkColorFilter< / a > < a href = 'undocumented#SkRefCnt' > SkRefCnt< / a > by one.
2017-07-28 19:18:29 +00:00
### Return Value
2018-11-09 21:04:58 +00:00
< a href = 'undocumented#SkColorFilter' > SkColorFilter< / a > if set, or nullptr
2017-07-28 19:18:29 +00:00
### Example
< div > < fiddle-embed name = "b588c95fa4c86ddbc4b0546762f08297" >
#### Example Output
~~~~
color filter unique: true
color filter unique: false
~~~~
< / fiddle-embed > < / div >
2018-05-16 11:07:07 +00:00
< a name = 'SkPaint_setColorFilter' > < / a >
2018-10-16 14:30:28 +00:00
---
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-11-09 21:04:58 +00:00
void < a href = '#SkPaint_setColorFilter' > setColorFilter< / a > (< a href = 'undocumented#sk_sp' > sk_sp< / a > < < a href = 'undocumented#SkColorFilter' > SkColorFilter< / a > > colorFilter)
2017-07-28 19:18:29 +00:00
< / pre >
2018-11-09 21:04:58 +00:00
Sets < a href = 'undocumented#SkColorFilter' > SkColorFilter< / a > to filter, decreasing < a href = 'undocumented#SkRefCnt' > SkRefCnt< / a > of the previous
< a href = 'undocumented#SkColorFilter' > SkColorFilter< / a > . Pass nullptr to clear < a href = 'undocumented#SkColorFilter' > SkColorFilter< / a > .
2017-09-21 16:31:06 +00:00
2018-11-09 21:04:58 +00:00
Increments filter < a href = 'undocumented#SkRefCnt' > SkRefCnt< / a > by one.
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkPaint_setColorFilter_colorFilter' > < code > < strong > colorFilter< / strong > < / code > < / a > < / td >
2018-11-09 21:04:58 +00:00
< td > < a href = 'undocumented#SkColorFilter' > SkColorFilter< / a > to apply to subsequent draw< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
2018-07-11 05:28:17 +00:00
< div > < fiddle-embed name = "c7b786dc9b3501cd0eaba47494b6fa31" > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
2018-10-16 14:30:28 +00:00
< a name = 'Blend_Mode_Methods' > < / a >
2017-07-28 19:18:29 +00:00
2018-10-16 14:30:28 +00:00
---
2018-02-01 14:37:32 +00:00
2018-11-09 21:04:58 +00:00
< 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 > .
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 >
over the destination < a href = 'SkColor_Reference#Color' > color< / a > .
2017-07-28 19:18:29 +00:00
### Example
2018-07-18 20:21:51 +00:00
< div > < fiddle-embed name = "73092d4d06faecea3c204d852a4dd8a8" > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
### See Also
2018-11-07 19:59:03 +00:00
< a href = '#Blend_Mode' > Blend_Mode< / a >
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a name = 'SkPaint_getBlendMode' > < / a >
2018-10-16 14:30:28 +00:00
---
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-11-29 17:05:25 +00:00
< a href = 'SkBlendMode_Reference#SkBlendMode' > SkBlendMode< / a > < a href = '#SkPaint_getBlendMode' > getBlendMode< / a > ()const
2017-07-28 19:18:29 +00:00
< / pre >
2018-10-31 16:14:03 +00:00
Returns < a href = 'SkBlendMode_Reference#SkBlendMode' > SkBlendMode< / a > .
By default, returns < a href = 'SkBlendMode_Reference#SkBlendMode' > SkBlendMode< / a > ::< a href = '#SkBlendMode_kSrcOver' > kSrcOver< / a > .
2017-07-28 19:18:29 +00:00
### Return Value
2018-11-09 21:04:58 +00:00
mode used to combine source < a href = 'SkColor_Reference#Color' > color< / a > with destination < a href = 'SkColor_Reference#Color' > color< / a >
2017-07-28 19:18:29 +00:00
### Example
2018-05-03 06:27:39 +00:00
< div > < fiddle-embed name = "a1e059c8f6740fa2044cc64152b39dda" >
2017-07-28 19:18:29 +00:00
#### Example Output
~~~~
kSrcOver == getBlendMode
kSrcOver != getBlendMode
~~~~
< / fiddle-embed > < / div >
2018-05-16 11:07:07 +00:00
< a name = 'SkPaint_isSrcOver' > < / a >
2018-10-16 14:30:28 +00:00
---
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-11-29 17:05:25 +00:00
bool < a href = '#SkPaint_isSrcOver' > isSrcOver< / a > ()const
2017-07-28 19:18:29 +00:00
< / pre >
2018-11-09 21:04:58 +00:00
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.
2017-07-28 19:18:29 +00:00
### Return Value
2018-11-09 21:04:58 +00:00
true if < a href = 'SkBlendMode_Reference#SkBlendMode' > SkBlendMode< / a > is < a href = 'SkBlendMode_Reference#SkBlendMode' > SkBlendMode< / a > ::< a href = '#SkBlendMode_kSrcOver' > kSrcOver< / a >
2017-07-28 19:18:29 +00:00
### Example
< div > < fiddle-embed name = "257c9473db7a2b3a0fb2b9e2431e59a6" >
#### Example Output
~~~~
isSrcOver == true
isSrcOver != true
~~~~
< / fiddle-embed > < / div >
2018-05-16 11:07:07 +00:00
< a name = 'SkPaint_setBlendMode' > < / a >
2018-10-16 14:30:28 +00:00
---
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-11-09 21:04:58 +00:00
void < a href = '#SkPaint_setBlendMode' > setBlendMode< / a > (< a href = 'SkBlendMode_Reference#SkBlendMode' > SkBlendMode< / a > mode)
2017-07-28 19:18:29 +00:00
< / pre >
2018-11-09 21:04:58 +00:00
Sets < a href = 'SkBlendMode_Reference#SkBlendMode' > SkBlendMode< / a > to < a href = '#SkPaint_setBlendMode_mode' > mode< / a > .
2017-07-28 19:18:29 +00:00
Does not check for valid input.
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkPaint_setBlendMode_mode' > < code > < strong > mode< / strong > < / code > < / a > < / td >
2018-11-09 21:04:58 +00:00
< td > < a href = 'SkBlendMode_Reference#SkBlendMode' > SkBlendMode< / a > used to combine source < a href = 'SkColor_Reference#Color' > color< / a > and destination< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
< div > < fiddle-embed name = "257c9473db7a2b3a0fb2b9e2431e59a6" >
#### Example Output
~~~~
isSrcOver == true
isSrcOver != true
~~~~
< / fiddle-embed > < / div >
2018-10-16 14:30:28 +00:00
< a name = 'Path_Effect_Methods' > < / a >
2017-07-28 19:18:29 +00:00
2018-10-16 14:30:28 +00:00
---
2018-02-01 14:37:32 +00:00
2018-11-09 21:04:58 +00:00
< a href = '#Path_Effect' > Path_Effect< / a > modifies the < a href = 'SkPath_Reference#Path' > path< / a > geometry before drawing it.
< a href = '#Path_Effect' > Path_Effect< / a > may implement dashing, custom fill effects and custom stroke effects.
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.
2017-07-28 19:18:29 +00:00
### Example
< div > < fiddle-embed name = "8cf5684b187d60f09e11c4a48993ea39" > < / fiddle-embed > < / div >
### See Also
2018-11-07 19:59:03 +00:00
< a href = '#Path_Effect' > Path_Effect< / a >
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a name = 'SkPaint_getPathEffect' > < / a >
2018-10-16 14:30:28 +00:00
---
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-11-29 17:05:25 +00:00
< a href = 'undocumented#SkPathEffect' > SkPathEffect< / a > * < a href = '#SkPaint_getPathEffect' > getPathEffect< / a > ()const
2017-07-28 19:18:29 +00:00
< / pre >
2018-11-09 21:04:58 +00:00
Returns < a href = 'undocumented#SkPathEffect' > SkPathEffect< / a > if set, or nullptr.
2018-10-31 16:14:03 +00:00
Does not alter < a href = 'undocumented#SkPathEffect' > SkPathEffect< / a > < a href = 'undocumented#SkRefCnt' > SkRefCnt< / a > .
2017-07-28 19:18:29 +00:00
### Return Value
2018-11-09 21:04:58 +00:00
< a href = 'undocumented#SkPathEffect' > SkPathEffect< / a > if previously set, nullptr otherwise
2017-07-28 19:18:29 +00:00
### Example
2018-07-06 05:23:23 +00:00
< div > < fiddle-embed name = "211a1b14bfa6c4332082c8eab4fbc5fd" >
2017-07-28 19:18:29 +00:00
#### Example Output
~~~~
nullptr == path effect
nullptr != path effect
~~~~
< / fiddle-embed > < / div >
2018-05-16 11:07:07 +00:00
< a name = 'SkPaint_refPathEffect' > < / a >
2018-10-16 14:30:28 +00:00
---
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-11-29 17:05:25 +00:00
< a href = 'undocumented#sk_sp' > sk_sp< / a > < < a href = 'undocumented#SkPathEffect' > SkPathEffect< / a > > < a href = '#SkPaint_refPathEffect' > refPathEffect< / a > ()const
2017-07-28 19:18:29 +00:00
< / pre >
2018-11-09 21:04:58 +00:00
Returns < a href = 'undocumented#SkPathEffect' > SkPathEffect< / a > if set, or nullptr.
Increases < a href = 'undocumented#SkPathEffect' > SkPathEffect< / a > < a href = 'undocumented#SkRefCnt' > SkRefCnt< / a > by one.
2017-07-28 19:18:29 +00:00
### Return Value
2018-11-09 21:04:58 +00:00
< a href = 'undocumented#SkPathEffect' > SkPathEffect< / a > if previously set, nullptr otherwise
2017-07-28 19:18:29 +00:00
### Example
2018-07-18 20:21:51 +00:00
< div > < fiddle-embed name = "f56039b94c702c2704c8c5100e623aca" >
2017-07-28 19:18:29 +00:00
#### Example Output
~~~~
path effect unique: true
path effect unique: false
~~~~
< / fiddle-embed > < / div >
2018-05-16 11:07:07 +00:00
< a name = 'SkPaint_setPathEffect' > < / a >
2018-10-16 14:30:28 +00:00
---
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-11-09 21:04:58 +00:00
void < a href = '#SkPaint_setPathEffect' > setPathEffect< / a > (< a href = 'undocumented#sk_sp' > sk_sp< / a > < < a href = 'undocumented#SkPathEffect' > SkPathEffect< / a > > pathEffect)
2017-07-28 19:18:29 +00:00
< / pre >
2018-11-09 21:04:58 +00:00
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
< a href = 'undocumented#SkPathEffect' > SkPathEffect< / a > . Pass nullptr to leave the < a href = 'SkPath_Reference#Path' > path< / a > geometry unaltered.
2017-09-21 16:31:06 +00:00
2018-11-09 21:04:58 +00:00
Increments < a href = '#SkPaint_setPathEffect_pathEffect' > pathEffect< / a > < a href = 'undocumented#SkRefCnt' > SkRefCnt< / a > by one.
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkPaint_setPathEffect_pathEffect' > < code > < strong > pathEffect< / strong > < / code > < / a > < / td >
2018-11-09 21:04:58 +00:00
< td > replace < a href = 'SkPath_Reference#SkPath' > SkPath< / a > with a modification when drawn< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
< div > < fiddle-embed name = "52dd55074ca0b7d520d04e750ca2a0d7" > < / fiddle-embed > < / div >
2018-10-16 14:30:28 +00:00
< a name = 'Mask_Filter_Methods' > < / a >
2017-07-28 19:18:29 +00:00
2018-10-16 14:30:28 +00:00
---
2018-02-01 14:37:32 +00:00
2018-11-09 21:04:58 +00:00
< a href = '#Mask_Filter' > Mask_Filter< / a > uses coverage of the shape drawn to create < a href = '#Mask_Alpha' > Mask_Alpha< / a > .
< a href = '#Mask_Filter' > Mask_Filter< / a > takes a Mask, and returns a Mask.
2017-09-21 16:31:06 +00:00
2018-11-09 21:04:58 +00:00
< a href = '#Mask_Filter' > Mask_Filter< / a > may change the geometry and transparency of the shape, such as
creating a blur effect. Set < a href = '#Mask_Filter' > Mask_Filter< / a > to nullptr to prevent < a href = '#Mask_Filter' > Mask_Filter< / a > from
modifying the draw.
2017-07-28 19:18:29 +00:00
### Example
2018-03-16 15:34:15 +00:00
< div > < fiddle-embed name = "55d7b9d482ac8e17a6153f555a8adb8d" > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a name = 'SkPaint_getMaskFilter' > < / a >
2018-10-16 14:30:28 +00:00
---
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-11-29 17:05:25 +00:00
< a href = 'undocumented#SkMaskFilter' > SkMaskFilter< / a > * < a href = '#SkPaint_getMaskFilter' > getMaskFilter< / a > ()const
2017-07-28 19:18:29 +00:00
< / pre >
2018-11-09 21:04:58 +00:00
Returns < a href = 'undocumented#SkMaskFilter' > SkMaskFilter< / a > if set, or nullptr.
2018-10-31 16:14:03 +00:00
Does not alter < a href = 'undocumented#SkMaskFilter' > SkMaskFilter< / a > < a href = 'undocumented#SkRefCnt' > SkRefCnt< / a > .
2017-07-28 19:18:29 +00:00
### Return Value
2018-11-09 21:04:58 +00:00
< a href = 'undocumented#SkMaskFilter' > SkMaskFilter< / a > if previously set, nullptr otherwise
2017-07-28 19:18:29 +00:00
### Example
2018-03-16 15:34:15 +00:00
< div > < fiddle-embed name = "5ac4b31371726da87bb7390b385e9fee" >
2017-07-28 19:18:29 +00:00
#### Example Output
~~~~
nullptr == mask filter
nullptr != mask filter
~~~~
< / fiddle-embed > < / div >
2018-05-16 11:07:07 +00:00
< a name = 'SkPaint_refMaskFilter' > < / a >
2018-10-16 14:30:28 +00:00
---
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-11-29 17:05:25 +00:00
< a href = 'undocumented#sk_sp' > sk_sp< / a > < < a href = 'undocumented#SkMaskFilter' > SkMaskFilter< / a > > < a href = '#SkPaint_refMaskFilter' > refMaskFilter< / a > ()const
2017-07-28 19:18:29 +00:00
< / pre >
2018-11-09 21:04:58 +00:00
Returns < a href = 'undocumented#SkMaskFilter' > SkMaskFilter< / a > if set, or nullptr.
2017-09-21 16:31:06 +00:00
2018-11-09 21:04:58 +00:00
Increases < a href = 'undocumented#SkMaskFilter' > SkMaskFilter< / a > < a href = 'undocumented#SkRefCnt' > SkRefCnt< / a > by one.
2017-07-28 19:18:29 +00:00
### Return Value
2018-11-09 21:04:58 +00:00
< a href = 'undocumented#SkMaskFilter' > SkMaskFilter< / a > if previously set, nullptr otherwise
2017-07-28 19:18:29 +00:00
### Example
2018-07-18 20:21:51 +00:00
< div > < fiddle-embed name = "084b0dc3cebd78718c651d58f257f799" >
2017-07-28 19:18:29 +00:00
#### Example Output
~~~~
mask filter unique: true
mask filter unique: false
~~~~
< / fiddle-embed > < / div >
2018-05-16 11:07:07 +00:00
< a name = 'SkPaint_setMaskFilter' > < / a >
2018-10-16 14:30:28 +00:00
---
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-11-09 21:04:58 +00:00
void < a href = '#SkPaint_setMaskFilter' > setMaskFilter< / a > (< a href = 'undocumented#sk_sp' > sk_sp< / a > < < a href = 'undocumented#SkMaskFilter' > SkMaskFilter< / a > > maskFilter)
2017-07-28 19:18:29 +00:00
< / pre >
2018-11-09 21:04:58 +00:00
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
< 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
2018-10-31 16:14:03 +00:00
< a href = 'undocumented#Mask_Alpha' > mask alpha< / a > unaltered.
2017-09-21 16:31:06 +00:00
2018-11-09 21:04:58 +00:00
Increments < a href = '#SkPaint_setMaskFilter_maskFilter' > maskFilter< / a > < a href = 'undocumented#SkRefCnt' > SkRefCnt< / a > by one.
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkPaint_setMaskFilter_maskFilter' > < code > < strong > maskFilter< / strong > < / code > < / a > < / td >
< td > modifies clipping mask generated from drawn geometry< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
2018-03-16 15:34:15 +00:00
< div > < fiddle-embed name = "a993831c40f3e134f809134e3b74e4a6" > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
2018-10-16 14:30:28 +00:00
< a name = 'Typeface_Methods' > < / a >
2017-07-28 19:18:29 +00:00
2018-10-16 14:30:28 +00:00
---
2018-02-01 14:37:32 +00:00
2018-11-29 17:05:25 +00:00
< 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 > .
2018-11-09 21:04:58 +00:00
< 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 > .
2018-11-29 17:05:25 +00:00
The default < a href = 'undocumented#Typeface' > Typeface< / a > defers to the platform-specific default < a href = 'SkFont_Reference#Font' > font< / a >
2018-11-09 21:04:58 +00:00
implementation.
2017-07-28 19:18:29 +00:00
### Example
2018-07-11 05:28:17 +00:00
< div > < fiddle-embed name = "1a7a5062725139760962582f599f1b97" > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a name = 'SkPaint_getTypeface' > < / a >
2018-10-16 14:30:28 +00:00
---
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-11-29 17:05:25 +00:00
< a href = 'undocumented#SkTypeface' > SkTypeface< / a > * < a href = '#SkPaint_getTypeface' > getTypeface< / a > ()const
2017-07-28 19:18:29 +00:00
< / pre >
2018-11-09 21:04:58 +00:00
Returns < a href = 'undocumented#SkTypeface' > SkTypeface< / a > if set, or nullptr.
2018-10-31 16:14:03 +00:00
Does not alter < a href = 'undocumented#SkTypeface' > SkTypeface< / a > < a href = 'undocumented#SkRefCnt' > SkRefCnt< / a > .
2017-07-28 19:18:29 +00:00
### Return Value
2018-11-09 21:04:58 +00:00
< a href = 'undocumented#SkTypeface' > SkTypeface< / a > if previously set, nullptr otherwise
2017-07-28 19:18:29 +00:00
### Example
2018-07-17 12:20:27 +00:00
< div > < fiddle-embed name = "5ce718e5a184baaac80e7098d7dad67b" >
2017-07-28 19:18:29 +00:00
#### Example Output
~~~~
nullptr == typeface
nullptr != typeface
~~~~
< / fiddle-embed > < / div >
2018-05-16 11:07:07 +00:00
< a name = 'SkPaint_refTypeface' > < / a >
2018-10-16 14:30:28 +00:00
---
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-11-29 17:05:25 +00:00
< a href = 'undocumented#sk_sp' > sk_sp< / a > < < a href = 'undocumented#SkTypeface' > SkTypeface< / a > > < a href = '#SkPaint_refTypeface' > refTypeface< / a > ()const
2017-07-28 19:18:29 +00:00
< / pre >
2018-11-09 21:04:58 +00:00
Increases < a href = 'undocumented#SkTypeface' > SkTypeface< / a > < a href = 'undocumented#SkRefCnt' > SkRefCnt< / a > by one.
2017-07-28 19:18:29 +00:00
### Return Value
2018-11-09 21:04:58 +00:00
< a href = 'undocumented#SkTypeface' > SkTypeface< / a > if previously set, nullptr otherwise
2017-07-28 19:18:29 +00:00
### Example
2018-07-18 20:21:51 +00:00
< div > < fiddle-embed name = "8b5aa7e555a0dc31be69db7cadf471a1" >
2017-07-28 19:18:29 +00:00
#### Example Output
~~~~
typeface1 != typeface2
typeface1 == typeface2
~~~~
< / fiddle-embed > < / div >
2018-05-16 11:07:07 +00:00
< a name = 'SkPaint_setTypeface' > < / a >
2018-10-16 14:30:28 +00:00
---
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-11-09 21:04:58 +00:00
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 > )
2017-07-28 19:18:29 +00:00
< / pre >
2018-11-09 21:04:58 +00:00
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 > .
Pass nullptr to clear < a href = 'undocumented#SkTypeface' > SkTypeface< / a > and use the default < a href = '#SkPaint_setTypeface_typeface' > typeface< / a > . Increments
< a href = '#SkPaint_setTypeface_typeface' > typeface< / a > < a href = 'undocumented#SkRefCnt' > SkRefCnt< / a > by one.
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkPaint_setTypeface_typeface' > < code > < strong > typeface< / strong > < / code > < / a > < / td >
2018-11-29 17:05:25 +00:00
< td > < a href = 'SkFont_Reference#Font' > font< / a > and style used to draw < a href = 'undocumented#Text' > text< / a > < / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
2018-01-05 19:21:59 +00:00
< div > < fiddle-embed name = "0e6fbb7773cd925b274552f4cd1abef2" > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
2018-10-16 14:30:28 +00:00
< a name = 'Image_Filter_Methods' > < / a >
2017-07-28 19:18:29 +00:00
2018-10-16 14:30:28 +00:00
---
2018-02-01 14:37:32 +00:00
2018-11-09 21:04:58 +00:00
< 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 >
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 > ,
which is drawn to the < a href = 'undocumented#Device' > device< / a > using the set < a href = '#Blend_Mode' > Blend_Mode< / a > .
2017-09-21 16:31:06 +00:00
2018-11-09 21:04:58 +00:00
< 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 >
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.
< a href = '#Image_Filter' > Image_Filter< / a > operates independently of and can be used in combination with
2018-11-07 19:59:03 +00:00
< a href = '#Mask_Filter' > Mask_Filter< / a > .
2017-07-28 19:18:29 +00:00
### Example
2018-07-05 05:35:27 +00:00
< div > < fiddle-embed name = "ece04ee3d3761e3425f37c8f06f054c1" > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a name = 'SkPaint_getImageFilter' > < / a >
2018-10-16 14:30:28 +00:00
---
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-11-29 17:05:25 +00:00
< a href = 'undocumented#SkImageFilter' > SkImageFilter< / a > * < a href = '#SkPaint_getImageFilter' > getImageFilter< / a > ()const
2017-07-28 19:18:29 +00:00
< / pre >
2018-11-09 21:04:58 +00:00
Returns < a href = 'undocumented#SkImageFilter' > SkImageFilter< / a > if set, or nullptr.
2018-10-31 16:14:03 +00:00
Does not alter < a href = 'undocumented#SkImageFilter' > SkImageFilter< / a > < a href = 'undocumented#SkRefCnt' > SkRefCnt< / a > .
2017-07-28 19:18:29 +00:00
### Return Value
2018-11-09 21:04:58 +00:00
< a href = 'undocumented#SkImageFilter' > SkImageFilter< / a > if previously set, nullptr otherwise
2017-07-28 19:18:29 +00:00
### Example
2018-07-06 05:23:23 +00:00
< div > < fiddle-embed name = "c11f8eaa1dd149bc18db21e23ce26904" >
2017-07-28 19:18:29 +00:00
#### Example Output
~~~~
nullptr == image filter
nullptr != image filter
~~~~
< / fiddle-embed > < / div >
2018-05-16 11:07:07 +00:00
< a name = 'SkPaint_refImageFilter' > < / a >
2018-10-16 14:30:28 +00:00
---
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-11-29 17:05:25 +00:00
< a href = 'undocumented#sk_sp' > sk_sp< / a > < < a href = 'undocumented#SkImageFilter' > SkImageFilter< / a > > < a href = '#SkPaint_refImageFilter' > refImageFilter< / a > ()const
2017-07-28 19:18:29 +00:00
< / pre >
2018-11-09 21:04:58 +00:00
Returns < a href = 'undocumented#SkImageFilter' > SkImageFilter< / a > if set, or nullptr.
Increases < a href = 'undocumented#SkImageFilter' > SkImageFilter< / a > < a href = 'undocumented#SkRefCnt' > SkRefCnt< / a > by one.
2017-07-28 19:18:29 +00:00
### Return Value
2018-11-09 21:04:58 +00:00
< a href = 'undocumented#SkImageFilter' > SkImageFilter< / a > if previously set, nullptr otherwise
2017-07-28 19:18:29 +00:00
### Example
< div > < fiddle-embed name = "13f09088b569251547107d14ae989dc1" >
#### Example Output
~~~~
image filter unique: true
image filter unique: false
~~~~
< / fiddle-embed > < / div >
2018-05-16 11:07:07 +00:00
< a name = 'SkPaint_setImageFilter' > < / a >
2018-10-16 14:30:28 +00:00
---
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-11-09 21:04:58 +00:00
void < a href = '#SkPaint_setImageFilter' > setImageFilter< / a > (< a href = 'undocumented#sk_sp' > sk_sp< / a > < < a href = 'undocumented#SkImageFilter' > SkImageFilter< / a > > imageFilter)
2017-07-28 19:18:29 +00:00
< / pre >
2018-11-09 21:04:58 +00:00
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
< 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
2017-07-28 19:18:29 +00:00
on drawing.
2017-09-21 16:31:06 +00:00
2018-11-09 21:04:58 +00:00
Increments < a href = '#SkPaint_setImageFilter_imageFilter' > imageFilter< / a > < a href = 'undocumented#SkRefCnt' > SkRefCnt< / a > by one.
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkPaint_setImageFilter_imageFilter' > < code > < strong > imageFilter< / strong > < / code > < / a > < / td >
2018-11-09 21:04:58 +00:00
< td > how < a href = 'SkImage_Reference#SkImage' > SkImage< / a > is sampled when transformed< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
< div > < fiddle-embed name = "6679d6e4ec632715ee03e68391bd7f9a" > < / fiddle-embed > < / div >
2018-10-16 14:30:28 +00:00
< a name = 'Draw_Looper_Methods' > < / a >
2017-07-28 19:18:29 +00:00
2018-10-16 14:30:28 +00:00
---
2018-02-01 14:37:32 +00:00
2018-11-09 21:04:58 +00:00
< a href = '#Draw_Looper' > Draw_Looper< / a > sets a modifier that communicates state from one < a href = '#Draw_Layer' > Draw_Layer< / a >
to another to construct the draw.
2017-09-21 16:31:06 +00:00
2018-11-09 21:04:58 +00:00
< 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.
< a href = '#Draw_Looper' > Draw_Looper< / a > may be used to draw multiple colors or create a colored shadow.
Set < a href = '#Draw_Looper' > Draw_Looper< / a > to nullptr to prevent < a href = '#Draw_Looper' > Draw_Looper< / a > from modifying the draw.
2017-07-28 19:18:29 +00:00
### Example
< div > < fiddle-embed name = "84ec12a36e50df5ac565cc7a75ffbe9f" > < / fiddle-embed > < / div >
2018-05-16 11:07:07 +00:00
< a name = 'SkPaint_getDrawLooper' > < / a >
2018-10-16 14:30:28 +00:00
---
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-11-29 17:05:25 +00:00
< a href = 'undocumented#SkDrawLooper' > SkDrawLooper< / a > * < a href = '#SkPaint_getDrawLooper' > getDrawLooper< / a > ()const
2017-07-28 19:18:29 +00:00
< / pre >
2018-11-09 21:04:58 +00:00
Returns < a href = 'undocumented#SkDrawLooper' > SkDrawLooper< / a > if set, or nullptr.
2018-10-31 16:14:03 +00:00
Does not alter < a href = 'undocumented#SkDrawLooper' > SkDrawLooper< / a > < a href = 'undocumented#SkRefCnt' > SkRefCnt< / a > .
2017-07-28 19:18:29 +00:00
### Return Value
2018-11-09 21:04:58 +00:00
< a href = 'undocumented#SkDrawLooper' > SkDrawLooper< / a > if previously set, nullptr otherwise
2017-07-28 19:18:29 +00:00
### Example
< div > < fiddle-embed name = "af4c5acc7a91e7f23c2af48018903ad4" >
#### Example Output
~~~~
nullptr == draw looper
nullptr != draw looper
~~~~
< / fiddle-embed > < / div >
2018-05-16 11:07:07 +00:00
< a name = 'SkPaint_refDrawLooper' > < / a >
2018-10-16 14:30:28 +00:00
---
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-11-29 17:05:25 +00:00
< a href = 'undocumented#sk_sp' > sk_sp< / a > < < a href = 'undocumented#SkDrawLooper' > SkDrawLooper< / a > > < a href = '#SkPaint_refDrawLooper' > refDrawLooper< / a > ()const
2017-07-28 19:18:29 +00:00
< / pre >
2018-11-09 21:04:58 +00:00
Returns < a href = 'undocumented#SkDrawLooper' > SkDrawLooper< / a > if set, or nullptr.
Increases < a href = 'undocumented#SkDrawLooper' > SkDrawLooper< / a > < a href = 'undocumented#SkRefCnt' > SkRefCnt< / a > by one.
2017-07-28 19:18:29 +00:00
### Return Value
2018-11-09 21:04:58 +00:00
< a href = 'undocumented#SkDrawLooper' > SkDrawLooper< / a > if previously set, nullptr otherwise
2017-07-28 19:18:29 +00:00
### Example
< div > < fiddle-embed name = "2a3782c33f04ed17a725d0e449c6f7c3" >
#### Example Output
~~~~
draw looper unique: true
draw looper unique: false
~~~~
< / fiddle-embed > < / div >
2018-05-16 11:07:07 +00:00
< a name = 'SkPaint_setDrawLooper' > < / a >
2018-10-16 14:30:28 +00:00
---
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-11-15 13:25:12 +00:00
void < a href = '#SkPaint_setDrawLooper' > setDrawLooper< / a > (< a href = 'undocumented#sk_sp' > sk_sp< / a > < < a href = 'undocumented#SkDrawLooper' > SkDrawLooper< / a > > drawLooper)
2017-07-28 19:18:29 +00:00
< / pre >
2018-11-09 21:04:58 +00:00
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
< 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
2017-09-21 16:31:06 +00:00
drawing unaltered.
2018-11-09 21:04:58 +00:00
Increments < a href = '#SkPaint_setDrawLooper_drawLooper' > drawLooper< / a > < a href = 'undocumented#SkRefCnt' > SkRefCnt< / a > by one.
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkPaint_setDrawLooper_drawLooper' > < code > < strong > drawLooper< / strong > < / code > < / a > < / td >
2018-10-31 16:14:03 +00:00
< td > iterates through drawing one or more time, altering < a href = 'SkPaint_Reference#SkPaint' > SkPaint< / a > < / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
< div > < fiddle-embed name = "bf10f838b330f0a3a3266d42ea68a638" > < / fiddle-embed > < / div >
2018-10-16 14:30:28 +00:00
< a name = 'Text_Size' > < / a >
2017-07-28 19:18:29 +00:00
2018-10-16 14:30:28 +00:00
---
2018-02-01 14:37:32 +00:00
2018-11-09 21:04:58 +00:00
< 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 > .
< a href = '#Paint_Text_Size' > Text_Size< / a > can be set to any positive value or zero.
< a href = '#Paint_Text_Size' > Text_Size< / a > defaults to 12.
Set < a href = 'undocumented#SkPaintDefaults_TextSize' > SkPaintDefaults_TextSize< / a > at compile time to change the default setting.
2017-07-28 19:18:29 +00:00
### Example
< div > < fiddle-embed name = "91c9a3e498bb9412e4522a95d076ed5f" > < / fiddle-embed > < / div >
2018-05-16 11:07:07 +00:00
< a name = 'SkPaint_getTextSize' > < / a >
2018-10-16 14:30:28 +00:00
---
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-11-29 17:05:25 +00:00
< a href = 'undocumented#SkScalar' > SkScalar< / a > < a href = '#SkPaint_getTextSize' > getTextSize< / a > ()const
2017-07-28 19:18:29 +00:00
< / pre >
2018-11-09 21:04:58 +00:00
Returns < a href = 'undocumented#Text' > text< / a > < a href = 'undocumented#Size' > size< / a > in < a href = 'SkPoint_Reference#Point' > points< / a > .
2017-07-28 19:18:29 +00:00
### Return Value
2018-10-31 16:14:03 +00:00
typographic height of < a href = 'undocumented#Text' > text< / a >
2017-07-28 19:18:29 +00:00
### Example
2018-07-04 05:33:26 +00:00
< div > < fiddle-embed name = "983e2a71ba72d4ba8c945420040b8f1c" > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a name = 'SkPaint_setTextSize' > < / a >
2018-10-16 14:30:28 +00:00
---
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-11-09 21:04:58 +00:00
void < a href = '#SkPaint_setTextSize' > setTextSize< / a > (< a href = 'undocumented#SkScalar' > SkScalar< / a > textSize)
2017-07-28 19:18:29 +00:00
< / pre >
2018-11-09 21:04:58 +00:00
Sets < a href = '#Text_Size' > text size< / a > in < a href = 'SkPoint_Reference#Point' > points< / a > .
Has no effect if < a href = '#SkPaint_setTextSize_textSize' > textSize< / a > is not greater than or equal to zero.
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkPaint_setTextSize_textSize' > < code > < strong > textSize< / strong > < / code > < / a > < / td >
2018-10-31 16:14:03 +00:00
< td > typographic height of < a href = 'undocumented#Text' > text< / a > < / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
2018-07-05 05:35:27 +00:00
< div > < fiddle-embed name = "6510c9e2f57b83c47e67829e7a68d493" > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
2018-10-16 14:30:28 +00:00
< a name = 'Text_Scale_X' > < / a >
2017-07-28 19:18:29 +00:00
2018-10-16 14:30:28 +00:00
---
2018-02-01 14:37:32 +00:00
2018-11-09 21:04:58 +00:00
< a href = '#Paint_Text_Scale_X' > Text_Scale_X< / a > adjusts the < a href = 'undocumented#Text' > text< / a > horizontal scale.
< a href = 'undocumented#Text' > Text< / a > scaling approximates condensed and expanded type faces when the actual face
is not available.
< a href = '#Paint_Text_Scale_X' > Text_Scale_X< / a > can be set to any value.
< a href = '#Paint_Text_Scale_X' > Text_Scale_X< / a > defaults to 1.
2017-07-28 19:18:29 +00:00
### Example
2018-07-05 05:35:27 +00:00
< div > < fiddle-embed name = "d13d787c1e36f515319fc998411c1d91" > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a name = 'SkPaint_getTextScaleX' > < / a >
2018-10-16 14:30:28 +00:00
---
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-11-29 17:05:25 +00:00
< a href = 'undocumented#SkScalar' > SkScalar< / a > < a href = '#SkPaint_getTextScaleX' > getTextScaleX< / a > ()const
2017-07-28 19:18:29 +00:00
< / pre >
2018-11-09 21:04:58 +00:00
Returns < a href = 'undocumented#Text' > text< / a > scale on x-axis.
2017-07-28 19:18:29 +00:00
Default value is 1.
### Return Value
2018-11-09 21:04:58 +00:00
< a href = 'undocumented#Text' > text< / a > horizontal scale
2017-07-28 19:18:29 +00:00
### Example
< div > < fiddle-embed name = "5dc8e58f6910cb8e4de9ed60f888188b" > < / fiddle-embed > < / div >
2018-05-16 11:07:07 +00:00
< a name = 'SkPaint_setTextScaleX' > < / a >
2018-10-16 14:30:28 +00:00
---
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-11-09 21:04:58 +00:00
void < a href = '#SkPaint_setTextScaleX' > setTextScaleX< / a > (< a href = 'undocumented#SkScalar' > SkScalar< / a > scaleX)
2017-07-28 19:18:29 +00:00
< / pre >
2018-11-09 21:04:58 +00:00
Sets < a href = 'undocumented#Text' > text scale< / a > on x-axis.
2017-07-28 19:18:29 +00:00
Default value is 1.
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkPaint_setTextScaleX_scaleX' > < code > < strong > scaleX< / strong > < / code > < / a > < / td >
2018-11-09 21:04:58 +00:00
< td > < a href = 'undocumented#Text' > text< / a > horizontal scale< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
< div > < fiddle-embed name = "a75bbdb8bb866b125c4c1dd5e967d470" > < / fiddle-embed > < / div >
2018-10-16 14:30:28 +00:00
< a name = 'Text_Skew_X' > < / a >
2017-07-28 19:18:29 +00:00
2018-10-16 14:30:28 +00:00
---
2018-02-01 14:37:32 +00:00
2018-11-09 21:04:58 +00:00
< a href = '#Paint_Text_Skew_X' > Text_Skew_X< / a > adjusts the < a href = 'undocumented#Text' > text< / a > horizontal slant.
< a href = 'undocumented#Text' > Text< / a > skewing approximates italic and oblique type faces when the actual face
is not available.
< a href = '#Paint_Text_Skew_X' > Text_Skew_X< / a > can be set to any value.
< a href = '#Paint_Text_Skew_X' > Text_Skew_X< / a > defaults to 0.
2017-07-28 19:18:29 +00:00
### Example
< div > < fiddle-embed name = "aff208b0aab265f273045b27e683c17c" > < / fiddle-embed > < / div >
2018-05-16 11:07:07 +00:00
< a name = 'SkPaint_getTextSkewX' > < / a >
2018-10-16 14:30:28 +00:00
---
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-11-29 17:05:25 +00:00
< a href = 'undocumented#SkScalar' > SkScalar< / a > < a href = '#SkPaint_getTextSkewX' > getTextSkewX< / a > ()const
2017-07-28 19:18:29 +00:00
< / pre >
2018-11-09 21:04:58 +00:00
Returns < a href = 'undocumented#Text' > text< / a > skew on x-axis.
2017-07-28 19:18:29 +00:00
Default value is zero.
### Return Value
2018-10-31 16:14:03 +00:00
additional shear on x-axis relative to y-axis
2017-07-28 19:18:29 +00:00
### Example
2018-07-19 14:50:44 +00:00
< div > < fiddle-embed name = "11c10f466dae0d1639dbb9f6a0040218" > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a name = 'SkPaint_setTextSkewX' > < / a >
2018-10-16 14:30:28 +00:00
---
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-11-09 21:04:58 +00:00
void < a href = '#SkPaint_setTextSkewX' > setTextSkewX< / a > (< a href = 'undocumented#SkScalar' > SkScalar< / a > skewX)
2017-07-28 19:18:29 +00:00
< / pre >
2018-11-09 21:04:58 +00:00
Sets < a href = 'undocumented#Text' > text skew< / a > on x-axis.
2017-07-28 19:18:29 +00:00
Default value is zero.
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkPaint_setTextSkewX_skewX' > < code > < strong > skewX< / strong > < / code > < / a > < / td >
2018-10-31 16:14:03 +00:00
< td > additional shear on x-axis relative to y-axis< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
2018-07-11 05:28:17 +00:00
< div > < fiddle-embed name = "6bd705a6e0c5f8ee24f302fe531bfabc" > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
2018-10-16 14:30:28 +00:00
< a name = 'Text_Encoding' > < / a >
2017-07-28 19:18:29 +00:00
---
### Example
2018-12-06 13:41:14 +00:00
< div > < fiddle-embed name = "767fa4e7b6300e16a419f9881f0f9d3d" > < div > First < a href = 'undocumented#Line' > line< / a > is encoded in UTF-8.
2018-11-09 21:04:58 +00:00
Second < a href = 'undocumented#Line' > line< / a > is encoded in UTF-16.
Third < a href = 'undocumented#Line' > line< / a > is encoded in UTF-32.
Fourth < a href = 'undocumented#Line' > line< / a > has 16-bit < a href = 'undocumented#Glyph' > glyph< / a > indices.
2018-03-05 18:26:16 +00:00
< / div > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a name = 'SkPaint_getTextEncoding' > < / a >
2018-10-16 14:30:28 +00:00
---
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-12-06 13:41:14 +00:00
< a href = 'undocumented#SkTextEncoding' > SkTextEncoding< / a > < a href = '#SkPaint_getTextEncoding' > getTextEncoding< / a > ()const
2017-07-28 19:18:29 +00:00
< / pre >
2018-12-06 13:41:14 +00:00
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
to methods like < a href = '#SkPaint_measureText' > measureText< / a > () and < a href = 'SkCanvas_Reference#SkCanvas' > SkCanvas< / a > ::< a href = '#SkCanvas_drawText' > drawText< / a > ().
2017-07-28 19:18:29 +00:00
### Return Value
2018-12-06 13:41:14 +00:00
the < a href = 'undocumented#Text' > text< / a > encoding
2017-07-28 19:18:29 +00:00
### Example
2018-12-06 13:41:14 +00:00
< div > < fiddle-embed name = "0d21e968e9a4c78c902ae3ef494941a0" >
2017-07-28 19:18:29 +00:00
#### Example Output
~~~~
2019-05-07 19:38:46 +00:00
SkTextEncoding::kUTF8 == text encoding
SkTextEncoding::kGlyphID == text encoding
2017-07-28 19:18:29 +00:00
~~~~
< / fiddle-embed > < / div >
2018-05-16 11:07:07 +00:00
< a name = 'SkPaint_setTextEncoding' > < / a >
2018-10-16 14:30:28 +00:00
---
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-12-06 13:41:14 +00:00
void < a href = '#SkPaint_setTextEncoding' > setTextEncoding< / a > (< a href = 'undocumented#SkTextEncoding' > SkTextEncoding< / a > encoding)
2017-07-28 19:18:29 +00:00
< / pre >
2018-12-06 13:41:14 +00:00
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
to methods like < a href = '#SkPaint_measureText' > measureText< / a > () and < a href = 'SkCanvas_Reference#SkCanvas' > SkCanvas< / a > ::< a href = '#SkCanvas_drawText' > drawText< / a > ().
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkPaint_setTextEncoding_encoding' > < code > < strong > encoding< / strong > < / code > < / a > < / td >
2018-12-06 13:41:14 +00:00
< td > the new < a href = '#Text_Encoding' > text encoding< / a > < / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
2018-12-06 13:41:14 +00:00
< div > < fiddle-embed name = "a5d1ba0dbf42afb797ffdb07647b5cb9" >
2017-07-28 19:18:29 +00:00
#### Example Output
~~~~
4 != text encoding
~~~~
< / fiddle-embed > < / div >
2018-10-08 18:57:48 +00:00
< a name = 'SkPaint_FontMetrics' > < / a >
2018-05-16 11:07:07 +00:00
2018-10-16 14:30:28 +00:00
---
2018-11-07 01:40:45 +00:00
< a name = 'Font_Metrics' > < / a >
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a name = 'SkPaint_getFontMetrics' > < / a >
2018-10-16 14:30:28 +00:00
---
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-11-29 17:05:25 +00:00
< a href = 'undocumented#SkScalar' > SkScalar< / a > < a href = '#SkPaint_getFontMetrics' > getFontMetrics< / a > (< a href = 'undocumented#SkFontMetrics' > SkFontMetrics< / a > * metrics)const
2017-07-28 19:18:29 +00:00
< / pre >
2018-11-09 21:04:58 +00:00
Returns < a href = 'undocumented#SkFontMetrics' > SkFontMetrics< / a > associated with < a href = 'undocumented#SkTypeface' > SkTypeface< / a > .
The return value is the recommended spacing between < a href = 'undocumented#Line' > lines< / a > : the sum of < a href = '#SkPaint_getFontMetrics_metrics' > metrics< / a >
2017-07-28 19:18:29 +00:00
descent, ascent, and leading.
2018-11-09 21:04:58 +00:00
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 > .
Results are scaled by < a href = '#Text_Size' > text size< / a > but does not take into account
2018-10-31 16:14:03 +00:00
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 > ,
< a href = '#Style_Stroke' > style stroke< / a > , and < a href = 'undocumented#SkPathEffect' > SkPathEffect< / a > .
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkPaint_getFontMetrics_metrics' > < code > < strong > metrics< / strong > < / code > < / a > < / td >
2018-11-09 21:04:58 +00:00
< td > storage for < a href = 'undocumented#SkFontMetrics' > SkFontMetrics< / a > ; may be nullptr< / td >
2018-05-16 11:07:07 +00:00
< / tr >
2017-07-28 19:18:29 +00:00
< / table >
### Return Value
2018-10-31 16:14:03 +00:00
recommended spacing between < a href = 'undocumented#Line' > lines< / a >
2017-07-28 19:18:29 +00:00
### Example
2018-11-02 05:33:11 +00:00
< div > < fiddle-embed name = "59d9b8249afa1c2af6186711250ce240" > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
### See Also
2018-12-06 13:41:14 +00:00
< a href = '#Font_Size' > Font_Size< / a > < a href = 'undocumented#Typeface' > Typeface< / a > < a href = '#Paint_Typeface_Methods' > Typeface_Methods< / a >
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a name = 'SkPaint_getFontSpacing' > < / a >
2018-10-16 14:30:28 +00:00
---
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-11-29 17:05:25 +00:00
< a href = 'undocumented#SkScalar' > SkScalar< / a > < a href = '#SkPaint_getFontSpacing' > getFontSpacing< / a > ()const
2017-07-28 19:18:29 +00:00
< / pre >
2018-11-09 21:04:58 +00:00
Returns the recommended spacing between < a href = 'undocumented#Line' > lines< / a > : the sum of metrics
2017-07-28 19:18:29 +00:00
descent, ascent, and leading.
2018-11-09 21:04:58 +00:00
Result is scaled by < a href = 'undocumented#Text' > text< / a > < a href = 'undocumented#Size' > size< / a > but does not take into account
2018-10-31 16:14:03 +00:00
dimensions required by stroking and < a href = 'undocumented#SkPathEffect' > SkPathEffect< / a > .
Returns the same result as < a href = '#SkPaint_getFontMetrics' > getFontMetrics< / a > ().
2017-07-28 19:18:29 +00:00
### Return Value
2018-10-31 16:14:03 +00:00
recommended spacing between < a href = 'undocumented#Line' > lines< / a >
2017-07-28 19:18:29 +00:00
### Example
< div > < fiddle-embed name = "424741e26e1b174e43087d67422ce14f" >
#### Example Output
~~~~
textSize: 12 fontSpacing: 13.9688
textSize: 18 fontSpacing: 20.9531
textSize: 24 fontSpacing: 27.9375
textSize: 32 fontSpacing: 37.25
~~~~
< / fiddle-embed > < / div >
2018-05-16 11:07:07 +00:00
< a name = 'SkPaint_textToGlyphs' > < / a >
2018-10-16 14:30:28 +00:00
---
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-11-29 17:05:25 +00:00
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
2017-07-28 19:18:29 +00:00
< / pre >
2018-11-09 21:04:58 +00:00
Converts < a href = '#SkPaint_textToGlyphs_text' > text< / a > into < a href = 'undocumented#Glyph' > glyph< / a > indices.
Returns the number of < a href = 'undocumented#Glyph' > glyph< / a > indices represented by < a href = '#SkPaint_textToGlyphs_text' > text< / a > .
2018-12-04 06:13:55 +00:00
< 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 > .
2018-11-09 21:04:58 +00:00
< a href = '#SkPaint_textToGlyphs_glyphs' > glyphs< / a > may be nullptr, to compute the < a href = 'undocumented#Glyph' > glyph< / a > count.
2017-07-28 19:18:29 +00:00
2018-11-09 21:04:58 +00:00
Does not check < a href = '#SkPaint_textToGlyphs_text' > text< / a > for valid character codes or valid < a href = 'undocumented#Glyph' > glyph< / a > indices.
2017-07-28 19:18:29 +00:00
2018-11-09 21:04:58 +00:00
If < a href = '#SkPaint_textToGlyphs_byteLength' > byteLength< / a > equals zero, returns zero.
If < a href = '#SkPaint_textToGlyphs_byteLength' > byteLength< / a > includes a partial character, the partial character is ignored.
2017-07-28 19:18:29 +00:00
2019-05-07 19:38:46 +00:00
If < a href = 'undocumented#SkTextEncoding' > SkTextEncoding< / a > is < a href = 'undocumented#SkTextEncoding::kUTF8' > SkTextEncoding::kUTF8< / a > and
2018-11-09 21:04:58 +00:00
< a href = '#SkPaint_textToGlyphs_text' > text< / a > contains an invalid UTF-8 sequence, zero is returned.
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkPaint_textToGlyphs_text' > < code > < strong > text< / strong > < / code > < / a > < / td >
2018-12-04 06:13:55 +00:00
< td > character storage encoded with < a href = 'undocumented#SkTextEncoding' > SkTextEncoding< / a > < / td >
2018-05-16 11:07:07 +00:00
< / tr >
< tr > < td > < a name = 'SkPaint_textToGlyphs_byteLength' > < code > < strong > byteLength< / strong > < / code > < / a > < / td >
< td > length of character storage in bytes< / td >
< / tr >
< tr > < td > < a name = 'SkPaint_textToGlyphs_glyphs' > < code > < strong > glyphs< / strong > < / code > < / a > < / td >
2018-11-09 21:04:58 +00:00
< td > storage for < a href = 'undocumented#Glyph' > glyph< / a > indices; may be nullptr< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Return Value
2018-11-09 21:04:58 +00:00
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 >
2017-07-28 19:18:29 +00:00
### Example
2018-12-06 13:41:14 +00:00
< div > < fiddle-embed name = "d11136d8a74f63009da2a7f550710823" > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a name = 'SkPaint_countText' > < / a >
2018-10-16 14:30:28 +00:00
---
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-11-29 17:05:25 +00:00
int < a href = '#SkPaint_countText' > countText< / a > (const void* < a href = 'undocumented#Text' > text< / a > , size_t byteLength)const
2017-07-28 19:18:29 +00:00
< / pre >
2018-11-09 21:04:58 +00:00
Returns the number of < a href = 'undocumented#Glyph' > glyphs< / a > in < a href = '#SkPaint_countText_text' > text< / a > .
2018-12-04 06:13:55 +00:00
Uses < a href = 'undocumented#SkTextEncoding' > SkTextEncoding< / a > to count the < a href = 'undocumented#Glyph' > glyphs< / a > .
2018-10-31 16:14:03 +00:00
Returns the same result as < a href = '#SkPaint_textToGlyphs' > textToGlyphs< / a > ().
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkPaint_countText_text' > < code > < strong > text< / strong > < / code > < / a > < / td >
2018-12-04 06:13:55 +00:00
< td > character storage encoded with < a href = 'undocumented#SkTextEncoding' > SkTextEncoding< / a > < / td >
2018-05-16 11:07:07 +00:00
< / tr >
< tr > < td > < a name = 'SkPaint_countText_byteLength' > < code > < strong > byteLength< / strong > < / code > < / a > < / td >
< td > length of character storage in bytes< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Return Value
2018-11-09 21:04:58 +00:00
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 >
2017-07-28 19:18:29 +00:00
### Example
2018-07-17 12:20:27 +00:00
< div > < fiddle-embed name = "85436c71aab5410767fc688ab0573e09" >
2017-07-28 19:18:29 +00:00
#### Example Output
~~~~
count = 5
~~~~
< / fiddle-embed > < / div >
2018-05-16 11:07:07 +00:00
< a name = 'SkPaint_containsText' > < / a >
2018-10-16 14:30:28 +00:00
---
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-11-29 17:05:25 +00:00
bool < a href = '#SkPaint_containsText' > containsText< / a > (const void* < a href = 'undocumented#Text' > text< / a > , size_t byteLength)const
2017-07-28 19:18:29 +00:00
< / pre >
2018-11-09 21:04:58 +00:00
Returns true if all < a href = '#SkPaint_containsText_text' > text< / a > corresponds to a non-zero < a href = 'undocumented#Glyph' > glyph< / a > index.
Returns false if any characters in < a href = '#SkPaint_containsText_text' > text< / a > are not supported in
2018-10-31 16:14:03 +00:00
< a href = 'undocumented#SkTypeface' > SkTypeface< / a > .
2017-07-28 19:18:29 +00:00
2019-05-07 19:38:46 +00:00
If < a href = 'undocumented#SkTextEncoding' > SkTextEncoding< / a > is < a href = 'undocumented#SkTextEncoding::kGlyphID' > SkTextEncoding::kGlyphID< / a > ,
2018-11-09 21:04:58 +00:00
returns true if all < a href = 'undocumented#Glyph' > glyph< / a > indices in < a href = '#SkPaint_containsText_text' > text< / a > are non-zero;
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 > .
2017-07-28 19:18:29 +00:00
2018-11-09 21:04:58 +00:00
Returns true if < a href = '#SkPaint_containsText_byteLength' > byteLength< / a > is zero.
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkPaint_containsText_text' > < code > < strong > text< / strong > < / code > < / a > < / td >
2018-10-31 16:14:03 +00:00
< td > array of characters or < a href = 'undocumented#Glyph' > glyphs< / a > < / td >
2018-05-16 11:07:07 +00:00
< / tr >
< tr > < td > < a name = 'SkPaint_containsText_byteLength' > < code > < strong > byteLength< / strong > < / code > < / a > < / td >
2018-11-09 21:04:58 +00:00
< td > number of bytes in < a href = '#SkPaint_containsText_text' > text< / a > array< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Return Value
2018-11-09 21:04:58 +00:00
true if all < a href = '#SkPaint_containsText_text' > text< / a > corresponds to a non-zero < a href = 'undocumented#Glyph' > glyph< / a > index
2017-07-28 19:18:29 +00:00
2018-11-09 21:04:58 +00:00
< div > < a href = '#SkPaint_containsText' > containsText< / a > succeeds for degree symbol, but cannot find a < a href = 'undocumented#Glyph' > glyph< / a > index
corresponding to the Unicode surrogate code < a href = 'SkPoint_Reference#Point' > point< / a > .
2018-03-05 18:26:16 +00:00
< / div >
2017-07-28 19:18:29 +00:00
#### Example Output
~~~~
0x00b0 == has char
0xd800 != has char
~~~~
### Example
2018-12-06 13:41:14 +00:00
< 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
2018-11-09 21:04:58 +00:00
that it corresponds to an entry in < a href = 'undocumented#Typeface' > Typeface< / a > .
2018-03-05 18:26:16 +00:00
< / div >
2017-07-28 19:18:29 +00:00
#### Example Output
~~~~
0x01ff == has glyph
0x0000 != has glyph
0xffff == has glyph
~~~~
< / fiddle-embed > < / div >
### See Also
2018-05-16 11:07:07 +00:00
< a href = '#SkPaint_setTextEncoding' > setTextEncoding< / a > < a href = 'undocumented#Typeface' > Typeface< / a >
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a name = 'SkPaint_glyphsToUnichars' > < / a >
2018-10-16 14:30:28 +00:00
---
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-11-29 17:05:25 +00:00
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
2017-07-28 19:18:29 +00:00
< / pre >
2018-11-09 21:04:58 +00:00
Converts < a href = '#SkPaint_glyphsToUnichars_glyphs' > glyphs< / a > into < a href = '#SkPaint_glyphsToUnichars_text' > text< / a > if possible.
< a href = 'undocumented#Glyph' > Glyph< / a > values without direct Unicode equivalents are mapped to zero.
Uses the < a href = 'undocumented#SkTypeface' > SkTypeface< / a > , but is unaffected
2019-05-07 19:38:46 +00:00
by < a href = 'undocumented#SkTextEncoding' > SkTextEncoding< / a > ; the < a href = '#SkPaint_glyphsToUnichars_text' > text< / a > values returned are equivalent to < a href = 'undocumented#SkTextEncoding::kUTF32' > SkTextEncoding::kUTF32< / a > .
2017-07-28 19:18:29 +00:00
2018-11-29 17:05:25 +00:00
Only supported on platforms that use FreeType as the < a href = 'SkFont_Reference#Font_Engine' > font engine< / a > .
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkPaint_glyphsToUnichars_glyphs' > < code > < strong > glyphs< / strong > < / code > < / a > < / td >
2018-11-29 17:05:25 +00:00
< td > array of indices into < a href = 'SkFont_Reference#Font' > font< / a > < / td >
2018-05-16 11:07:07 +00:00
< / tr >
< tr > < td > < a name = 'SkPaint_glyphsToUnichars_count' > < code > < strong > count< / strong > < / code > < / a > < / td >
2018-11-09 21:04:58 +00:00
< td > length of < a href = 'undocumented#Glyph' > glyph< / a > array< / td >
2018-05-16 11:07:07 +00:00
< / tr >
< tr > < td > < a name = 'SkPaint_glyphsToUnichars_text' > < code > < strong > text< / strong > < / code > < / a > < / td >
2018-10-31 16:14:03 +00:00
< td > storage for character codes, one per < a href = 'undocumented#Glyph' > glyph< / a > < / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
2018-12-11 05:44:07 +00:00
< 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 > .
< / div >
2017-07-28 19:18:29 +00:00
2018-10-16 14:30:28 +00:00
< a name = 'Measure_Text' > < / a >
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a name = 'SkPaint_measureText' > < / a >
2018-10-16 14:30:28 +00:00
---
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-11-29 17:05:25 +00:00
< 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
2017-07-28 19:18:29 +00:00
< / pre >
2018-10-23 18:44:05 +00:00
Returns the advance width of < a href = '#SkPaint_measureText_text' > text< / a > .
2018-05-16 11:07:07 +00:00
The advance is the normal distance to move before drawing additional < a href = '#SkPaint_measureText_text' > text< / a > .
2018-12-04 06:13:55 +00:00
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 > ,
2018-11-09 21:04:58 +00:00
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
< a href = 'undocumented#SkPathEffect' > SkPathEffect< / a > to scale the metrics and < a href = '#SkPaint_measureText_bounds' > bounds< / a > .
Returns the bounding box of < a href = '#SkPaint_measureText_text' > text< / a > if < a href = '#SkPaint_measureText_bounds' > bounds< / a > is not nullptr.
The bounding box is computed as if the < a href = '#SkPaint_measureText_text' > text< / a > was drawn at the origin.
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkPaint_measureText_text' > < code > < strong > text< / strong > < / code > < / a > < / td >
2018-11-09 21:04:58 +00:00
< td > character codes or < a href = 'undocumented#Glyph' > glyph< / a > indices to be measured< / td >
2018-05-16 11:07:07 +00:00
< / tr >
< tr > < td > < a name = 'SkPaint_measureText_length' > < code > < strong > length< / strong > < / code > < / a > < / td >
2018-11-09 21:04:58 +00:00
< td > number of bytes of < a href = '#SkPaint_measureText_text' > text< / a > to measure< / td >
2018-05-16 11:07:07 +00:00
< / tr >
< tr > < td > < a name = 'SkPaint_measureText_bounds' > < code > < strong > bounds< / strong > < / code > < / a > < / td >
< td > returns bounding box relative to (0, 0) if not nullptr< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Return Value
advance width or height
### Example
2018-07-18 20:21:51 +00:00
< div > < fiddle-embed name = "06084f609184470135a9cd9ebc5af149" > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a name = 'SkPaint_measureText_2' > < / a >
2018-01-26 17:56:22 +00:00
2018-10-16 14:30:28 +00:00
---
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-11-29 17:05:25 +00:00
< a href = 'undocumented#SkScalar' > SkScalar< / a > < a href = '#SkPaint_measureText' > measureText< / a > (const void* < a href = 'undocumented#Text' > text< / a > , size_t length)const
2017-07-28 19:18:29 +00:00
< / pre >
2018-10-23 18:44:05 +00:00
Returns the advance width of < a href = '#SkPaint_measureText_2_text' > text< / a > .
2018-05-16 11:07:07 +00:00
The advance is the normal distance to move before drawing additional < a href = '#SkPaint_measureText_2_text' > text< / a > .
2018-12-04 06:13:55 +00:00
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 > ,
2018-11-09 21:04:58 +00:00
and < a href = '#Text_Size' > text size< / a > to scale the metrics.
2018-10-31 16:14:03 +00:00
Does not scale the advance or bounds by < a href = '#Fake_Bold' > fake bold< / a > or < a href = 'undocumented#SkPathEffect' > SkPathEffect< / a > .
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkPaint_measureText_2_text' > < code > < strong > text< / strong > < / code > < / a > < / td >
2018-11-09 21:04:58 +00:00
< td > character codes or < a href = 'undocumented#Glyph' > glyph< / a > indices to be measured< / td >
2018-05-16 11:07:07 +00:00
< / tr >
< tr > < td > < a name = 'SkPaint_measureText_2_length' > < code > < strong > length< / strong > < / code > < / a > < / td >
2018-11-09 21:04:58 +00:00
< td > number of bytes of < a href = '#SkPaint_measureText_2_text' > text< / a > to measure< / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Return Value
advance width or height
### Example
< div > < fiddle-embed name = "f1139a5ddd17fd47c2f45f6e642cac76" >
#### Example Output
~~~~
default width = 5
double width = 10
~~~~
< / fiddle-embed > < / div >
2018-05-16 11:07:07 +00:00
< a name = 'SkPaint_getTextWidths' > < / a >
2018-10-16 14:30:28 +00:00
---
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-11-29 17:05:25 +00:00
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
2017-07-28 19:18:29 +00:00
< / pre >
2018-11-09 21:04:58 +00:00
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
the < a href = 'undocumented#Glyph' > glyph< / a > count in < a href = '#SkPaint_getTextWidths_text' > text< / a > .
Both < a href = '#SkPaint_getTextWidths_widths' > widths< / a > and < a href = '#SkPaint_getTextWidths_bounds' > bounds< / a > may be nullptr.
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.
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.
2018-12-04 06:13:55 +00:00
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 > ,
2018-11-09 21:04:58 +00:00
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 > .
2018-10-31 16:14:03 +00:00
Does not scale the advance by < a href = '#Fake_Bold' > fake bold< / a > or < a href = 'undocumented#SkPathEffect' > SkPathEffect< / a > .
2018-11-09 21:04:58 +00:00
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 > .
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkPaint_getTextWidths_text' > < code > < strong > text< / strong > < / code > < / a > < / td >
2018-11-09 21:04:58 +00:00
< td > character codes or < a href = 'undocumented#Glyph' > glyph< / a > indices to be measured< / td >
2018-05-16 11:07:07 +00:00
< / tr >
< tr > < td > < a name = 'SkPaint_getTextWidths_byteLength' > < code > < strong > byteLength< / strong > < / code > < / a > < / td >
2018-11-09 21:04:58 +00:00
< td > number of bytes of < a href = '#SkPaint_getTextWidths_text' > text< / a > to measure< / td >
2018-05-16 11:07:07 +00:00
< / tr >
< tr > < td > < a name = 'SkPaint_getTextWidths_widths' > < code > < strong > widths< / strong > < / code > < / a > < / td >
2018-11-09 21:04:58 +00:00
< td > returns < a href = '#SkPaint_getTextWidths_text' > text< / a > advances for each < a href = 'undocumented#Glyph' > glyph< / a > ; may be nullptr< / td >
2018-05-16 11:07:07 +00:00
< / tr >
< tr > < td > < a name = 'SkPaint_getTextWidths_bounds' > < code > < strong > bounds< / strong > < / code > < / a > < / td >
2018-11-09 21:04:58 +00:00
< 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 >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Return Value
2018-11-09 21:04:58 +00:00
< a href = 'undocumented#Glyph' > glyph< / a > count in < a href = '#SkPaint_getTextWidths_text' > text< / a >
2017-07-28 19:18:29 +00:00
### Example
2018-11-09 21:04:58 +00:00
< 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.
The underlines show the < a href = '#SkPaint_getTextWidths_text' > text< / a > advance, spaced to keep them distinct.
2018-03-05 18:26:16 +00:00
< / div > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
2018-10-16 14:30:28 +00:00
< a name = 'Text_Path' > < / a >
2018-02-01 14:37:32 +00:00
2018-11-09 21:04:58 +00:00
< 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 > .
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a name = 'SkPaint_getTextPath' > < / a >
2018-10-16 14:30:28 +00:00
---
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-11-29 17:05:25 +00:00
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
2017-07-28 19:18:29 +00:00
< / pre >
2018-11-09 21:04:58 +00:00
Returns the geometry as < a href = 'SkPath_Reference#SkPath' > SkPath< / a > equivalent to the drawn < a href = '#SkPaint_getTextPath_text' > text< / a > .
2018-12-04 06:13:55 +00:00
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 > ,
2018-11-09 21:04:58 +00:00
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 > .
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 > .
Uses < a href = '#SkPaint_getTextPath_x' > x< / a > , < a href = '#SkPaint_getTextPath_y' > y< / a > , to position < a href = '#SkPaint_getTextPath_path' > path< / a > .
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkPaint_getTextPath_text' > < code > < strong > text< / strong > < / code > < / a > < / td >
2018-11-09 21:04:58 +00:00
< td > character codes or < a href = 'undocumented#Glyph' > glyph< / a > indices< / td >
2018-05-16 11:07:07 +00:00
< / tr >
< tr > < td > < a name = 'SkPaint_getTextPath_length' > < code > < strong > length< / strong > < / code > < / a > < / td >
< td > number of bytes of < a href = '#SkPaint_getTextPath_text' > text< / a > < / td >
< / tr >
< tr > < td > < a name = 'SkPaint_getTextPath_x' > < code > < strong > x< / strong > < / code > < / a > < / td >
2018-10-31 16:14:03 +00:00
< td > x-axis value of the origin of the < a href = '#SkPaint_getTextPath_text' > text< / a > < / td >
2018-05-16 11:07:07 +00:00
< / tr >
< tr > < td > < a name = 'SkPaint_getTextPath_y' > < code > < strong > y< / strong > < / code > < / a > < / td >
2018-10-31 16:14:03 +00:00
< td > y-axis value of the origin of the < a href = '#SkPaint_getTextPath_text' > text< / a > < / td >
2018-05-16 11:07:07 +00:00
< / tr >
< tr > < td > < a name = 'SkPaint_getTextPath_path' > < code > < strong > path< / strong > < / code > < / a > < / td >
2018-10-31 16:14:03 +00:00
< td > geometry of the < a href = 'undocumented#Glyph' > glyphs< / a > < / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
2018-11-09 21:04:58 +00:00
< 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
the offset location. The result is rendered with one draw call.
2018-03-05 18:26:16 +00:00
< / div > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a name = 'SkPaint_getPosTextPath' > < / a >
2018-10-16 14:30:28 +00:00
---
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-11-29 17:05:25 +00:00
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
2017-07-28 19:18:29 +00:00
< / pre >
2018-11-09 21:04:58 +00:00
Returns the geometry as < a href = 'SkPath_Reference#SkPath' > SkPath< / a > equivalent to the drawn < a href = '#SkPaint_getPosTextPath_text' > text< / a > .
2018-12-04 06:13:55 +00:00
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 > ,
2018-11-09 21:04:58 +00:00
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 > .
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 > .
Uses < a href = '#SkPaint_getPosTextPath_pos' > pos< / a > array to position < a href = '#SkPaint_getPosTextPath_path' > path< / a > .
< a href = '#SkPaint_getPosTextPath_pos' > pos< / a > contains a position for each < a href = 'undocumented#Glyph' > glyph< / a > .
2017-07-28 19:18:29 +00:00
### Parameters
2018-05-16 11:07:07 +00:00
< table > < tr > < td > < a name = 'SkPaint_getPosTextPath_text' > < code > < strong > text< / strong > < / code > < / a > < / td >
2018-11-09 21:04:58 +00:00
< td > character codes or < a href = 'undocumented#Glyph' > glyph< / a > indices< / td >
2018-05-16 11:07:07 +00:00
< / tr >
< tr > < td > < a name = 'SkPaint_getPosTextPath_length' > < code > < strong > length< / strong > < / code > < / a > < / td >
< td > number of bytes of < a href = '#SkPaint_getPosTextPath_text' > text< / a > < / td >
< / tr >
< tr > < td > < a name = 'SkPaint_getPosTextPath_pos' > < code > < strong > pos< / strong > < / code > < / a > < / td >
2018-10-31 16:14:03 +00:00
< td > positions of each < a href = 'undocumented#Glyph' > glyph< / a > < / td >
2018-05-16 11:07:07 +00:00
< / tr >
< tr > < td > < a name = 'SkPaint_getPosTextPath_path' > < code > < strong > path< / strong > < / code > < / a > < / td >
2018-10-31 16:14:03 +00:00
< td > geometry of the < a href = 'undocumented#Glyph' > glyphs< / a > < / td >
2017-07-28 19:18:29 +00:00
< / tr >
< / table >
### Example
2018-11-09 21:04:58 +00:00
< div > < fiddle-embed name = "7f27c93472aa99a7542fb3493076f072" > < div > Simplifies three < a href = 'undocumented#Glyph' > Glyphs< / a > to eliminate overlaps, and strokes the result.
2018-03-05 18:26:16 +00:00
< / div > < / fiddle-embed > < / div >
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< a name = 'SkPaint_nothingToDraw' > < / a >
2018-10-16 14:30:28 +00:00
---
2017-07-28 19:18:29 +00:00
2018-05-16 11:07:07 +00:00
< pre style = "padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0 " >
2018-11-29 17:05:25 +00:00
bool < a href = '#SkPaint_nothingToDraw' > nothingToDraw< / a > ()const
2017-07-28 19:18:29 +00:00
< / pre >
2018-11-09 21:04:58 +00:00
Returns true if < a href = 'SkPaint_Reference#SkPaint' > SkPaint< / a > prevents all drawing;
otherwise, the < a href = 'SkPaint_Reference#SkPaint' > SkPaint< / a > may or may not allow drawing.
2017-07-28 19:18:29 +00:00
2018-11-09 21:04:58 +00:00
Returns true if, for example, < a href = 'SkBlendMode_Reference#SkBlendMode' > SkBlendMode< / a > combined with < a href = 'SkColor_Reference#Alpha' > alpha< / a > computes a
new < a href = 'SkColor_Reference#Alpha' > alpha< / a > of zero.
2017-07-28 19:18:29 +00:00
### Return Value
2018-11-09 21:04:58 +00:00
true if < a href = 'SkPaint_Reference#SkPaint' > SkPaint< / a > prevents all drawing
2017-07-28 19:18:29 +00:00
### Example
2018-07-18 20:21:51 +00:00
< div > < fiddle-embed name = "2973b05bfbb6b4c29332c8ac4fcf3995" >
2017-07-28 19:18:29 +00:00
#### Example Output
~~~~
initial nothing to draw: false
blend dst nothing to draw: true
blend src over nothing to draw: false
alpha 0 nothing to draw: true
~~~~
< / fiddle-embed > < / div >
2018-10-16 14:30:28 +00:00
< a name = 'Utility' > < / a >
2018-02-07 12:27:09 +00:00