diff options
author | 2017-07-28 15:18:29 -0400 | |
---|---|---|
committer | 2017-07-28 19:25:53 +0000 | |
commit | 12799e17d55c09d322bc49bfd9f1247c03f3c0b2 (patch) | |
tree | eeceb48d3c31aefe1c96ebc22726df31e6fd34ab /site/user | |
parent | 293d9bd3c2f5a10734bdfb755d4853c57632ac08 (diff) |
bookmaker generated site docs
The documents were generated by running
tools/bookmaker against docs/*.bmh
No-Try: true
Docs-Preview: https://skia.org/?cl=28002
Change-Id: I7d7dd73cdea4a234c6175646d5b8938e1af3117a
Reviewed-on: https://skia-review.googlesource.com/28002
Reviewed-by: Cary Clark <caryclark@skia.org>
Commit-Queue: Cary Clark <caryclark@skia.org>
Diffstat (limited to 'site/user')
-rw-r--r-- | site/user/api/METADATA | 2 | ||||
-rw-r--r-- | site/user/api/SkCanvas_Reference.md | 4911 | ||||
-rw-r--r-- | site/user/api/SkPaint_Reference.md | 5190 | ||||
-rw-r--r-- | site/user/api/SkPath_Reference.md | 4975 | ||||
-rw-r--r-- | site/user/api/creating_skcanvas.md (renamed from site/user/api/canvas.md) | 0 | ||||
-rw-r--r-- | site/user/api/index.md | 15 | ||||
-rw-r--r-- | site/user/api/skcanvas_overivew.md (renamed from site/user/api/skcanvas.md) | 2 | ||||
-rw-r--r-- | site/user/api/skmatrix_overivew.md (renamed from site/user/api/skmatrix.md) | 2 | ||||
-rw-r--r-- | site/user/api/skpaint_overview.md (renamed from site/user/api/skpaint.md) | 2 | ||||
-rw-r--r-- | site/user/api/skrect_overivew.md (renamed from site/user/api/skrect.md) | 2 | ||||
-rw-r--r-- | site/user/api/skregion_overview.md (renamed from site/user/api/skregion.md) | 2 | ||||
-rw-r--r-- | site/user/api/undocumented.md | 638 | ||||
-rw-r--r-- | site/user/api/usingBookmaker.md | 79 |
13 files changed, 15808 insertions, 12 deletions
diff --git a/site/user/api/METADATA b/site/user/api/METADATA index 27625c5c1a..83df9430d8 100644 --- a/site/user/api/METADATA +++ b/site/user/api/METADATA @@ -1,3 +1,3 @@ { - "fileOrder": ["skcanvas", "skpaint", "skrect", "skregion", "skmatrix", "grcontext", "canvas"] + "fileOrder": ["skcanvas_overview", "skpaint_overview", "skrect_overview", "skregion_overview", "skmatrix_overview", "creating_skcanvas", "SkCanvas_Reference", "SkPaint_Reference", "SkPath_Reference", "usingBookmaker"] } diff --git a/site/user/api/SkCanvas_Reference.md b/site/user/api/SkCanvas_Reference.md new file mode 100644 index 0000000000..f6976b2750 --- /dev/null +++ b/site/user/api/SkCanvas_Reference.md @@ -0,0 +1,4911 @@ +SkCanvas Reference +=== + +# <a name="Canvas"></a> Canvas +<a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> provides an interface for drawing, and how the drawing is clipped and transformed. +<a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> contains a stack of <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a> and <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> values. + +<a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> and <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> together provide the state to draw into <a href="bmh_undocumented?cl=9919#Surface">Surface</a> or <a href="bmh_undocumented?cl=9919#Device">Device</a>. +Each <a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> draw call transforms the geometry of the object by the concatenation of all <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a> +values in the stack. +The transformed geometry is clipped by the intersection of all of <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> values in the stack. +The <a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> draw calls take <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> parameter for drawing state. +Create <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> to supply the drawing state, such as <a href="bmh_undocumented?cl=9919#Color">Color</a>, +<a href="bmh_undocumented?cl=9919#Typeface">Typeface</a>, <a href="bmh_SkPaint_Reference?cl=9919#Text_Size">Paint Text Size</a>, <a href="bmh_SkPaint_Reference?cl=9919#Stroke_Width">Paint Stroke Width</a>, <a href="bmh_undocumented?cl=9919#Shader">Shader</a> and so on. + +To draw to a pixel-based destination, create <a href="bmh_undocumented?cl=9919#Raster">Raster Surface</a> or <a href="bmh_undocumented?cl=9919#GPU">GPU Surface</a>. +Request <a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> from <a href="bmh_undocumented?cl=9919#Surface">Surface</a> to obtain the interface to draw. +<a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> generated by <a href="bmh_undocumented?cl=9919#Raster">Raster Surface</a> draws to memory visible to the <a href="bmh_undocumented?cl=9919#CPU">CPU</a>. +<a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> generated by <a href="bmh_undocumented?cl=9919#GPU">GPU Surface</a> uses <a href="bmh_undocumented?cl=9919#Vulkan">Vulkan</a> or <a href="bmh_undocumented?cl=9919#OpenGL">OpenGL</a> to draw to the <a href="bmh_undocumented?cl=9919#GPU">GPU</a>. + +<a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> can be constructed to draw to <a href="bmh_undocumented?cl=9919#Bitmap">Bitmap</a> without first creating <a href="bmh_undocumented?cl=9919#Raster">Raster Surface</a>. +This approach may be deprecated in the future. + +To draw to a document, obtain <a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> from <a href="bmh_undocumented?cl=9919#Canvas">SVG Canvas</a>, <a href="bmh_undocumented?cl=9919#PDF">Document PDF</a>, or <a href="bmh_undocumented?cl=9919#Recorder">Picture Recorder</a>. +Document-based <a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> and other <a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> subclasses reference <a href="bmh_undocumented?cl=9919#Device">Device</a> describing the destination. + +# <a name="SkCanvas"></a> Class SkCanvas + +# <a name="Overview"></a> Overview + +## <a name="Subtopics"></a> Subtopics + +| topics | description | +| --- | --- | + +## <a name="Constants"></a> Constants + +| constants | description | +| --- | --- | +| <a href="bmh_SkCanvas_Reference?cl=9919#Lattice_Flags">Lattice::Flags</a> | Controls <a href="bmh_SkCanvas_Reference?cl=9919#Lattice">Lattice</a> transparency. | +| <a href="bmh_SkCanvas_Reference?cl=9919#PointMode">PointMode</a> | Sets <a href="bmh_SkCanvas_Reference?cl=9919#drawPoints">drawPoints</a> options. | +| <a href="bmh_SkCanvas_Reference?cl=9919#SaveLayerFlags">SaveLayerFlags</a> | Sets <a href="bmh_SkCanvas_Reference?cl=9919#SaveLayerRec">SaveLayerRec</a> options. | +| <a href="bmh_SkCanvas_Reference?cl=9919#SrcRectConstraint">SrcRectConstraint</a> | Sets <a href="bmh_SkCanvas_Reference?cl=9919#drawImageRect">drawImageRect</a> options. | + +## <a name="Structs"></a> Structs + +| struct | description | +| --- | --- | +| <a href="bmh_SkCanvas_Reference?cl=9919#Lattice">Lattice</a> | Divides <a href="bmh_undocumented?cl=9919#Bitmap">Bitmap</a>, <a href="bmh_undocumented?cl=9919#Image">Image</a> into a rectangular grid. | +| <a href="bmh_SkCanvas_Reference?cl=9919#SaveLayerRec">SaveLayerRec</a> | Contains state to create the layer offscreen. | + +## <a name="Constructors"></a> Constructors + +Create the desired type of <a href="bmh_undocumented?cl=9919#Surface">Surface</a> to obtain its <a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> when possible. <a href="bmh_SkCanvas_Reference?cl=9919#Overview_Constructors">Constructors</a> are useful +when no <a href="bmh_undocumented?cl=9919#Surface">Surface</a> is required, and some helpers implicitly create <a href="bmh_undocumented?cl=9919#Raster">Raster Surface</a>. + +| | description | +| --- | --- | +| <a href="bmh_SkCanvas_Reference?cl=9919#empty_constructor">SkCanvas()</a> | No <a href="bmh_undocumented?cl=9919#Surface">Surface</a>, no dimensions. | +| | No <a href="bmh_undocumented?cl=9919#Surface">Surface</a>, set dimensions, <a href="bmh_undocumented?cl=9919#Properties">Surface Properties</a>. | +| <a href="bmh_SkCanvas_Reference?cl=9919#copy_constructor">SkCanvas(SkBaseDevice* device)</a> | Existing <a href="bmh_undocumented?cl=9919#Device">Device</a>. (<a href="bmh_undocumented?cl=9919#SkBaseDevice">SkBaseDevice</a> is private.) | +| <a href="bmh_SkCanvas_Reference?cl=9919#copy_constructor">SkCanvas(const SkBitmap& bitmap)</a> | Uses existing <a href="bmh_undocumented?cl=9919#Bitmap">Bitmap</a>. | +| <a href="bmh_SkCanvas_Reference?cl=9919#const_SkBitmap_const_SkSurfaceProps">SkCanvas(const SkBitmap& bitmap, const SkSurfaceProps& props)</a> | Uses existing <a href="bmh_undocumented?cl=9919#Bitmap">Bitmap</a> and <a href="bmh_undocumented?cl=9919#Properties">Surface Properties</a>. | +| <a href="bmh_SkCanvas_Reference?cl=9919#MakeRasterDirect">MakeRasterDirect</a> | Creates from <a href="bmh_undocumented?cl=9919#SkImageInfo">SkImageInfo</a> and <a href="bmh_undocumented?cl=9919#Storage">Pixel Storage</a>. | +| <a href="bmh_SkCanvas_Reference?cl=9919#MakeRasterDirectN32">MakeRasterDirectN32</a> | Creates from image data and <a href="bmh_undocumented?cl=9919#Storage">Pixel Storage</a>. | + +## <a name="Member_Functions"></a> Member Functions + +| function | description | +| --- | --- | +| <a href="bmh_SkCanvas_Reference?cl=9919#accessTopLayerPixels">accessTopLayerPixels</a> | Returns writable pixel access if available. | +| <a href="bmh_SkCanvas_Reference?cl=9919#accessTopRasterHandle">accessTopRasterHandle</a> | Returns context that tracks <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> and <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>. | +| <a href="bmh_SkCanvas_Reference?cl=9919#clear">clear</a> | Fills <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> with <a href="bmh_undocumented?cl=9919#Color">Color</a>. | +| <a href="bmh_SkCanvas_Reference?cl=9919#clipPath">clipPath</a> | Combines <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> with <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>. | +| <a href="bmh_SkCanvas_Reference?cl=9919#clipRRect">clipRRect</a> | Combines <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> with <a href="bmh_undocumented?cl=9919#Round_Rect">Round Rect</a>. | +| <a href="bmh_SkCanvas_Reference?cl=9919#clipRect">clipRect</a> | Combines <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> with <a href="bmh_undocumented?cl=9919#Rect">Rect</a>. | +| <a href="bmh_SkCanvas_Reference?cl=9919#clipRegion">clipRegion</a> | Combines <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> with <a href="bmh_undocumented?cl=9919#Region">Region</a>. | +| <a href="bmh_SkCanvas_Reference?cl=9919#concat">concat</a> | Multiplies <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a> by <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>. | +| <a href="bmh_SkCanvas_Reference?cl=9919#discard">discard</a> | Makes <a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> contents undefined. | +| <a href="bmh_SkCanvas_Reference?cl=9919#drawAnnotation">drawAnnotation</a> | Associates a <a href="bmh_undocumented?cl=9919#Rect">Rect</a> with a key-value pair. | +| <a href="bmh_SkCanvas_Reference?cl=9919#drawArc">drawArc</a> | Draws <a href="bmh_undocumented?cl=9919#Arc">Arc</a> using <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>, <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>, and <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a>. | +| <a href="bmh_SkCanvas_Reference?cl=9919#drawAtlas">drawAtlas</a> | Draws sprites using <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>, <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>, and <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a>. | +| <a href="bmh_SkCanvas_Reference?cl=9919#drawBitmap">drawBitmap</a> | Draws <a href="bmh_undocumented?cl=9919#Bitmap">Bitmap</a> at (x, y) position. | +| <a href="bmh_SkCanvas_Reference?cl=9919#drawBitmapLattice">drawBitmapLattice</a> | Draws differentially stretched <a href="bmh_undocumented?cl=9919#Bitmap">Bitmap</a>. | +| <a href="bmh_SkCanvas_Reference?cl=9919#drawBitmapNine">drawBitmapNine</a> | Draws <a href="bmh_undocumented?cl=9919#Nine_Patch">Nine Patch</a> <a href="bmh_undocumented?cl=9919#Bitmap">Bitmap</a>. | +| <a href="bmh_SkCanvas_Reference?cl=9919#drawBitmapRect">drawBitmapRect</a> | Draws <a href="bmh_undocumented?cl=9919#Bitmap">Bitmap</a>, source <a href="bmh_undocumented?cl=9919#Rect">Rect</a> to destination <a href="bmh_undocumented?cl=9919#Rect">Rect</a>. | +| <a href="bmh_SkCanvas_Reference?cl=9919#drawCircle">drawCircle</a> | Draws <a href="bmh_undocumented?cl=9919#Circle">Circle</a> using <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>, <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>, and <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a>. | +| <a href="bmh_SkCanvas_Reference?cl=9919#drawColor">drawColor</a> | Fills <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> with <a href="bmh_undocumented?cl=9919#Color">Color</a> and <a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a>. | +| <a href="bmh_SkCanvas_Reference?cl=9919#drawDRRect">drawDRRect</a> | Draws double <a href="bmh_undocumented?cl=9919#Round_Rect">Round Rect</a> stroked or filled. | +| <a href="bmh_SkCanvas_Reference?cl=9919#drawDrawable">drawDrawable</a> | Draws <a href="bmh_undocumented?cl=9919#Drawable">Drawable</a>, encapsulated drawing commands. | +| <a href="bmh_SkCanvas_Reference?cl=9919#drawIRect">drawIRect</a> | Draws <a href="bmh_undocumented?cl=9919#IRect">IRect</a> using <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>, <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>, and <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a>. | +| <a href="bmh_SkCanvas_Reference?cl=9919#drawImage">drawImage</a> | Draws <a href="bmh_undocumented?cl=9919#Image">Image</a> at (x, y) position. | +| <a href="bmh_SkCanvas_Reference?cl=9919#drawImageLattice">drawImageLattice</a> | Draws differentially stretched <a href="bmh_undocumented?cl=9919#Image">Image</a>. | +| <a href="bmh_SkCanvas_Reference?cl=9919#drawImageNine">drawImageNine</a> | Draws <a href="bmh_undocumented?cl=9919#Nine_Patch">Nine Patch</a> <a href="bmh_undocumented?cl=9919#Image">Image</a>. | +| <a href="bmh_SkCanvas_Reference?cl=9919#drawImageRect">drawImageRect</a> | Draws <a href="bmh_undocumented?cl=9919#Image">Image</a>, source <a href="bmh_undocumented?cl=9919#Rect">Rect</a> to destination <a href="bmh_undocumented?cl=9919#Rect">Rect</a>. | +| <a href="bmh_SkCanvas_Reference?cl=9919#drawLine">drawLine</a> | Draws line segment between two points. | +| <a href="bmh_SkCanvas_Reference?cl=9919#drawOval">drawOval</a> | Draws <a href="bmh_undocumented?cl=9919#Oval">Oval</a> using <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>, <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>, and <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a>. | +| <a href="bmh_SkCanvas_Reference?cl=9919#drawPaint">drawPaint</a> | Fills <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> with <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a>. | +| <a href="bmh_SkCanvas_Reference?cl=9919#drawPatch">drawPatch</a> | Draws cubic <a href="bmh_undocumented?cl=9919#Coons">Coons</a> patch. | +| <a href="bmh_SkCanvas_Reference?cl=9919#drawPath">drawPath</a> | Draws <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> using <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>, <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>, and <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a>. | +| <a href="bmh_SkCanvas_Reference?cl=9919#drawPicture">drawPicture</a> | Draws <a href="bmh_undocumented?cl=9919#Picture">Picture</a> using <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> and <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>. | +| <a href="bmh_SkCanvas_Reference?cl=9919#drawPoint">drawPoint</a> | Draws point at (x, y) position. | +| <a href="bmh_SkCanvas_Reference?cl=9919#drawPoints">drawPoints</a> | Draws array as points, lines, polygon. | +| <a href="bmh_SkCanvas_Reference?cl=9919#drawPosText">drawPosText</a> | Draws text at array of (x, y) positions. | +| <a href="bmh_SkCanvas_Reference?cl=9919#drawPosTextH">drawPosTextH</a> | Draws text at x positions with common baseline. | +| <a href="bmh_SkCanvas_Reference?cl=9919#drawRRect">drawRRect</a> | Draws <a href="bmh_undocumented?cl=9919#Round_Rect">Round Rect</a> using <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>, <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>, and <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a>. | +| <a href="bmh_SkCanvas_Reference?cl=9919#drawRect">drawRect</a> | Draws <a href="bmh_undocumented?cl=9919#Rect">Rect</a> using <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>, <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>, and <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a>. | +| <a href="bmh_SkCanvas_Reference?cl=9919#drawRegion">drawRegion</a> | Draws <a href="bmh_undocumented?cl=9919#Region">Region</a> using <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>, <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>, and <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a>. | +| <a href="bmh_SkCanvas_Reference?cl=9919#drawRoundRect">drawRoundRect</a> | Draws <a href="bmh_undocumented?cl=9919#Round_Rect">Round Rect</a> using <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>, <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>, and <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a>. | +| <a href="bmh_SkCanvas_Reference?cl=9919#drawText">drawText</a> | Draws text at (x, y), using font advance. | +| <a href="bmh_SkCanvas_Reference?cl=9919#drawTextBlob">drawTextBlob</a> | Draws text with arrays of positions and <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a>. | +| <a href="bmh_SkCanvas_Reference?cl=9919#drawTextOnPath">drawTextOnPath</a> | Draws text following <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> contour. | +| <a href="bmh_SkCanvas_Reference?cl=9919#drawTextOnPathHV">drawTextOnPathHV</a> | Draws text following <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> with offsets. | +| <a href="bmh_SkCanvas_Reference?cl=9919#drawTextRSXform">drawTextRSXform</a> | Draws text with array of <a href="bmh_undocumented?cl=9919#RSXform">RSXform</a>. | +| <a href="bmh_SkCanvas_Reference?cl=9919#drawString">drawString</a> | Draws null terminated string at (x, y) using font advance. | +| <a href="bmh_SkCanvas_Reference?cl=9919#drawVertices">drawVertices</a> | Draws <a href="bmh_undocumented?cl=9919#Vertices">Vertices</a>, a triangle mesh. | +| <a href="bmh_SkCanvas_Reference?cl=9919#flush">flush</a> | Triggers execution of all pending draw operations. | +| <a href="bmh_SkCanvas_Reference?cl=9919#getBaseLayerSize">getBaseLayerSize</a> | Gets size of base layer in global coordinates. | +| <a href="bmh_SkCanvas_Reference?cl=9919#getDeviceClipBounds">getDeviceClipBounds</a> | Returns <a href="bmh_undocumented?cl=9919#IRect">IRect</a> bounds of <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>. | +| <a href="bmh_SkCanvas_Reference?cl=9919#getDrawFilter">getDrawFilter</a> | Legacy; to be deprecated. | +| <a href="bmh_SkCanvas_Reference?cl=9919#getGrContext">getGrContext</a> | Returns <a href="bmh_undocumented?cl=9919#GPU_Context">GPU Context</a> of the <a href="bmh_undocumented?cl=9919#GPU">GPU Surface</a>. | +| <a href="bmh_SkCanvas_Reference?cl=9919#getLocalClipBounds">getLocalClipBounds</a> | Returns <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> bounds in source coordinates. | +| <a href="bmh_SkCanvas_Reference?cl=9919#getMetaData">getMetaData</a> | Associates additional data with the canvas. | +| <a href="bmh_SkCanvas_Reference?cl=9919#getProps">getProps</a> | Copies <a href="bmh_undocumented?cl=9919#Properties">Surface Properties</a> if available. | +| <a href="bmh_SkCanvas_Reference?cl=9919#getSaveCount">getSaveCount</a> | Returns depth of stack containing <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> and <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>. | +| <a href="bmh_SkCanvas_Reference?cl=9919#getTotalMatrix">getTotalMatrix</a> | Returns <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>. | +| <a href="bmh_SkCanvas_Reference?cl=9919#imageInfo">imageInfo</a> | Returns <a href="bmh_undocumented?cl=9919#Info">Image Info</a> for <a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a>. | +| <a href="bmh_SkCanvas_Reference?cl=9919#isClipEmpty">isClipEmpty</a> | Returns if <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> is empty. | +| <a href="bmh_SkCanvas_Reference?cl=9919#isClipRect">isClipRect</a> | Returns if <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> is <a href="bmh_undocumented?cl=9919#Rect">Rect</a> and not empty. | +| <a href="bmh_SkCanvas_Reference?cl=9919#MakeRasterDirect">MakeRasterDirect</a> | Creates <a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> from <a href="bmh_undocumented?cl=9919#SkImageInfo">SkImageInfo</a> and pixel data. | +| <a href="bmh_SkCanvas_Reference?cl=9919#MakeRasterDirectN32">MakeRasterDirectN32</a> | Creates <a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> from image specifications and pixel data. | +| <a href="bmh_SkCanvas_Reference?cl=9919#makeSurface">makeSurface</a> | Creates <a href="bmh_undocumented?cl=9919#Surface">Surface</a> matching <a href="bmh_undocumented?cl=9919#SkImageInfo">SkImageInfo</a> and <a href="bmh_undocumented?cl=9919#SkSurfaceProps">SkSurfaceProps</a>. | +| <a href="bmh_SkCanvas_Reference?cl=9919#peekPixels">peekPixels</a> | Returns if <a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> has direct access to its pixels. | +| <a href="bmh_SkCanvas_Reference?cl=9919#quickReject">quickReject</a> | Returns if <a href="bmh_undocumented?cl=9919#Rect">Rect</a> is outside <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>. | +| <a href="bmh_SkCanvas_Reference?cl=9919#readPixels">readPixels</a> | Copies and converts rectangle of pixels from <a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a>. | +| <a href="bmh_SkCanvas_Reference?cl=9919#resetMatrix">resetMatrix</a> | Resets <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a> to identity. | +| <a href="bmh_SkCanvas_Reference?cl=9919#restore">restore</a> | Restores changes to <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> and <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>, pops save stack. | +| <a href="bmh_SkCanvas_Reference?cl=9919#restoreToCount">restoreToCount</a> | Restores changes to <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> and <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a> to given depth. | +| <a href="bmh_SkCanvas_Reference?cl=9919#rotate">rotate</a> | Rotates <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>. | +| <a href="bmh_SkCanvas_Reference?cl=9919#save">save</a> | Saves <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> and <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a> on stack. | +| <a href="bmh_SkCanvas_Reference?cl=9919#saveLayer">saveLayer</a> | Saves <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> and <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a> on stack; creates offscreen. | +| <a href="bmh_SkCanvas_Reference?cl=9919#saveLayerAlpha">saveLayerAlpha</a> | Saves <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> and <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a> on stack; creates offscreen; sets opacity. | +| <a href="bmh_SkCanvas_Reference?cl=9919#saveLayerPreserveLCDTextRequests">saveLayerPreserveLCDTextRequests</a> | Saves <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> and <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a> on stack; creates offscreen for <a href="bmh_undocumented?cl=9919#LCD">LCD</a> text. | +| <a href="bmh_SkCanvas_Reference?cl=9919#scale">scale</a> | Scales <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>. | +| <a href="bmh_SkCanvas_Reference?cl=9919#setAllowSimplifyClip">setAllowSimplifyClip</a> | Experimental. | +| <a href="bmh_SkCanvas_Reference?cl=9919#setDrawFilter">setDrawFilter</a> | Legacy; to be deprecated. | +| <a href="bmh_SkCanvas_Reference?cl=9919#setMatrix">setMatrix</a> | Sets <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>. | +| <a href="bmh_SkCanvas_Reference?cl=9919#skew">skew</a> | Skews <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>. | +| <a href="bmh_SkCanvas_Reference?cl=9919#translate">translate</a> | Translates <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>. | +| <a href="bmh_SkCanvas_Reference?cl=9919#writePixels">writePixels</a> | Copies and converts rectangle of pixels to <a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a>. | + +<a name="MakeRasterDirect"></a> +## MakeRasterDirect + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +static std::unique_ptr<SkCanvas> MakeRasterDirect(const SkImageInfo& info, + void* pixels, size_t rowBytes) +</pre> + +Allocates raster canvas that will draw directly into <a href="bmh_SkCanvas_Reference?cl=9919#MakeRasterDirect">pixels</a>. +To access <a href="bmh_SkCanvas_Reference?cl=9919#MakeRasterDirect">pixels</a> after drawing, call <a href="bmh_SkCanvas_Reference?cl=9919#flush">flush</a> or <a href="bmh_SkCanvas_Reference?cl=9919#peekPixels">peekPixels</a>. + +### Parameters + +<table> <tr> <td><code><strong>info </strong></code></td> <td> +Width, height, <a href="bmh_undocumented?cl=9919#Color_Type">Image Color Type</a>, <a href="bmh_undocumented?cl=9919#Alpha_Type">Image Alpha Type</a>, <a href="bmh_undocumented?cl=9919#Color_Space">Color Space</a>, of <a href="bmh_undocumented?cl=9919#Raster">Raster Surface</a>. +Width, or height, or both, may be zero.</td> + </tr> <tr> <td><code><strong>pixels </strong></code></td> <td> +Pointer to destination <a href="bmh_SkCanvas_Reference?cl=9919#MakeRasterDirect">pixels</a> buffer. Buffer size should be <a href="bmh_SkCanvas_Reference?cl=9919#MakeRasterDirect">info</a> height +times <a href="bmh_SkCanvas_Reference?cl=9919#MakeRasterDirect">rowBytes</a> times bytes required for <a href="bmh_undocumented?cl=9919#Color_Type">Image Color Type</a>.</td> + </tr> <tr> <td><code><strong>rowBytes </strong></code></td> <td> +The interval from one <a href="bmh_undocumented?cl=9919#Surface">Surface</a> row to the next; equal to or greater than +<a href="bmh_SkCanvas_Reference?cl=9919#MakeRasterDirect">info</a> width times bytes required for <a href="bmh_undocumented?cl=9919#Color_Type">Image Color Type</a>.</td> + </tr> +</table> + +### Return Value + +<a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> if all parameters are valid; otherwise, nullptr. +Valid parameters include: <a href="bmh_SkCanvas_Reference?cl=9919#MakeRasterDirect">info</a> dimensions must be zero or positive, and other checks; +<a href="bmh_SkCanvas_Reference?cl=9919#MakeRasterDirect">info</a> must contain <a href="bmh_undocumented?cl=9919#Color_Type">Image Color Type</a> and <a href="bmh_undocumented?cl=9919#Alpha_Type">Image Alpha Type</a> supported by <a href="bmh_undocumented?cl=9919#Raster">Raster Surface</a>; +<a href="bmh_SkCanvas_Reference?cl=9919#MakeRasterDirect">pixels</a> must be not be nullptr; +<a href="bmh_SkCanvas_Reference?cl=9919#MakeRasterDirect">rowBytes</a> must be zero or large enough to contain width <a href="bmh_SkCanvas_Reference?cl=9919#MakeRasterDirect">pixels</a> of <a href="bmh_undocumented?cl=9919#Color_Type">Image Color Type</a>. + +### Example + +<div><fiddle-embed name="30839f66c2d267e021d0cabb81ef1123"><div>Allocates a three by three bitmap, clears it to white, and draws a black pixel +in the center.</div> + +#### Example Output + +~~~~ +--- +-x- +--- +~~~~ + +</fiddle-embed></div> + +### See Also + +<a href="bmh_SkCanvas_Reference?cl=9919#MakeRasterDirectN32">MakeRasterDirectN32</a> <a href="bmh_undocumented?cl=9919#MakeRasterDirect">SkSurface::MakeRasterDirect</a> + +--- + +<a name="MakeRasterDirectN32"></a> +## MakeRasterDirectN32 + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +static std::unique_ptr<SkCanvas> MakeRasterDirectN32(int width, int height, + SkPMColor* pixels, + size_t rowBytes) +</pre> + +Creates <a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> with <a href="bmh_undocumented?cl=9919#Raster">Raster Surface</a> with inline image specification that draws into <a href="bmh_SkCanvas_Reference?cl=9919#MakeRasterDirectN32">pixels</a>. +<a href="bmh_undocumented?cl=9919#Color_Type">Image Color Type</a> is set to <a href="bmh_undocumented?cl=9919#SkColorType">kN32 SkColorType</a>. +<a href="bmh_undocumented?cl=9919#Alpha_Type">Image Alpha Type</a> is set to <a href="bmh_undocumented?cl=9919#SkAlphaType">kPremul SkAlphaType</a>. +To access <a href="bmh_SkCanvas_Reference?cl=9919#MakeRasterDirectN32">pixels</a> after drawing, call <a href="bmh_SkCanvas_Reference?cl=9919#flush">flush</a> or <a href="bmh_SkCanvas_Reference?cl=9919#peekPixels">peekPixels</a>. + +### Parameters + +<table> <tr> <td><code><strong>width </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#Pixel">Pixel</a> column count on <a href="bmh_undocumented?cl=9919#Raster">Raster Surface</a> created. Must be zero or greater.</td> + </tr> <tr> <td><code><strong>height </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#Pixel">Pixel</a> row count on <a href="bmh_undocumented?cl=9919#Raster">Raster Surface</a> created. Must be zero or greater.</td> + </tr> <tr> <td><code><strong>pixels </strong></code></td> <td> +Pointer to destination <a href="bmh_SkCanvas_Reference?cl=9919#MakeRasterDirectN32">pixels</a> buffer. Buffer size should be <a href="bmh_SkCanvas_Reference?cl=9919#height">height</a> +times <a href="bmh_SkCanvas_Reference?cl=9919#MakeRasterDirectN32">rowBytes</a> times four.</td> + </tr> <tr> <td><code><strong>rowBytes </strong></code></td> <td> +The interval from one <a href="bmh_undocumented?cl=9919#Surface">Surface</a> row to the next; equal to or greater than +<a href="bmh_SkCanvas_Reference?cl=9919#width">width</a> times four.</td> + </tr> +</table> + +### Return Value + +<a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> if all parameters are valid; otherwise, nullptr. +Valid parameters include: <a href="bmh_SkCanvas_Reference?cl=9919#width">width</a> and <a href="bmh_SkCanvas_Reference?cl=9919#height">height</a> must be zero or positive; +<a href="bmh_SkCanvas_Reference?cl=9919#MakeRasterDirectN32">pixels</a> must be not be nullptr; +<a href="bmh_SkCanvas_Reference?cl=9919#MakeRasterDirectN32">rowBytes</a> must be zero or large enough to contain <a href="bmh_SkCanvas_Reference?cl=9919#width">width</a> <a href="bmh_SkCanvas_Reference?cl=9919#MakeRasterDirectN32">pixels</a> of <a href="bmh_undocumented?cl=9919#Color_Type">Image Color Type</a>. + +### Example + +<div><fiddle-embed name="bc8d576bf09358cf0e972b72efba936c"><div>Allocates a three by three bitmap, clears it to white, and draws a black pixel +in the center.</div> + +#### Example Output + +~~~~ +--- +-x- +--- +~~~~ + +</fiddle-embed></div> + +--- + +<a name="empty_constructor"></a> +## SkCanvas + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +SkCanvas() +</pre> + +Creates an empty canvas with no backing device/pixels, and zero +dimensions. + +### Return Value + +An empty canvas. + +### Example + +<div><fiddle-embed name="903451d6c93bf69e2833747a3e8cc8f7"><div>Passes a placeholder to a function that requires one.</div> + +#### Example Output + +~~~~ +paint draws text left to right +paint draws text top to bottom +paint draws text top to bottom +~~~~ + +</fiddle-embed></div> + +--- + +<a name="int_int_const_SkSurfaceProps_star"></a> +## SkCanvas + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +SkCanvas(int width, int height, const SkSurfaceProps* props = NULL) +</pre> + +Creates <a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> of the specified dimensions without a <a href="bmh_undocumented?cl=9919#Surface">Surface</a>. +Used by subclasses with custom implementations for draw methods. + +### Parameters + +<table> <tr> <td><code><strong>width </strong></code></td> <td> +Zero or greater.</td> + </tr> <tr> <td><code><strong>height </strong></code></td> <td> +Zero or greater.</td> + </tr> <tr> <td><code><strong>props </strong></code></td> <td> +The <a href="bmh_undocumented?cl=9919#LCD">LCD</a> striping orientation and setting for device independent fonts.</td> + </tr> +</table> + +### Return Value + +<a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> placeholder with dimensions. + +### Example + +<div><fiddle-embed name="ce6a5ef2df447970b4453489d9d67930"> + +#### Example Output + +~~~~ +canvas is empty +~~~~ + +</fiddle-embed></div> + +--- + +<a name="copy_constructor"></a> +## SkCanvas + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +explicit SkCanvas(SkBaseDevice* device) +</pre> + +Construct a canvas that draws into <a href="bmh_SkCanvas_Reference?cl=9919#device">device</a>. +Used by child classes of <a href="bmh_SkCanvas_Reference?cl=9919#SkCanvas">SkCanvas</a>. + +### Parameters + +<table> <tr> <td><code><strong>device </strong></code></td> <td> +Specifies a <a href="bmh_SkCanvas_Reference?cl=9919#device">device</a> for the canvas to draw into.</td> + </tr> +</table> + +### Return Value + +<a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> that can be used to draw into <a href="bmh_SkCanvas_Reference?cl=9919#device">device</a>. + +### Example + +<div><fiddle-embed name="cc6d6fd6d9aa98b12984e11ef52172ec"></fiddle-embed></div> + +--- + +<a name="copy_constructor"></a> +## SkCanvas + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +explicit SkCanvas(const SkBitmap& bitmap) +</pre> + +Construct a canvas that draws into <a href="bmh_SkCanvas_Reference?cl=9919#copy_constructor">bitmap</a>. +Sets <a href="bmh_undocumented?cl=9919#kLegacyFontHost_InitType">SkSurfaceProps::kLegacyFontHost InitType</a> in constructed <a href="bmh_undocumented?cl=9919#Surface">Surface</a>. + +### Parameters + +<table> <tr> <td><code><strong>bitmap </strong></code></td> <td> +Width, height, <a href="bmh_undocumented?cl=9919#Color_Type">Image Color Type</a>, <a href="bmh_undocumented?cl=9919#Alpha_Type">Image Alpha Type</a>, and pixel storage of <a href="bmh_undocumented?cl=9919#Raster">Raster Surface</a>. +<a href="bmh_undocumented?cl=9919#Bitmap">Bitmap</a> is copied so that subsequently editing <a href="bmh_SkCanvas_Reference?cl=9919#copy_constructor">bitmap</a> will not affect +constructed <a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a>.</td> + </tr> +</table> + +### Return Value + +<a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> that can be used to draw into <a href="bmh_SkCanvas_Reference?cl=9919#copy_constructor">bitmap</a>. + +### Example + +<div><fiddle-embed name=""><div>The actual output depends on the installed fonts.</div> + +#### Example Output + +~~~~ +----- +--x-- +--x-- +--x-- +--x-- +--x-- +--x-- +----- +--x-- +--x-- +----- +~~~~ + +</fiddle-embed></div> + +--- + +## <a name="SkCanvas::ColorBehavior"></a> Enum SkCanvas::ColorBehavior + +<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0"> +enum class <a href="bmh_SkCanvas_Reference?cl=9919#ColorBehavior">ColorBehavior</a> { +<a href="bmh_SkCanvas_Reference?cl=9919#kLegacy">kLegacy</a>, +};</pre> + +### Constants + +<table> + <tr> + <td><a name="SkCanvas::kLegacy"></a> <code><strong>SkCanvas::kLegacy </strong></code></td><td>0</td><td></td> + </tr> + +</table> + +<a name="const_SkBitmap_const_SkSurfaceProps"></a> +## SkCanvas + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +SkCanvas(const SkBitmap& bitmap, const SkSurfaceProps& props) +</pre> + +Construct a canvas that draws into <a href="bmh_SkCanvas_Reference?cl=9919#const_SkBitmap_const_SkSurfaceProps">bitmap</a>. +Use <a href="bmh_SkCanvas_Reference?cl=9919#const_SkBitmap_const_SkSurfaceProps">props</a> to match the device characteristics, like <a href="bmh_undocumented?cl=9919#LCD">LCD</a> striping. + +### Parameters + +<table> <tr> <td><code><strong>bitmap </strong></code></td> <td> +Width, height, <a href="bmh_undocumented?cl=9919#Color_Type">Image Color Type</a>, <a href="bmh_undocumented?cl=9919#Alpha_Type">Image Alpha Type</a>, and pixel storage of <a href="bmh_undocumented?cl=9919#Raster">Raster Surface</a>. +<a href="bmh_undocumented?cl=9919#Bitmap">Bitmap</a> is copied so that subsequently editing <a href="bmh_SkCanvas_Reference?cl=9919#const_SkBitmap_const_SkSurfaceProps">bitmap</a> will not affect +constructed <a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a>.</td> + </tr> <tr> <td><code><strong>props </strong></code></td> <td> +The order and orientation of <a href="bmh_undocumented?cl=9919#RGB">RGB</a> striping; and whether to use +device independent fonts.</td> + </tr> +</table> + +### Return Value + +<a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> that can be used to draw into <a href="bmh_SkCanvas_Reference?cl=9919#const_SkBitmap_const_SkSurfaceProps">bitmap</a>. + +### Example + +<div><fiddle-embed name="5ddec03684bb09f94b016dc205cb173b"><div>The actual output depends on the installed fonts.</div> + +#### Example Output + +~~~~ +----- +---x- +---x- +---x- +---x- +---x- +---x- +----- +---x- +---x- +----- +~~~~ + +</fiddle-embed></div> + +--- + +<a name="destructor"></a> +## ~SkCanvas + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +virtual ~SkCanvas() +</pre> + +Draws <a href="bmh_SkCanvas_Reference?cl=9919#State_Stack_Layer">State Stack Layer</a>, if any. +Free up resources used by <a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a>. + +### Example + +<div><fiddle-embed name=""></fiddle-embed></div> + +--- + +<a name="getMetaData"></a> +## getMetaData + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +SkMetaData& getMetaData() +</pre> + +Associates additional data with the canvas. +The storage is freed when <a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> is deleted. + +### Return Value + +storage that can be read from and written to. + +### Example + +<div><fiddle-embed name="1598396056045e8d0c583b748293d652"> + +#### Example Output + +~~~~ +before: (null) +during: Hello! +after: (null) +~~~~ + +</fiddle-embed></div> + +--- + +<a name="imageInfo"></a> +## imageInfo + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +SkImageInfo imageInfo() const +</pre> + +Returns <a href="bmh_undocumented?cl=9919#Info">Image Info</a> for <a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a>. If <a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> is not associated with <a href="bmh_undocumented?cl=9919#Raster">Raster Surface</a> or +<a href="bmh_undocumented?cl=9919#GPU">GPU Surface</a>, returns <a href="bmh_undocumented?cl=9919#empty_constructor">SkImageInfo::SkImageInfo()</a> is returned <a href="bmh_undocumented?cl=9919#Color_Type">Image Color Type</a> is set to <a href="bmh_undocumented?cl=9919#SkColorType">kUnknown SkColorType</a>. + +### Return Value + +dimensions and <a href="bmh_undocumented?cl=9919#Color_Type">Image Color Type</a> of <a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a>. + +### Example + +<div><fiddle-embed name="9d2ec54aff38728be1cb44e06a2252ef"></fiddle-embed></div> + +--- + +<a name="getProps"></a> +## getProps + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +bool getProps(SkSurfaceProps* props) const +</pre> + +If <a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> is associated with <a href="bmh_undocumented?cl=9919#Raster">Raster Surface</a> or +<a href="bmh_undocumented?cl=9919#GPU">GPU Surface</a>, copies <a href="bmh_undocumented?cl=9919#Properties">Surface Properties</a> and returns true. Otherwise, +return false and leave <a href="bmh_SkCanvas_Reference?cl=9919#props">props</a> unchanged. + +### Parameters + +<table> <tr> <td><code><strong>props </strong></code></td> <td> +Pointer to writable <a href="bmh_undocumented?cl=9919#SkSurfaceProps">SkSurfaceProps</a>.</td> + </tr> +</table> + +### Return Value + +true if <a href="bmh_undocumented?cl=9919#Properties">Surface Properties</a> was copied. + +### Example + +<div><fiddle-embed name="0fbf2dedc2619bbfbf173c9e3bc1a508"> + +#### Example Output + +~~~~ +isRGB:0 +isRGB:1 +~~~~ + +</fiddle-embed></div> + +--- + +<a name="flush"></a> +## flush + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void flush() +</pre> + +Triggers the immediate execution of all pending draw operations. +If <a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> is associated with <a href="bmh_undocumented?cl=9919#GPU">GPU Surface</a>, resolve all pending <a href="bmh_undocumented?cl=9919#GPU">GPU</a> operations. + +### Example + +<div><fiddle-embed name=""></fiddle-embed></div> + +--- + +<a name="getBaseLayerSize"></a> +## getBaseLayerSize + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +virtual SkISize getBaseLayerSize() const +</pre> + +Gets the size of the base or root layer in global canvas coordinates. The +origin of the base layer is always (0,0). The current drawable area may be +smaller (due to clipping or <a href="bmh_SkCanvas_Reference?cl=9919#saveLayer">saveLayer</a>). + +### Return Value + +Integral width and height of base layer. + +### Example + +<div><fiddle-embed name="374e245d91cd729eca48fd20e631fdf3"> + +#### Example Output + +~~~~ +clip=10,30 +size=20,30 +~~~~ + +</fiddle-embed></div> + +--- + +<a name="makeSurface"></a> +## makeSurface + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +sk_sp<SkSurface> makeSurface(const SkImageInfo& info, + const SkSurfaceProps* props = nullptr) +</pre> + +Creates <a href="bmh_undocumented?cl=9919#Surface">Surface</a> matching <a href="bmh_SkCanvas_Reference?cl=9919#info">info</a> and <a href="bmh_SkCanvas_Reference?cl=9919#props">props</a>, and associates it with <a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a>. +If <a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> is already associated with <a href="bmh_undocumented?cl=9919#Surface">Surface</a>, it cannot create a new <a href="bmh_undocumented?cl=9919#Surface">Surface</a>. + +### Parameters + +<table> <tr> <td><code><strong>info </strong></code></td> <td> +Initialize <a href="bmh_undocumented?cl=9919#Surface">Surface</a> with width, height, <a href="bmh_undocumented?cl=9919#Color_Type">Image Color Type</a>, <a href="bmh_undocumented?cl=9919#Alpha_Type">Image Alpha Type</a>, and <a href="bmh_undocumented?cl=9919#Color_Space">Color Space</a>.</td> + </tr> <tr> <td><code><strong>props </strong></code></td> <td> +Use to match if provided, or use the <a href="bmh_undocumented?cl=9919#Properties">Surface Properties</a> in <a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> otherwise.</td> + </tr> +</table> + +### Return Value + +<a href="bmh_undocumented?cl=9919#Surface">Surface</a> matching <a href="bmh_SkCanvas_Reference?cl=9919#info">info</a> and <a href="bmh_SkCanvas_Reference?cl=9919#props">props</a>, or nullptr if no match is available. + +### Example + +<div><fiddle-embed name="1ce28351444b41ab2b8e3128a4b9b9c2"> + +#### Example Output + +~~~~ +compatible != nullptr +size = 3, 4 +~~~~ + +</fiddle-embed></div> + +--- + +<a name="getGrContext"></a> +## getGrContext + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +virtual GrContext* getGrContext() +</pre> + +Returns <a href="bmh_undocumented?cl=9919#GPU_Context">GPU Context</a> of the <a href="bmh_undocumented?cl=9919#GPU">GPU Surface</a> associated with <a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a>. + +### Return Value + +<a href="bmh_undocumented?cl=9919#GPU_Context">GPU Context</a>, if available; nullptr otherwise. + +### Example + +<div><fiddle-embed name="c4ea949e5fa5a0630dcb6b0204bd498f"></fiddle-embed></div> + +--- + +<a name="accessTopLayerPixels"></a> +## accessTopLayerPixels + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void* accessTopLayerPixels(SkImageInfo* info, size_t* rowBytes, + SkIPoint* origin = NULL) +</pre> + +Returns the pixel base address, <a href="bmh_undocumented?cl=9919#Info">Image Info</a>, <a href="bmh_SkCanvas_Reference?cl=9919#rowBytes">rowBytes</a>, and <a href="bmh_SkCanvas_Reference?cl=9919#origin">origin</a> if the pixels +can be read directly. +The returned address is only valid +while <a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> is in scope and unchanged. Any <a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> call or <a href="bmh_undocumented?cl=9919#Surface">Surface</a> call +may invalidate the returned address and other returned values. + +If pixels are inaccessible, <a href="bmh_SkCanvas_Reference?cl=9919#info">info</a>, <a href="bmh_SkCanvas_Reference?cl=9919#rowBytes">rowBytes</a>, and <a href="bmh_SkCanvas_Reference?cl=9919#origin">origin</a> are unchanged. + +### Parameters + +<table> <tr> <td><code><strong>info </strong></code></td> <td> +If not nullptr, copies writable pixels' <a href="bmh_undocumented?cl=9919#Info">Image Info</a>.</td> + </tr> <tr> <td><code><strong>rowBytes </strong></code></td> <td> +If not nullptr, copies writable pixels' row bytes.</td> + </tr> <tr> <td><code><strong>origin </strong></code></td> <td> +If not nullptr, copies <a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> top layer <a href="bmh_SkCanvas_Reference?cl=9919#origin">origin</a>, its top left corner.</td> + </tr> +</table> + +### Return Value + +Address of pixels, or nullptr if inaccessible. + +### Example + +<div><fiddle-embed name="38d0d6ca9bea146d31bcbec197856359"></fiddle-embed></div> + +### Example + +<div><fiddle-embed name="a7ac9c21bbabcdeeca00f72a61cd0f3e"><div>Draws "" on the device. Then draws "" in an offscreen layer, and reads the +offscreen to add a large dotted "". Finally blends the offscreen with the +device. + +The offscreen and blended result appear on the <a href="bmh_undocumented?cl=9919#CPU">CPU</a> and <a href="bmh_undocumented?cl=9919#GPU">GPU</a> but the large dotted +"" appear only on the <a href="bmh_undocumented?cl=9919#CPU">CPU</a>.</div></fiddle-embed></div> + +--- + +<a name="accessTopRasterHandle"></a> +## accessTopRasterHandle + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +SkRasterHandleAllocator::Handle accessTopRasterHandle() const +</pre> + +Returns custom context that tracks the <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a> and <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>. + +Use <a href="bmh_undocumented?cl=9919#Raster_Handle_Allocator">Raster Handle Allocator</a> to blend <a href="bmh_undocumented?cl=9919#Skia">Skia</a> drawing with custom drawing, typically performed +by the host platform's user interface. This accessor returns the custom context created +when <a href="bmh_undocumented?cl=9919#MakeCanvas">SkRasterHandleAllocator::MakeCanvas</a> creates a custom canvas with raster storage for +the drawing destination. + +### Return Value + +Context of custom allocator. + +### Example + +<div><fiddle-embed name="4486d0c0b22ad2931db130f42da4c80c"><div></div> + +#### Example Output + +~~~~ +context = skia +~~~~ + +</fiddle-embed></div> + +### See Also + +<a href="bmh_undocumented?cl=9919#SkRasterHandleAllocator">SkRasterHandleAllocator</a> + +--- + +<a name="peekPixels"></a> +## peekPixels + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +bool peekPixels(SkPixmap* pixmap) +</pre> + +Returns true if <a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> has direct access to its pixels. + +Pixels are readable when <a href="bmh_undocumented?cl=9919#Device">Device</a> is raster. Pixels are not readable when <a href="bmh_SkCanvas_Reference?cl=9919#SkCanvas">SkCanvas</a> is returned from +<a href="bmh_undocumented?cl=9919#GPU">GPU Surface</a>, returned by <a href="bmh_undocumented?cl=9919#beginPage">SkDocument::beginPage</a>, returned by <a href="bmh_undocumented?cl=9919#beginRecording">SkPictureRecorder::beginRecording</a>, +or <a href="bmh_SkCanvas_Reference?cl=9919#SkCanvas">SkCanvas</a> is the base of a utility class like <a href="bmh_undocumented?cl=9919#SkDumpCanvas">SkDumpCanvas</a>. + +<a href="bmh_SkCanvas_Reference?cl=9919#pixmap">pixmap</a> pixel address is only valid while <a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> is in scope and unchanged. Any <a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> or <a href="bmh_undocumented?cl=9919#Surface">Surface</a> call may +invalidate the <a href="bmh_SkCanvas_Reference?cl=9919#pixmap">pixmap</a> values. + +### Parameters + +<table> <tr> <td><code><strong>pixmap </strong></code></td> <td> +storage for <a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> pixel state if <a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> pixels are readable; otherwise, ignored.</td> + </tr> +</table> + +### Return Value + +true if <a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> has direct access to pixels. + +### Example + +<div><fiddle-embed name="e9411d676d1fa13b46331abe9e14ad3e"> + +#### Example Output + +~~~~ +width=256 height=256 +~~~~ + +</fiddle-embed></div> + +--- + +<a name="readPixels"></a> +## readPixels + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +bool readPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRowBytes, + int srcX, int srcY) +</pre> + +Copies rectangle of pixels from <a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> into <a href="bmh_SkCanvas_Reference?cl=9919#dstPixels">dstPixels</a>, converting their <a href="bmh_undocumented?cl=9919#Color_Type">Image Color Type</a> and <a href="bmh_undocumented?cl=9919#Alpha_Type">Image Alpha Type</a>. +Pixels are readable when <a href="bmh_undocumented?cl=9919#Device">Device</a> is raster. Pixels are not readable when <a href="bmh_SkCanvas_Reference?cl=9919#SkCanvas">SkCanvas</a> is returned from +<a href="bmh_undocumented?cl=9919#GPU">GPU Surface</a>, returned by <a href="bmh_undocumented?cl=9919#beginPage">SkDocument::beginPage</a>, returned by <a href="bmh_undocumented?cl=9919#beginRecording">SkPictureRecorder::beginRecording</a>, +or <a href="bmh_SkCanvas_Reference?cl=9919#SkCanvas">SkCanvas</a> is the base of a utility class like <a href="bmh_undocumented?cl=9919#SkDumpCanvas">SkDumpCanvas</a>. + +<a href="bmh_undocumented?cl=9919#Pixel">Pixel</a> values are converted only if <a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> <a href="bmh_undocumented?cl=9919#Color_Type">Image Color Type</a> and <a href="bmh_undocumented?cl=9919#Alpha_Type">Image Alpha Type</a> does not match <a href="bmh_SkCanvas_Reference?cl=9919#dstInfo">dstInfo</a>. +Only pixels within the rectangle that intersect <a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> pixels are copied. +<a href="bmh_SkCanvas_Reference?cl=9919#dstPixels">dstPixels</a> outside the rectangle intersection are unchanged. + +| source rectangle | value | +| --- | --- | +| left | <a href="bmh_SkCanvas_Reference?cl=9919#srcX">srcX</a> | +| top | <a href="bmh_SkCanvas_Reference?cl=9919#srcY">srcY</a> | +| width | <a href="bmh_SkCanvas_Reference?cl=9919#dstInfo">dstInfo</a>.width() | +| height | <a href="bmh_SkCanvas_Reference?cl=9919#dstInfo">dstInfo</a>.height() | + +| canvas pixel bounds | value | +| --- | --- | +| left | 0 | +| top | 0 | +| width | <a href="bmh_SkCanvas_Reference?cl=9919#imageInfo">imageInfo</a>.width() | +| height | <a href="bmh_SkCanvas_Reference?cl=9919#imageInfo">imageInfo</a>.height() | + +Does not copy, and returns false if: + +<table> <tr> + <td>Source rectangle and canvas pixel bounds do not intersect.</td> </tr> <tr> + <td><a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> pixels could not be converted to <a href="bmh_SkCanvas_Reference?cl=9919#dstInfo">dstInfo</a> <a href="bmh_undocumented?cl=9919#Color_Type">Image Color Type</a> or <a href="bmh_SkCanvas_Reference?cl=9919#dstInfo">dstInfo</a> <a href="bmh_undocumented?cl=9919#Alpha_Type">Image Alpha Type</a>.</td> </tr> <tr> + <td><a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> pixels are not readable; for instance, <a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> is not raster, or is document-based.</td> </tr> <tr> + <td><a href="bmh_SkCanvas_Reference?cl=9919#dstRowBytes">dstRowBytes</a> is too small to contain one row of pixels.</td> </tr> +</table> + +### Parameters + +<table> <tr> <td><code><strong>dstInfo </strong></code></td> <td> +Dimensions, <a href="bmh_undocumented?cl=9919#Color_Type">Image Color Type</a>, and <a href="bmh_undocumented?cl=9919#Alpha_Type">Image Alpha Type</a> of <a href="bmh_SkCanvas_Reference?cl=9919#dstPixels">dstPixels</a>.</td> + </tr> <tr> <td><code><strong>dstPixels </strong></code></td> <td> +Storage for pixels, of size <a href="bmh_SkCanvas_Reference?cl=9919#dstInfo">dstInfo</a>.height() times <a href="bmh_SkCanvas_Reference?cl=9919#dstRowBytes">dstRowBytes</a>.</td> + </tr> <tr> <td><code><strong>dstRowBytes </strong></code></td> <td> +Size of one destination row, <a href="bmh_SkCanvas_Reference?cl=9919#dstInfo">dstInfo</a>.width() times pixel size.</td> + </tr> <tr> <td><code><strong>srcX </strong></code></td> <td> +Offset into readable pixels in x.</td> + </tr> <tr> <td><code><strong>srcY </strong></code></td> <td> +Offset into readable pixels in y.</td> + </tr> +</table> + +### Return Value + +true if pixels were copied. + +### Example + +<div><fiddle-embed name="481e990e923a0ed34654f4361b94f096"><div><a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> returned by <a href="bmh_undocumented?cl=9919#Raster">Raster Surface</a> has premultiplied pixel values. +<a href="bmh_SkCanvas_Reference?cl=9919#clear">clear</a> takes unpremultiplied input with <a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a> equal 0x80 +and <a href="bmh_undocumented?cl=9919#RGB">Color RGB</a> equal 0x55, 0xAA, 0xFF. <a href="bmh_undocumented?cl=9919#RGB">Color RGB</a> is multipled by <a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a> +to generate premultipled value 0x802B5580. <a href="bmh_SkCanvas_Reference?cl=9919#readPixels">readPixels</a> converts pixel back +to unpremultipled value 0x8056A9FF, introducing error.</div> + +#### Example Output + +~~~~ +pixel = 802b5580 +pixel = 8056a9ff +~~~~ + +</fiddle-embed></div> + +--- + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +bool readPixels(const SkPixmap& pixmap, int srcX, int srcY) +</pre> + +Copies rectangle of pixels from <a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> into <a href="bmh_undocumented?cl=9919#Pixmap">Pixmap</a>, converting their <a href="bmh_undocumented?cl=9919#Color_Type">Image Color Type</a> and <a href="bmh_undocumented?cl=9919#Alpha_Type">Image Alpha Type</a>. +Pixels are readable when <a href="bmh_undocumented?cl=9919#Device">Device</a> is raster. Pixels are not readable when <a href="bmh_SkCanvas_Reference?cl=9919#SkCanvas">SkCanvas</a> is returned from +<a href="bmh_undocumented?cl=9919#GPU">GPU Surface</a>, returned by <a href="bmh_undocumented?cl=9919#beginPage">SkDocument::beginPage</a>, returned by <a href="bmh_undocumented?cl=9919#beginRecording">SkPictureRecorder::beginRecording</a>, +or <a href="bmh_SkCanvas_Reference?cl=9919#SkCanvas">SkCanvas</a> is the base of a utility class like <a href="bmh_undocumented?cl=9919#SkDumpCanvas">SkDumpCanvas</a>. + +<a href="bmh_undocumented?cl=9919#Pixel">Pixel</a> values are converted only if <a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> <a href="bmh_undocumented?cl=9919#Color_Type">Image Color Type</a> and <a href="bmh_undocumented?cl=9919#Alpha_Type">Image Alpha Type</a> does not match bitmap <a href="bmh_undocumented?cl=9919#Info">Image Info</a>. +Only <a href="bmh_undocumented?cl=9919#Pixmap">Pixmap</a> pixels within the rectangle that intersect <a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> pixels are copied. +<a href="bmh_undocumented?cl=9919#Pixmap">Pixmap</a> pixels outside the rectangle intersection are unchanged. + +| source rectangle | value | +| --- | --- | +| left | <a href="bmh_SkCanvas_Reference?cl=9919#srcX">srcX</a> | +| top | <a href="bmh_SkCanvas_Reference?cl=9919#srcY">srcY</a> | +| width | bitmap.width() | +| height | bitmap.height() | + +| canvas pixel bounds | value | +| --- | --- | +| left | 0 | +| top | 0 | +| width | <a href="bmh_SkCanvas_Reference?cl=9919#imageInfo">imageInfo</a>.width() | +| height | <a href="bmh_SkCanvas_Reference?cl=9919#imageInfo">imageInfo</a>.height() | + +Does not copy, and returns false if: + +<table> <tr> + <td>Source rectangle and canvas pixel bounds do not intersect.</td> </tr> <tr> + <td><a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> pixels could not be converted to bitmap <a href="bmh_undocumented?cl=9919#Color_Type">Image Color Type</a> or bitmap <a href="bmh_undocumented?cl=9919#Alpha_Type">Image Alpha Type</a>.</td> </tr> <tr> + <td><a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> pixels are not readable; for instance, <a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> is not raster, or is document-based.</td> </tr> <tr> + <td>bitmap pixels could not be allocated.</td> </tr> <tr> + <td><a href="bmh_undocumented?cl=9919#Row_Bytes">Bitmap Row Bytes</a> is too small to contain one row of pixels.</td> </tr> +</table> + +### Parameters + +<table> <tr> <td><code><strong>pixmap </strong></code></td> <td> +Receives pixels copied from <a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a>.</td> + </tr> <tr> <td><code><strong>srcX </strong></code></td> <td> +Offset into readable pixels in x.</td> + </tr> <tr> <td><code><strong>srcY </strong></code></td> <td> +Offset into readable pixels in y.</td> + </tr> +</table> + +### Return Value + +true if pixels were copied. + +### Example + +<div><fiddle-embed name="85f199032943b6483722c34a91c4e20f"> + +#### Example Output + +~~~~ +pixel = 802b5580 +~~~~ + +</fiddle-embed></div> + +--- + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +bool readPixels(const SkBitmap& bitmap, int srcX, int srcY) +</pre> + +Copies pixels enclosed by <a href="bmh_SkCanvas_Reference?cl=9919#bitmap">bitmap</a> offset to (x, y) from <a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> into <a href="bmh_SkCanvas_Reference?cl=9919#bitmap">bitmap</a>, converting their <a href="bmh_undocumented?cl=9919#Color_Type">Image Color Type</a> and <a href="bmh_undocumented?cl=9919#Alpha_Type">Image Alpha Type</a>. +Pixels are readable when <a href="bmh_undocumented?cl=9919#Device">Device</a> is raster. Pixels are not readable when <a href="bmh_SkCanvas_Reference?cl=9919#SkCanvas">SkCanvas</a> is returned from +<a href="bmh_undocumented?cl=9919#GPU">GPU Surface</a>, returned by <a href="bmh_undocumented?cl=9919#beginPage">SkDocument::beginPage</a>, returned by <a href="bmh_undocumented?cl=9919#beginRecording">SkPictureRecorder::beginRecording</a>, +or <a href="bmh_SkCanvas_Reference?cl=9919#SkCanvas">SkCanvas</a> is the base of a utility class like <a href="bmh_undocumented?cl=9919#SkDumpCanvas">SkDumpCanvas</a>. +Allocates pixel storage in <a href="bmh_SkCanvas_Reference?cl=9919#bitmap">bitmap</a> if needed. + +<a href="bmh_undocumented?cl=9919#Pixel">Pixel</a> values are converted only if <a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> <a href="bmh_undocumented?cl=9919#Color_Type">Image Color Type</a> and <a href="bmh_undocumented?cl=9919#Alpha_Type">Image Alpha Type</a> does not match <a href="bmh_SkCanvas_Reference?cl=9919#bitmap">bitmap</a> <a href="bmh_undocumented?cl=9919#Info">Image Info</a>. +Only pixels within the rectangle that intersect <a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> pixels are copied. +Bitamp pixels outside the rectangle intersection are unchanged. + +| canvas pixel bounds | value | +| --- | --- | +| left | 0 | +| top | 0 | +| width | <a href="bmh_SkCanvas_Reference?cl=9919#imageInfo">imageInfo</a>.width() | +| height | <a href="bmh_SkCanvas_Reference?cl=9919#imageInfo">imageInfo</a>.height() | + +Does not copy, and returns false if: + +<table> <tr> + <td>Bounds formed by (x, y) and <a href="bmh_SkCanvas_Reference?cl=9919#bitmap">bitmap</a> (width, height) and canvas pixel bounds do not intersect.</td> </tr> <tr> + <td><a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> pixels could not be converted to <a href="bmh_SkCanvas_Reference?cl=9919#bitmap">bitmap</a> <a href="bmh_undocumented?cl=9919#Color_Type">Image Color Type</a> or <a href="bmh_SkCanvas_Reference?cl=9919#bitmap">bitmap</a> <a href="bmh_undocumented?cl=9919#Alpha_Type">Image Alpha Type</a>.</td> </tr> <tr> + <td><a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> pixels are not readable; for instance, <a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> is not raster, or is document-based.</td> </tr> <tr> + <td><a href="bmh_SkCanvas_Reference?cl=9919#bitmap">bitmap</a> pixels could not be allocated.</td> </tr> <tr> + <td><a href="bmh_undocumented?cl=9919#Row_Bytes">Bitmap Row Bytes</a> is too small to contain one row of pixels.</td> </tr> +</table> + +### Parameters + +<table> <tr> <td><code><strong>bitmap </strong></code></td> <td> +Receives pixels copied from <a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a>.</td> + </tr> <tr> <td><code><strong>srcX </strong></code></td> <td> +Offset into readable pixels in x.</td> + </tr> <tr> <td><code><strong>srcY </strong></code></td> <td> +Offset into readable pixels in y.</td> + </tr> +</table> + +### Return Value + +true if pixels were copied. + +### Example + +<div><fiddle-embed name="af6dec8ef974aa67bf102f29915bcd6a"> + +#### Example Output + +~~~~ +pixel = 802b5580 +~~~~ + +</fiddle-embed></div> + +--- + +<a name="writePixels"></a> +## writePixels + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +bool writePixels(const SkImageInfo& info, const void* pixels, size_t rowBytes, + int x, int y) +</pre> + +Copies to <a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> <a href="bmh_SkCanvas_Reference?cl=9919#pixels">pixels</a>, ignoring the <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a> and <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>, converting to match +<a href="bmh_SkCanvas_Reference?cl=9919#info">info</a> <a href="bmh_undocumented?cl=9919#Color_Type">Image Color Type</a> and <a href="bmh_SkCanvas_Reference?cl=9919#info">info</a> <a href="bmh_undocumented?cl=9919#Alpha_Type">Image Alpha Type</a>. + +<a href="bmh_undocumented?cl=9919#Pixel">Pixel</a> values are converted only if <a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> <a href="bmh_undocumented?cl=9919#Color_Type">Image Color Type</a> and <a href="bmh_undocumented?cl=9919#Alpha_Type">Image Alpha Type</a> does not match <a href="bmh_SkCanvas_Reference?cl=9919#info">info</a>. +Only <a href="bmh_SkCanvas_Reference?cl=9919#pixels">pixels</a> within the source rectangle that intersect <a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> pixel bounds are copied. +<a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> <a href="bmh_SkCanvas_Reference?cl=9919#pixels">pixels</a> outside the rectangle intersection are unchanged. + +| source rectangle | value | +| --- | --- | +| left | <a href="bmh_SkCanvas_Reference?cl=9919#x">x</a> | +| top | <a href="bmh_SkCanvas_Reference?cl=9919#y">y</a> | +| width | <a href="bmh_SkCanvas_Reference?cl=9919#info">info</a>.width() | +| height | <a href="bmh_SkCanvas_Reference?cl=9919#info">info</a>.height() | + +| canvas pixel bounds | value | +| --- | --- | +| left | 0 | +| top | 0 | +| width | <a href="bmh_SkCanvas_Reference?cl=9919#imageInfo">imageInfo</a>.width() | +| height | <a href="bmh_SkCanvas_Reference?cl=9919#imageInfo">imageInfo</a>.height() | + +Does not copy, and returns false if: + +<table> <tr> + <td>Source rectangle and canvas pixel bounds do not intersect.</td> </tr> <tr> + <td><a href="bmh_SkCanvas_Reference?cl=9919#pixels">pixels</a> could not be converted to <a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> <a href="bmh_undocumented?cl=9919#Color_Type">Image Color Type</a> or <a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> <a href="bmh_undocumented?cl=9919#Alpha_Type">Image Alpha Type</a>.</td> </tr> <tr> + <td><a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> <a href="bmh_SkCanvas_Reference?cl=9919#pixels">pixels</a> are not writable; for instance, <a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> is document-based.</td> </tr> <tr> + <td><a href="bmh_SkCanvas_Reference?cl=9919#rowBytes">rowBytes</a> is too small to contain one row of <a href="bmh_SkCanvas_Reference?cl=9919#pixels">pixels</a>.</td> </tr> +</table> + +### Parameters + +<table> <tr> <td><code><strong>info </strong></code></td> <td> +Dimensions, <a href="bmh_undocumented?cl=9919#Color_Type">Image Color Type</a>, and <a href="bmh_undocumented?cl=9919#Alpha_Type">Image Alpha Type</a> of <a href="bmh_SkCanvas_Reference?cl=9919#pixels">pixels</a>.</td> + </tr> <tr> <td><code><strong>pixels </strong></code></td> <td> +Pixels to copy, of size <a href="bmh_SkCanvas_Reference?cl=9919#info">info</a>.height() times <a href="bmh_SkCanvas_Reference?cl=9919#rowBytes">rowBytes</a>.</td> + </tr> <tr> <td><code><strong>rowBytes </strong></code></td> <td> +Offset from one row to the next, usually <a href="bmh_SkCanvas_Reference?cl=9919#info">info</a>.width() times pixel size.</td> + </tr> <tr> <td><code><strong>x </strong></code></td> <td> +Offset into <a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> writable <a href="bmh_SkCanvas_Reference?cl=9919#pixels">pixels</a> in <a href="bmh_SkCanvas_Reference?cl=9919#x">x</a>.</td> + </tr> <tr> <td><code><strong>y </strong></code></td> <td> +Offset into <a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> writable <a href="bmh_SkCanvas_Reference?cl=9919#pixels">pixels</a> in <a href="bmh_SkCanvas_Reference?cl=9919#y">y</a>.</td> + </tr> +</table> + +### Return Value + +true if <a href="bmh_SkCanvas_Reference?cl=9919#pixels">pixels</a> were written to <a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a>. + +### Example + +<div><fiddle-embed name="29b98ebf58aa9fd1edfaabf9f4490b3a"></fiddle-embed></div> + +--- + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +bool writePixels(const SkBitmap& bitmap, int x, int y) +</pre> + +Writes to <a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> pixels, ignoring the <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a> and <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>, converting to match +<a href="bmh_SkCanvas_Reference?cl=9919#bitmap">bitmap</a> <a href="bmh_undocumented?cl=9919#Color_Type">Image Color Type</a> and <a href="bmh_SkCanvas_Reference?cl=9919#bitmap">bitmap</a> <a href="bmh_undocumented?cl=9919#Alpha_Type">Image Alpha Type</a>. + +<a href="bmh_undocumented?cl=9919#Pixel">Pixel</a> values are converted only if <a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> <a href="bmh_undocumented?cl=9919#Color_Type">Image Color Type</a> and <a href="bmh_undocumented?cl=9919#Alpha_Type">Image Alpha Type</a> does not match <a href="bmh_SkCanvas_Reference?cl=9919#bitmap">bitmap</a>. +Only pixels within the source rectangle that intersect <a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> pixel bounds are copied. +<a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> pixels outside the rectangle intersection are unchanged. + +| source rectangle | value | +| --- | --- | +| left | <a href="bmh_SkCanvas_Reference?cl=9919#x">x</a> | +| top | <a href="bmh_SkCanvas_Reference?cl=9919#y">y</a> | +| width | <a href="bmh_SkCanvas_Reference?cl=9919#bitmap">bitmap</a>.width() | +| height | <a href="bmh_SkCanvas_Reference?cl=9919#bitmap">bitmap</a>.height() | + +| canvas pixel bounds | value | +| --- | --- | +| left | 0 | +| top | 0 | +| width | <a href="bmh_SkCanvas_Reference?cl=9919#imageInfo">imageInfo</a>.width() | +| height | <a href="bmh_SkCanvas_Reference?cl=9919#imageInfo">imageInfo</a>.height() | + +Does not copy, and returns false if: + +<table> <tr> + <td>Source rectangle and <a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> pixel bounds do not intersect.</td> </tr> <tr> + <td><a href="bmh_SkCanvas_Reference?cl=9919#bitmap">bitmap</a> does not have allocated pixels.</td> </tr> <tr> + <td><a href="bmh_SkCanvas_Reference?cl=9919#bitmap">bitmap</a> pixels could not be converted to <a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> <a href="bmh_undocumented?cl=9919#Color_Type">Image Color Type</a> or <a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> <a href="bmh_undocumented?cl=9919#Alpha_Type">Image Alpha Type</a>.</td> </tr> <tr> + <td><a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> pixels are not writable; for instance, <a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> is document-based.</td> </tr> <tr> + <td><a href="bmh_SkCanvas_Reference?cl=9919#bitmap">bitmap</a> pixels are inaccessible; for instance, <a href="bmh_SkCanvas_Reference?cl=9919#bitmap">bitmap</a> wraps a texture.</td> </tr> +</table> + +### Parameters + +<table> <tr> <td><code><strong>bitmap </strong></code></td> <td> +Provides pixels copied to <a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a>.</td> + </tr> <tr> <td><code><strong>x </strong></code></td> <td> +Offset into <a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> writable pixels in <a href="bmh_SkCanvas_Reference?cl=9919#x">x</a>.</td> + </tr> <tr> <td><code><strong>y </strong></code></td> <td> +Offset into <a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> writable pixels in <a href="bmh_SkCanvas_Reference?cl=9919#y">y</a>.</td> + </tr> +</table> + +### Return Value + +true if pixels were written to <a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a>. + +### Example + +<div><fiddle-embed name="8b128e067881f9251357653692fa28da"></fiddle-embed></div> + +--- + +# <a name="State_Stack"></a> State Stack +<a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> maintains a stack of state that allows hierarchical drawing, commonly used +to implement windows and views. The initial state has an identity matrix and and an infinite clip. +Even with a wide-open clip, drawing is constrained by the bounds of the +<a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> <a href="bmh_undocumented?cl=9919#Surface">Surface</a> or <a href="bmh_undocumented?cl=9919#Device">Device</a>. + +<a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> savable state consists of <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>, <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>, and <a href="bmh_undocumented?cl=9919#Draw_Filter">Draw Filter</a>. +<a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> describes the area that may be drawn to. +<a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a> transforms the geometry. +<a href="bmh_undocumented?cl=9919#Draw_Filter">Draw Filter</a> (deprecated on most platforms) modifies the paint before drawing. + +<a href="bmh_SkCanvas_Reference?cl=9919#save">save</a>, <a href="bmh_SkCanvas_Reference?cl=9919#saveLayer">saveLayer</a>, <a href="bmh_SkCanvas_Reference?cl=9919#saveLayerPreserveLCDTextRequests">saveLayerPreserveLCDTextRequests</a>, and <a href="bmh_SkCanvas_Reference?cl=9919#saveLayerAlpha">saveLayerAlpha</a> +save state and return the depth of the stack. + +<a href="bmh_SkCanvas_Reference?cl=9919#restore">restore</a> and <a href="bmh_SkCanvas_Reference?cl=9919#restoreToCount">restoreToCount</a> revert state to its value when saved. + +Each state on the stack intersects <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> with the previous <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>, +and concatenates <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a> with the previous <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>. +The intersected <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> makes the drawing area the same or smaller; +the concatenated <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a> may move the origin and potentially scale or rotate +the coordinate space. + +<a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> does not require balancing the state stack but it is a good idea +to do so. Calling <a href="bmh_SkCanvas_Reference?cl=9919#save">save</a> without <a href="bmh_SkCanvas_Reference?cl=9919#restore">restore</a> will eventually cause <a href="bmh_undocumented?cl=9919#Skia">Skia</a> to fail; +mismatched <a href="bmh_SkCanvas_Reference?cl=9919#save">save</a> and <a href="bmh_SkCanvas_Reference?cl=9919#restore">restore</a> create hard to find bugs. + +It is not possible to use state to draw outside of the clip defined by the +previous state. + +### Example + +<div><fiddle-embed name="a4548baa133302e933b4d3442c06f5b3"><div>Draw to ever smaller clips; then restore drawing to full canvas. +Note that the second <a href="bmh_SkCanvas_Reference?cl=9919#clipRect">clipRect</a> is not permitted to enlarge <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>.</div></fiddle-embed></div> + +Each <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> uses the current <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a> for its coordinates. + +### Example + +<div><fiddle-embed name="9f563a2d60aa31d4b26742e5aa17aa4e"><div>While <a href="bmh_SkCanvas_Reference?cl=9919#clipRect">clipRect</a> is given the same rectangle twice, <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a> makes the second +<a href="bmh_SkCanvas_Reference?cl=9919#clipRect">clipRect</a> draw at half the size of the first.</div></fiddle-embed></div> + +### See Also + +<a href="bmh_SkCanvas_Reference?cl=9919#save">save</a> <a href="bmh_SkCanvas_Reference?cl=9919#saveLayer">saveLayer</a> <a href="bmh_SkCanvas_Reference?cl=9919#saveLayerPreserveLCDTextRequests">saveLayerPreserveLCDTextRequests</a> <a href="bmh_SkCanvas_Reference?cl=9919#saveLayerAlpha">saveLayerAlpha</a> <a href="bmh_SkCanvas_Reference?cl=9919#restore">restore</a> <a href="bmh_SkCanvas_Reference?cl=9919#restoreToCount">restoreToCount</a> + +<a name="save"></a> +## save + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +int save() +</pre> + +Saves <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>, <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>, and <a href="bmh_undocumented?cl=9919#Draw_Filter">Draw Filter</a> (<a href="bmh_undocumented?cl=9919#Draw_Filter">Draw Filter</a> deprecated on most platforms). +Calling <a href="bmh_SkCanvas_Reference?cl=9919#restore">restore</a> discards changes to <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>, <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>, and <a href="bmh_undocumented?cl=9919#Draw_Filter">Draw Filter</a>, +restoring the <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>, <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>, and <a href="bmh_undocumented?cl=9919#Draw_Filter">Draw Filter</a> to their state when <a href="bmh_SkCanvas_Reference?cl=9919#save">save</a> was called. + +<a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a> may be changed by <a href="bmh_SkCanvas_Reference?cl=9919#translate">translate</a>, <a href="bmh_SkCanvas_Reference?cl=9919#scale">scale</a>, <a href="bmh_SkCanvas_Reference?cl=9919#rotate">rotate</a>, <a href="bmh_SkCanvas_Reference?cl=9919#skew">skew</a>, <a href="bmh_SkCanvas_Reference?cl=9919#concat">concat</a>, <a href="bmh_SkCanvas_Reference?cl=9919#setMatrix">setMatrix</a>, and <a href="bmh_SkCanvas_Reference?cl=9919#resetMatrix">resetMatrix</a>. +<a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> may be changed by <a href="bmh_SkCanvas_Reference?cl=9919#clipRect">clipRect</a>, <a href="bmh_SkCanvas_Reference?cl=9919#clipRRect">clipRRect</a>, <a href="bmh_SkCanvas_Reference?cl=9919#clipPath">clipPath</a>, <a href="bmh_SkCanvas_Reference?cl=9919#clipRegion">clipRegion</a>. + +Saved <a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> state is put on a stack; multiple calls to <a href="bmh_SkCanvas_Reference?cl=9919#save">save</a> should be balance by an equal number of +calls to <a href="bmh_SkCanvas_Reference?cl=9919#restore">restore</a>. + +Call <a href="bmh_SkCanvas_Reference?cl=9919#restoreToCount">restoreToCount</a> with result to restore this and subsequent saves. + +### Return Value + +Depth of saved stack. + +### Example + +<div><fiddle-embed name="e477dce358a9ba3b0aa1bf33b8a376de"><div>The black square is translated 50 pixels down and to the right. +Restoring <a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> state removes <a href="bmh_SkCanvas_Reference?cl=9919#translate">translate</a> from <a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> stack; +the red square is not translated, and is drawn at the origin.</div></fiddle-embed></div> + +--- + +## <a name="Layer"></a> Layer + +<a href="bmh_SkCanvas_Reference?cl=9919#State_Stack_Layer">Layer</a> allocates a temporary offscreen <a href="bmh_undocumented?cl=9919#Bitmap">Bitmap</a> to draw into. When the drawing is complete, +the <a href="bmh_undocumented?cl=9919#Bitmap">Bitmap</a> is drawn into the <a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a>. + +<a href="bmh_SkCanvas_Reference?cl=9919#State_Stack_Layer">Layer</a> is saved in a stack along with other saved state. When state with a <a href="bmh_SkCanvas_Reference?cl=9919#State_Stack_Layer">Layer</a> +is restored, the offscreen <a href="bmh_undocumented?cl=9919#Bitmap">Bitmap</a> is drawn into the previous layer. + +<a href="bmh_SkCanvas_Reference?cl=9919#State_Stack_Layer">Layer</a> may be initialized with the contents of the previous layer. When <a href="bmh_SkCanvas_Reference?cl=9919#State_Stack_Layer">Layer</a> is +restored, its <a href="bmh_undocumented?cl=9919#Bitmap">Bitmap</a> can be modified by <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> passed to <a href="bmh_SkCanvas_Reference?cl=9919#State_Stack_Layer">Layer</a> to apply <a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a>, +<a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>, <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a>, and <a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a>. + +<a name="saveLayer"></a> +## saveLayer + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +int saveLayer(const SkRect* bounds, const SkPaint* paint) +</pre> + +Saves <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>, <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>, and <a href="bmh_undocumented?cl=9919#Draw_Filter">Draw Filter</a> (<a href="bmh_undocumented?cl=9919#Draw_Filter">Draw Filter</a> deprecated on most platforms), +and allocates an offscreen <a href="bmh_undocumented?cl=9919#Bitmap">Bitmap</a> for subsequent drawing. +Calling <a href="bmh_SkCanvas_Reference?cl=9919#restore">restore</a> discards changes to <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>, <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>, and <a href="bmh_undocumented?cl=9919#Draw_Filter">Draw Filter</a>, +and draws the offscreen bitmap. +The <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>, <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>, and <a href="bmh_undocumented?cl=9919#Draw_Filter">Draw Filter</a> are restored to their state when <a href="bmh_SkCanvas_Reference?cl=9919#save">save</a> was called. + +<a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a> may be changed by <a href="bmh_SkCanvas_Reference?cl=9919#translate">translate</a>, <a href="bmh_SkCanvas_Reference?cl=9919#scale">scale</a>, <a href="bmh_SkCanvas_Reference?cl=9919#rotate">rotate</a>, <a href="bmh_SkCanvas_Reference?cl=9919#skew">skew</a>, <a href="bmh_SkCanvas_Reference?cl=9919#concat">concat</a>, <a href="bmh_SkCanvas_Reference?cl=9919#setMatrix">setMatrix</a>, and <a href="bmh_SkCanvas_Reference?cl=9919#resetMatrix">resetMatrix</a>. +<a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> may be changed by <a href="bmh_SkCanvas_Reference?cl=9919#clipRect">clipRect</a>, <a href="bmh_SkCanvas_Reference?cl=9919#clipRRect">clipRRect</a>, <a href="bmh_SkCanvas_Reference?cl=9919#clipPath">clipPath</a>, <a href="bmh_SkCanvas_Reference?cl=9919#clipRegion">clipRegion</a>. + +<a href="bmh_undocumented?cl=9919#Rect">Rect</a> <a href="bmh_SkCanvas_Reference?cl=9919#bounds">bounds</a> suggests but does not define the offscreen size. To clip drawing to a specific rectangle, +use <a href="bmh_SkCanvas_Reference?cl=9919#clipRect">clipRect</a>. + +Optional <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a> applies <a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a>, <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>, <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a>, and <a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a> when <a href="bmh_SkCanvas_Reference?cl=9919#restore">restore</a> is called. + +Call <a href="bmh_SkCanvas_Reference?cl=9919#restoreToCount">restoreToCount</a> with result to restore this and subsequent saves. + +### Parameters + +<table> <tr> <td><code><strong>bounds </strong></code></td> <td> +Used as a hint to limit the size of the offscreen; may be nullptr.</td> + </tr> <tr> <td><code><strong>paint </strong></code></td> <td> +Used when <a href="bmh_SkCanvas_Reference?cl=9919#restore">restore</a> is called to draw the offscreen; may be nullptr.</td> + </tr> +</table> + +### Return Value + +Depth of saved stack. + +### Example + +<div><fiddle-embed name="05f9b6fa6b5007aea89dfe66c306855d"><div>Rectangles are blurred by <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a> when <a href="bmh_SkCanvas_Reference?cl=9919#restore">restore</a> draws offscreen to main <a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a>.</div></fiddle-embed></div> + +--- + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +int saveLayer(const SkRect& bounds, const SkPaint* paint) +</pre> + +Saves <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>, <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>, and <a href="bmh_undocumented?cl=9919#Draw_Filter">Draw Filter</a> (<a href="bmh_undocumented?cl=9919#Draw_Filter">Draw Filter</a> deprecated on most platforms), +and allocates an offscreen <a href="bmh_undocumented?cl=9919#Bitmap">Bitmap</a> for subsequent drawing. +Calling <a href="bmh_SkCanvas_Reference?cl=9919#restore">restore</a> discards changes to <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>, <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>, and <a href="bmh_undocumented?cl=9919#Draw_Filter">Draw Filter</a>, +and draws the offscreen <a href="bmh_undocumented?cl=9919#Bitmap">Bitmap</a>. +The <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>, <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>, and <a href="bmh_undocumented?cl=9919#Draw_Filter">Draw Filter</a> are restored to their state when <a href="bmh_SkCanvas_Reference?cl=9919#save">save</a> was called. + +<a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a> may be changed by <a href="bmh_SkCanvas_Reference?cl=9919#translate">translate</a>, <a href="bmh_SkCanvas_Reference?cl=9919#scale">scale</a>, <a href="bmh_SkCanvas_Reference?cl=9919#rotate">rotate</a>, <a href="bmh_SkCanvas_Reference?cl=9919#skew">skew</a>, <a href="bmh_SkCanvas_Reference?cl=9919#concat">concat</a>, <a href="bmh_SkCanvas_Reference?cl=9919#setMatrix">setMatrix</a>, and <a href="bmh_SkCanvas_Reference?cl=9919#resetMatrix">resetMatrix</a>. +<a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> may be changed by <a href="bmh_SkCanvas_Reference?cl=9919#clipRect">clipRect</a>, <a href="bmh_SkCanvas_Reference?cl=9919#clipRRect">clipRRect</a>, <a href="bmh_SkCanvas_Reference?cl=9919#clipPath">clipPath</a>, <a href="bmh_SkCanvas_Reference?cl=9919#clipRegion">clipRegion</a>. + +<a href="bmh_SkCanvas_Reference?cl=9919#bounds">bounds</a> suggests but does not define the offscreen size. To clip drawing to a specific rectangle, +use <a href="bmh_SkCanvas_Reference?cl=9919#clipRect">clipRect</a>. + +Optional <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a> applies <a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a>, <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>, <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a>, and <a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a> when <a href="bmh_SkCanvas_Reference?cl=9919#restore">restore</a> is called. + +Call <a href="bmh_SkCanvas_Reference?cl=9919#restoreToCount">restoreToCount</a> with result to restore this and subsequent saves. + +### Parameters + +<table> <tr> <td><code><strong>bounds </strong></code></td> <td> +Used as a hint to limit the size of the offscreen; may be nullptr.</td> + </tr> <tr> <td><code><strong>paint </strong></code></td> <td> +Used when <a href="bmh_SkCanvas_Reference?cl=9919#restore">restore</a> is called to draw the offscreen; may be nullptr.</td> + </tr> +</table> + +### Return Value + +Depth of saved stack. + +### Example + +<div><fiddle-embed name="812f3c8f8b93e8c7e55528c7a22887bf"><div>Rectangles are blurred by <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a> when <a href="bmh_SkCanvas_Reference?cl=9919#restore">restore</a> draws offscreen to main <a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a>. +The red rectangle is clipped; it does not fully fit on the offscreen <a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a>. +<a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a> blurs past edge of offscreen so red rectangle is blurred on all sides.</div></fiddle-embed></div> + +--- + +<a name="saveLayerPreserveLCDTextRequests"></a> +## saveLayerPreserveLCDTextRequests + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +int saveLayerPreserveLCDTextRequests(const SkRect* bounds, const SkPaint* paint) +</pre> + +Saves <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>, <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>, and <a href="bmh_undocumented?cl=9919#Draw_Filter">Draw Filter</a> (<a href="bmh_undocumented?cl=9919#Draw_Filter">Draw Filter</a> deprecated on most platforms), +and allocates an offscreen bitmap for subsequent drawing. +<a href="bmh_SkPaint_Reference?cl=9919#LCD_Text">LCD Text</a> is preserved when the offscreen is drawn to the prior layer. + +Draw text on an opaque background so that <a href="bmh_SkPaint_Reference?cl=9919#LCD_Text">LCD Text</a> blends correctly with the prior layer. + +Calling <a href="bmh_SkCanvas_Reference?cl=9919#restore">restore</a> discards changes to <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>, <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>, and <a href="bmh_undocumented?cl=9919#Draw_Filter">Draw Filter</a>, +and draws the offscreen bitmap. +The <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>, <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>, and <a href="bmh_undocumented?cl=9919#Draw_Filter">Draw Filter</a> are restored to their state when <a href="bmh_SkCanvas_Reference?cl=9919#save">save</a> was called. + +<a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a> may be changed by <a href="bmh_SkCanvas_Reference?cl=9919#translate">translate</a>, <a href="bmh_SkCanvas_Reference?cl=9919#scale">scale</a>, <a href="bmh_SkCanvas_Reference?cl=9919#rotate">rotate</a>, <a href="bmh_SkCanvas_Reference?cl=9919#skew">skew</a>, <a href="bmh_SkCanvas_Reference?cl=9919#concat">concat</a>, <a href="bmh_SkCanvas_Reference?cl=9919#setMatrix">setMatrix</a>, and <a href="bmh_SkCanvas_Reference?cl=9919#resetMatrix">resetMatrix</a>. +<a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> may be changed by <a href="bmh_SkCanvas_Reference?cl=9919#clipRect">clipRect</a>, <a href="bmh_SkCanvas_Reference?cl=9919#clipRRect">clipRRect</a>, <a href="bmh_SkCanvas_Reference?cl=9919#clipPath">clipPath</a>, <a href="bmh_SkCanvas_Reference?cl=9919#clipRegion">clipRegion</a>. +Draw <a href="bmh_SkPaint_Reference?cl=9919#LCD_Text">LCD Text</a> on an opaque background to get good results. + +<a href="bmh_SkCanvas_Reference?cl=9919#bounds">bounds</a> suggests but does not define the offscreen size. To clip drawing to a specific rectangle, +use <a href="bmh_SkCanvas_Reference?cl=9919#clipRect">clipRect</a>. + +<a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a> modifies how the offscreen overlays the prior layer. <a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a>, <a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a>, +<a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>, <a href="bmh_undocumented?cl=9919#Draw_Looper">Draw Looper</a>, <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a>, and <a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a>, affect the offscreen draw. + +Call <a href="bmh_SkCanvas_Reference?cl=9919#restoreToCount">restoreToCount</a> with result to restore this and subsequent saves. + +### Parameters + +<table> <tr> <td><code><strong>bounds </strong></code></td> <td> +Used as a hint to limit the size of the offscreen; may be nullptr.</td> + </tr> <tr> <td><code><strong>paint </strong></code></td> <td> +Used when <a href="bmh_SkCanvas_Reference?cl=9919#restore">restore</a> is called to draw the offscreen; may be nullptr.</td> + </tr> +</table> + +### Return Value + +Depth of saved stack. + +### Example + +<div><fiddle-embed name="8460bf8b013f46c67e0bd96e13451aff"></fiddle-embed></div> + +--- + +<a name="saveLayerAlpha"></a> +## saveLayerAlpha + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +int saveLayerAlpha(const SkRect* bounds, U8CPU alpha) +</pre> + +Saves <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>, <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>, and <a href="bmh_undocumented?cl=9919#Draw_Filter">Draw Filter</a> (<a href="bmh_undocumented?cl=9919#Draw_Filter">Draw Filter</a> deprecated on most platforms), +and allocates an offscreen bitmap for subsequent drawing. + +Calling <a href="bmh_SkCanvas_Reference?cl=9919#restore">restore</a> discards changes to <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>, <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>, and <a href="bmh_undocumented?cl=9919#Draw_Filter">Draw Filter</a>, +and blends the offscreen bitmap with <a href="bmh_SkCanvas_Reference?cl=9919#alpha">alpha</a> opacity onto the prior layer. +The <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>, <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>, and <a href="bmh_undocumented?cl=9919#Draw_Filter">Draw Filter</a> are restored to their state when <a href="bmh_SkCanvas_Reference?cl=9919#save">save</a> was called. + +<a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a> may be changed by <a href="bmh_SkCanvas_Reference?cl=9919#translate">translate</a>, <a href="bmh_SkCanvas_Reference?cl=9919#scale">scale</a>, <a href="bmh_SkCanvas_Reference?cl=9919#rotate">rotate</a>, <a href="bmh_SkCanvas_Reference?cl=9919#skew">skew</a>, <a href="bmh_SkCanvas_Reference?cl=9919#concat">concat</a>, <a href="bmh_SkCanvas_Reference?cl=9919#setMatrix">setMatrix</a>, and <a href="bmh_SkCanvas_Reference?cl=9919#resetMatrix">resetMatrix</a>. +<a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> may be changed by <a href="bmh_SkCanvas_Reference?cl=9919#clipRect">clipRect</a>, <a href="bmh_SkCanvas_Reference?cl=9919#clipRRect">clipRRect</a>, <a href="bmh_SkCanvas_Reference?cl=9919#clipPath">clipPath</a>, <a href="bmh_SkCanvas_Reference?cl=9919#clipRegion">clipRegion</a>. + +<a href="bmh_SkCanvas_Reference?cl=9919#bounds">bounds</a> suggests but does not define the offscreen size. To clip drawing to a specific rectangle, +use <a href="bmh_SkCanvas_Reference?cl=9919#clipRect">clipRect</a>. + +Call <a href="bmh_SkCanvas_Reference?cl=9919#restoreToCount">restoreToCount</a> with result to restore this and subsequent saves. + +### Parameters + +<table> <tr> <td><code><strong>bounds </strong></code></td> <td> +Used as a hint to limit the size of the offscreen; may be nullptr.</td> + </tr> <tr> <td><code><strong>alpha </strong></code></td> <td> +The opacity of the offscreen; zero is fully transparent, 255 is fully opaque.</td> + </tr> +</table> + +### Return Value + +Depth of saved stack. + +### Example + +<div><fiddle-embed name="8ab88d86fb438856cc48d6e2f08a6e24"></fiddle-embed></div> + +--- + +## <a name="SkCanvas::SaveLayerFlags"></a> Enum SkCanvas::SaveLayerFlags + +<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0"> +enum { +<a href="bmh_SkCanvas_Reference?cl=9919#kIsOpaque_SaveLayerFlag">kIsOpaque SaveLayerFlag</a> = 1 << 0, +<a href="bmh_SkCanvas_Reference?cl=9919#kPreserveLCDText_SaveLayerFlag">kPreserveLCDText SaveLayerFlag</a> = 1 << 1, +<a href="bmh_SkCanvas_Reference?cl=9919#kInitWithPrevious_SaveLayerFlag">kInitWithPrevious SaveLayerFlag</a> = 1 << 2, +}; + +typedef uint32_t <a href="bmh_SkCanvas_Reference?cl=9919#SaveLayerFlags">SaveLayerFlags</a>;</pre> + +<a href="bmh_SkCanvas_Reference?cl=9919#SaveLayerFlags">SaveLayerFlags</a> provides options that may be used in any combination in <a href="bmh_SkCanvas_Reference?cl=9919#SaveLayerRec">SaveLayerRec</a>, +defining how the offscreen allocated by <a href="bmh_SkCanvas_Reference?cl=9919#saveLayer">saveLayer</a> operates. + +### Constants + +<table> + <tr> + <td><a name="SkCanvas::kIsOpaque_SaveLayerFlag"></a> <code><strong>SkCanvas::kIsOpaque_SaveLayerFlag </strong></code></td><td>1</td><td>Creates offscreen without transparency. Flag is ignored if layer <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> contains +<a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a> or <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>.</td> + </tr> + <tr> + <td><a name="SkCanvas::kPreserveLCDText_SaveLayerFlag"></a> <code><strong>SkCanvas::kPreserveLCDText_SaveLayerFlag </strong></code></td><td>2</td><td>Creates offscreen for <a href="bmh_undocumented?cl=9919#LCD">LCD</a> text. Flag is ignored if layer <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> contains +<a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a> or <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>.</td> + </tr> + <tr> + <td><a name="SkCanvas::kInitWithPrevious_SaveLayerFlag"></a> <code><strong>SkCanvas::kInitWithPrevious_SaveLayerFlag </strong></code></td><td>4</td><td>Initializes offscreen with the contents of the previous layer.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="d314c688925d2c549d4762f5cc6e6a1a"><div><a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> layer captures red and blue circles scaled up by four. +scalePaint blends offscreen back with transparency.</div></fiddle-embed></div> + + + +# <a name="SkCanvas::SaveLayerRec"></a> Struct SkCanvas::SaveLayerRec + +<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0"> +struct <a href="bmh_SkCanvas_Reference?cl=9919#SaveLayerRec_SaveLayerRec">SaveLayerRec</a> { +<a href="bmh_SkCanvas_Reference?cl=9919#SaveLayerRec_SaveLayerRec">SaveLayerRec</a>*(... + +const <a href="bmh_undocumented?cl=9919#SkRect">SkRect</a>* <a href="bmh_SkCanvas_Reference?cl=9919#SaveLayerRec_fBounds">fBounds</a>; +const <a href="bmh_SkPaint_Reference?cl=9919#SkPaint">SkPaint</a>* <a href="bmh_SkCanvas_Reference?cl=9919#SaveLayerRec_fPaint">fPaint</a>; +const <a href="bmh_undocumented?cl=9919#SkImageFilter">SkImageFilter</a>* <a href="bmh_SkCanvas_Reference?cl=9919#SaveLayerRec_fBackdrop">fBackdrop</a>; +<a href="bmh_SkCanvas_Reference?cl=9919#SaveLayerFlags">SaveLayerFlags</a> <a href="bmh_SkCanvas_Reference?cl=9919#SaveLayerRec_fSaveLayerFlags">fSaveLayerFlags</a>; +};</pre> + +<a href="bmh_SkCanvas_Reference?cl=9919#SaveLayerRec_SaveLayerRec">SaveLayerRec</a> contains the state used to create the layer offscreen. + +<code><strong>const SkRect* fBounds</strong></code> + +<a href="bmh_SkCanvas_Reference?cl=9919#SaveLayerRec_fBounds">fBounds</a> is used as a hint to limit the size of the offscreen; may be nullptr. +<a href="bmh_SkCanvas_Reference?cl=9919#SaveLayerRec_fBounds">fBounds</a> suggests but does not define the offscreen size. To clip drawing to a specific rectangle, +use <a href="bmh_SkCanvas_Reference?cl=9919#clipRect">clipRect</a>. + +<code><strong>const SkPaint* fPaint</strong></code> + +<a href="bmh_SkCanvas_Reference?cl=9919#SaveLayerRec_fPaint">fPaint</a> modifies how the offscreen overlays the prior layer; may be nullptr. <a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a>, <a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a>, +<a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>, <a href="bmh_undocumented?cl=9919#Draw_Looper">Draw Looper</a>, <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a>, and <a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a> affect the offscreen draw. + +<code><strong>const SkImageFilter* fBackdrop</strong></code> + +<a href="bmh_SkCanvas_Reference?cl=9919#SaveLayerRec_fBackdrop">fBackdrop</a> applies <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a> to the prior layer when copying to the layer offscreen; may be nullptr. +Use <a href="bmh_SkCanvas_Reference?cl=9919#kInitWithPrevious_SaveLayerFlag">kInitWithPrevious SaveLayerFlag</a> to copy the prior layer without a <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a>. + +<code><strong>const SkImage* fClipMask</strong></code> + +may be nullptr. + +<code><strong>const SkMatrix* fClipMatrix</strong></code> + +may be nullptr. + +<code><strong>SaveLayerFlags fSaveLayerFlags</strong></code> + +<a href="bmh_SkCanvas_Reference?cl=9919#SaveLayerRec_fSaveLayerFlags">fSaveLayerFlags</a> are used to create layer offscreen without transparency, create layer offscreen for +<a href="bmh_undocumented?cl=9919#LCD">LCD</a> text, and to create layer offscreen with the contents of the previous layer. + +### Example + +<div><fiddle-embed name="7b18146582fc2440656b839a173ed500"><div><a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> layer captures a red anti-aliased circle and a blue aliased circle scaled up by four. +After drawing another unscaled red circle on top, the offscreen is transferred to the main canvas.</div></fiddle-embed></div> + +<a name="SaveLayerRec"></a> +## SaveLayerRec + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +SaveLayerRec() +</pre> + +Sets <a href="bmh_SkCanvas_Reference?cl=9919#SaveLayerRec_fBounds">fBounds</a>, <a href="bmh_SkCanvas_Reference?cl=9919#SaveLayerRec_fPaint">fPaint</a>, and <a href="bmh_SkCanvas_Reference?cl=9919#SaveLayerRec_fBackdrop">fBackdrop</a> to nullptr. Clears <a href="bmh_SkCanvas_Reference?cl=9919#SaveLayerRec_fSaveLayerFlags">fSaveLayerFlags</a>. + +### Return Value + +empty <a href="bmh_SkCanvas_Reference?cl=9919#SaveLayerRec_SaveLayerRec">SaveLayerRec</a>. + +### Example + +<div><fiddle-embed name="ac7c834dce2eac6ef49c15e820e94003"> + +#### Example Output + +~~~~ +rec1 == rec2 +~~~~ + +</fiddle-embed></div> + +--- + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +SaveLayerRec(const SkRect* bounds, const SkPaint* paint, + SaveLayerFlags saveLayerFlags = 0) +</pre> + +Sets <a href="bmh_SkCanvas_Reference?cl=9919#SaveLayerRec_fBounds">fBounds</a>, <a href="bmh_SkCanvas_Reference?cl=9919#SaveLayerRec_fPaint">fPaint</a>, and <a href="bmh_SkCanvas_Reference?cl=9919#SaveLayerRec_fSaveLayerFlags">fSaveLayerFlags</a>; sets <a href="bmh_SkCanvas_Reference?cl=9919#SaveLayerRec_fBackdrop">fBackdrop</a> to nullptr. + +### Parameters + +<table> <tr> <td><code><strong>bounds </strong></code></td> <td> +Offscreen dimensions; may be nullptr.</td> + </tr> <tr> <td><code><strong>paint </strong></code></td> <td> +Applied to offscreen when overlaying prior layer; may be nullptr.</td> + </tr> <tr> <td><code><strong>saveLayerFlags </strong></code></td> <td> +<a href="bmh_SkCanvas_Reference?cl=9919#SaveLayerRec_SaveLayerRec">SaveLayerRec</a> options to modify offscreen.</td> + </tr> +</table> + +### Return Value + +<a href="bmh_SkCanvas_Reference?cl=9919#SaveLayerRec_SaveLayerRec">SaveLayerRec</a> with empty backdrop. + +### Example + +<div><fiddle-embed name="027f920259888fc19591ea9a90d92873"> + +#### Example Output + +~~~~ +rec1 == rec2 +~~~~ + +</fiddle-embed></div> + +--- + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +SaveLayerRec(const SkRect* bounds, const SkPaint* paint, + const SkImageFilter* backdrop, SaveLayerFlags saveLayerFlags) +</pre> + +Sets <a href="bmh_SkCanvas_Reference?cl=9919#SaveLayerRec_fBounds">fBounds</a>, <a href="bmh_SkCanvas_Reference?cl=9919#SaveLayerRec_fPaint">fPaint</a>, <a href="bmh_SkCanvas_Reference?cl=9919#SaveLayerRec_fBackdrop">fBackdrop</a>, and <a href="bmh_SkCanvas_Reference?cl=9919#SaveLayerRec_fSaveLayerFlags">fSaveLayerFlags</a>. + +### Parameters + +<table> <tr> <td><code><strong>bounds </strong></code></td> <td> +Offscreen dimensions; may be nullptr.</td> + </tr> <tr> <td><code><strong>paint </strong></code></td> <td> +Applied to offscreen when overlaying prior layer; may be nullptr.</td> + </tr> <tr> <td><code><strong>backdrop </strong></code></td> <td> +Copies prior layer to offscreen with <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a>; may be nullptr.</td> + </tr> <tr> <td><code><strong>saveLayerFlags </strong></code></td> <td> +<a href="bmh_SkCanvas_Reference?cl=9919#SaveLayerRec_SaveLayerRec">SaveLayerRec</a> options to modify offscreen.</td> + </tr> +</table> + +### Return Value + +<a href="bmh_SkCanvas_Reference?cl=9919#SaveLayerRec_SaveLayerRec">SaveLayerRec</a> fully specified. + +### Example + +<div><fiddle-embed name="9b7fa2fe855642ffff6538829db15328"> + +#### Example Output + +~~~~ +rec1 == rec2 +~~~~ + +</fiddle-embed></div> + +--- + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +SaveLayerRec(const SkRect* bounds, const SkPaint* paint, + const SkImageFilter* backdrop, const SkImage* clipMask, + const SkMatrix* clipMatrix, SaveLayerFlags saveLayerFlags) +</pre> + +Not ready for general use. + +### Parameters + +<table> <tr> <td><code><strong>bounds </strong></code></td> <td> +Offscreen dimensions; may be nullptr.</td> + </tr> <tr> <td><code><strong>paint </strong></code></td> <td> +Applied to offscreen when overlaying prior layer; may be nullptr.</td> + </tr> <tr> <td><code><strong>backdrop </strong></code></td> <td> +Copies prior layer to offscreen with <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a>; may be nullptr.</td> + </tr> <tr> <td><code><strong>clipMask </strong></code></td> <td> +May be nullptr.</td> + </tr> <tr> <td><code><strong>clipMatrix </strong></code></td> <td> +May be nullptr.</td> + </tr> <tr> <td><code><strong>saveLayerFlags </strong></code></td> <td> +<a href="bmh_SkCanvas_Reference?cl=9919#SaveLayerRec_SaveLayerRec">SaveLayerRec</a> options to modify offscreen.</td> + </tr> +</table> + +### Return Value + +<a href="bmh_SkCanvas_Reference?cl=9919#SaveLayerRec_SaveLayerRec">SaveLayerRec</a> fully specified. + +--- + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +int saveLayer(const SaveLayerRec& layerRec) +</pre> + +Saves <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>, <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>, and <a href="bmh_undocumented?cl=9919#Draw_Filter">Draw Filter</a> (<a href="bmh_undocumented?cl=9919#Draw_Filter">Draw Filter</a> deprecated on most platforms), +and allocates an offscreen bitmap for subsequent drawing. + +Calling <a href="bmh_SkCanvas_Reference?cl=9919#restore">restore</a> discards changes to <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>, <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>, and <a href="bmh_undocumented?cl=9919#Draw_Filter">Draw Filter</a>, +and blends the offscreen bitmap with alpha opacity onto the prior layer. +The <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>, <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>, and <a href="bmh_undocumented?cl=9919#Draw_Filter">Draw Filter</a> are restored to their state when <a href="bmh_SkCanvas_Reference?cl=9919#save">save</a> was called. + +<a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a> may be changed by <a href="bmh_SkCanvas_Reference?cl=9919#translate">translate</a>, <a href="bmh_SkCanvas_Reference?cl=9919#scale">scale</a>, <a href="bmh_SkCanvas_Reference?cl=9919#rotate">rotate</a>, <a href="bmh_SkCanvas_Reference?cl=9919#skew">skew</a>, <a href="bmh_SkCanvas_Reference?cl=9919#concat">concat</a>, <a href="bmh_SkCanvas_Reference?cl=9919#setMatrix">setMatrix</a>, and <a href="bmh_SkCanvas_Reference?cl=9919#resetMatrix">resetMatrix</a>. +<a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> may be changed by <a href="bmh_SkCanvas_Reference?cl=9919#clipRect">clipRect</a>, <a href="bmh_SkCanvas_Reference?cl=9919#clipRRect">clipRRect</a>, <a href="bmh_SkCanvas_Reference?cl=9919#clipPath">clipPath</a>, <a href="bmh_SkCanvas_Reference?cl=9919#clipRegion">clipRegion</a>. + +<a href="bmh_SkCanvas_Reference?cl=9919#SaveLayerRec">SaveLayerRec</a> contains the state used to create the layer offscreen. + +Call <a href="bmh_SkCanvas_Reference?cl=9919#restoreToCount">restoreToCount</a> with result to restore this and subsequent saves. + +### Parameters + +<table> <tr> <td><code><strong>layerRec </strong></code></td> <td> +offscreen state.</td> + </tr> +</table> + +### Return Value + +depth of save state stack. + +### Example + +<div><fiddle-embed name="0da8c199f1d9ec4d1b9c5d1114d6cbd6"><div>The example draws an image, and saves it into a layer with <a href="bmh_SkCanvas_Reference?cl=9919#kInitWithPrevious_SaveLayerFlag">kInitWithPrevious SaveLayerFlag</a>. +Next it punches a hole in the layer and restore with <a href="bmh_undocumented?cl=9919#kPlus">SkBlendMode::kPlus</a>. +Where the layer was cleared, the original image will draw unchanged. +Outside of the circle the mandrill is brightened.</div></fiddle-embed></div> + +--- + +<a name="restore"></a> +## restore + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void restore() +</pre> + +Removes changes to <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>, <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>, and <a href="bmh_undocumented?cl=9919#Draw_Filter">Draw Filter</a> since <a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> state was +last saved. The state is removed from the stack. + +Does nothing if the stack is empty. + +### Example + +<div><fiddle-embed name="e78471212a67f2f4fd39496e17a30d17"></fiddle-embed></div> + +--- + +<a name="getSaveCount"></a> +## getSaveCount + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +int getSaveCount() const +</pre> + +Returns the number of saved states, each containing: <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>, <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>, and <a href="bmh_undocumented?cl=9919#Draw_Filter">Draw Filter</a>. +Equals the number of <a href="bmh_SkCanvas_Reference?cl=9919#save">save</a> calls less the number of <a href="bmh_SkCanvas_Reference?cl=9919#restore">restore</a> calls plus one. +The save count of a new canvas is one. + +### Return Value + +depth of save state stack. + +### Example + +<div><fiddle-embed name="005f2b207e078baac596681924fe591e"> + +#### Example Output + +~~~~ +depth = 1 +depth = 2 +depth = 1 +~~~~ + +</fiddle-embed></div> + +--- + +<a name="restoreToCount"></a> +## restoreToCount + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void restoreToCount(int saveCount) +</pre> + +Restores state to <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>, <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>, and <a href="bmh_undocumented?cl=9919#Draw_Filter">Draw Filter</a> +values when <a href="bmh_SkCanvas_Reference?cl=9919#save">save</a>, <a href="bmh_SkCanvas_Reference?cl=9919#saveLayer">saveLayer</a>, <a href="bmh_SkCanvas_Reference?cl=9919#saveLayerPreserveLCDTextRequests">saveLayerPreserveLCDTextRequests</a>, or <a href="bmh_SkCanvas_Reference?cl=9919#saveLayerAlpha">saveLayerAlpha</a> +returned <a href="bmh_SkCanvas_Reference?cl=9919#saveCount">saveCount</a>. + +Does nothing if <a href="bmh_SkCanvas_Reference?cl=9919#saveCount">saveCount</a> is greater than state stack count. +Restores state to initial values if <a href="bmh_SkCanvas_Reference?cl=9919#saveCount">saveCount</a> is less than or equal to one. + +### Parameters + +<table> <tr> <td><code><strong>saveCount </strong></code></td> <td> +The depth of state stack to restore.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="9ed0d56436e114c7097fd49eed1aea47"> + +#### Example Output + +~~~~ +depth = 1 +depth = 3 +depth = 1 +~~~~ + +</fiddle-embed></div> + +--- + +# <a name="Matrix"></a> Matrix + +<a name="translate"></a> +## translate + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void translate(SkScalar dx, SkScalar dy) +</pre> + +Translate <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a> by <a href="bmh_SkCanvas_Reference?cl=9919#dx">dx</a> along the x-axis and <a href="bmh_SkCanvas_Reference?cl=9919#dy">dy</a> along the y-axis. + +Mathematically, replace <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a> with a translation matrix +pre-multiplied with <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>. + +This has the effect of moving the drawing by (<a href="bmh_SkCanvas_Reference?cl=9919#dx">dx</a>, <a href="bmh_SkCanvas_Reference?cl=9919#dy">dy</a>) before transforming +the result with <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>. + +### Parameters + +<table> <tr> <td><code><strong>dx </strong></code></td> <td> +The distance to translate in x.</td> + </tr> <tr> <td><code><strong>dy </strong></code></td> <td> +The distance to translate in y.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="eb93d5fa66a5f7a10f4f9210494d7222"><div><a href="bmh_SkCanvas_Reference?cl=9919#scale">scale</a> followed by <a href="bmh_SkCanvas_Reference?cl=9919#translate">translate</a> produces different results from <a href="bmh_SkCanvas_Reference?cl=9919#translate">translate</a> followed +by <a href="bmh_SkCanvas_Reference?cl=9919#scale">scale</a>. + +The blue stroke follows translate of (50, 50); a black +fill follows scale of (2, 1/2.f). After restoring the clip, which resets +<a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>, a red frame follows the same scale of (2, 1/2.f); a gray fill +follows translate of (50, 50).</div></fiddle-embed></div> + +--- + +<a name="scale"></a> +## scale + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void scale(SkScalar sx, SkScalar sy) +</pre> + +Scale <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a> by <a href="bmh_SkCanvas_Reference?cl=9919#sx">sx</a> on the x-axis and <a href="bmh_SkCanvas_Reference?cl=9919#sy">sy</a> on the y-axis. + +Mathematically, replace <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a> with a scale matrix +pre-multiplied with <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>. + +This has the effect of scaling the drawing by (<a href="bmh_SkCanvas_Reference?cl=9919#sx">sx</a>, <a href="bmh_SkCanvas_Reference?cl=9919#sy">sy</a>) before transforming +the result with <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>. + +### Parameters + +<table> <tr> <td><code><strong>sx </strong></code></td> <td> +The amount to scale in x.</td> + </tr> <tr> <td><code><strong>sy </strong></code></td> <td> +The amount to scale in y.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="7d0d801ef13c6c6da51e840c22ac15b0"></fiddle-embed></div> + +--- + +<a name="rotate"></a> +## rotate + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void rotate(SkScalar degrees) +</pre> + +Rotate <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a> by <a href="bmh_SkCanvas_Reference?cl=9919#degrees">degrees</a>. Positive <a href="bmh_SkCanvas_Reference?cl=9919#degrees">degrees</a> rotates clockwise. + +Mathematically, replace <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a> with a rotation matrix +pre-multiplied with <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>. + +This has the effect of rotating the drawing by <a href="bmh_SkCanvas_Reference?cl=9919#degrees">degrees</a> before transforming +the result with <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>. + +### Parameters + +<table> <tr> <td><code><strong>degrees </strong></code></td> <td> +The amount to rotate, in <a href="bmh_SkCanvas_Reference?cl=9919#degrees">degrees</a>.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="caafb205771b714948e00dcd58ccaf1f"><div>Draw clock hands at time 5:10. The hour hand and minute hand point up and +are rotated clockwise.</div></fiddle-embed></div> + +--- + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void rotate(SkScalar degrees, SkScalar px, SkScalar py) +</pre> + +Rotate <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a> by <a href="bmh_SkCanvas_Reference?cl=9919#degrees">degrees</a> about a point at (<a href="bmh_SkCanvas_Reference?cl=9919#px">px</a>, <a href="bmh_SkCanvas_Reference?cl=9919#py">py</a>). Positive <a href="bmh_SkCanvas_Reference?cl=9919#degrees">degrees</a> rotates clockwise. + +Mathematically, construct a rotation matrix. Pre-multiply the rotation matrix by +a translation matrix, then replace <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a> with the resulting matrix +pre-multiplied with <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>. + +This has the effect of rotating the drawing about a given point before transforming +the result with <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>. + +### Parameters + +<table> <tr> <td><code><strong>degrees </strong></code></td> <td> +The amount to rotate, in <a href="bmh_SkCanvas_Reference?cl=9919#degrees">degrees</a>.</td> + </tr> <tr> <td><code><strong>px </strong></code></td> <td> +The x coordinate of the point to rotate about.</td> + </tr> <tr> <td><code><strong>py </strong></code></td> <td> +The y coordinate of the point to rotate about.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="bcf5baea1c66a957d5ffd7b54bbbfeff"></fiddle-embed></div> + +--- + +<a name="skew"></a> +## skew + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void skew(SkScalar sx, SkScalar sy) +</pre> + +Skew <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a> by <a href="bmh_SkCanvas_Reference?cl=9919#sx">sx</a> on the x-axis and <a href="bmh_SkCanvas_Reference?cl=9919#sy">sy</a> on the y-axis. A positive value of <a href="bmh_SkCanvas_Reference?cl=9919#sx">sx</a> skews the +drawing right as y increases; a positive value of <a href="bmh_SkCanvas_Reference?cl=9919#sy">sy</a> skews the drawing down as x increases. + +Mathematically, replace <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a> with a skew matrix +pre-multiplied with <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>. + +Preconcat the current matrix with the specified skew. + +### Parameters + +<table> <tr> <td><code><strong>sx </strong></code></td> <td> +The amount to skew in x.</td> + </tr> <tr> <td><code><strong>sy </strong></code></td> <td> +The amount to skew in y.</td> + </tr> +This has the effect of scaling the drawing by (<a href="bmh_SkCanvas_Reference?cl=9919#sx">sx</a>, <a href="bmh_SkCanvas_Reference?cl=9919#sy">sy</a>) before transforming +the result with <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>. + +</table> + +### Example + +<div><fiddle-embed name="2e2acc21d7774df7e0940a30ad2ca99e"><div>Black text mimics an oblique text style by using a negative skew in x that +shifts the geometry to the right as the y values decrease. +Red text uses a positive skew in y to shift the geometry down as the x values +increase. +Blue text combines x and y skew to rotate and scale.</div></fiddle-embed></div> + +--- + +<a name="concat"></a> +## concat + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void concat(const SkMatrix& matrix) +</pre> + +Replace <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a> with <a href="bmh_SkCanvas_Reference?cl=9919#matrix">matrix</a> pre-multiplied with <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>. + +This has the effect of transforming the drawn geometry by <a href="bmh_SkCanvas_Reference?cl=9919#matrix">matrix</a>, before transforming +the result with <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>. + +### Parameters + +<table> <tr> <td><code><strong>matrix </strong></code></td> <td> +Pre-multiply with <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="8f6818b25a92a88638ad99b2dd293f61"></fiddle-embed></div> + +--- + +<a name="setMatrix"></a> +## setMatrix + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void setMatrix(const SkMatrix& matrix) +</pre> + +Replace <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a> with <a href="bmh_SkCanvas_Reference?cl=9919#matrix">matrix</a>. +Unlike <a href="bmh_SkCanvas_Reference?cl=9919#concat">concat</a>, any prior <a href="bmh_SkCanvas_Reference?cl=9919#matrix">matrix</a> state is overwritten. + +### Parameters + +<table> <tr> <td><code><strong>matrix </strong></code></td> <td> +Copied into <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="24b9cf7e6f9a08394e1e07413bd8733a"></fiddle-embed></div> + +--- + +<a name="resetMatrix"></a> +## resetMatrix + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void resetMatrix() +</pre> + +Sets <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a> to the identity matrix. +Any prior matrix state is overwritten. + +### Example + +<div><fiddle-embed name="412afffdf4682baa503a4e2e99201967"></fiddle-embed></div> + +--- + +<a name="getTotalMatrix"></a> +## getTotalMatrix + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +const SkMatrix& getTotalMatrix() const +</pre> + +Returns <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>. +This does not account for translation by <a href="bmh_undocumented?cl=9919#Device">Device</a> or <a href="bmh_undocumented?cl=9919#Surface">Surface</a>. + +### Return Value + +<a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a> on <a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a>. + +### Example + +<div><fiddle-embed name="c0d5fa544759704768f47cac91ae3832"> + +#### Example Output + +~~~~ +isIdentity true +~~~~ + +</fiddle-embed></div> + +--- + +# <a name="Clip"></a> Clip +<a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> is built from a stack of clipping paths. Each <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> in the +stack can be constructed from one or more <a href="bmh_SkPath_Reference?cl=9919#Contour">Path Contour</a> elements. The +<a href="bmh_SkPath_Reference?cl=9919#Contour">Path Contour</a> may be composed of any number of <a href="bmh_SkPath_Reference?cl=9919#Verb">Path Verb</a> segments. Each +<a href="bmh_SkPath_Reference?cl=9919#Contour">Path Contour</a> forms a closed area; <a href="bmh_SkPath_Reference?cl=9919#Fill_Type">Path Fill Type</a> defines the area enclosed +by <a href="bmh_SkPath_Reference?cl=9919#Contour">Path Contour</a>. + +<a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> stack of <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> elements successfully restrict the <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> area. Each +<a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> is transformed by <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>, then intersected with or subtracted from the +prior <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> to form the replacement <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>. Use <a href="bmh_undocumented?cl=9919#kDifference">SkClipOp::kDifference</a> +to subtract <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> from <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>; use <a href="bmh_undocumented?cl=9919#kIntersect">SkClipOp::kIntersect</a> to intersect <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> +with <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>. + +A clipping <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> may be anti-aliased; if <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>, after transformation, is +composed of horizontal and vertical lines, clearing <a href="bmh_SkPaint_Reference?cl=9919#Anti_alias">Anti-alias</a> allows whole pixels +to either be inside or outside the clip. The fastest drawing has a aliased, +rectanglar clip. + +If clipping <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> has <a href="bmh_SkPaint_Reference?cl=9919#Anti_alias">Anti-alias</a> set, clip may partially clip a pixel, requiring +that drawing blend partially with the destination along the edge. A rotated +rectangular anti-aliased clip looks smoother but draws slower. + +<a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> can combine with <a href="bmh_undocumented?cl=9919#Rect">Rect</a> and <a href="bmh_undocumented?cl=9919#Round_Rect">Round Rect</a> primitives; like +<a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>, these are transformed by <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a> before they are combined with <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>. + +<a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> can combine with <a href="bmh_undocumented?cl=9919#Region">Region</a>. <a href="bmh_undocumented?cl=9919#Region">Region</a> is assumed to be in <a href="bmh_undocumented?cl=9919#Device">Device</a> coordinates +and is unaffected by <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>. + +### Example + +<div><fiddle-embed name="d2e60e5171f26ff9ddefae48387f889b"><div>Draw a red circle with an aliased clip and an anti-aliased clip. +Use an image filter to zoom into the pixels drawn. +The edge of the aliased clip fully draws pixels in the red circle. +The edge of the anti-aliased clip partially draws pixels in the red circle.</div></fiddle-embed></div> + +<a name="clipRect"></a> +## clipRect + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void clipRect(const SkRect& rect, SkClipOp op, bool doAntiAlias) +</pre> + +Replace <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> with the intersection or difference of <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> and <a href="bmh_SkCanvas_Reference?cl=9919#rect">rect</a>, +with an aliased or anti-aliased clip edge. <a href="bmh_SkCanvas_Reference?cl=9919#rect">rect</a> is transformed by <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a> +before it is combined with <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>. + +### Parameters + +<table> <tr> <td><code><strong>rect </strong></code></td> <td> +Rectangle to combine with <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>.</td> + </tr> <tr> <td><code><strong>op </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#Op">Clip Op</a> to apply to <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>.</td> + </tr> <tr> <td><code><strong>doAntiAlias </strong></code></td> <td> +true if <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> is to be anti-aliased.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="6a614faa0fbcf19958b5559c19b02d0f"></fiddle-embed></div> + +--- + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void clipRect(const SkRect& rect, SkClipOp op) +</pre> + +Replace <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> with the intersection or difference of <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> and <a href="bmh_SkCanvas_Reference?cl=9919#rect">rect</a>. +Resulting <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> is aliased; pixels are fully contained by the clip. +<a href="bmh_SkCanvas_Reference?cl=9919#rect">rect</a> is transformed by <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a> +before it is combined with <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>. + +### Parameters + +<table> <tr> <td><code><strong>rect </strong></code></td> <td> +Rectangle to combine with <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>.</td> + </tr> <tr> <td><code><strong>op </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#Op">Clip Op</a> to apply to <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="13bbc5fa5597a6cd4d704b419dbc66d9"></fiddle-embed></div> + +--- + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void clipRect(const SkRect& rect, bool doAntiAlias = false) +</pre> + +Replace <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> with the intersection of <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> and <a href="bmh_SkCanvas_Reference?cl=9919#rect">rect</a>. +Resulting <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> is aliased; pixels are fully contained by the clip. +<a href="bmh_SkCanvas_Reference?cl=9919#rect">rect</a> is transformed by <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a> +before it is combined with <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>. + +### Parameters + +<table> <tr> <td><code><strong>rect </strong></code></td> <td> +Rectangle to combine with <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>.</td> + </tr> <tr> <td><code><strong>doAntiAlias </strong></code></td> <td> +true if <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> is to be anti-aliased.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="1d4e0632c97e42692775d834fe10aa99"><div>A circle drawn in pieces looks uniform when drawn aliased. +The same circle pieces blend with pixels more than once when anti-aliased, +visible as a thin pair of lines through the right circle.</div></fiddle-embed></div> + +--- + +<a name="androidFramework_setDeviceClipRestriction"></a> +## androidFramework_setDeviceClipRestriction + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void androidFramework_setDeviceClipRestriction(const SkIRect& rect) +</pre> + +Sets the max clip rectangle, which can be set by <a href="bmh_SkCanvas_Reference?cl=9919#clipRect">clipRect</a>, <a href="bmh_SkCanvas_Reference?cl=9919#clipRRect">clipRRect</a> and +<a href="bmh_SkCanvas_Reference?cl=9919#clipPath">clipPath</a> and intersect the current clip with the specified <a href="bmh_SkCanvas_Reference?cl=9919#androidFramework_setDeviceClipRestriction">rect</a>. +The max clip affects only future ops (it is not retroactive). +The clip restriction is not recorded in pictures. + +### Parameters + +<table> <tr> <td><code><strong>rect </strong></code></td> <td> +The maximum allowed clip in device coordinates.</td> + </tr> + +--- + +</table> + +<a name="clipRRect"></a> +## clipRRect + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void clipRRect(const SkRRect& rrect, SkClipOp op, bool doAntiAlias) +</pre> + +Replace <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> with the intersection or difference of <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> and <a href="bmh_SkCanvas_Reference?cl=9919#rrect">rrect</a>, +with an aliased or anti-aliased clip edge. +<a href="bmh_SkCanvas_Reference?cl=9919#rrect">rrect</a> is transformed by <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a> +before it is combined with <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>. + +### Parameters + +<table> <tr> <td><code><strong>rrect </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#Round_Rect">Round Rect</a> to combine with <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>.</td> + </tr> <tr> <td><code><strong>op </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#Op">Clip Op</a> to apply to <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>.</td> + </tr> <tr> <td><code><strong>doAntiAlias </strong></code></td> <td> +true if <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> is to be antialiased.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="182ef48ab5e04ba3578496fda8d9fa36"></fiddle-embed></div> + +--- + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void clipRRect(const SkRRect& rrect, SkClipOp op) +</pre> + +Replace <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> with the intersection or difference of <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> and <a href="bmh_SkCanvas_Reference?cl=9919#rrect">rrect</a>. +Resulting <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> is aliased; pixels are fully contained by the clip. +<a href="bmh_SkCanvas_Reference?cl=9919#rrect">rrect</a> is transformed by <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a> +before it is combined with <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>. + +### Parameters + +<table> <tr> <td><code><strong>rrect </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#Round_Rect">Round Rect</a> to combine with <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>.</td> + </tr> <tr> <td><code><strong>op </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#Op">Clip Op</a> to apply to <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="ef6ae2eaae6761130ce38065d0364abd"></fiddle-embed></div> + +--- + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void clipRRect(const SkRRect& rrect, bool doAntiAlias = false) +</pre> + +Replace <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> with the intersection of <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> and <a href="bmh_SkCanvas_Reference?cl=9919#rrect">rrect</a>, +with an aliased or anti-aliased clip edge. +<a href="bmh_SkCanvas_Reference?cl=9919#rrect">rrect</a> is transformed by <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a> +before it is combined with <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>. + +### Parameters + +<table> <tr> <td><code><strong>rrect </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#Round_Rect">Round Rect</a> to combine with <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>.</td> + </tr> <tr> <td><code><strong>doAntiAlias </strong></code></td> <td> +true if <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> is to be antialiased.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="f583114580b2176fe3e75b0994476a84"></fiddle-embed></div> + +--- + +<a name="clipPath"></a> +## clipPath + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void clipPath(const SkPath& path, SkClipOp op, bool doAntiAlias) +</pre> + +Replace <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> with the intersection or difference of <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> and <a href="bmh_SkCanvas_Reference?cl=9919#path">path</a>, +with an aliased or anti-aliased clip edge. <a href="bmh_SkPath_Reference?cl=9919#Fill_Type">Path Fill Type</a> determines if <a href="bmh_SkCanvas_Reference?cl=9919#path">path</a> +describes the area inside or outside its contours; and if <a href="bmh_SkPath_Reference?cl=9919#Contour">Path Contour</a> overlaps +itself or another <a href="bmh_SkPath_Reference?cl=9919#Contour">Path Contour</a>, whether the overlaps form part of the area. +<a href="bmh_SkCanvas_Reference?cl=9919#path">path</a> is transformed by <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a> +before it is combined with <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>. + +### Parameters + +<table> <tr> <td><code><strong>path </strong></code></td> <td> +<a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> to combine with <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>.</td> + </tr> <tr> <td><code><strong>op </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#Op">Clip Op</a> to apply to <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>.</td> + </tr> <tr> <td><code><strong>doAntiAlias </strong></code></td> <td> +true if <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> is to be antialiased.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="ee47ae6b813bfaa55e1a7b7c053ed60d"><div>Top figure uses <a href="bmh_SkPath_Reference?cl=9919#kInverseWinding_FillType">SkPath::kInverseWinding FillType</a> and <a href="bmh_undocumented?cl=9919#kDifference">SkClipOp::kDifference</a>; +area outside clip is subtracted from circle. + +Bottom figure uses <a href="bmh_SkPath_Reference?cl=9919#kWinding_FillType">SkPath::kWinding FillType</a> and <a href="bmh_undocumented?cl=9919#kIntersect">SkClipOp::kIntersect</a>; +area inside clip is intersected with circle.</div></fiddle-embed></div> + +--- + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void clipPath(const SkPath& path, SkClipOp op) +</pre> + +Replace <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> with the intersection or difference of <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> and <a href="bmh_SkCanvas_Reference?cl=9919#path">path</a>. +Resulting <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> is aliased; pixels are fully contained by the clip. +<a href="bmh_SkPath_Reference?cl=9919#Fill_Type">Path Fill Type</a> determines if <a href="bmh_SkCanvas_Reference?cl=9919#path">path</a> +describes the area inside or outside its contours; and if <a href="bmh_SkPath_Reference?cl=9919#Contour">Path Contour</a> overlaps +itself or another <a href="bmh_SkPath_Reference?cl=9919#Contour">Path Contour</a>, whether the overlaps form part of the area. +<a href="bmh_SkCanvas_Reference?cl=9919#path">path</a> is transformed by <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a> +before it is combined with <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>. + +### Parameters + +<table> <tr> <td><code><strong>path </strong></code></td> <td> +<a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> to combine with <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>.</td> + </tr> <tr> <td><code><strong>op </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#Op">Clip Op</a> to apply to <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="7856755c1bf8431c286c734b353345ad"><div>Overlapping <a href="bmh_undocumented?cl=9919#Rect">Rects</a> form a clip. When clip's <a href="bmh_SkPath_Reference?cl=9919#Fill_Type">Path Fill Type</a> is set to +<a href="bmh_SkPath_Reference?cl=9919#kWinding_FillType">SkPath::kWinding FillType</a>, the overlap is included. Set to +<a href="bmh_SkPath_Reference?cl=9919#kEvenOdd_FillType">SkPath::kEvenOdd FillType</a>, the overlap is excluded and forms a hole.</div></fiddle-embed></div> + +--- + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void clipPath(const SkPath& path, bool doAntiAlias = false) +</pre> + +Replace <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> with the intersection of <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> and <a href="bmh_SkCanvas_Reference?cl=9919#path">path</a>. +Resulting <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> is aliased; pixels are fully contained by the clip. +<a href="bmh_SkPath_Reference?cl=9919#Fill_Type">Path Fill Type</a> determines if <a href="bmh_SkCanvas_Reference?cl=9919#path">path</a> +describes the area inside or outside its contours; and if <a href="bmh_SkPath_Reference?cl=9919#Contour">Path Contour</a> overlaps +itself or another <a href="bmh_SkPath_Reference?cl=9919#Contour">Path Contour</a>, whether the overlaps form part of the area. +<a href="bmh_SkCanvas_Reference?cl=9919#path">path</a> is transformed by <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a> +before it is combined with <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>. + +### Parameters + +<table> <tr> <td><code><strong>path </strong></code></td> <td> +<a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> to combine with <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>.</td> + </tr> <tr> <td><code><strong>doAntiAlias </strong></code></td> <td> +true if <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> is to be antialiased.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="187a7ae77a8176e417181411988534b6"><div><a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> loops over itself covering its center twice. When clip's <a href="bmh_SkPath_Reference?cl=9919#Fill_Type">Path Fill Type</a> +is set to <a href="bmh_SkPath_Reference?cl=9919#kWinding_FillType">SkPath::kWinding FillType</a>, the overlap is included. Set to +<a href="bmh_SkPath_Reference?cl=9919#kEvenOdd_FillType">SkPath::kEvenOdd FillType</a>, the overlap is excluded and forms a hole.</div></fiddle-embed></div> + +--- + +<a name="setAllowSimplifyClip"></a> +## setAllowSimplifyClip + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void setAllowSimplifyClip(bool allow) +</pre> + +Only used for testing.Set to simplify clip stack using path ops. + +--- + +<a name="clipRegion"></a> +## clipRegion + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void clipRegion(const SkRegion& deviceRgn, SkClipOp op = SkClipOp::kIntersect) +</pre> + +Replace <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> with the intersection or difference of <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> and <a href="bmh_undocumented?cl=9919#Region">Region</a> <a href="bmh_SkCanvas_Reference?cl=9919#deviceRgn">deviceRgn</a>. +Resulting <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> is aliased; pixels are fully contained by the clip. +<a href="bmh_SkCanvas_Reference?cl=9919#deviceRgn">deviceRgn</a> is unaffected by <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>. + +### Parameters + +<table> <tr> <td><code><strong>deviceRgn </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#Region">Region</a> to combine with <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>.</td> + </tr> <tr> <td><code><strong>op </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#Op">Clip Op</a> to apply to <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="7bb57c0e456c5fda2c2cca4abb68b19e"><div>region is unaffected by canvas rotation; rect is affected by canvas rotation. +Both clips are aliased; this is unnoticable on <a href="bmh_undocumented?cl=9919#Region">Region</a> clip because it +aligns to pixel boundaries.</div></fiddle-embed></div> + +--- + +<a name="quickReject"></a> +## quickReject + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +bool quickReject(const SkRect& rect) const +</pre> + +Return true if <a href="bmh_undocumented?cl=9919#Rect">Rect</a> <a href="bmh_SkCanvas_Reference?cl=9919#rect">rect</a>, transformed by <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>, can be quickly determined to be +outside of <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>. May return false even though <a href="bmh_SkCanvas_Reference?cl=9919#rect">rect</a> is outside of <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>. + +Use to check if an area to be drawn is clipped out, to skip subsequent draw calls. + +### Parameters + +<table> <tr> <td><code><strong>rect </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#Rect">Rect</a> to compare with <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>.</td> + </tr> +</table> + +### Return Value + +true if <a href="bmh_SkCanvas_Reference?cl=9919#rect">rect</a>, transformed by <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>, does not intersect <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>. + +### Example + +<div><fiddle-embed name="c15e39862d5f07b0fed44c71e86f7cc9"> + +#### Example Output + +~~~~ +quickReject true +quickReject false +~~~~ + +</fiddle-embed></div> + +--- + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +bool quickReject(const SkPath& path) const +</pre> + +Return true if <a href="bmh_SkCanvas_Reference?cl=9919#path">path</a>, transformed by <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>, can be quickly determined to be +outside of <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>. May return false even though <a href="bmh_SkCanvas_Reference?cl=9919#path">path</a> is outside of <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>. + +Use to check if an area to be drawn is clipped out, to skip subsequent draw calls. + +### Parameters + +<table> <tr> <td><code><strong>path </strong></code></td> <td> +<a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> to compare with <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>.</td> + </tr> +</table> + +### Return Value + +true if <a href="bmh_SkCanvas_Reference?cl=9919#path">path</a>, transformed by <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>, does not intersect <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>. + +### Example + +<div><fiddle-embed name="64723a541c40073157abf2ca67907e15"> + +#### Example Output + +~~~~ +quickReject true +quickReject false +~~~~ + +</fiddle-embed></div> + +--- + +<a name="getLocalClipBounds"></a> +## getLocalClipBounds + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +SkRect getLocalClipBounds() const +</pre> + +Return bounds of <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>, transformed by inverse of <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>. If <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> is empty, +return <a href="bmh_undocumented?cl=9919#MakeEmpty">SkRect::MakeEmpty</a>, where all <a href="bmh_undocumented?cl=9919#Rect">Rect</a> sides equal zero. + +<a href="bmh_undocumented?cl=9919#Rect">Rect</a> returned is outset by one to account for partial pixel coverage if <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> +is anti-aliased. + +### Return Value + +bounds of <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> in local coordinates. + +### Example + +<div><fiddle-embed name="0b36ff64daf88c046b4ae6ed4ee64db9"><div>Initial bounds is device bounds outset by 1 on all sides. +Clipped bounds is <a href="bmh_SkCanvas_Reference?cl=9919#clipPath">clipPath</a> bounds outset by 1 on all sides. +Scaling the canvas by two in x and y scales the local bounds by 1/2 in x and y.</div> + +#### Example Output + +~~~~ +left:-1 top:-1 right:257 bottom:257 +left:29 top:129 right:121 bottom:231 +left:14.5 top:64.5 right:60.5 bottom:115.5 +~~~~ + +</fiddle-embed></div> + +--- + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +bool getLocalClipBounds(SkRect* bounds) const +</pre> + +Return <a href="bmh_SkCanvas_Reference?cl=9919#bounds">bounds</a> of <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>, transformed by inverse of <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>. If <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> is empty, +return false, and set <a href="bmh_SkCanvas_Reference?cl=9919#bounds">bounds</a> to <a href="bmh_undocumented?cl=9919#MakeEmpty">SkRect::MakeEmpty</a>, where all <a href="bmh_undocumented?cl=9919#Rect">Rect</a> sides equal zero. + +<a href="bmh_SkCanvas_Reference?cl=9919#bounds">bounds</a> is outset by one to account for partial pixel coverage if <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> +is anti-aliased. + +### Parameters + +<table> <tr> <td><code><strong>bounds </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#Rect">Rect</a> of <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> in local coordinates.</td> + </tr> +</table> + +### Return Value + +true if <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> <a href="bmh_SkCanvas_Reference?cl=9919#bounds">bounds</a> is not empty. + +### Example + +<div><fiddle-embed name="85496614e90c66b020f8a70db8d06f4a"> + +#### Example Output + +~~~~ +local bounds empty = false +local bounds empty = true +~~~~ + +</fiddle-embed></div> + +--- + +<a name="getDeviceClipBounds"></a> +## getDeviceClipBounds + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +SkIRect getDeviceClipBounds() const +</pre> + +Return <a href="bmh_undocumented?cl=9919#IRect">IRect</a> bounds of <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>, unaffected by <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>. If <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> is empty, +return <a href="bmh_undocumented?cl=9919#MakeEmpty">SkRect::MakeEmpty</a>, where all <a href="bmh_undocumented?cl=9919#Rect">Rect</a> sides equal zero. + +Unlike <a href="bmh_SkCanvas_Reference?cl=9919#getLocalClipBounds">getLocalClipBounds</a>, returned <a href="bmh_undocumented?cl=9919#IRect">IRect</a> is not outset. + +### Return Value + +bounds of <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> in <a href="bmh_undocumented?cl=9919#Device">Device</a> coordinates. + +### Example + +<div><fiddle-embed name="5f4c910afa4a5a61702e5119eab2cac9"><div>Initial bounds is device bounds, not outset. +Clipped bounds is <a href="bmh_SkCanvas_Reference?cl=9919#clipPath">clipPath</a> bounds, not outset. +Scaling the canvas by 1/2 in x and y scales the device bounds by 1/2 in x and y.</div> + +#### Example Output + +~~~~ +left:0 top:0 right:256 bottom:256 +left:30 top:130 right:120 bottom:230 +left:15 top:65 right:60 bottom:115 +~~~~ + +</fiddle-embed></div> + +--- + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +bool getDeviceClipBounds(SkIRect* bounds) const +</pre> + +Return <a href="bmh_undocumented?cl=9919#IRect">IRect</a> <a href="bmh_SkCanvas_Reference?cl=9919#bounds">bounds</a> of <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>, unaffected by <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>. If <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> is empty, +return false, and set <a href="bmh_SkCanvas_Reference?cl=9919#bounds">bounds</a> to <a href="bmh_undocumented?cl=9919#MakeEmpty">SkRect::MakeEmpty</a>, where all <a href="bmh_undocumented?cl=9919#Rect">Rect</a> sides equal zero. + +Unlike <a href="bmh_SkCanvas_Reference?cl=9919#getLocalClipBounds">getLocalClipBounds</a>, <a href="bmh_SkCanvas_Reference?cl=9919#bounds">bounds</a> is not outset. + +### Parameters + +<table> <tr> <td><code><strong>bounds </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#Rect">Rect</a> of <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> in device coordinates.</td> + </tr> +</table> + +### Return Value + +true if <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> <a href="bmh_SkCanvas_Reference?cl=9919#bounds">bounds</a> is not empty. + +### Example + +<div><fiddle-embed name="6abb99f849a1f0e33e1dedc00d1c4f7a"> + +#### Example Output + +~~~~ +device bounds empty = false +device bounds empty = true +~~~~ + +</fiddle-embed></div> + +--- + +<a name="drawColor"></a> +## drawColor + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void drawColor(SkColor color, SkBlendMode mode = SkBlendMode::kSrcOver) +</pre> + +Fill <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> with <a href="bmh_undocumented?cl=9919#Color">Color</a> <a href="bmh_SkCanvas_Reference?cl=9919#color">color</a>. +<a href="bmh_SkCanvas_Reference?cl=9919#mode">mode</a> determines how <a href="bmh_undocumented?cl=9919#ARGB">Color ARGB</a> is combined with destination. + +### Parameters + +<table> <tr> <td><code><strong>color </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#Unpremultiplied">Unpremultiplied</a> <a href="bmh_undocumented?cl=9919#ARGB">Color ARGB</a>.</td> + </tr> <tr> <td><code><strong>mode </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#SkBlendMode">SkBlendMode</a> used to combine source <a href="bmh_SkCanvas_Reference?cl=9919#color">color</a> and destination.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="9cf94fead1e6b17d836c704b4eac269a"></fiddle-embed></div> + +--- + +<a name="clear"></a> +## clear + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void clear(SkColor color) +</pre> + +Fill <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> with <a href="bmh_undocumented?cl=9919#Color">Color</a> <a href="bmh_SkCanvas_Reference?cl=9919#color">color</a> using <a href="bmh_undocumented?cl=9919#kSrc">SkBlendMode::kSrc</a>. +This has the effect of replacing all pixels contained by <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> with <a href="bmh_SkCanvas_Reference?cl=9919#color">color</a>. + +### Parameters + +<table> <tr> <td><code><strong>color </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#Unpremultiplied">Unpremultiplied</a> <a href="bmh_undocumented?cl=9919#ARGB">Color ARGB</a>.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="d97750e04989d42dc879406127b22c0b"></fiddle-embed></div> + +--- + +<a name="discard"></a> +## discard + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void discard() +</pre> + +Make <a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> contents undefined. Subsequent calls that read <a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> pixels, +such as drawing with <a href="bmh_undocumented?cl=9919#SkBlendMode">SkBlendMode</a>, return undefined results. <a href="bmh_SkCanvas_Reference?cl=9919#discard">discard</a> does +not change <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> or <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>. + +<a href="bmh_SkCanvas_Reference?cl=9919#discard">discard</a> may do nothing, depending on the implementation of <a href="bmh_undocumented?cl=9919#Surface">Surface</a> or <a href="bmh_undocumented?cl=9919#Device">Device</a> +that created <a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a>. + +<a href="bmh_SkCanvas_Reference?cl=9919#discard">discard</a> allows optimized performance on subsequent draws by removing +cached data associated with <a href="bmh_undocumented?cl=9919#Surface">Surface</a> or <a href="bmh_undocumented?cl=9919#Device">Device</a>. +It is not necessary to call <a href="bmh_SkCanvas_Reference?cl=9919#discard">discard</a> once done with <a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a>; +any cached data is deleted when owning <a href="bmh_undocumented?cl=9919#Surface">Surface</a> or <a href="bmh_undocumented?cl=9919#Device">Device</a> is deleted. + +--- + +<a name="drawPaint"></a> +## drawPaint + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void drawPaint(const SkPaint& paint) +</pre> + +Fill <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> with <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a>. <a href="bmh_SkCanvas_Reference?cl=9919#drawPaint">drawPaint</a> is affected by <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> components +<a href="bmh_undocumented?cl=9919#Rasterizer">Rasterizer</a>, <a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a>, <a href="bmh_undocumented?cl=9919#Shader">Shader</a>, <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>, <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a>, and <a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a>; but not by +<a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a>. + +### Parameters + +<table> <tr> <td><code><strong>paint </strong></code></td> <td> +Used to fill the canvas.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="1cd076b9b1a7c976cdca72b93c4f42dd"></fiddle-embed></div> + +--- + +## <a name="SkCanvas::PointMode"></a> Enum SkCanvas::PointMode + +<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0"> +enum <a href="bmh_SkCanvas_Reference?cl=9919#PointMode">PointMode</a> { +<a href="bmh_SkCanvas_Reference?cl=9919#kPoints_PointMode">kPoints PointMode</a>, +<a href="bmh_SkCanvas_Reference?cl=9919#kLines_PointMode">kLines PointMode</a>, +<a href="bmh_SkCanvas_Reference?cl=9919#kPolygon_PointMode">kPolygon PointMode</a> +};</pre> + +Selects if an array of points are drawn as discrete points, as lines, or as +an open polygon. + +### Constants + +<table> + <tr> + <td><a name="SkCanvas::kPoints_PointMode"></a> <code><strong>SkCanvas::kPoints_PointMode </strong></code></td><td>0</td><td>Draw each point separately.</td> + </tr> + <tr> + <td><a name="SkCanvas::kLines_PointMode"></a> <code><strong>SkCanvas::kLines_PointMode </strong></code></td><td>1</td><td>Draw each pair of points as a line segment.</td> + </tr> + <tr> + <td><a name="SkCanvas::kPolygon_PointMode"></a> <code><strong>SkCanvas::kPolygon_PointMode </strong></code></td><td>2</td><td>Draw the array of points as a open polygon.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="292b4b2008961b6f612434d3121fc4ce"><div>The upper left corner shows three squares when drawn as points. +The upper right corner shows one line; when drawn as lines, two points are required per line. +The lower right corner shows two lines; when draw as polygon, no miter is drawn at the corner. +The lower left corner shows two lines with a miter when path contains polygon.</div></fiddle-embed></div> + + + +<a name="drawPoints"></a> +## drawPoints + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void drawPoints(PointMode mode, size_t count, const SkPoint pts[], + const SkPaint& paint) +</pre> + +Draw <a href="bmh_SkCanvas_Reference?cl=9919#pts">pts</a> using <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>, <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a> and <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a>. +<a href="bmh_SkCanvas_Reference?cl=9919#count">count</a> is the number of points; if <a href="bmh_SkCanvas_Reference?cl=9919#count">count</a> is less than one, <a href="bmh_SkCanvas_Reference?cl=9919#drawPoints">drawPoints</a> has no effect. +<a href="bmh_SkCanvas_Reference?cl=9919#mode">mode</a> may be one of: <a href="bmh_SkCanvas_Reference?cl=9919#kPoints_PointMode">kPoints PointMode</a>, <a href="bmh_SkCanvas_Reference?cl=9919#kLines_PointMode">kLines PointMode</a>, or <a href="bmh_SkCanvas_Reference?cl=9919#kPolygon_PointMode">kPolygon PointMode</a>. + +If <a href="bmh_SkCanvas_Reference?cl=9919#mode">mode</a> is <a href="bmh_SkCanvas_Reference?cl=9919#kPoints_PointMode">kPoints PointMode</a>, the shape of point drawn depends on <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a> <a href="bmh_SkPaint_Reference?cl=9919#Stroke_Cap">Paint Stroke Cap</a>. +If <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a> is set to <a href="bmh_SkPaint_Reference?cl=9919#kRound_Cap">SkPaint::kRound Cap</a>, each point draws a circle of diameter <a href="bmh_SkPaint_Reference?cl=9919#Stroke_Width">Paint Stroke Width</a>. +If <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a> is set to <a href="bmh_SkPaint_Reference?cl=9919#kSquare_Cap">SkPaint::kSquare Cap</a> or <a href="bmh_SkPaint_Reference?cl=9919#kButt_Cap">SkPaint::kButt Cap</a>, +each point draws a square of width and height <a href="bmh_SkPaint_Reference?cl=9919#Stroke_Width">Paint Stroke Width</a>. + +If <a href="bmh_SkCanvas_Reference?cl=9919#mode">mode</a> is <a href="bmh_SkCanvas_Reference?cl=9919#kLines_PointMode">kLines PointMode</a>, each pair of points draws a line segment. +One line is drawn for every two points; each point is used once. If <a href="bmh_SkCanvas_Reference?cl=9919#count">count</a> is odd, +the final point is ignored. + +If <a href="bmh_SkCanvas_Reference?cl=9919#mode">mode</a> is <a href="bmh_SkCanvas_Reference?cl=9919#kPolygon_PointMode">kPolygon PointMode</a>, each adjacent pair of points draws a line segment. +<a href="bmh_SkCanvas_Reference?cl=9919#count">count</a> minus one lines are drawn; the first and last point are used once. + +Each line segment respects <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a> <a href="bmh_SkPaint_Reference?cl=9919#Stroke_Cap">Paint Stroke Cap</a> and <a href="bmh_SkPaint_Reference?cl=9919#Stroke_Width">Paint Stroke Width</a>. +<a href="bmh_SkPaint_Reference?cl=9919#Style">Paint Style</a> is ignored, as if were set to <a href="bmh_SkPaint_Reference?cl=9919#kStroke_Style">SkPaint::kStroke Style</a>. + +<a href="bmh_SkCanvas_Reference?cl=9919#drawPoints">drawPoints</a> always draws each element one at a time; <a href="bmh_SkCanvas_Reference?cl=9919#drawPoints">drawPoints</a> is not affected by +<a href="bmh_SkPaint_Reference?cl=9919#Stroke_Join">Paint Stroke Join</a>, and unlike <a href="bmh_SkCanvas_Reference?cl=9919#drawPath">drawPath</a>, does not create a mask from all points and lines +before drawing. + +### Parameters + +<table> <tr> <td><code><strong>mode </strong></code></td> <td> +Whether <a href="bmh_SkCanvas_Reference?cl=9919#pts">pts</a> draws points or lines.</td> + </tr> <tr> <td><code><strong>count </strong></code></td> <td> +The number of points in the array.</td> + </tr> <tr> <td><code><strong>pts </strong></code></td> <td> +Array of points to draw.</td> + </tr> <tr> <td><code><strong>paint </strong></code></td> <td> +Stroke, blend, color, and so on, used to draw.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="f1dfbb0d5a17c8beab19af29f2aaba8c"><div> + +<table> <tr> + <td>The first column draws points.</td> </tr> <tr> + <td>The second column draws points as lines.</td> </tr> <tr> + <td>The third column draws points as a polygon.</td> </tr> <tr> + <td>The fourth column draws points as a polygonal path.</td> </tr> <tr> + <td>The first row uses a round cap and round join.</td> </tr> <tr> + <td>The second row uses a square cap and a miter join.</td> </tr> <tr> + <td>The third row uses a butt cap and a bevel join.</td> </tr> +</table> + +The transparent color makes multiple line draws visible; +the path is drawn all at once.</div></fiddle-embed></div> + +--- + +<a name="drawPoint"></a> +## drawPoint + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void drawPoint(SkScalar x, SkScalar y, const SkPaint& paint) +</pre> + +Draw point at (<a href="bmh_SkCanvas_Reference?cl=9919#x">x</a>, <a href="bmh_SkCanvas_Reference?cl=9919#y">y</a>) using <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>, <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a> and <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a>. + +The shape of point drawn depends on <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a> <a href="bmh_SkPaint_Reference?cl=9919#Stroke_Cap">Paint Stroke Cap</a>. +If <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a> is set to <a href="bmh_SkPaint_Reference?cl=9919#kRound_Cap">SkPaint::kRound Cap</a>, draw a circle of diameter <a href="bmh_SkPaint_Reference?cl=9919#Stroke_Width">Paint Stroke Width</a>. +If <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a> is set to <a href="bmh_SkPaint_Reference?cl=9919#kSquare_Cap">SkPaint::kSquare Cap</a> or <a href="bmh_SkPaint_Reference?cl=9919#kButt_Cap">SkPaint::kButt Cap</a>, +draw a square of width and height <a href="bmh_SkPaint_Reference?cl=9919#Stroke_Width">Paint Stroke Width</a>. +<a href="bmh_SkPaint_Reference?cl=9919#Style">Paint Style</a> is ignored, as if were set to <a href="bmh_SkPaint_Reference?cl=9919#kStroke_Style">SkPaint::kStroke Style</a>. + +### Parameters + +<table> <tr> <td><code><strong>x </strong></code></td> <td> +Left edge of circle or square.</td> + </tr> <tr> <td><code><strong>y </strong></code></td> <td> +Top edge of circle or square.</td> + </tr> <tr> <td><code><strong>paint </strong></code></td> <td> +Stroke, blend, color, and so on, used to draw.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="3476b553e7b547b604a3f6969f02d933"></fiddle-embed></div> + +--- + +<a name="drawLine"></a> +## drawLine + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void drawLine(SkScalar x0, SkScalar y0, SkScalar x1, SkScalar y1, + const SkPaint& paint) +</pre> + +Draw line segment from (<a href="bmh_SkCanvas_Reference?cl=9919#x0">x0</a>, <a href="bmh_SkCanvas_Reference?cl=9919#y0">y0</a>) to (<a href="bmh_SkCanvas_Reference?cl=9919#x1">x1</a>, <a href="bmh_SkCanvas_Reference?cl=9919#y1">y1</a>) using <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>, <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>, and <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a>. +In <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a>: <a href="bmh_SkPaint_Reference?cl=9919#Stroke_Width">Paint Stroke Width</a> describes the line thickness; <a href="bmh_SkPaint_Reference?cl=9919#Stroke_Cap">Paint Stroke Cap</a> draws the end rounded or square; +<a href="bmh_SkPaint_Reference?cl=9919#Style">Paint Style</a> is ignored, as if were set to <a href="bmh_SkPaint_Reference?cl=9919#kStroke_Style">SkPaint::kStroke Style</a>. + +### Parameters + +<table> <tr> <td><code><strong>x0 </strong></code></td> <td> +Start of line segment on x-axis.</td> + </tr> <tr> <td><code><strong>y0 </strong></code></td> <td> +Start of line segment on y-axis.</td> + </tr> <tr> <td><code><strong>x1 </strong></code></td> <td> +End of line segment on x-axis.</td> + </tr> <tr> <td><code><strong>y1 </strong></code></td> <td> +End of line segment on y-axis.</td> + </tr> <tr> <td><code><strong>paint </strong></code></td> <td> +Stroke, blend, color, and so on, used to draw.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="d10ee4a265f278d02afe11ad889b293b"></fiddle-embed></div> + +--- + +<a name="drawRect"></a> +## drawRect + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void drawRect(const SkRect& rect, const SkPaint& paint) +</pre> + +Draw <a href="bmh_undocumented?cl=9919#Rect">Rect</a> <a href="bmh_SkCanvas_Reference?cl=9919#rect">rect</a> using <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>, <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>, and <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a>. +In <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a>: <a href="bmh_SkPaint_Reference?cl=9919#Style">Paint Style</a> determines if rectangle is stroked or filled; +if stroked, <a href="bmh_SkPaint_Reference?cl=9919#Stroke_Width">Paint Stroke Width</a> describes the line thickness, and +<a href="bmh_SkPaint_Reference?cl=9919#Stroke_Join">Paint Stroke Join</a> draws the corners rounded or square. + +### Parameters + +<table> <tr> <td><code><strong>rect </strong></code></td> <td> +The rectangle to be drawn.</td> + </tr> <tr> <td><code><strong>paint </strong></code></td> <td> +Stroke or fill, blend, color, and so on, used to draw.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="871b0da9b4a23de11ae7a772ce14aed3"></fiddle-embed></div> + +--- + +<a name="drawIRect"></a> +## drawIRect + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void drawIRect(const SkIRect& rect, const SkPaint& paint) +</pre> + +Draw <a href="bmh_undocumented?cl=9919#IRect">IRect</a> <a href="bmh_SkCanvas_Reference?cl=9919#rect">rect</a> using <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>, <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>, and <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a>. +In <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a>: <a href="bmh_SkPaint_Reference?cl=9919#Style">Paint Style</a> determines if rectangle is stroked or filled; +if stroked, <a href="bmh_SkPaint_Reference?cl=9919#Stroke_Width">Paint Stroke Width</a> describes the line thickness, and +<a href="bmh_SkPaint_Reference?cl=9919#Stroke_Join">Paint Stroke Join</a> draws the corners rounded or square. + +### Parameters + +<table> <tr> <td><code><strong>rect </strong></code></td> <td> +The rectangle to be drawn.</td> + </tr> <tr> <td><code><strong>paint </strong></code></td> <td> +Stroke or fill, blend, color, and so on, used to draw.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="d3d8ca584134560750b1efa4a4c6e138"></fiddle-embed></div> + +--- + +<a name="drawRegion"></a> +## drawRegion + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void drawRegion(const SkRegion& region, const SkPaint& paint) +</pre> + +Draw <a href="bmh_undocumented?cl=9919#Region">Region</a> <a href="bmh_SkCanvas_Reference?cl=9919#region">region</a> using <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>, <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>, and <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a>. +In <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a>: <a href="bmh_SkPaint_Reference?cl=9919#Style">Paint Style</a> determines if rectangle is stroked or filled; +if stroked, <a href="bmh_SkPaint_Reference?cl=9919#Stroke_Width">Paint Stroke Width</a> describes the line thickness, and +<a href="bmh_SkPaint_Reference?cl=9919#Stroke_Join">Paint Stroke Join</a> draws the corners rounded or square. + +### Parameters + +<table> <tr> <td><code><strong>region </strong></code></td> <td> +The <a href="bmh_SkCanvas_Reference?cl=9919#region">region</a> to be drawn.</td> + </tr> <tr> <td><code><strong>paint </strong></code></td> <td> +<a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> stroke or fill, blend, color, and so on, used to draw.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="80309e0deca0f8add616cec7bec634ca"></fiddle-embed></div> + +--- + +<a name="drawOval"></a> +## drawOval + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void drawOval(const SkRect& oval, const SkPaint& paint) +</pre> + +Draw <a href="bmh_undocumented?cl=9919#Oval">Oval</a> <a href="bmh_SkCanvas_Reference?cl=9919#oval">oval</a> using <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>, <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>, and <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a>. +In <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a>: <a href="bmh_SkPaint_Reference?cl=9919#Style">Paint Style</a> determines if <a href="bmh_undocumented?cl=9919#Oval">Oval</a> is stroked or filled; +if stroked, <a href="bmh_SkPaint_Reference?cl=9919#Stroke_Width">Paint Stroke Width</a> describes the line thickness. + +### Parameters + +<table> <tr> <td><code><strong>oval </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#Rect">Rect</a> bounds of <a href="bmh_undocumented?cl=9919#Oval">Oval</a>.</td> + </tr> <tr> <td><code><strong>paint </strong></code></td> <td> +<a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> stroke or fill, blend, color, and so on, used to draw.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="8b6b86f8a022811cd29a9c6ab771df12"></fiddle-embed></div> + +--- + +<a name="drawRRect"></a> +## drawRRect + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void drawRRect(const SkRRect& rrect, const SkPaint& paint) +</pre> + +Draw <a href="bmh_undocumented?cl=9919#Round_Rect">Round Rect</a> <a href="bmh_SkCanvas_Reference?cl=9919#rrect">rrect</a> using <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>, <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>, and <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a>. +In <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a>: <a href="bmh_SkPaint_Reference?cl=9919#Style">Paint Style</a> determines if <a href="bmh_SkCanvas_Reference?cl=9919#rrect">rrect</a> is stroked or filled; +if stroked, <a href="bmh_SkPaint_Reference?cl=9919#Stroke_Width">Paint Stroke Width</a> describes the line thickness. + +<a href="bmh_SkCanvas_Reference?cl=9919#rrect">rrect</a> may represent a rectangle, circle, oval, uniformly rounded rectangle, or may have +any combination of positive non-square radii for the four corners. + +### Parameters + +<table> <tr> <td><code><strong>rrect </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#Round_Rect">Round Rect</a> with up to eight corner radii to draw.</td> + </tr> <tr> <td><code><strong>paint </strong></code></td> <td> +<a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> stroke or fill, blend, color, and so on, used to draw.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="369cdbfb2a200d5bb8ae40f7cc1025c3"></fiddle-embed></div> + +--- + +<a name="drawDRRect"></a> +## drawDRRect + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void drawDRRect(const SkRRect& outer, const SkRRect& inner, const SkPaint& paint) +</pre> + +Draw <a href="bmh_undocumented?cl=9919#Round_Rect">Round Rect</a> <a href="bmh_SkCanvas_Reference?cl=9919#outer">outer</a> and <a href="bmh_SkCanvas_Reference?cl=9919#inner">inner</a> +using <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>, <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>, and <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a>. +<a href="bmh_SkCanvas_Reference?cl=9919#outer">outer</a> must contain <a href="bmh_SkCanvas_Reference?cl=9919#inner">inner</a> or the drawing is undefined. +In <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a>: <a href="bmh_SkPaint_Reference?cl=9919#Style">Paint Style</a> determines if rrect is stroked or filled; +if stroked, <a href="bmh_SkPaint_Reference?cl=9919#Stroke_Width">Paint Stroke Width</a> describes the line thickness. +If stroked and <a href="bmh_undocumented?cl=9919#Round_Rect">Round Rect</a> corner has zero length radii, <a href="bmh_SkPaint_Reference?cl=9919#Stroke_Join">Paint Stroke Join</a> can draw +corners rounded or square. + +<a href="bmh_undocumented?cl=9919#GPU_backed">GPU-backed</a> platforms take advantage of <a href="bmh_SkCanvas_Reference?cl=9919#drawDRRect">drawDRRect</a> since both <a href="bmh_SkCanvas_Reference?cl=9919#outer">outer</a> and <a href="bmh_SkCanvas_Reference?cl=9919#inner">inner</a> are +concave and <a href="bmh_SkCanvas_Reference?cl=9919#outer">outer</a> contains <a href="bmh_SkCanvas_Reference?cl=9919#inner">inner</a>. These platforms may not be able to draw +<a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> built with identical data as fast. + +### Parameters + +<table> <tr> <td><code><strong>outer </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#Round_Rect">Round Rect</a> <a href="bmh_SkCanvas_Reference?cl=9919#outer">outer</a> bounds to draw.</td> + </tr> <tr> <td><code><strong>inner </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#Round_Rect">Round Rect</a> <a href="bmh_SkCanvas_Reference?cl=9919#inner">inner</a> bounds to draw.</td> + </tr> <tr> <td><code><strong>paint </strong></code></td> <td> +<a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> stroke or fill, blend, color, and so on, used to draw.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="02e33141f13da2f19aef7feb7117b541"></fiddle-embed></div> + +### Example + +<div><fiddle-embed name="30823cb4edf884d330285ea161664931"><div>Outer <a href="bmh_undocumented?cl=9919#Rect">Rect</a> has no corner radii, but stroke join is rounded. +Inner <a href="bmh_undocumented?cl=9919#Round_Rect">Round Rect</a> has corner radii; outset stroke increases radii of corners. +Stroke join does not affect <a href="bmh_SkCanvas_Reference?cl=9919#inner">inner</a> <a href="bmh_undocumented?cl=9919#Round_Rect">Round Rect</a> since it has no sharp corners.</div></fiddle-embed></div> + +--- + +<a name="drawCircle"></a> +## drawCircle + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void drawCircle(SkScalar cx, SkScalar cy, SkScalar radius, const SkPaint& paint) +</pre> + +Draw <a href="bmh_undocumented?cl=9919#Circle">Circle</a> at (<a href="bmh_SkCanvas_Reference?cl=9919#cx">cx</a>, <a href="bmh_SkCanvas_Reference?cl=9919#cy">cy</a>) with <a href="bmh_SkCanvas_Reference?cl=9919#radius">radius</a> using <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>, <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>, and <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a>. +If <a href="bmh_SkCanvas_Reference?cl=9919#radius">radius</a> is zero or less, nothing is drawn. +In <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a>: <a href="bmh_SkPaint_Reference?cl=9919#Style">Paint Style</a> determines if <a href="bmh_undocumented?cl=9919#Circle">Circle</a> is stroked or filled; +if stroked, <a href="bmh_SkPaint_Reference?cl=9919#Stroke_Width">Paint Stroke Width</a> describes the line thickness. + +### Parameters + +<table> <tr> <td><code><strong>cx </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#Circle">Circle</a> center on the x-axis.</td> + </tr> <tr> <td><code><strong>cy </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#Circle">Circle</a> center on the y-axis.</td> + </tr> <tr> <td><code><strong>radius </strong></code></td> <td> +Half the diameter of <a href="bmh_undocumented?cl=9919#Circle">Circle</a>.</td> + </tr> <tr> <td><code><strong>paint </strong></code></td> <td> +<a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> stroke or fill, blend, color, and so on, used to draw.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="841229e25ca9dfb68bd0dc4dfff356eb"></fiddle-embed></div> + +--- + +<a name="drawArc"></a> +## drawArc + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void drawArc(const SkRect& oval, SkScalar startAngle, SkScalar sweepAngle, + bool useCenter, const SkPaint& paint) +</pre> + +Draw <a href="bmh_undocumented?cl=9919#Arc">Arc</a> using <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>, <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>, and <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a>. +<a href="bmh_undocumented?cl=9919#Arc">Arc</a> is part of <a href="bmh_undocumented?cl=9919#Oval">Oval</a> bounded by <a href="bmh_SkCanvas_Reference?cl=9919#oval">oval</a>, sweeping from <a href="bmh_SkCanvas_Reference?cl=9919#startAngle">startAngle</a> to <a href="bmh_SkCanvas_Reference?cl=9919#startAngle">startAngle</a> plus +<a href="bmh_SkCanvas_Reference?cl=9919#sweepAngle">sweepAngle</a>. <a href="bmh_SkCanvas_Reference?cl=9919#startAngle">startAngle</a> and <a href="bmh_SkCanvas_Reference?cl=9919#sweepAngle">sweepAngle</a> are in degrees. +<a href="bmh_SkCanvas_Reference?cl=9919#startAngle">startAngle</a> of zero places start point at the right middle edge of <a href="bmh_SkCanvas_Reference?cl=9919#oval">oval</a>. +A positive <a href="bmh_SkCanvas_Reference?cl=9919#sweepAngle">sweepAngle</a> places <a href="bmh_undocumented?cl=9919#Arc">Arc</a> end point clockwise from start point; +a negative <a href="bmh_SkCanvas_Reference?cl=9919#sweepAngle">sweepAngle</a> places <a href="bmh_undocumented?cl=9919#Arc">Arc</a> end point counterclockwise from start point. +<a href="bmh_SkCanvas_Reference?cl=9919#sweepAngle">sweepAngle</a> may exceed 360 degrees, a full circle. +If <a href="bmh_SkCanvas_Reference?cl=9919#useCenter">useCenter</a> is true, draw a wedge that includes lines from <a href="bmh_SkCanvas_Reference?cl=9919#oval">oval</a> +center to <a href="bmh_undocumented?cl=9919#Arc">Arc</a> end points. If <a href="bmh_SkCanvas_Reference?cl=9919#useCenter">useCenter</a> is false, draw <a href="bmh_undocumented?cl=9919#Arc">Arc</a> between end points. + +If <a href="bmh_undocumented?cl=9919#Rect">Rect</a> <a href="bmh_SkCanvas_Reference?cl=9919#oval">oval</a> is empty or <a href="bmh_SkCanvas_Reference?cl=9919#sweepAngle">sweepAngle</a> is zero, nothing is drawn. + +### Parameters + +<table> <tr> <td><code><strong>oval </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#Rect">Rect</a> bounds of <a href="bmh_undocumented?cl=9919#Oval">Oval</a> containing <a href="bmh_undocumented?cl=9919#Arc">Arc</a> to draw.</td> + </tr> <tr> <td><code><strong>startAngle </strong></code></td> <td> +Angle in degrees where <a href="bmh_undocumented?cl=9919#Arc">Arc</a> begins.</td> + </tr> <tr> <td><code><strong>sweepAngle </strong></code></td> <td> +Sweep angle in degrees; positive is clockwise.</td> + </tr> <tr> <td><code><strong>useCenter </strong></code></td> <td> +If true include the center of the <a href="bmh_SkCanvas_Reference?cl=9919#oval">oval</a>.</td> + </tr> <tr> <td><code><strong>paint </strong></code></td> <td> +<a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> stroke or fill, blend, color, and so on, used to draw.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="11f0fbe7b30d776913c2e7c92c02ff57"></fiddle-embed></div> + +### Example + +<div><fiddle-embed name="e91dbe45974489b8962c815017b7914f"></fiddle-embed></div> + +--- + +<a name="drawRoundRect"></a> +## drawRoundRect + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void drawRoundRect(const SkRect& rect, SkScalar rx, SkScalar ry, + const SkPaint& paint) +</pre> + +Draw <a href="bmh_undocumented?cl=9919#Round_Rect">Round Rect</a> bounded by <a href="bmh_undocumented?cl=9919#Rect">Rect</a> <a href="bmh_SkCanvas_Reference?cl=9919#rect">rect</a>, with corner radii (<a href="bmh_SkCanvas_Reference?cl=9919#rx">rx</a>, <a href="bmh_SkCanvas_Reference?cl=9919#ry">ry</a>) using <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>, <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>, +and <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a>. +In <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a>: <a href="bmh_SkPaint_Reference?cl=9919#Style">Paint Style</a> determines if <a href="bmh_undocumented?cl=9919#Round_Rect">Round Rect</a> is stroked or filled; +if stroked, <a href="bmh_SkPaint_Reference?cl=9919#Stroke_Width">Paint Stroke Width</a> describes the line thickness. +If <a href="bmh_SkCanvas_Reference?cl=9919#rx">rx</a> or <a href="bmh_SkCanvas_Reference?cl=9919#ry">ry</a> are less than zero, they are treated as if they are zero. +If <a href="bmh_SkCanvas_Reference?cl=9919#rx">rx</a> plus <a href="bmh_SkCanvas_Reference?cl=9919#ry">ry</a> exceeds <a href="bmh_SkCanvas_Reference?cl=9919#rect">rect</a> width or <a href="bmh_SkCanvas_Reference?cl=9919#rect">rect</a> height, radii are scaled down to fit. +If <a href="bmh_SkCanvas_Reference?cl=9919#rx">rx</a> and <a href="bmh_SkCanvas_Reference?cl=9919#ry">ry</a> are zero, <a href="bmh_undocumented?cl=9919#Round_Rect">Round Rect</a> is drawn as <a href="bmh_undocumented?cl=9919#Rect">Rect</a> and if stroked is affected by <a href="bmh_SkPaint_Reference?cl=9919#Stroke_Join">Paint Stroke Join</a>. + +### Parameters + +<table> <tr> <td><code><strong>rect </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#Rect">Rect</a> bounds of <a href="bmh_undocumented?cl=9919#Round_Rect">Round Rect</a> to draw.</td> + </tr> <tr> <td><code><strong>rx </strong></code></td> <td> +Semiaxis length in x of oval describing rounded corners.</td> + </tr> <tr> <td><code><strong>ry </strong></code></td> <td> +Semiaxis length in y of oval describing rounded corners.</td> + </tr> <tr> <td><code><strong>paint </strong></code></td> <td> +Stroke, blend, color, and so on, used to draw.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="199fe818c09026c114e165bff166a39f"><div>Top row has a zero radius a generates a rectangle. +Second row radii sum to less than sides. +Third row radii sum equals sides. +Fourth row radii sum exceeds sides; radii are scaled to fit.</div></fiddle-embed></div> + +--- + +<a name="drawPath"></a> +## drawPath + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void drawPath(const SkPath& path, const SkPaint& paint) +</pre> + +Draw <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> <a href="bmh_SkCanvas_Reference?cl=9919#path">path</a> using <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>, <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>, and <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a>. +<a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> contains an array of <a href="bmh_SkPath_Reference?cl=9919#Contour">Path Contour</a>, each of which may be open or closed. + +In <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a>: <a href="bmh_SkPaint_Reference?cl=9919#Style">Paint Style</a> determines if <a href="bmh_undocumented?cl=9919#Round_Rect">Round Rect</a> is stroked or filled: +if filled, <a href="bmh_SkPath_Reference?cl=9919#Fill_Type">Path Fill Type</a> determines whether <a href="bmh_SkPath_Reference?cl=9919#Contour">Path Contour</a> describes inside or outside of fill; +if stroked, <a href="bmh_SkPaint_Reference?cl=9919#Stroke_Width">Paint Stroke Width</a> describes the line thickness, <a href="bmh_SkPaint_Reference?cl=9919#Stroke_Cap">Paint Stroke Cap</a> describes line ends, +and <a href="bmh_SkPaint_Reference?cl=9919#Stroke_Join">Paint Stroke Join</a> describes how corners are drawn. + +### Parameters + +<table> <tr> <td><code><strong>path </strong></code></td> <td> +<a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> to draw.</td> + </tr> <tr> <td><code><strong>paint </strong></code></td> <td> +Stroke, blend, color, and so on, used to draw.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="d489555a878cb2ab08eea5faf516f54e"><div>Top rows draw stroked <a href="bmh_SkCanvas_Reference?cl=9919#path">path</a> with combinations of joins and caps. The open contour +is affected by caps; the closed contour is affected by joins. +Bottom row draws fill the same for open and closed contour. +First bottom column shows winding fills overlap. +Second bottom column shows even odd fills exclude overlap. +Third bottom column shows inverse winding fills area outside both contours.</div></fiddle-embed></div> + +--- + +# <a name="Draw_Image"></a> Draw Image +<a href="bmh_SkCanvas_Reference?cl=9919#drawImage">drawImage</a>, <a href="bmh_SkCanvas_Reference?cl=9919#drawImageRect">drawImageRect</a>, and <a href="bmh_SkCanvas_Reference?cl=9919#drawImageNine">drawImageNine</a> can be called with a bare pointer or a smart pointer as a convenience. +The pairs of calls are otherwise identical. + +<a name="drawImage"></a> +## drawImage + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void drawImage(const SkImage* image, SkScalar left, SkScalar top, + const SkPaint* paint = NULL) +</pre> + +Draw <a href="bmh_undocumented?cl=9919#Image">Image</a> <a href="bmh_SkCanvas_Reference?cl=9919#image">image</a>, with its top-left corner at (<a href="bmh_SkCanvas_Reference?cl=9919#left">left</a>, <a href="bmh_SkCanvas_Reference?cl=9919#top">top</a>), +using <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>, <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>, and optional <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a>. + +If <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a> is supplied, apply <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>, <a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a>, <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a>, <a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a>, and <a href="bmh_undocumented?cl=9919#Draw_Looper">Draw Looper</a>. +If <a href="bmh_SkCanvas_Reference?cl=9919#image">image</a> is <a href="bmh_undocumented?cl=9919#SkColorType">kAlpha 8 SkColorType</a>, apply <a href="bmh_undocumented?cl=9919#Shader">Shader</a>. +if <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a> contains <a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a>, generate mask from <a href="bmh_SkCanvas_Reference?cl=9919#image">image</a> bounds. If generated mask extends +beyond <a href="bmh_SkCanvas_Reference?cl=9919#image">image</a> bounds, replicate <a href="bmh_SkCanvas_Reference?cl=9919#image">image</a> edge colors, just as <a href="bmh_undocumented?cl=9919#Shader">Shader</a> made from +<a href="bmh_undocumented?cl=9919#makeShader">SkImage::makeShader</a> with <a href="bmh_undocumented?cl=9919#kClamp_TileMode">SkShader::kClamp TileMode</a> set replicates the <a href="bmh_SkCanvas_Reference?cl=9919#image">image</a>'s edge +color when it samples outside of its bounds. + +### Parameters + +<table> <tr> <td><code><strong>image </strong></code></td> <td> +Uncompressed rectangular map of pixels.</td> + </tr> <tr> <td><code><strong>left </strong></code></td> <td> +Left side of <a href="bmh_SkCanvas_Reference?cl=9919#image">image</a>.</td> + </tr> <tr> <td><code><strong>top </strong></code></td> <td> +Top side of <a href="bmh_SkCanvas_Reference?cl=9919#image">image</a>.</td> + </tr> <tr> <td><code><strong>paint </strong></code></td> <td> +<a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> containing <a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a>, <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>, <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a>, and so on; or nullptr.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="185746dc0faa6f1df30c4afe098646ff"></fiddle-embed></div> + +--- + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void drawImage(const sk_sp<SkImage>& image, SkScalar left, SkScalar top, + const SkPaint* paint = NULL) +</pre> + +Draw <a href="bmh_undocumented?cl=9919#Image">Image</a> <a href="bmh_SkCanvas_Reference?cl=9919#image">image</a>, with its top-left corner at (<a href="bmh_SkCanvas_Reference?cl=9919#left">left</a>, <a href="bmh_SkCanvas_Reference?cl=9919#top">top</a>), +using <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>, <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>, and optional <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a>. + +If <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a> is supplied, apply <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>, <a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a>, <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a>, <a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a>, and <a href="bmh_undocumented?cl=9919#Draw_Looper">Draw Looper</a>. +If <a href="bmh_SkCanvas_Reference?cl=9919#image">image</a> is <a href="bmh_undocumented?cl=9919#SkColorType">kAlpha 8 SkColorType</a>, apply <a href="bmh_undocumented?cl=9919#Shader">Shader</a>. +if <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a> contains <a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a>, generate mask from <a href="bmh_SkCanvas_Reference?cl=9919#image">image</a> bounds. If generated mask extends +beyond <a href="bmh_SkCanvas_Reference?cl=9919#image">image</a> bounds, replicate <a href="bmh_SkCanvas_Reference?cl=9919#image">image</a> edge colors, just as <a href="bmh_undocumented?cl=9919#Shader">Shader</a> made from +<a href="bmh_undocumented?cl=9919#makeShader">SkImage::makeShader</a> with <a href="bmh_undocumented?cl=9919#kClamp_TileMode">SkShader::kClamp TileMode</a> set replicates the <a href="bmh_SkCanvas_Reference?cl=9919#image">image</a>'s edge +color when it samples outside of its bounds. + +### Parameters + +<table> <tr> <td><code><strong>image </strong></code></td> <td> +Uncompressed rectangular map of pixels.</td> + </tr> <tr> <td><code><strong>left </strong></code></td> <td> +Left side of <a href="bmh_SkCanvas_Reference?cl=9919#image">image</a>.</td> + </tr> <tr> <td><code><strong>top </strong></code></td> <td> +Top side of <a href="bmh_SkCanvas_Reference?cl=9919#image">image</a>.</td> + </tr> <tr> <td><code><strong>paint </strong></code></td> <td> +<a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> containing <a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a>, <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>, <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a>, and so on; or nullptr.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="a4e877e891b1be5faa2b7fd07f673a10"></fiddle-embed></div> + +--- + +## <a name="SkCanvas::SrcRectConstraint"></a> Enum SkCanvas::SrcRectConstraint + +<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0"> +enum <a href="bmh_SkCanvas_Reference?cl=9919#SrcRectConstraint">SrcRectConstraint</a> { +<a href="bmh_SkCanvas_Reference?cl=9919#kStrict_SrcRectConstraint">kStrict SrcRectConstraint</a>, +<a href="bmh_SkCanvas_Reference?cl=9919#kFast_SrcRectConstraint">kFast SrcRectConstraint</a>, +};</pre> + +<a href="bmh_SkCanvas_Reference?cl=9919#SrcRectConstraint">SrcRectConstraint</a> controls the behavior at the edge of the <a href="bmh_undocumented?cl=9919#Rect">Rect</a> src, provided to <a href="bmh_SkCanvas_Reference?cl=9919#drawImageRect">drawImageRect</a>, +trading off speed for precision. + +<a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a> in <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> may sample multiple pixels in the image. +<a href="bmh_undocumented?cl=9919#Rect">Rect</a> src restricts the bounds of pixels that may be read. <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a> may slow +down if it cannot read outside the bounds, when sampling near the edge of <a href="bmh_undocumented?cl=9919#Rect">Rect</a> src. +<a href="bmh_SkCanvas_Reference?cl=9919#SrcRectConstraint">SrcRectConstraint</a> specifies whether an <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a> is allowed to read pixels +outside <a href="bmh_undocumented?cl=9919#Rect">Rect</a> src. + +### Constants + +<table> + <tr> + <td><a name="SkCanvas::kStrict_SrcRectConstraint"></a> <code><strong>SkCanvas::kStrict_SrcRectConstraint </strong></code></td><td>Requires Image_Filter to respect Rect src,</td><td>sampling only inside of its bounds, possibly with a performance penalty.</td> + </tr> + <tr> + <td><a name="SkCanvas::kFast_SrcRectConstraint"></a> <code><strong>SkCanvas::kFast_SrcRectConstraint </strong></code></td><td>Permits Image_Filter to sample outside of Rect src</td><td>by half the width of <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a>, permitting it to run faster but with +error at the image edges.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="5df49d1f4da37275a1f10ef7f1a749f0"><div>redBorder contains a black and white checkerboard bordered by red. +redBorder is drawn scaled by 16 on the left. +The middle and right bitmaps are filtered checkboards. +Drawing the checkerboard with <a href="bmh_SkCanvas_Reference?cl=9919#kStrict_SrcRectConstraint">kStrict SrcRectConstraint</a> shows only a blur of black and white. +Drawing the checkerboard with <a href="bmh_SkCanvas_Reference?cl=9919#kFast_SrcRectConstraint">kFast SrcRectConstraint</a> allows red to bleed in the corners.</div></fiddle-embed></div> + + + +<a name="drawImageRect"></a> +## drawImageRect + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void drawImageRect(const SkImage* image, const SkRect& src, const SkRect& dst, + const SkPaint* paint, + SrcRectConstraint constraint = kStrict_SrcRectConstraint) +</pre> + +Draw <a href="bmh_undocumented?cl=9919#Rect">Rect</a> <a href="bmh_SkCanvas_Reference?cl=9919#src">src</a> of <a href="bmh_undocumented?cl=9919#Image">Image</a> <a href="bmh_SkCanvas_Reference?cl=9919#image">image</a>, scaled and translated to fill <a href="bmh_undocumented?cl=9919#Rect">Rect</a> <a href="bmh_SkCanvas_Reference?cl=9919#dst">dst</a>. +Additionally transform draw using <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>, <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>, and optional <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a>. +If <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a> is supplied, apply <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>, <a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a>, <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a>, <a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a>, and <a href="bmh_undocumented?cl=9919#Draw_Looper">Draw Looper</a>. +If <a href="bmh_SkCanvas_Reference?cl=9919#image">image</a> is <a href="bmh_undocumented?cl=9919#SkColorType">kAlpha 8 SkColorType</a>, apply <a href="bmh_undocumented?cl=9919#Shader">Shader</a>. +if <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a> contains <a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a>, generate mask from <a href="bmh_SkCanvas_Reference?cl=9919#image">image</a> bounds. If generated mask extends +beyond <a href="bmh_SkCanvas_Reference?cl=9919#image">image</a> bounds, replicate <a href="bmh_SkCanvas_Reference?cl=9919#image">image</a> edge colors, just as <a href="bmh_undocumented?cl=9919#Shader">Shader</a> made from +<a href="bmh_undocumented?cl=9919#makeShader">SkImage::makeShader</a> with <a href="bmh_undocumented?cl=9919#kClamp_TileMode">SkShader::kClamp TileMode</a> set replicates the <a href="bmh_SkCanvas_Reference?cl=9919#image">image</a>'s edge +color when it samples outside of its bounds. +<a href="bmh_SkCanvas_Reference?cl=9919#constraint">constraint</a> set to <a href="bmh_SkCanvas_Reference?cl=9919#kStrict_SrcRectConstraint">kStrict SrcRectConstraint</a> limits <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> <a href="bmh_undocumented?cl=9919#Filter_Quality">Filter Quality</a> to sample within <a href="bmh_SkCanvas_Reference?cl=9919#src">src</a>; +set to <a href="bmh_SkCanvas_Reference?cl=9919#kFast_SrcRectConstraint">kFast SrcRectConstraint</a> allows sampling outside to improve performance. + +### Parameters + +<table> <tr> <td><code><strong>image </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#Image">Image</a> containing pixels, dimensions, and format.</td> + </tr> <tr> <td><code><strong>src </strong></code></td> <td> +Source <a href="bmh_undocumented?cl=9919#Rect">Rect</a> of <a href="bmh_SkCanvas_Reference?cl=9919#image">image</a> to draw from.</td> + </tr> <tr> <td><code><strong>dst </strong></code></td> <td> +Destination <a href="bmh_undocumented?cl=9919#Rect">Rect</a> of <a href="bmh_SkCanvas_Reference?cl=9919#image">image</a> to draw to.</td> + </tr> <tr> <td><code><strong>paint </strong></code></td> <td> +<a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> containing <a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a>, <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>, <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a>, and so on; or nullptr.</td> + </tr> <tr> <td><code><strong>constraint </strong></code></td> <td> +Filter strictly within <a href="bmh_SkCanvas_Reference?cl=9919#src">src</a> or draw faster.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="2b01c707ef8b5ce3023b7a1d55fce059"><div>The left bitmap draws with <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> default <a href="bmh_undocumented?cl=9919#SkFilterQuality">kNone SkFilterQuality</a>, and stays within +its bounds; there's no bleeding with <a href="bmh_SkCanvas_Reference?cl=9919#kFast_SrcRectConstraint">kFast SrcRectConstraint</a>. +the middle and right bitmaps draw with <a href="bmh_undocumented?cl=9919#SkFilterQuality">kLow SkFilterQuality</a>; with +<a href="bmh_SkCanvas_Reference?cl=9919#kStrict_SrcRectConstraint">kStrict SrcRectConstraint</a>, the filter remains within the checkerboard, and +with <a href="bmh_SkCanvas_Reference?cl=9919#kFast_SrcRectConstraint">kFast SrcRectConstraint</a> red bleeds on the edges.</div></fiddle-embed></div> + +--- + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void drawImageRect(const SkImage* image, const SkIRect& isrc, const SkRect& dst, + const SkPaint* paint, + SrcRectConstraint constraint = kStrict_SrcRectConstraint) +</pre> + +Draw <a href="bmh_undocumented?cl=9919#IRect">IRect</a> <a href="bmh_SkCanvas_Reference?cl=9919#isrc">isrc</a> of <a href="bmh_undocumented?cl=9919#Image">Image</a> <a href="bmh_SkCanvas_Reference?cl=9919#image">image</a>, scaled and translated to fill <a href="bmh_undocumented?cl=9919#Rect">Rect</a> <a href="bmh_SkCanvas_Reference?cl=9919#dst">dst</a>. +Note that <a href="bmh_SkCanvas_Reference?cl=9919#isrc">isrc</a> is on integer pixel boundaries; <a href="bmh_SkCanvas_Reference?cl=9919#dst">dst</a> may include fractional boundaries. +Additionally transform draw using <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>, <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>, and optional <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a>. +If <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a> is supplied, apply <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>, <a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a>, <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a>, <a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a>, and <a href="bmh_undocumented?cl=9919#Draw_Looper">Draw Looper</a>. +If <a href="bmh_SkCanvas_Reference?cl=9919#image">image</a> is <a href="bmh_undocumented?cl=9919#SkColorType">kAlpha 8 SkColorType</a>, apply <a href="bmh_undocumented?cl=9919#Shader">Shader</a>. +if <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a> contains <a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a>, generate mask from <a href="bmh_SkCanvas_Reference?cl=9919#image">image</a> bounds. If generated mask extends +beyond <a href="bmh_SkCanvas_Reference?cl=9919#image">image</a> bounds, replicate <a href="bmh_SkCanvas_Reference?cl=9919#image">image</a> edge colors, just as <a href="bmh_undocumented?cl=9919#Shader">Shader</a> made from +<a href="bmh_undocumented?cl=9919#makeShader">SkImage::makeShader</a> with <a href="bmh_undocumented?cl=9919#kClamp_TileMode">SkShader::kClamp TileMode</a> set replicates the <a href="bmh_SkCanvas_Reference?cl=9919#image">image</a>'s edge +color when it samples outside of its bounds. +<a href="bmh_SkCanvas_Reference?cl=9919#constraint">constraint</a> set to <a href="bmh_SkCanvas_Reference?cl=9919#kStrict_SrcRectConstraint">kStrict SrcRectConstraint</a> limits <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> <a href="bmh_undocumented?cl=9919#Filter_Quality">Filter Quality</a> to sample within src; +set to <a href="bmh_SkCanvas_Reference?cl=9919#kFast_SrcRectConstraint">kFast SrcRectConstraint</a> allows sampling outside to improve performance. + +### Parameters + +<table> <tr> <td><code><strong>image </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#Image">Image</a> containing pixels, dimensions, and format.</td> + </tr> <tr> <td><code><strong>isrc </strong></code></td> <td> +Source <a href="bmh_undocumented?cl=9919#IRect">IRect</a> of <a href="bmh_SkCanvas_Reference?cl=9919#image">image</a> to draw from.</td> + </tr> <tr> <td><code><strong>dst </strong></code></td> <td> +Destination <a href="bmh_undocumented?cl=9919#Rect">Rect</a> of <a href="bmh_SkCanvas_Reference?cl=9919#image">image</a> to draw to.</td> + </tr> <tr> <td><code><strong>paint </strong></code></td> <td> +<a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> containing <a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a>, <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>, <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a>, and so on; or nullptr.</td> + </tr> <tr> <td><code><strong>constraint </strong></code></td> <td> +Filter strictly within src or draw faster.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="b63b8f9f587b8d918973dc065ce4a593"></fiddle-embed></div> + +--- + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void drawImageRect(const SkImage* image, const SkRect& dst, const SkPaint* paint, + SrcRectConstraint constraint = kStrict_SrcRectConstraint) +</pre> + +Draw <a href="bmh_undocumented?cl=9919#Image">Image</a> <a href="bmh_SkCanvas_Reference?cl=9919#image">image</a>, scaled and translated to fill <a href="bmh_undocumented?cl=9919#Rect">Rect</a> <a href="bmh_SkCanvas_Reference?cl=9919#dst">dst</a>, +using <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>, <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>, and optional <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a>. +If <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a> is supplied, apply <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>, <a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a>, <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a>, <a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a>, and <a href="bmh_undocumented?cl=9919#Draw_Looper">Draw Looper</a>. +If <a href="bmh_SkCanvas_Reference?cl=9919#image">image</a> is <a href="bmh_undocumented?cl=9919#SkColorType">kAlpha 8 SkColorType</a>, apply <a href="bmh_undocumented?cl=9919#Shader">Shader</a>. +if <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a> contains <a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a>, generate mask from <a href="bmh_SkCanvas_Reference?cl=9919#image">image</a> bounds. If generated mask extends +beyond <a href="bmh_SkCanvas_Reference?cl=9919#image">image</a> bounds, replicate <a href="bmh_SkCanvas_Reference?cl=9919#image">image</a> edge colors, just as <a href="bmh_undocumented?cl=9919#Shader">Shader</a> made from +<a href="bmh_undocumented?cl=9919#makeShader">SkImage::makeShader</a> with <a href="bmh_undocumented?cl=9919#kClamp_TileMode">SkShader::kClamp TileMode</a> set replicates the <a href="bmh_SkCanvas_Reference?cl=9919#image">image</a>'s edge +color when it samples outside of its bounds. +Use constaint to choose <a href="bmh_SkCanvas_Reference?cl=9919#kStrict_SrcRectConstraint">kStrict SrcRectConstraint</a> or <a href="bmh_SkCanvas_Reference?cl=9919#kFast_SrcRectConstraint">kFast SrcRectConstraint</a>. + +### Parameters + +<table> <tr> <td><code><strong>image </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#Image">Image</a> containing pixels, dimensions, and format.</td> + </tr> <tr> <td><code><strong>dst </strong></code></td> <td> +Destination <a href="bmh_undocumented?cl=9919#Rect">Rect</a> of <a href="bmh_SkCanvas_Reference?cl=9919#image">image</a> to draw to.</td> + </tr> <tr> <td><code><strong>paint </strong></code></td> <td> +<a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> containing <a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a>, <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>, <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a>, and so on; or nullptr.</td> + </tr> <tr> <td><code><strong>constraint </strong></code></td> <td> +Filter strictly within src or draw faster.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="3cf8fb639fef99993cafc064d550c739"></fiddle-embed></div> + +--- + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void drawImageRect(const sk_sp<SkImage>& image, const SkRect& src, + const SkRect& dst, const SkPaint* paint, + SrcRectConstraint constraint = kStrict_SrcRectConstraint) +</pre> + +Draw <a href="bmh_undocumented?cl=9919#Rect">Rect</a> <a href="bmh_SkCanvas_Reference?cl=9919#src">src</a> of <a href="bmh_undocumented?cl=9919#Image">Image</a> <a href="bmh_SkCanvas_Reference?cl=9919#image">image</a>, scaled and translated to fill <a href="bmh_undocumented?cl=9919#Rect">Rect</a> <a href="bmh_SkCanvas_Reference?cl=9919#dst">dst</a>. +Additionally transform draw using <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>, <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>, and optional <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a>. +If <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a> is supplied, apply <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>, <a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a>, <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a>, <a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a>, and <a href="bmh_undocumented?cl=9919#Draw_Looper">Draw Looper</a>. +If <a href="bmh_SkCanvas_Reference?cl=9919#image">image</a> is <a href="bmh_undocumented?cl=9919#SkColorType">kAlpha 8 SkColorType</a>, apply <a href="bmh_undocumented?cl=9919#Shader">Shader</a>. +if <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a> contains <a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a>, generate mask from <a href="bmh_SkCanvas_Reference?cl=9919#image">image</a> bounds. If generated mask extends +beyond <a href="bmh_SkCanvas_Reference?cl=9919#image">image</a> bounds, replicate <a href="bmh_SkCanvas_Reference?cl=9919#image">image</a> edge colors, just as <a href="bmh_undocumented?cl=9919#Shader">Shader</a> made from +<a href="bmh_undocumented?cl=9919#makeShader">SkImage::makeShader</a> with <a href="bmh_undocumented?cl=9919#kClamp_TileMode">SkShader::kClamp TileMode</a> set replicates the <a href="bmh_SkCanvas_Reference?cl=9919#image">image</a>'s edge +color when it samples outside of its bounds. +<a href="bmh_SkCanvas_Reference?cl=9919#constraint">constraint</a> set to <a href="bmh_SkCanvas_Reference?cl=9919#kStrict_SrcRectConstraint">kStrict SrcRectConstraint</a> limits <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> <a href="bmh_undocumented?cl=9919#Filter_Quality">Filter Quality</a> to sample within <a href="bmh_SkCanvas_Reference?cl=9919#src">src</a>; +set to <a href="bmh_SkCanvas_Reference?cl=9919#kFast_SrcRectConstraint">kFast SrcRectConstraint</a> allows sampling outside to improve performance. + +### Parameters + +<table> <tr> <td><code><strong>image </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#Image">Image</a> containing pixels, dimensions, and format.</td> + </tr> <tr> <td><code><strong>src </strong></code></td> <td> +Source <a href="bmh_undocumented?cl=9919#Rect">Rect</a> of <a href="bmh_SkCanvas_Reference?cl=9919#image">image</a> to draw from.</td> + </tr> <tr> <td><code><strong>dst </strong></code></td> <td> +Destination <a href="bmh_undocumented?cl=9919#Rect">Rect</a> of <a href="bmh_SkCanvas_Reference?cl=9919#image">image</a> to draw to.</td> + </tr> <tr> <td><code><strong>paint </strong></code></td> <td> +<a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> containing <a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a>, <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>, <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a>, and so on; or nullptr.</td> + </tr> <tr> <td><code><strong>constraint </strong></code></td> <td> +Filter strictly within <a href="bmh_SkCanvas_Reference?cl=9919#src">src</a> or draw faster.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="589999454db90c573f7facfb007253a7"><div><a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> scales and translates; transformation from <a href="bmh_SkCanvas_Reference?cl=9919#src">src</a> to <a href="bmh_SkCanvas_Reference?cl=9919#dst">dst</a> also scales. +The two matrices are concatenated to create the final transformation.</div></fiddle-embed></div> + +--- + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void drawImageRect(const sk_sp<SkImage>& image, const SkIRect& isrc, + const SkRect& dst, const SkPaint* paint, + SrcRectConstraint constraint = kStrict_SrcRectConstraint) +</pre> + +Draw <a href="bmh_undocumented?cl=9919#IRect">IRect</a> <a href="bmh_SkCanvas_Reference?cl=9919#isrc">isrc</a> of <a href="bmh_undocumented?cl=9919#Image">Image</a> <a href="bmh_SkCanvas_Reference?cl=9919#image">image</a>, scaled and translated to fill <a href="bmh_undocumented?cl=9919#Rect">Rect</a> <a href="bmh_SkCanvas_Reference?cl=9919#dst">dst</a>. +Note that <a href="bmh_SkCanvas_Reference?cl=9919#isrc">isrc</a> is on integer pixel boundaries; <a href="bmh_SkCanvas_Reference?cl=9919#dst">dst</a> may include fractional boundaries. +Additionally transform draw using <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>, <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>, and optional <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a>. +If <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a> is supplied, apply <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>, <a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a>, <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a>, <a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a>, and <a href="bmh_undocumented?cl=9919#Draw_Looper">Draw Looper</a>. +If <a href="bmh_SkCanvas_Reference?cl=9919#image">image</a> is <a href="bmh_undocumented?cl=9919#SkColorType">kAlpha 8 SkColorType</a>, apply <a href="bmh_undocumented?cl=9919#Shader">Shader</a>. +if <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a> contains <a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a>, generate mask from <a href="bmh_SkCanvas_Reference?cl=9919#image">image</a> bounds. If generated mask extends +beyond <a href="bmh_SkCanvas_Reference?cl=9919#image">image</a> bounds, replicate <a href="bmh_SkCanvas_Reference?cl=9919#image">image</a> edge colors, just as <a href="bmh_undocumented?cl=9919#Shader">Shader</a> made from +<a href="bmh_undocumented?cl=9919#MakeBitmapShader">SkShader::MakeBitmapShader</a> with <a href="bmh_undocumented?cl=9919#kClamp_TileMode">SkShader::kClamp TileMode</a> set replicates the <a href="bmh_SkCanvas_Reference?cl=9919#image">image</a>'s edge +color when it samples outside of its bounds. +cons set to <a href="bmh_SkCanvas_Reference?cl=9919#kStrict_SrcRectConstraint">kStrict SrcRectConstraint</a> limits <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> <a href="bmh_undocumented?cl=9919#Filter_Quality">Filter Quality</a> to sample within src; +set to <a href="bmh_SkCanvas_Reference?cl=9919#kFast_SrcRectConstraint">kFast SrcRectConstraint</a> allows sampling outside to improve performance. + +### Parameters + +<table> <tr> <td><code><strong>image </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#Image">Image</a> containing pixels, dimensions, and format.</td> + </tr> <tr> <td><code><strong>isrc </strong></code></td> <td> +Source <a href="bmh_undocumented?cl=9919#IRect">IRect</a> of <a href="bmh_SkCanvas_Reference?cl=9919#image">image</a> to draw from.</td> + </tr> <tr> <td><code><strong>dst </strong></code></td> <td> +Destination <a href="bmh_undocumented?cl=9919#Rect">Rect</a> of <a href="bmh_SkCanvas_Reference?cl=9919#image">image</a> to draw to.</td> + </tr> <tr> <td><code><strong>paint </strong></code></td> <td> +<a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> containing <a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a>, <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>, <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a>, and so on; or nullptr.</td> + </tr> <tr> <td><code><strong>constraint </strong></code></td> <td> +Filter strictly within src or draw faster.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="249fadde5d0d0fc515e9f53f188af48b"></fiddle-embed></div> + +--- + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void drawImageRect(const sk_sp<SkImage>& image, const SkRect& dst, + const SkPaint* paint, + SrcRectConstraint constraint = kStrict_SrcRectConstraint) +</pre> + +Draw <a href="bmh_undocumented?cl=9919#Image">Image</a> <a href="bmh_SkCanvas_Reference?cl=9919#image">image</a>, scaled and translated to fill <a href="bmh_undocumented?cl=9919#Rect">Rect</a> <a href="bmh_SkCanvas_Reference?cl=9919#dst">dst</a>, +using <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>, <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>, and optional <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a>. +If <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a> is supplied, apply <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>, <a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a>, <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a>, <a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a>, and <a href="bmh_undocumented?cl=9919#Draw_Looper">Draw Looper</a>. +If <a href="bmh_SkCanvas_Reference?cl=9919#image">image</a> is <a href="bmh_undocumented?cl=9919#SkColorType">kAlpha 8 SkColorType</a>, apply <a href="bmh_undocumented?cl=9919#Shader">Shader</a>. +if <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a> contains <a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a>, generate mask from <a href="bmh_SkCanvas_Reference?cl=9919#image">image</a> bounds. If generated mask extends +beyond <a href="bmh_SkCanvas_Reference?cl=9919#image">image</a> bounds, replicate <a href="bmh_SkCanvas_Reference?cl=9919#image">image</a> edge colors, just as <a href="bmh_undocumented?cl=9919#Shader">Shader</a> made from +<a href="bmh_undocumented?cl=9919#makeShader">SkImage::makeShader</a> with <a href="bmh_undocumented?cl=9919#kClamp_TileMode">SkShader::kClamp TileMode</a> set replicates the <a href="bmh_SkCanvas_Reference?cl=9919#image">image</a>'s edge +color when it samples outside of its bounds. +<a href="bmh_SkCanvas_Reference?cl=9919#constraint">constraint</a> set to <a href="bmh_SkCanvas_Reference?cl=9919#kStrict_SrcRectConstraint">kStrict SrcRectConstraint</a> limits <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> <a href="bmh_undocumented?cl=9919#Filter_Quality">Filter Quality</a> to sample within src; +set to <a href="bmh_SkCanvas_Reference?cl=9919#kFast_SrcRectConstraint">kFast SrcRectConstraint</a> allows sampling outside to improve performance. + +### Parameters + +<table> <tr> <td><code><strong>image </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#Image">Image</a> containing pixels, dimensions, and format.</td> + </tr> <tr> <td><code><strong>dst </strong></code></td> <td> +Destination <a href="bmh_undocumented?cl=9919#Rect">Rect</a> of <a href="bmh_SkCanvas_Reference?cl=9919#image">image</a> to draw to.</td> + </tr> <tr> <td><code><strong>paint </strong></code></td> <td> +<a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> containing <a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a>, <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>, <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a>, and so on; or nullptr.</td> + </tr> <tr> <td><code><strong>constraint </strong></code></td> <td> +Filter strictly within src or draw faster.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="37a85bd2247487c7af584e42c1cabe4a"></fiddle-embed></div> + +--- + +<a name="drawImageNine"></a> +## drawImageNine + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void drawImageNine(const SkImage* image, const SkIRect& center, + const SkRect& dst, const SkPaint* paint = nullptr) +</pre> + +Draw <a href="bmh_undocumented?cl=9919#Image">Image</a> <a href="bmh_SkCanvas_Reference?cl=9919#image">image</a> stretched differentially to fit into <a href="bmh_undocumented?cl=9919#Rect">Rect</a> <a href="bmh_SkCanvas_Reference?cl=9919#dst">dst</a>. +<a href="bmh_undocumented?cl=9919#IRect">IRect</a> <a href="bmh_SkCanvas_Reference?cl=9919#center">center</a> divides the <a href="bmh_SkCanvas_Reference?cl=9919#image">image</a> into nine sections: four sides, four corners, and the <a href="bmh_SkCanvas_Reference?cl=9919#center">center</a>. +corners are unscaled or scaled down proportionately if their sides are larger than <a href="bmh_SkCanvas_Reference?cl=9919#dst">dst</a>; +<a href="bmh_SkCanvas_Reference?cl=9919#center">center</a> and four sides are scaled to fit remaining space, if any. +Additionally transform draw using <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>, <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>, and optional <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a>. +If <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a> is supplied, apply <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>, <a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a>, <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a>, <a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a>, and <a href="bmh_undocumented?cl=9919#Draw_Looper">Draw Looper</a>. +If <a href="bmh_SkCanvas_Reference?cl=9919#image">image</a> is <a href="bmh_undocumented?cl=9919#SkColorType">kAlpha 8 SkColorType</a>, apply <a href="bmh_undocumented?cl=9919#Shader">Shader</a>. +if <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a> contains <a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a>, generate mask from <a href="bmh_SkCanvas_Reference?cl=9919#image">image</a> bounds. If generated mask extends +beyond <a href="bmh_SkCanvas_Reference?cl=9919#image">image</a> bounds, replicate <a href="bmh_SkCanvas_Reference?cl=9919#image">image</a> edge colors, just as <a href="bmh_undocumented?cl=9919#Shader">Shader</a> made from +<a href="bmh_undocumented?cl=9919#MakeBitmapShader">SkShader::MakeBitmapShader</a> with <a href="bmh_undocumented?cl=9919#kClamp_TileMode">SkShader::kClamp TileMode</a> set replicates the <a href="bmh_SkCanvas_Reference?cl=9919#image">image</a>'s edge +color when it samples outside of its bounds. + +### Parameters + +<table> <tr> <td><code><strong>image </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#Image">Image</a> containing pixels, dimensions, and format.</td> + </tr> <tr> <td><code><strong>center </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#IRect">IRect</a> edge of <a href="bmh_SkCanvas_Reference?cl=9919#image">image</a> corners and sides.</td> + </tr> <tr> <td><code><strong>dst </strong></code></td> <td> +Destination <a href="bmh_undocumented?cl=9919#Rect">Rect</a> of <a href="bmh_SkCanvas_Reference?cl=9919#image">image</a> to draw to.</td> + </tr> <tr> <td><code><strong>paint </strong></code></td> <td> +<a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> containing <a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a>, <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>, <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a>, and so on; or nullptr.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="47f78f3f70ccd9e6c40ee3203a5c71dd"><div>The leftmost <a href="bmh_SkCanvas_Reference?cl=9919#image">image</a> is smaller than <a href="bmh_SkCanvas_Reference?cl=9919#center">center</a>; only corners are drawn, all scaled to fit. +The second <a href="bmh_SkCanvas_Reference?cl=9919#image">image</a> equals the size of <a href="bmh_SkCanvas_Reference?cl=9919#center">center</a>; only corners are drawn, unscaled. +The remaining images are larger than <a href="bmh_SkCanvas_Reference?cl=9919#center">center</a>. All corners draw unscaled. The sides +and <a href="bmh_SkCanvas_Reference?cl=9919#center">center</a> are scaled if needed to take up the remaining space.</div></fiddle-embed></div> + +--- + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void drawImageNine(const sk_sp<SkImage>& image, const SkIRect& center, + const SkRect& dst, const SkPaint* paint = nullptr) +</pre> + +Draw <a href="bmh_undocumented?cl=9919#Image">Image</a> <a href="bmh_SkCanvas_Reference?cl=9919#image">image</a> stretched differentially to fit into <a href="bmh_undocumented?cl=9919#Rect">Rect</a> <a href="bmh_SkCanvas_Reference?cl=9919#dst">dst</a>. +<a href="bmh_undocumented?cl=9919#IRect">IRect</a> <a href="bmh_SkCanvas_Reference?cl=9919#center">center</a> divides the <a href="bmh_SkCanvas_Reference?cl=9919#image">image</a> into nine sections: four sides, four corners, and the <a href="bmh_SkCanvas_Reference?cl=9919#center">center</a>. +corners are unscaled or scaled down proportionately if their sides are larger than <a href="bmh_SkCanvas_Reference?cl=9919#dst">dst</a>; +<a href="bmh_SkCanvas_Reference?cl=9919#center">center</a> and four sides are scaled to fit remaining space, if any. +Additionally transform draw using <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>, <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>, and optional <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a>. +If <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a> is supplied, apply <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>, <a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a>, <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a>, <a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a>, and <a href="bmh_undocumented?cl=9919#Draw_Looper">Draw Looper</a>. +If <a href="bmh_SkCanvas_Reference?cl=9919#image">image</a> is <a href="bmh_undocumented?cl=9919#SkColorType">kAlpha 8 SkColorType</a>, apply <a href="bmh_undocumented?cl=9919#Shader">Shader</a>. +if <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a> contains <a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a>, generate mask from <a href="bmh_SkCanvas_Reference?cl=9919#image">image</a> bounds. If generated mask extends +beyond <a href="bmh_SkCanvas_Reference?cl=9919#image">image</a> bounds, replicate <a href="bmh_SkCanvas_Reference?cl=9919#image">image</a> edge colors, just as <a href="bmh_undocumented?cl=9919#Shader">Shader</a> made from +<a href="bmh_undocumented?cl=9919#MakeBitmapShader">SkShader::MakeBitmapShader</a> with <a href="bmh_undocumented?cl=9919#kClamp_TileMode">SkShader::kClamp TileMode</a> set replicates the <a href="bmh_SkCanvas_Reference?cl=9919#image">image</a>'s edge +color when it samples outside of its bounds. + +### Parameters + +<table> <tr> <td><code><strong>image </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#Image">Image</a> containing pixels, dimensions, and format.</td> + </tr> <tr> <td><code><strong>center </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#IRect">IRect</a> edge of <a href="bmh_SkCanvas_Reference?cl=9919#image">image</a> corners and sides.</td> + </tr> <tr> <td><code><strong>dst </strong></code></td> <td> +Destination <a href="bmh_undocumented?cl=9919#Rect">Rect</a> of <a href="bmh_SkCanvas_Reference?cl=9919#image">image</a> to draw to.</td> + </tr> <tr> <td><code><strong>paint </strong></code></td> <td> +<a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> containing <a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a>, <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>, <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a>, and so on; or nullptr.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="e941e553970569d1ffb03a42f7fcd6d9"><div>The two leftmost images has four corners and sides to the left and right of <a href="bmh_SkCanvas_Reference?cl=9919#center">center</a>. +The leftmost <a href="bmh_SkCanvas_Reference?cl=9919#image">image</a> scales the width of corners proportionately to fit. +The third and fourth <a href="bmh_SkCanvas_Reference?cl=9919#image">image</a> corners are unscaled; the sides and <a href="bmh_SkCanvas_Reference?cl=9919#center">center</a> are scaled to +fill the remaining space. +The rightmost <a href="bmh_SkCanvas_Reference?cl=9919#image">image</a> has four corners scaled vertically to fit, and uses sides above +and below <a href="bmh_SkCanvas_Reference?cl=9919#center">center</a> to fill the remaining space.</div></fiddle-embed></div> + +--- + +<a name="drawBitmap"></a> +## drawBitmap + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void drawBitmap(const SkBitmap& bitmap, SkScalar left, SkScalar top, + const SkPaint* paint = NULL) +</pre> + +Draw <a href="bmh_undocumented?cl=9919#Bitmap">Bitmap</a> <a href="bmh_SkCanvas_Reference?cl=9919#bitmap">bitmap</a>, with its top-left corner at (<a href="bmh_SkCanvas_Reference?cl=9919#left">left</a>, <a href="bmh_SkCanvas_Reference?cl=9919#top">top</a>), +using <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>, <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>, and optional <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a>. +If <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a> is supplied, apply <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>, <a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a>, <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a>, <a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a>, and <a href="bmh_undocumented?cl=9919#Draw_Looper">Draw Looper</a>. +If <a href="bmh_SkCanvas_Reference?cl=9919#bitmap">bitmap</a> is <a href="bmh_undocumented?cl=9919#SkColorType">kAlpha 8 SkColorType</a>, apply <a href="bmh_undocumented?cl=9919#Shader">Shader</a>. +if <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a> contains <a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a>, generate mask from <a href="bmh_SkCanvas_Reference?cl=9919#bitmap">bitmap</a> bounds. If generated mask extends +beyond <a href="bmh_SkCanvas_Reference?cl=9919#bitmap">bitmap</a> bounds, replicate <a href="bmh_SkCanvas_Reference?cl=9919#bitmap">bitmap</a> edge colors, just as <a href="bmh_undocumented?cl=9919#Shader">Shader</a> made from +<a href="bmh_undocumented?cl=9919#MakeBitmapShader">SkShader::MakeBitmapShader</a> with <a href="bmh_undocumented?cl=9919#kClamp_TileMode">SkShader::kClamp TileMode</a> set replicates the <a href="bmh_SkCanvas_Reference?cl=9919#bitmap">bitmap</a>'s edge +color when it samples outside of its bounds. + +### Parameters + +<table> <tr> <td><code><strong>bitmap </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#Bitmap">Bitmap</a> containing pixels, dimensions, and format.</td> + </tr> <tr> <td><code><strong>left </strong></code></td> <td> +Left side of <a href="bmh_SkCanvas_Reference?cl=9919#bitmap">bitmap</a>.</td> + </tr> <tr> <td><code><strong>top </strong></code></td> <td> +Top side of <a href="bmh_SkCanvas_Reference?cl=9919#bitmap">bitmap</a>.</td> + </tr> <tr> <td><code><strong>paint </strong></code></td> <td> +<a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> containing <a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a>, <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>, <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a>, and so on; or nullptr.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="70d7fbf7de82264dd66a526d98d31def"></fiddle-embed></div> + +--- + +<a name="drawBitmapRect"></a> +## drawBitmapRect + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void drawBitmapRect(const SkBitmap& bitmap, const SkRect& src, const SkRect& dst, + const SkPaint* paint, + SrcRectConstraint constraint = kStrict_SrcRectConstraint) +</pre> + +Draw <a href="bmh_undocumented?cl=9919#Rect">Rect</a> <a href="bmh_SkCanvas_Reference?cl=9919#src">src</a> of <a href="bmh_undocumented?cl=9919#Bitmap">Bitmap</a> <a href="bmh_SkCanvas_Reference?cl=9919#bitmap">bitmap</a>, scaled and translated to fill <a href="bmh_undocumented?cl=9919#Rect">Rect</a> <a href="bmh_SkCanvas_Reference?cl=9919#dst">dst</a>. +Additionally transform draw using <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>, <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>, and optional <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a>. +If <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a> is supplied, apply <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>, <a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a>, <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a>, <a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a>, and <a href="bmh_undocumented?cl=9919#Draw_Looper">Draw Looper</a>. +If <a href="bmh_SkCanvas_Reference?cl=9919#bitmap">bitmap</a> is <a href="bmh_undocumented?cl=9919#SkColorType">kAlpha 8 SkColorType</a>, apply <a href="bmh_undocumented?cl=9919#Shader">Shader</a>. +if <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a> contains <a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a>, generate mask from <a href="bmh_SkCanvas_Reference?cl=9919#bitmap">bitmap</a> bounds. If generated mask extends +beyond <a href="bmh_SkCanvas_Reference?cl=9919#bitmap">bitmap</a> bounds, replicate <a href="bmh_SkCanvas_Reference?cl=9919#bitmap">bitmap</a> edge colors, just as <a href="bmh_undocumented?cl=9919#Shader">Shader</a> made from +<a href="bmh_undocumented?cl=9919#MakeBitmapShader">SkShader::MakeBitmapShader</a> with <a href="bmh_undocumented?cl=9919#kClamp_TileMode">SkShader::kClamp TileMode</a> set replicates the <a href="bmh_SkCanvas_Reference?cl=9919#bitmap">bitmap</a>'s edge +color when it samples outside of its bounds. +<a href="bmh_SkCanvas_Reference?cl=9919#constraint">constraint</a> set to <a href="bmh_SkCanvas_Reference?cl=9919#kStrict_SrcRectConstraint">kStrict SrcRectConstraint</a> limits <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> <a href="bmh_undocumented?cl=9919#Filter_Quality">Filter Quality</a> to sample within <a href="bmh_SkCanvas_Reference?cl=9919#src">src</a>; +set to <a href="bmh_SkCanvas_Reference?cl=9919#kFast_SrcRectConstraint">kFast SrcRectConstraint</a> allows sampling outside to improve performance. + +### Parameters + +<table> <tr> <td><code><strong>bitmap </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#Bitmap">Bitmap</a> containing pixels, dimensions, and format.</td> + </tr> <tr> <td><code><strong>src </strong></code></td> <td> +Source <a href="bmh_undocumented?cl=9919#Rect">Rect</a> of image to draw from.</td> + </tr> <tr> <td><code><strong>dst </strong></code></td> <td> +Destination <a href="bmh_undocumented?cl=9919#Rect">Rect</a> of image to draw to.</td> + </tr> <tr> <td><code><strong>paint </strong></code></td> <td> +<a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> containing <a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a>, <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>, <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a>, and so on; or nullptr.</td> + </tr> <tr> <td><code><strong>constraint </strong></code></td> <td> +Filter strictly within <a href="bmh_SkCanvas_Reference?cl=9919#src">src</a> or draw faster.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="de449106e78ec558d9921b9f076de164"></fiddle-embed></div> + +--- + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void drawBitmapRect(const SkBitmap& bitmap, const SkIRect& isrc, + const SkRect& dst, const SkPaint* paint, + SrcRectConstraint constraint = kStrict_SrcRectConstraint) +</pre> + +Draw <a href="bmh_undocumented?cl=9919#IRect">IRect</a> <a href="bmh_SkCanvas_Reference?cl=9919#isrc">isrc</a> of <a href="bmh_undocumented?cl=9919#Bitmap">Bitmap</a> <a href="bmh_SkCanvas_Reference?cl=9919#bitmap">bitmap</a>, scaled and translated to fill <a href="bmh_undocumented?cl=9919#Rect">Rect</a> <a href="bmh_SkCanvas_Reference?cl=9919#dst">dst</a>. +Note that <a href="bmh_SkCanvas_Reference?cl=9919#isrc">isrc</a> is on integer pixel boundaries; <a href="bmh_SkCanvas_Reference?cl=9919#dst">dst</a> may include fractional boundaries. +Additionally transform draw using <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>, <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>, and optional <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a>. +If <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a> is supplied, apply <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>, <a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a>, <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a>, <a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a>, and <a href="bmh_undocumented?cl=9919#Draw_Looper">Draw Looper</a>. +If <a href="bmh_SkCanvas_Reference?cl=9919#bitmap">bitmap</a> is <a href="bmh_undocumented?cl=9919#SkColorType">kAlpha 8 SkColorType</a>, apply <a href="bmh_undocumented?cl=9919#Shader">Shader</a>. +if <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a> contains <a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a>, generate mask from <a href="bmh_SkCanvas_Reference?cl=9919#bitmap">bitmap</a> bounds. If generated mask extends +beyond <a href="bmh_SkCanvas_Reference?cl=9919#bitmap">bitmap</a> bounds, replicate <a href="bmh_SkCanvas_Reference?cl=9919#bitmap">bitmap</a> edge colors, just as <a href="bmh_undocumented?cl=9919#Shader">Shader</a> made from +<a href="bmh_undocumented?cl=9919#MakeBitmapShader">SkShader::MakeBitmapShader</a> with <a href="bmh_undocumented?cl=9919#kClamp_TileMode">SkShader::kClamp TileMode</a> set replicates the <a href="bmh_SkCanvas_Reference?cl=9919#bitmap">bitmap</a>'s edge +color when it samples outside of its bounds. +<a href="bmh_SkCanvas_Reference?cl=9919#constraint">constraint</a> set to <a href="bmh_SkCanvas_Reference?cl=9919#kStrict_SrcRectConstraint">kStrict SrcRectConstraint</a> limits <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> <a href="bmh_undocumented?cl=9919#Filter_Quality">Filter Quality</a> to sample within src; +set to <a href="bmh_SkCanvas_Reference?cl=9919#kFast_SrcRectConstraint">kFast SrcRectConstraint</a> allows sampling outside to improve performance. + +### Parameters + +<table> <tr> <td><code><strong>bitmap </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#Bitmap">Bitmap</a> containing pixels, dimensions, and format.</td> + </tr> <tr> <td><code><strong>isrc </strong></code></td> <td> +Source <a href="bmh_undocumented?cl=9919#IRect">IRect</a> of image to draw from.</td> + </tr> <tr> <td><code><strong>dst </strong></code></td> <td> +Destination <a href="bmh_undocumented?cl=9919#Rect">Rect</a> of image to draw to.</td> + </tr> <tr> <td><code><strong>paint </strong></code></td> <td> +<a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> containing <a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a>, <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>, <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a>, and so on; or nullptr.</td> + </tr> <tr> <td><code><strong>constraint </strong></code></td> <td> +Filter strictly within src or draw faster.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="69b028ef1f95c355672fbdcbf47550f2"></fiddle-embed></div> + +--- + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void drawBitmapRect(const SkBitmap& bitmap, const SkRect& dst, + const SkPaint* paint, + SrcRectConstraint constraint = kStrict_SrcRectConstraint) +</pre> + +Draw <a href="bmh_undocumented?cl=9919#Bitmap">Bitmap</a> <a href="bmh_SkCanvas_Reference?cl=9919#bitmap">bitmap</a>, scaled and translated to fill <a href="bmh_undocumented?cl=9919#Rect">Rect</a> <a href="bmh_SkCanvas_Reference?cl=9919#dst">dst</a>. +Note that isrc is on integer pixel boundaries; <a href="bmh_SkCanvas_Reference?cl=9919#dst">dst</a> may include fractional boundaries. +Additionally transform draw using <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>, <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>, and optional <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a>. +If <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a> is supplied, apply <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>, <a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a>, <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a>, <a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a>, and <a href="bmh_undocumented?cl=9919#Draw_Looper">Draw Looper</a>. +If <a href="bmh_SkCanvas_Reference?cl=9919#bitmap">bitmap</a> is <a href="bmh_undocumented?cl=9919#SkColorType">kAlpha 8 SkColorType</a>, apply <a href="bmh_undocumented?cl=9919#Shader">Shader</a>. +if <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a> contains <a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a>, generate mask from <a href="bmh_SkCanvas_Reference?cl=9919#bitmap">bitmap</a> bounds. If generated mask extends +beyond <a href="bmh_SkCanvas_Reference?cl=9919#bitmap">bitmap</a> bounds, replicate <a href="bmh_SkCanvas_Reference?cl=9919#bitmap">bitmap</a> edge colors, just as <a href="bmh_undocumented?cl=9919#Shader">Shader</a> made from +<a href="bmh_undocumented?cl=9919#MakeBitmapShader">SkShader::MakeBitmapShader</a> with <a href="bmh_undocumented?cl=9919#kClamp_TileMode">SkShader::kClamp TileMode</a> set replicates the <a href="bmh_SkCanvas_Reference?cl=9919#bitmap">bitmap</a>'s edge +color when it samples outside of its bounds. +<a href="bmh_SkCanvas_Reference?cl=9919#constraint">constraint</a> set to <a href="bmh_SkCanvas_Reference?cl=9919#kStrict_SrcRectConstraint">kStrict SrcRectConstraint</a> limits <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> <a href="bmh_undocumented?cl=9919#Filter_Quality">Filter Quality</a> to sample within src; +set to <a href="bmh_SkCanvas_Reference?cl=9919#kFast_SrcRectConstraint">kFast SrcRectConstraint</a> allows sampling outside to improve performance. + +### Parameters + +<table> <tr> <td><code><strong>bitmap </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#Bitmap">Bitmap</a> containing pixels, dimensions, and format.</td> + </tr> <tr> <td><code><strong>dst </strong></code></td> <td> +Destination <a href="bmh_undocumented?cl=9919#Rect">Rect</a> of image to draw to.</td> + </tr> <tr> <td><code><strong>paint </strong></code></td> <td> +<a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> containing <a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a>, <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>, <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a>, and so on; or nullptr.</td> + </tr> <tr> <td><code><strong>constraint </strong></code></td> <td> +Filter strictly within src or draw faster.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="76b74b826e43b4a595d18115564e88c7"></fiddle-embed></div> + +--- + +<a name="drawBitmapNine"></a> +## drawBitmapNine + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void drawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, + const SkRect& dst, const SkPaint* paint = NULL) +</pre> + +Draw <a href="bmh_undocumented?cl=9919#Bitmap">Bitmap</a> <a href="bmh_SkCanvas_Reference?cl=9919#bitmap">bitmap</a> stretched differentially to fit into <a href="bmh_undocumented?cl=9919#Rect">Rect</a> <a href="bmh_SkCanvas_Reference?cl=9919#dst">dst</a>. +<a href="bmh_undocumented?cl=9919#IRect">IRect</a> <a href="bmh_SkCanvas_Reference?cl=9919#center">center</a> divides the <a href="bmh_SkCanvas_Reference?cl=9919#bitmap">bitmap</a> into nine sections: four sides, four corners, and the <a href="bmh_SkCanvas_Reference?cl=9919#center">center</a>. +corners are unscaled or scaled down proportionately if their sides are larger than <a href="bmh_SkCanvas_Reference?cl=9919#dst">dst</a>; +<a href="bmh_SkCanvas_Reference?cl=9919#center">center</a> and four sides are scaled to fit remaining space, if any. +Additionally transform draw using <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>, <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>, and optional <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a>. +If <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a> is supplied, apply <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>, <a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a>, <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a>, <a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a>, and <a href="bmh_undocumented?cl=9919#Draw_Looper">Draw Looper</a>. +If <a href="bmh_SkCanvas_Reference?cl=9919#bitmap">bitmap</a> is <a href="bmh_undocumented?cl=9919#SkColorType">kAlpha 8 SkColorType</a>, apply <a href="bmh_undocumented?cl=9919#Shader">Shader</a>. +if <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a> contains <a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a>, generate mask from <a href="bmh_SkCanvas_Reference?cl=9919#bitmap">bitmap</a> bounds. If generated mask extends +beyond <a href="bmh_SkCanvas_Reference?cl=9919#bitmap">bitmap</a> bounds, replicate <a href="bmh_SkCanvas_Reference?cl=9919#bitmap">bitmap</a> edge colors, just as <a href="bmh_undocumented?cl=9919#Shader">Shader</a> made from +<a href="bmh_undocumented?cl=9919#MakeBitmapShader">SkShader::MakeBitmapShader</a> with <a href="bmh_undocumented?cl=9919#kClamp_TileMode">SkShader::kClamp TileMode</a> set replicates the <a href="bmh_SkCanvas_Reference?cl=9919#bitmap">bitmap</a>'s edge +color when it samples outside of its bounds. + +### Parameters + +<table> <tr> <td><code><strong>bitmap </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#Bitmap">Bitmap</a> containing pixels, dimensions, and format.</td> + </tr> <tr> <td><code><strong>center </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#IRect">IRect</a> edge of image corners and sides.</td> + </tr> <tr> <td><code><strong>dst </strong></code></td> <td> +Destination <a href="bmh_undocumented?cl=9919#Rect">Rect</a> of image to draw to.</td> + </tr> <tr> <td><code><strong>paint </strong></code></td> <td> +<a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> containing <a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a>, <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>, <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a>, and so on; or nullptr.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="a4a30aa10e566a85fe6f6cad2ff9935b"><div>The two leftmost <a href="bmh_SkCanvas_Reference?cl=9919#bitmap">bitmap</a> draws has four corners and sides to the left and right of <a href="bmh_SkCanvas_Reference?cl=9919#center">center</a>. +The leftmost <a href="bmh_SkCanvas_Reference?cl=9919#bitmap">bitmap</a> draw scales the width of corners proportionately to fit. +The third and fourth draw corners are unscaled; the sides and <a href="bmh_SkCanvas_Reference?cl=9919#center">center</a> are scaled to +fill the remaining space. +The rightmost <a href="bmh_SkCanvas_Reference?cl=9919#bitmap">bitmap</a> draw has four corners scaled vertically to fit, and uses sides above +and below <a href="bmh_SkCanvas_Reference?cl=9919#center">center</a> to fill the remaining space.</div></fiddle-embed></div> + +--- + +# <a name="SkCanvas::Lattice"></a> Struct SkCanvas::Lattice +<a href="bmh_SkCanvas_Reference?cl=9919#Lattice">Lattice</a> divides <a href="bmh_undocumented?cl=9919#Bitmap">Bitmap</a> or <a href="bmh_undocumented?cl=9919#Image">Image</a> into a rectangular grid. +Grid entries on even columns and even rows are fixed; these entries are +always drawn at their original size if the destination is large enough. +If the destination side is too small to hold the fixed entries, all fixed +entries are proportionately scaled down to fit. +The grid entries not on even columns and rows are scaled to fit the +remaining space, if any. + +<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0"> +struct <a href="bmh_SkCanvas_Reference?cl=9919#Lattice">Lattice</a> { +enum <a href="bmh_SkCanvas_Reference?cl=9919#Lattice_Flags">Flags</a> {... + +const int* <a href="bmh_SkCanvas_Reference?cl=9919#Lattice_fXDivs">fXDivs</a>; +const int* <a href="bmh_SkCanvas_Reference?cl=9919#Lattice_fYDivs">fYDivs</a>; +const <a href="bmh_SkCanvas_Reference?cl=9919#Lattice_Flags">Flags</a>* <a href="bmh_SkCanvas_Reference?cl=9919#Lattice_fFlags">fFlags</a>; +int <a href="bmh_SkCanvas_Reference?cl=9919#Lattice_fXCount">fXCount</a>; +int <a href="bmh_SkCanvas_Reference?cl=9919#Lattice_fYCount">fYCount</a>; +const <a href="bmh_undocumented?cl=9919#SkIRect">SkIRect</a>* <a href="bmh_SkCanvas_Reference?cl=9919#Lattice_fBounds">fBounds</a>; +};</pre> + +## <a name="SkCanvas::Lattice::Flags"></a> Enum SkCanvas::Lattice::Flags + +<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0"> +enum <a href="bmh_SkCanvas_Reference?cl=9919#Lattice_Flags">Flags</a> : uint8_t { +<a href="bmh_SkCanvas_Reference?cl=9919#Lattice_kTransparent_Flags">kTransparent Flags</a> = 1 << 0, +};</pre> + +Optional setting per rectangular grid entry to make it transparent. + +### Constants + +<table> + <tr> + <td><a name="SkCanvas::Lattice::kTransparent_Flags"></a> <code><strong>SkCanvas::Lattice::kTransparent_Flags </strong></code></td><td>1</td><td>Set to skip lattice rectangle by making it transparent.</td> + </tr> + +</table> + +<code><strong>const int* fXDivs</strong></code> + +Array of x-coordinates that divide the bitmap vertically. +Array entries must be unique, increasing, greater than or equal to <a href="bmh_SkCanvas_Reference?cl=9919#Lattice_fBounds">fBounds</a> left edge, +and less than <a href="bmh_SkCanvas_Reference?cl=9919#Lattice_fBounds">fBounds</a> right edge. +Set the first element to <a href="bmh_SkCanvas_Reference?cl=9919#Lattice_fBounds">fBounds</a> left to collapse the left column of fixed grid entries. + +<code><strong>const int* fYDivs</strong></code> + +Array of y-coordinates that divide the bitmap horizontally. +Array entries must be unique, increasing, greater than or equal to <a href="bmh_SkCanvas_Reference?cl=9919#Lattice_fBounds">fBounds</a> top edge, +and less than <a href="bmh_SkCanvas_Reference?cl=9919#Lattice_fBounds">fBounds</a> bottom edge. +Set the first element to <a href="bmh_SkCanvas_Reference?cl=9919#Lattice_fBounds">fBounds</a> top to collapse the top row of fixed grid entries. + +<code><strong>const Flags* fFlags</strong></code> + +Optional array of <a href="bmh_SkCanvas_Reference?cl=9919#Lattice_Flags">Flags</a>, one per rectangular grid entry: +array length must be (<a href="bmh_SkCanvas_Reference?cl=9919#Lattice_fXCount">fXCount</a> + 1) * (<a href="bmh_SkCanvas_Reference?cl=9919#Lattice_fYCount">fYCount</a> + 1). +Array entries correspond to the rectangular grid entries, ascending +left to right and then top to bottom. + +<code><strong>int fXCount</strong></code> + +Number of entries in <a href="bmh_SkCanvas_Reference?cl=9919#Lattice_fXDivs">fXDivs</a> array; one less than the number of horizontal divisions. + +<code><strong>int fYCount</strong></code> + +Number of entries in <a href="bmh_SkCanvas_Reference?cl=9919#Lattice_fYDivs">fYDivs</a> array; one less than the number of vertical divisions. + +<code><strong>const SkIRect* fBounds</strong></code> + +Optional subset <a href="bmh_undocumented?cl=9919#IRect">IRect</a> source to draw from. +If nullptr, source bounds is dimensions of <a href="bmh_undocumented?cl=9919#Bitmap">Bitmap</a> or <a href="bmh_undocumented?cl=9919#Image">Image</a>. + +<a name="drawBitmapLattice"></a> +## drawBitmapLattice + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void drawBitmapLattice(const SkBitmap& bitmap, const Lattice& lattice, + const SkRect& dst, const SkPaint* paint = nullptr) +</pre> + +Draw <a href="bmh_undocumented?cl=9919#Bitmap">Bitmap</a> <a href="bmh_SkCanvas_Reference?cl=9919#bitmap">bitmap</a> stretched differentially to fit into <a href="bmh_undocumented?cl=9919#Rect">Rect</a> <a href="bmh_SkCanvas_Reference?cl=9919#dst">dst</a>. + +<a href="bmh_SkCanvas_Reference?cl=9919#Lattice">Lattice</a> <a href="bmh_SkCanvas_Reference?cl=9919#lattice">lattice</a> divides <a href="bmh_SkCanvas_Reference?cl=9919#bitmap">bitmap</a> into a rectangular grid. +Each intersection of an even-numbered row and column is fixed; like the corners +of <a href="bmh_SkCanvas_Reference?cl=9919#drawBitmapNine">drawBitmapNine</a>, fixed <a href="bmh_SkCanvas_Reference?cl=9919#lattice">lattice</a> elements never scale larger than their initial size +and shrink proportionately when all fixed elements exceed the <a href="bmh_SkCanvas_Reference?cl=9919#bitmap">bitmap</a>'s dimension. +All other grid elements scale to fill the available space, if any. + +Additionally transform draw using <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>, <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>, and optional <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a>. +If <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a> is supplied, apply <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>, <a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a>, <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a>, <a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a>, and <a href="bmh_undocumented?cl=9919#Draw_Looper">Draw Looper</a>. +If <a href="bmh_SkCanvas_Reference?cl=9919#bitmap">bitmap</a> is <a href="bmh_undocumented?cl=9919#SkColorType">kAlpha 8 SkColorType</a>, apply <a href="bmh_undocumented?cl=9919#Shader">Shader</a>. +if <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a> contains <a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a>, generate mask from <a href="bmh_SkCanvas_Reference?cl=9919#bitmap">bitmap</a> bounds. If generated mask extends +beyond <a href="bmh_SkCanvas_Reference?cl=9919#bitmap">bitmap</a> bounds, replicate <a href="bmh_SkCanvas_Reference?cl=9919#bitmap">bitmap</a> edge colors, just as <a href="bmh_undocumented?cl=9919#Shader">Shader</a> made from +<a href="bmh_undocumented?cl=9919#MakeBitmapShader">SkShader::MakeBitmapShader</a> with <a href="bmh_undocumented?cl=9919#kClamp_TileMode">SkShader::kClamp TileMode</a> set replicates the <a href="bmh_SkCanvas_Reference?cl=9919#bitmap">bitmap</a>'s edge +color when it samples outside of its bounds. + +### Parameters + +<table> <tr> <td><code><strong>bitmap </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#Bitmap">Bitmap</a> containing pixels, dimensions, and format.</td> + </tr> <tr> <td><code><strong>lattice </strong></code></td> <td> +Division of <a href="bmh_SkCanvas_Reference?cl=9919#bitmap">bitmap</a> into fixed and variable rectangles.</td> + </tr> <tr> <td><code><strong>dst </strong></code></td> <td> +Destination <a href="bmh_undocumented?cl=9919#Rect">Rect</a> of image to draw to.</td> + </tr> <tr> <td><code><strong>paint </strong></code></td> <td> +<a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> containing <a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a>, <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>, <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a>, and so on; or nullptr.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="773134f4fe127f9c9caa110c24c988dc"><div>The two leftmost <a href="bmh_SkCanvas_Reference?cl=9919#bitmap">bitmap</a> draws has four corners and sides to the left and right of center. +The leftmost <a href="bmh_SkCanvas_Reference?cl=9919#bitmap">bitmap</a> draw scales the width of corners proportionately to fit. +The third and fourth draw corners are unscaled; the sides are scaled to +fill the remaining space; the center is transparent. +The rightmost <a href="bmh_SkCanvas_Reference?cl=9919#bitmap">bitmap</a> draw has four corners scaled vertically to fit, and uses sides above +and below center to fill the remaining space.</div></fiddle-embed></div> + +--- + +<a name="drawImageLattice"></a> +## drawImageLattice + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void drawImageLattice(const SkImage* image, const Lattice& lattice, + const SkRect& dst, const SkPaint* paint = nullptr) +</pre> + +Draw <a href="bmh_undocumented?cl=9919#Image">Image</a> <a href="bmh_SkCanvas_Reference?cl=9919#image">image</a> stretched differentially to fit into <a href="bmh_undocumented?cl=9919#Rect">Rect</a> <a href="bmh_SkCanvas_Reference?cl=9919#dst">dst</a>. + +<a href="bmh_SkCanvas_Reference?cl=9919#Lattice">Lattice</a> <a href="bmh_SkCanvas_Reference?cl=9919#lattice">lattice</a> divides <a href="bmh_SkCanvas_Reference?cl=9919#image">image</a> into a rectangular grid. +Each intersection of an even-numbered row and column is fixed; like the corners +of <a href="bmh_SkCanvas_Reference?cl=9919#drawImageNine">drawImageNine</a>, fixed <a href="bmh_SkCanvas_Reference?cl=9919#lattice">lattice</a> elements never scale larger than their initial size +and shrink proportionately when all fixed elements exceed the bitmap's dimension. +All other grid elements scale to fill the available space, if any. + +Additionally transform draw using <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>, <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>, and optional <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a>. +If <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a> is supplied, apply <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>, <a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a>, <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a>, <a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a>, and <a href="bmh_undocumented?cl=9919#Draw_Looper">Draw Looper</a>. +If <a href="bmh_SkCanvas_Reference?cl=9919#image">image</a> is <a href="bmh_undocumented?cl=9919#SkColorType">kAlpha 8 SkColorType</a>, apply <a href="bmh_undocumented?cl=9919#Shader">Shader</a>. +if <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a> contains <a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a>, generate mask from <a href="bmh_SkCanvas_Reference?cl=9919#image">image</a> bounds. If generated mask extends +beyond <a href="bmh_SkCanvas_Reference?cl=9919#image">image</a> bounds, replicate <a href="bmh_SkCanvas_Reference?cl=9919#image">image</a> edge colors, just as <a href="bmh_undocumented?cl=9919#Shader">Shader</a> made from +<a href="bmh_undocumented?cl=9919#MakeBitmapShader">SkShader::MakeBitmapShader</a> with <a href="bmh_undocumented?cl=9919#kClamp_TileMode">SkShader::kClamp TileMode</a> set replicates the <a href="bmh_SkCanvas_Reference?cl=9919#image">image</a>'s edge +color when it samples outside of its bounds. + +### Parameters + +<table> <tr> <td><code><strong>image </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#Image">Image</a> containing pixels, dimensions, and format.</td> + </tr> <tr> <td><code><strong>lattice </strong></code></td> <td> +Division of bitmap into fixed and variable rectangles.</td> + </tr> <tr> <td><code><strong>dst </strong></code></td> <td> +Destination <a href="bmh_undocumented?cl=9919#Rect">Rect</a> of <a href="bmh_SkCanvas_Reference?cl=9919#image">image</a> to draw to.</td> + </tr> <tr> <td><code><strong>paint </strong></code></td> <td> +<a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> containing <a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a>, <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>, <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a>, and so on; or nullptr.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="c52ee1d4c69363c6b109539c1da3ce83"><div>The leftmost <a href="bmh_SkCanvas_Reference?cl=9919#image">image</a> is smaller than center; only corners are drawn, all scaled to fit. +The second <a href="bmh_SkCanvas_Reference?cl=9919#image">image</a> equals the size of center; only corners are drawn, unscaled. +The remaining images are larger than center. All corners draw unscaled. The sides +are scaled if needed to take up the remaining space; the center is transparent.</div></fiddle-embed></div> + +--- + +<a name="drawText"></a> +## drawText + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void drawText(const void* text, size_t byteLength, SkScalar x, SkScalar y, + const SkPaint& paint) +</pre> + +Draw <a href="bmh_SkCanvas_Reference?cl=9919#text">text</a>, with origin at (<a href="bmh_SkCanvas_Reference?cl=9919#x">x</a>, <a href="bmh_SkCanvas_Reference?cl=9919#y">y</a>), using <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>, <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>, and <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a>. +<a href="bmh_SkCanvas_Reference?cl=9919#text">text</a>'s meaning depends on <a href="bmh_SkPaint_Reference?cl=9919#Text_Encoding">Paint Text Encoding</a>; by default, <a href="bmh_SkCanvas_Reference?cl=9919#text">text</a> encoding is <a href="bmh_undocumented?cl=9919#UTF_8">UTF-8</a>. +<a href="bmh_SkCanvas_Reference?cl=9919#x">x</a> and <a href="bmh_SkCanvas_Reference?cl=9919#y">y</a> meaning depends on <a href="bmh_SkPaint_Reference?cl=9919#Text_Align">Paint Text Align</a> and <a href="bmh_SkPaint_Reference?cl=9919#Vertical_Text">Paint Vertical Text</a>; by default <a href="bmh_SkCanvas_Reference?cl=9919#text">text</a> +draws left to right, positioning the first glyph's left side bearing at <a href="bmh_SkCanvas_Reference?cl=9919#x">x</a> and its +baseline at <a href="bmh_SkCanvas_Reference?cl=9919#y">y</a>. <a href="bmh_undocumented?cl=9919#Text">Text</a> size is affected by <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a> and <a href="bmh_SkPaint_Reference?cl=9919#Text_Size">Paint Text Size</a>. + +All elements of <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a>: <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a>, <a href="bmh_undocumented?cl=9919#Rasterizer">Rasterizer</a>, <a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a>, <a href="bmh_undocumented?cl=9919#Shader">Shader</a>, <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>, +<a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a>, and <a href="bmh_undocumented?cl=9919#Draw_Looper">Draw Looper</a>; apply to <a href="bmh_SkCanvas_Reference?cl=9919#text">text</a>. By default, <a href="bmh_SkCanvas_Reference?cl=9919#drawText">drawText</a> draws filled 12 point black +glyphs. + +### Parameters + +<table> <tr> <td><code><strong>text </strong></code></td> <td> +Character code points or glyphs drawn.</td> + </tr> <tr> <td><code><strong>byteLength </strong></code></td> <td> +Byte length of <a href="bmh_SkCanvas_Reference?cl=9919#text">text</a> array.</td> + </tr> <tr> <td><code><strong>x </strong></code></td> <td> +Start of <a href="bmh_SkCanvas_Reference?cl=9919#text">text</a> on x-axis.</td> + </tr> <tr> <td><code><strong>y </strong></code></td> <td> +Start of <a href="bmh_SkCanvas_Reference?cl=9919#text">text</a> on y-axis.</td> + </tr> <tr> <td><code><strong>paint </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#Text">Text</a> size, blend, color, and so on, used to draw.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="a3365bd3044b13e8e0318ee8aefbdf91"><div>The same <a href="bmh_SkCanvas_Reference?cl=9919#text">text</a> is drawn varying <a href="bmh_SkPaint_Reference?cl=9919#Text_Size">Paint Text Size</a> and varying +<a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>.</div></fiddle-embed></div> + +--- + +<a name="drawString"></a> +## drawString + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void drawString(const char* string, SkScalar x, SkScalar y, const SkPaint& paint) +</pre> + +Draw null terminated <a href="bmh_SkCanvas_Reference?cl=9919#string">string</a>, with origin at (<a href="bmh_SkCanvas_Reference?cl=9919#x">x</a>, <a href="bmh_SkCanvas_Reference?cl=9919#y">y</a>), using <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>, <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>, and <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a>. +<a href="bmh_SkCanvas_Reference?cl=9919#string">string</a>'s meaning depends on <a href="bmh_SkPaint_Reference?cl=9919#Text_Encoding">Paint Text Encoding</a>; by default, <a href="bmh_SkCanvas_Reference?cl=9919#string">string</a> encoding is <a href="bmh_undocumented?cl=9919#UTF_8">UTF-8</a>. +Other values of <a href="bmh_SkPaint_Reference?cl=9919#Text_Encoding">Paint Text Encoding</a> are unlikely to produce the desired results, since +zero bytes may be embedded in the <a href="bmh_SkCanvas_Reference?cl=9919#string">string</a>. +<a href="bmh_SkCanvas_Reference?cl=9919#x">x</a> and <a href="bmh_SkCanvas_Reference?cl=9919#y">y</a> meaning depends on <a href="bmh_SkPaint_Reference?cl=9919#Text_Align">Paint Text Align</a> and <a href="bmh_SkPaint_Reference?cl=9919#Vertical_Text">Paint Vertical Text</a>; by default <a href="bmh_SkCanvas_Reference?cl=9919#string">string</a> +draws left to right, positioning the first glyph's left side bearing at <a href="bmh_SkCanvas_Reference?cl=9919#x">x</a> and its +baseline at <a href="bmh_SkCanvas_Reference?cl=9919#y">y</a>. <a href="bmh_undocumented?cl=9919#Text">Text</a> size is affected by <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a> and <a href="bmh_SkPaint_Reference?cl=9919#Text_Size">Paint Text Size</a>. + +All elements of <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a>: <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a>, <a href="bmh_undocumented?cl=9919#Rasterizer">Rasterizer</a>, <a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a>, <a href="bmh_undocumented?cl=9919#Shader">Shader</a>, <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>, +<a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a>, and <a href="bmh_undocumented?cl=9919#Draw_Looper">Draw Looper</a>; apply to <a href="bmh_SkCanvas_Reference?cl=9919#string">string</a>. By default, <a href="bmh_SkCanvas_Reference?cl=9919#drawString">drawString</a> draws filled 12 point black +glyphs. + +### Parameters + +<table> <tr> <td><code><strong>string </strong></code></td> <td> +Character code points or glyphs drawn, ending with a char value of zero.</td> + </tr> <tr> <td><code><strong>x </strong></code></td> <td> +Start of <a href="bmh_SkCanvas_Reference?cl=9919#string">string</a> on x-axis.</td> + </tr> <tr> <td><code><strong>y </strong></code></td> <td> +Start of <a href="bmh_SkCanvas_Reference?cl=9919#string">string</a> on y-axis.</td> + </tr> <tr> <td><code><strong>paint </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#Text">Text</a> size, blend, color, and so on, used to draw.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="65cc4b15cd1a8d067eb1dbfd7e2c17dd"></fiddle-embed></div> + +### See Also + +<a href="bmh_SkCanvas_Reference?cl=9919#drawText">drawText</a> + +--- + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void drawString(const SkString& string, SkScalar x, SkScalar y, + const SkPaint& paint) +</pre> + +Draw null terminated <a href="bmh_SkCanvas_Reference?cl=9919#string">string</a>, with origin at (<a href="bmh_SkCanvas_Reference?cl=9919#x">x</a>, <a href="bmh_SkCanvas_Reference?cl=9919#y">y</a>), using <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>, <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>, and <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a>. +<a href="bmh_SkCanvas_Reference?cl=9919#string">string</a>'s meaning depends on <a href="bmh_SkPaint_Reference?cl=9919#Text_Encoding">Paint Text Encoding</a>; by default, <a href="bmh_SkCanvas_Reference?cl=9919#string">string</a> encoding is <a href="bmh_undocumented?cl=9919#UTF_8">UTF-8</a>. +Other values of <a href="bmh_SkPaint_Reference?cl=9919#Text_Encoding">Paint Text Encoding</a> are unlikely to produce the desired results, since +zero bytes may be embedded in the <a href="bmh_SkCanvas_Reference?cl=9919#string">string</a>. +<a href="bmh_SkCanvas_Reference?cl=9919#x">x</a> and <a href="bmh_SkCanvas_Reference?cl=9919#y">y</a> meaning depends on <a href="bmh_SkPaint_Reference?cl=9919#Text_Align">Paint Text Align</a> and <a href="bmh_SkPaint_Reference?cl=9919#Vertical_Text">Paint Vertical Text</a>; by default <a href="bmh_SkCanvas_Reference?cl=9919#string">string</a> +draws left to right, positioning the first glyph's left side bearing at <a href="bmh_SkCanvas_Reference?cl=9919#x">x</a> and its +baseline at <a href="bmh_SkCanvas_Reference?cl=9919#y">y</a>. <a href="bmh_undocumented?cl=9919#Text">Text</a> size is affected by <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a> and <a href="bmh_SkPaint_Reference?cl=9919#Text_Size">Paint Text Size</a>. + +All elements of <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a>: <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a>, <a href="bmh_undocumented?cl=9919#Rasterizer">Rasterizer</a>, <a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a>, <a href="bmh_undocumented?cl=9919#Shader">Shader</a>, <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>, +<a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a>, and <a href="bmh_undocumented?cl=9919#Draw_Looper">Draw Looper</a>; apply to <a href="bmh_SkCanvas_Reference?cl=9919#string">string</a>. By default, <a href="bmh_SkCanvas_Reference?cl=9919#drawString">drawString</a> draws filled 12 point black +glyphs. + +### Parameters + +<table> <tr> <td><code><strong>string </strong></code></td> <td> +Character code points or glyphs drawn, ending with a char value of zero.</td> + </tr> <tr> <td><code><strong>x </strong></code></td> <td> +Start of <a href="bmh_SkCanvas_Reference?cl=9919#string">string</a> on x-axis.</td> + </tr> <tr> <td><code><strong>y </strong></code></td> <td> +Start of <a href="bmh_SkCanvas_Reference?cl=9919#string">string</a> on y-axis.</td> + </tr> <tr> <td><code><strong>paint </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#Text">Text</a> size, blend, color, and so on, used to draw.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="435178c09feb3bfec5e35d983609a013"></fiddle-embed></div> + +### See Also + +<a href="bmh_SkCanvas_Reference?cl=9919#drawText">drawText</a> + +--- + +<a name="drawPosText"></a> +## drawPosText + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void drawPosText(const void* text, size_t byteLength, const SkPoint pos[], + const SkPaint& paint) +</pre> + +Draw each glyph in <a href="bmh_SkCanvas_Reference?cl=9919#text">text</a> with the origin in <a href="bmh_SkCanvas_Reference?cl=9919#pos">pos</a> array, using <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>, <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>, and <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a>. +The number of entries in <a href="bmh_SkCanvas_Reference?cl=9919#pos">pos</a> array must match the number of glyphs described by <a href="bmh_SkCanvas_Reference?cl=9919#byteLength">byteLength</a> of <a href="bmh_SkCanvas_Reference?cl=9919#text">text</a>. +<a href="bmh_SkCanvas_Reference?cl=9919#text">text</a>'s meaning depends on <a href="bmh_SkPaint_Reference?cl=9919#Text_Encoding">Paint Text Encoding</a>; by default, <a href="bmh_SkCanvas_Reference?cl=9919#text">text</a> encoding is <a href="bmh_undocumented?cl=9919#UTF_8">UTF-8</a>. +<a href="bmh_SkCanvas_Reference?cl=9919#pos">pos</a> elements' meaning depends on <a href="bmh_SkPaint_Reference?cl=9919#Text_Align">Paint Text Align</a> and <a href="bmh_SkPaint_Reference?cl=9919#Vertical_Text">Paint Vertical Text</a>; by default each +glyph's left side bearing is positioned at x and its +baseline is positioned at y. <a href="bmh_undocumented?cl=9919#Text">Text</a> size is affected by <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a> and <a href="bmh_SkPaint_Reference?cl=9919#Text_Size">Paint Text Size</a>. + +All elements of <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a>: <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a>, <a href="bmh_undocumented?cl=9919#Rasterizer">Rasterizer</a>, <a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a>, <a href="bmh_undocumented?cl=9919#Shader">Shader</a>, <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>, +<a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a>, and <a href="bmh_undocumented?cl=9919#Draw_Looper">Draw Looper</a>; apply to <a href="bmh_SkCanvas_Reference?cl=9919#text">text</a>. By default, <a href="bmh_SkCanvas_Reference?cl=9919#drawPosText">drawPosText</a> draws filled 12 point black +glyphs. + +Layout engines such as <a href="bmh_undocumented?cl=9919#Harfbuzz">Harfbuzz</a> typically use <a href="bmh_SkCanvas_Reference?cl=9919#drawPosText">drawPosText</a> to position each glyph +rather than using the font's advance widths. + +### Parameters + +<table> <tr> <td><code><strong>text </strong></code></td> <td> +Character code points or glyphs drawn.</td> + </tr> <tr> <td><code><strong>byteLength </strong></code></td> <td> +Byte length of <a href="bmh_SkCanvas_Reference?cl=9919#text">text</a> array.</td> + </tr> <tr> <td><code><strong>pos </strong></code></td> <td> +Array of glyph origins.</td> + </tr> <tr> <td><code><strong>paint </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#Text">Text</a> size, blend, color, and so on, used to draw.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="bf0b2402533a23b6392e0676b7a8414c"></fiddle-embed></div> + +--- + +<a name="drawPosTextH"></a> +## drawPosTextH + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void drawPosTextH(const void* text, size_t byteLength, const SkScalar xpos[], + SkScalar constY, const SkPaint& paint) +</pre> + +Draw each glyph in <a href="bmh_SkCanvas_Reference?cl=9919#text">text</a> with its (x, y) origin composed from <a href="bmh_SkCanvas_Reference?cl=9919#xpos">xpos</a> array and <a href="bmh_SkCanvas_Reference?cl=9919#constY">constY</a>, using <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>, <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>, and <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a>. +The number of entries in <a href="bmh_SkCanvas_Reference?cl=9919#xpos">xpos</a> array must match the number of glyphs described by <a href="bmh_SkCanvas_Reference?cl=9919#byteLength">byteLength</a> of <a href="bmh_SkCanvas_Reference?cl=9919#text">text</a>. +<a href="bmh_SkCanvas_Reference?cl=9919#text">text</a>'s meaning depends on <a href="bmh_SkPaint_Reference?cl=9919#Text_Encoding">Paint Text Encoding</a>; by default, <a href="bmh_SkCanvas_Reference?cl=9919#text">text</a> encoding is <a href="bmh_undocumented?cl=9919#UTF_8">UTF-8</a>. +pos elements' meaning depends on <a href="bmh_SkPaint_Reference?cl=9919#Text_Align">Paint Text Align</a> and <a href="bmh_SkPaint_Reference?cl=9919#Vertical_Text">Paint Vertical Text</a>; by default each +glyph's left side bearing is positioned at an <a href="bmh_SkCanvas_Reference?cl=9919#xpos">xpos</a> element and its +baseline is positioned at <a href="bmh_SkCanvas_Reference?cl=9919#constY">constY</a>. <a href="bmh_undocumented?cl=9919#Text">Text</a> size is affected by <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a> and <a href="bmh_SkPaint_Reference?cl=9919#Text_Size">Paint Text Size</a>. + +All elements of <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a>: <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a>, <a href="bmh_undocumented?cl=9919#Rasterizer">Rasterizer</a>, <a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a>, <a href="bmh_undocumented?cl=9919#Shader">Shader</a>, <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>, +<a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a>, and <a href="bmh_undocumented?cl=9919#Draw_Looper">Draw Looper</a>; apply to <a href="bmh_SkCanvas_Reference?cl=9919#text">text</a>. By default, <a href="bmh_SkCanvas_Reference?cl=9919#drawPosTextH">drawPosTextH</a> draws filled 12 point black +glyphs. + +Layout engines such as <a href="bmh_undocumented?cl=9919#Harfbuzz">Harfbuzz</a> typically use <a href="bmh_SkCanvas_Reference?cl=9919#drawPosTextH">drawPosTextH</a> to position each glyph +rather than using the font's advance widths if all glyphs share the same baseline. + +### Parameters + +<table> <tr> <td><code><strong>text </strong></code></td> <td> +Character code points or glyphs drawn.</td> + </tr> <tr> <td><code><strong>byteLength </strong></code></td> <td> +Byte length of <a href="bmh_SkCanvas_Reference?cl=9919#text">text</a> array.</td> + </tr> <tr> <td><code><strong>xpos </strong></code></td> <td> +Array of x positions, used to position each glyph.</td> + </tr> <tr> <td><code><strong>constY </strong></code></td> <td> +Shared y coordinate for all of x positions.</td> + </tr> <tr> <td><code><strong>paint </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#Text">Text</a> size, blend, color, and so on, used to draw.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="95c6a7ef82993a8d2add676080e9438a"></fiddle-embed></div> + +--- + +<a name="drawTextOnPathHV"></a> +## drawTextOnPathHV + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void drawTextOnPathHV(const void* text, size_t byteLength, const SkPath& path, + SkScalar hOffset, SkScalar vOffset, const SkPaint& paint) +</pre> + +Draw <a href="bmh_SkCanvas_Reference?cl=9919#text">text</a> on <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> <a href="bmh_SkCanvas_Reference?cl=9919#path">path</a>, using <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>, <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>, and <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a>. +Origin of <a href="bmh_SkCanvas_Reference?cl=9919#text">text</a> is at distance <a href="bmh_SkCanvas_Reference?cl=9919#hOffset">hOffset</a> along the <a href="bmh_SkCanvas_Reference?cl=9919#path">path</a>, offset by a perpendicular vector of +length <a href="bmh_SkCanvas_Reference?cl=9919#vOffset">vOffset</a>. If the <a href="bmh_SkCanvas_Reference?cl=9919#path">path</a> section corresponding the glyph advance is curved, the glyph +is drawn curved to match; control points in the glyph are mapped to projected points parallel +to the <a href="bmh_SkCanvas_Reference?cl=9919#path">path</a>. If the <a href="bmh_SkCanvas_Reference?cl=9919#text">text</a>'s advance is larger than the <a href="bmh_SkCanvas_Reference?cl=9919#path">path</a> length, the excess <a href="bmh_SkCanvas_Reference?cl=9919#text">text</a> is clipped. + +<a href="bmh_SkCanvas_Reference?cl=9919#text">text</a>'s meaning depends on <a href="bmh_SkPaint_Reference?cl=9919#Text_Encoding">Paint Text Encoding</a>; by default, <a href="bmh_SkCanvas_Reference?cl=9919#text">text</a> encoding is <a href="bmh_undocumented?cl=9919#UTF_8">UTF-8</a>. +Origin meaning depends on <a href="bmh_SkPaint_Reference?cl=9919#Text_Align">Paint Text Align</a> and <a href="bmh_SkPaint_Reference?cl=9919#Vertical_Text">Paint Vertical Text</a>; by default <a href="bmh_SkCanvas_Reference?cl=9919#text">text</a> +positions the first glyph's left side bearing at origin x and its +baseline at origin y. <a href="bmh_undocumented?cl=9919#Text">Text</a> size is affected by <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a> and <a href="bmh_SkPaint_Reference?cl=9919#Text_Size">Paint Text Size</a>. + +All elements of <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a>: <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a>, <a href="bmh_undocumented?cl=9919#Rasterizer">Rasterizer</a>, <a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a>, <a href="bmh_undocumented?cl=9919#Shader">Shader</a>, <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>, +<a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a>, and <a href="bmh_undocumented?cl=9919#Draw_Looper">Draw Looper</a>; apply to <a href="bmh_SkCanvas_Reference?cl=9919#text">text</a>. By default, <a href="bmh_SkCanvas_Reference?cl=9919#drawTextOnPathHV">drawTextOnPathHV</a> draws filled 12 point black +glyphs. + +### Parameters + +<table> <tr> <td><code><strong>text </strong></code></td> <td> +Character code points or glyphs drawn.</td> + </tr> <tr> <td><code><strong>byteLength </strong></code></td> <td> +Byte length of <a href="bmh_SkCanvas_Reference?cl=9919#text">text</a> array.</td> + </tr> <tr> <td><code><strong>path </strong></code></td> <td> +<a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> providing <a href="bmh_SkCanvas_Reference?cl=9919#text">text</a> baseline.</td> + </tr> <tr> <td><code><strong>hOffset </strong></code></td> <td> +Distance along <a href="bmh_SkCanvas_Reference?cl=9919#path">path</a> to offset origin.</td> + </tr> <tr> <td><code><strong>vOffset </strong></code></td> <td> +Offset of <a href="bmh_SkCanvas_Reference?cl=9919#text">text</a> above (if negative) or below (if positive) the <a href="bmh_SkCanvas_Reference?cl=9919#path">path</a>.</td> + </tr> <tr> <td><code><strong>paint </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#Text">Text</a> size, blend, color, and so on, used to draw.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="25cc5452156d7f06e85f514913d46b5c"></fiddle-embed></div> + +--- + +<a name="drawTextOnPath"></a> +## drawTextOnPath + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void drawTextOnPath(const void* text, size_t byteLength, const SkPath& path, + const SkMatrix* matrix, const SkPaint& paint) +</pre> + +Draw <a href="bmh_SkCanvas_Reference?cl=9919#text">text</a> on <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> <a href="bmh_SkCanvas_Reference?cl=9919#path">path</a>, using <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>, <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>, and <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a>. +Origin of <a href="bmh_SkCanvas_Reference?cl=9919#text">text</a> is at beginning of <a href="bmh_SkCanvas_Reference?cl=9919#path">path</a> offset by <a href="bmh_SkCanvas_Reference?cl=9919#matrix">matrix</a>, if provided, before it is mapped to <a href="bmh_SkCanvas_Reference?cl=9919#path">path</a>. +If the <a href="bmh_SkCanvas_Reference?cl=9919#path">path</a> section corresponding the glyph advance is curved, the glyph +is drawn curved to match; control points in the glyph are mapped to projected points parallel +to the <a href="bmh_SkCanvas_Reference?cl=9919#path">path</a>. If the <a href="bmh_SkCanvas_Reference?cl=9919#text">text</a>'s advance is larger than the <a href="bmh_SkCanvas_Reference?cl=9919#path">path</a> length, the excess <a href="bmh_SkCanvas_Reference?cl=9919#text">text</a> is clipped. + +<a href="bmh_SkCanvas_Reference?cl=9919#text">text</a>'s meaning depends on <a href="bmh_SkPaint_Reference?cl=9919#Text_Encoding">Paint Text Encoding</a>; by default, <a href="bmh_SkCanvas_Reference?cl=9919#text">text</a> encoding is <a href="bmh_undocumented?cl=9919#UTF_8">UTF-8</a>. +Origin meaning depends on <a href="bmh_SkPaint_Reference?cl=9919#Text_Align">Paint Text Align</a> and <a href="bmh_SkPaint_Reference?cl=9919#Vertical_Text">Paint Vertical Text</a>; by default <a href="bmh_SkCanvas_Reference?cl=9919#text">text</a> +positions the first glyph's left side bearing at origin x and its +baseline at origin y. <a href="bmh_undocumented?cl=9919#Text">Text</a> size is affected by <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a> and <a href="bmh_SkPaint_Reference?cl=9919#Text_Size">Paint Text Size</a>. + +All elements of <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a>: <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a>, <a href="bmh_undocumented?cl=9919#Rasterizer">Rasterizer</a>, <a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a>, <a href="bmh_undocumented?cl=9919#Shader">Shader</a>, <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>, +<a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a>, and <a href="bmh_undocumented?cl=9919#Draw_Looper">Draw Looper</a>; apply to <a href="bmh_SkCanvas_Reference?cl=9919#text">text</a>. By default, <a href="bmh_SkCanvas_Reference?cl=9919#drawTextOnPath">drawTextOnPath</a> draws filled 12 point black +glyphs. + +### Parameters + +<table> <tr> <td><code><strong>text </strong></code></td> <td> +Character code points or glyphs drawn.</td> + </tr> <tr> <td><code><strong>byteLength </strong></code></td> <td> +Byte length of <a href="bmh_SkCanvas_Reference?cl=9919#text">text</a> array.</td> + </tr> <tr> <td><code><strong>path </strong></code></td> <td> +<a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> providing <a href="bmh_SkCanvas_Reference?cl=9919#text">text</a> baseline.</td> + </tr> <tr> <td><code><strong>matrix </strong></code></td> <td> +Optional transform of glyphs before mapping to <a href="bmh_SkCanvas_Reference?cl=9919#path">path</a>; or nullptr.</td> + </tr> <tr> <td><code><strong>paint </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#Text">Text</a> size, blend, color, and so on, used to draw.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="0f60797fbdce3d3c71c46b800e6bd6f8"></fiddle-embed></div> + +--- + +<a name="drawTextRSXform"></a> +## drawTextRSXform + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void drawTextRSXform(const void* text, size_t byteLength, + const SkRSXform xform[], const SkRect* cullRect, + const SkPaint& paint) +</pre> + +Draw <a href="bmh_SkCanvas_Reference?cl=9919#text">text</a>, transforming each glyph by the corresponding <a href="bmh_undocumented?cl=9919#SkRSXform">SkRSXform</a>, +using <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>, <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>, and <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a>. +<a href="bmh_undocumented?cl=9919#RSXform">RSXform</a> array specifies a separate square scale, rotation, and translation for +each glyph. +Optional <a href="bmh_undocumented?cl=9919#Rect">Rect</a> <a href="bmh_SkCanvas_Reference?cl=9919#cullRect">cullRect</a> is a conservative bounds of <a href="bmh_SkCanvas_Reference?cl=9919#text">text</a>, +taking into account <a href="bmh_undocumented?cl=9919#RSXform">RSXform</a> and <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a>. If cullrect is outside of <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>, canvas can +skip drawing. + +All elements of <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a>: <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a>, <a href="bmh_undocumented?cl=9919#Rasterizer">Rasterizer</a>, <a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a>, <a href="bmh_undocumented?cl=9919#Shader">Shader</a>, <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>, +<a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a>, and <a href="bmh_undocumented?cl=9919#Draw_Looper">Draw Looper</a>; apply to <a href="bmh_SkCanvas_Reference?cl=9919#text">text</a>. By default, <a href="bmh_SkCanvas_Reference?cl=9919#drawTextRSXform">drawTextRSXform</a> draws filled 12 point black +glyphs. + +### Parameters + +<table> <tr> <td><code><strong>text </strong></code></td> <td> +Character code points or glyphs drawn.</td> + </tr> <tr> <td><code><strong>byteLength </strong></code></td> <td> +Byte length of <a href="bmh_SkCanvas_Reference?cl=9919#text">text</a> array.</td> + </tr> <tr> <td><code><strong>xform </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#RSXform">RSXform</a> rotates, scales, and translates each glyph individually.</td> + </tr> <tr> <td><code><strong>cullRect </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#Rect">Rect</a> bounds of <a href="bmh_SkCanvas_Reference?cl=9919#text">text</a> for efficient clipping; or nullptr.</td> + </tr> <tr> <td><code><strong>paint </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#Text">Text</a> size, blend, color, and so on, used to draw.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="55c84c39890c7516f7c835c46b1b8fc9"></fiddle-embed></div> + +--- + +<a name="drawTextBlob"></a> +## drawTextBlob + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void drawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y, + const SkPaint& paint) +</pre> + +Draw <a href="bmh_undocumented?cl=9919#Text_Blob">Text Blob</a> <a href="bmh_SkCanvas_Reference?cl=9919#blob">blob</a> at (<a href="bmh_SkCanvas_Reference?cl=9919#x">x</a>, <a href="bmh_SkCanvas_Reference?cl=9919#y">y</a>), using <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>, <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>, and <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a>. +<a href="bmh_SkCanvas_Reference?cl=9919#blob">blob</a> contains glyphs, their positions, and <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a> attributes specific to text: +<a href="bmh_undocumented?cl=9919#Typeface">Typeface</a>, <a href="bmh_SkPaint_Reference?cl=9919#Text_Size">Paint Text Size</a>, <a href="bmh_SkPaint_Reference?cl=9919#Text_Scale_X">Paint Text Scale X</a>, <a href="bmh_SkPaint_Reference?cl=9919#Text_Skew_X">Paint Text Skew X</a>, <a href="bmh_SkPaint_Reference?cl=9919#Text_Align">Paint Text Align</a>, +<a href="bmh_SkPaint_Reference?cl=9919#Hinting">Paint Hinting</a>, <a href="bmh_SkPaint_Reference?cl=9919#Anti_alias">Anti-alias</a>, <a href="bmh_SkPaint_Reference?cl=9919#Fake_Bold">Paint Fake Bold</a>, <a href="bmh_SkPaint_Reference?cl=9919#Font_Embedded_Bitmaps">Font Embedded Bitmaps</a>, <a href="bmh_SkPaint_Reference?cl=9919#Full_Hinting_Spacing">Full Hinting Spacing</a>, +<a href="bmh_SkPaint_Reference?cl=9919#LCD_Text">LCD Text</a>, <a href="bmh_SkPaint_Reference?cl=9919#Linear_Text">Linear Text</a>, <a href="bmh_SkPaint_Reference?cl=9919#Subpixel_Text">Subpixel Text</a>, and <a href="bmh_SkPaint_Reference?cl=9919#Vertical_Text">Paint Vertical Text</a>. + +Elements of <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a>: <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a>, <a href="bmh_undocumented?cl=9919#Rasterizer">Rasterizer</a>, <a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a>, <a href="bmh_undocumented?cl=9919#Shader">Shader</a>, <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>, +<a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a>, and <a href="bmh_undocumented?cl=9919#Draw_Looper">Draw Looper</a>; apply to <a href="bmh_SkCanvas_Reference?cl=9919#blob">blob</a>. + +### Parameters + +<table> <tr> <td><code><strong>blob </strong></code></td> <td> +Glyphs, positions, and their paints' text size, typeface, and so on.</td> + </tr> <tr> <td><code><strong>x </strong></code></td> <td> +Horizontal offset applied to <a href="bmh_SkCanvas_Reference?cl=9919#blob">blob</a>.</td> + </tr> <tr> <td><code><strong>y </strong></code></td> <td> +Vertical offset applied to <a href="bmh_SkCanvas_Reference?cl=9919#blob">blob</a>.</td> + </tr> <tr> <td><code><strong>paint </strong></code></td> <td> +Blend, color, stroking, and so on, used to draw.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="b8c0a748ed5c328f38e00f5f3d12e5e6"></fiddle-embed></div> + +--- + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void drawTextBlob(const sk_sp<SkTextBlob>& blob, SkScalar x, SkScalar y, + const SkPaint& paint) +</pre> + +Draw <a href="bmh_undocumented?cl=9919#Text_Blob">Text Blob</a> <a href="bmh_SkCanvas_Reference?cl=9919#blob">blob</a> at (<a href="bmh_SkCanvas_Reference?cl=9919#x">x</a>, <a href="bmh_SkCanvas_Reference?cl=9919#y">y</a>), using <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>, <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>, and <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a>. +<a href="bmh_SkCanvas_Reference?cl=9919#blob">blob</a> contains glyphs, their positions, and <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a> attributes specific to text: +<a href="bmh_undocumented?cl=9919#Typeface">Typeface</a>, <a href="bmh_SkPaint_Reference?cl=9919#Text_Size">Paint Text Size</a>, <a href="bmh_SkPaint_Reference?cl=9919#Text_Scale_X">Paint Text Scale X</a>, <a href="bmh_SkPaint_Reference?cl=9919#Text_Skew_X">Paint Text Skew X</a>, <a href="bmh_SkPaint_Reference?cl=9919#Text_Align">Paint Text Align</a>, +<a href="bmh_SkPaint_Reference?cl=9919#Hinting">Paint Hinting</a>, <a href="bmh_SkPaint_Reference?cl=9919#Anti_alias">Anti-alias</a>, <a href="bmh_SkPaint_Reference?cl=9919#Fake_Bold">Paint Fake Bold</a>, <a href="bmh_SkPaint_Reference?cl=9919#Font_Embedded_Bitmaps">Font Embedded Bitmaps</a>, <a href="bmh_SkPaint_Reference?cl=9919#Full_Hinting_Spacing">Full Hinting Spacing</a>, +<a href="bmh_SkPaint_Reference?cl=9919#LCD_Text">LCD Text</a>, <a href="bmh_SkPaint_Reference?cl=9919#Linear_Text">Linear Text</a>, <a href="bmh_SkPaint_Reference?cl=9919#Subpixel_Text">Subpixel Text</a>, and <a href="bmh_SkPaint_Reference?cl=9919#Vertical_Text">Paint Vertical Text</a>. + +Elements of <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a>: <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a>, <a href="bmh_undocumented?cl=9919#Rasterizer">Rasterizer</a>, <a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a>, <a href="bmh_undocumented?cl=9919#Shader">Shader</a>, <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>, +<a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a>, and <a href="bmh_undocumented?cl=9919#Draw_Looper">Draw Looper</a>; apply to <a href="bmh_SkCanvas_Reference?cl=9919#blob">blob</a>. + +### Parameters + +<table> <tr> <td><code><strong>blob </strong></code></td> <td> +Glyphs, positions, and their paints' text size, typeface, and so on.</td> + </tr> <tr> <td><code><strong>x </strong></code></td> <td> +Horizontal offset applied to <a href="bmh_SkCanvas_Reference?cl=9919#blob">blob</a>.</td> + </tr> <tr> <td><code><strong>y </strong></code></td> <td> +Vertical offset applied to <a href="bmh_SkCanvas_Reference?cl=9919#blob">blob</a>.</td> + </tr> <tr> <td><code><strong>paint </strong></code></td> <td> +Blend, color, stroking, and so on, used to draw.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="d313ad4726518f5d44f6433887bb7ce9"><div><a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> attributes unrelated to text, like color, have no effect on <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a> in allocated <a href="bmh_undocumented?cl=9919#Text_Blob">Text Blob</a>. +<a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> attributes related to text, like text size, have no effect on <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a> passed to <a href="bmh_SkCanvas_Reference?cl=9919#drawTextBlob">drawTextBlob</a>.</div></fiddle-embed></div> + +--- + +<a name="drawPicture"></a> +## drawPicture + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void drawPicture(const SkPicture* picture) +</pre> + +Draw <a href="bmh_undocumented?cl=9919#Picture">Picture</a> <a href="bmh_SkCanvas_Reference?cl=9919#picture">picture</a>, using <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> and <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>. +<a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> and <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a> are unchanged by <a href="bmh_SkCanvas_Reference?cl=9919#picture">picture</a> contents, as if +<a href="bmh_SkCanvas_Reference?cl=9919#save">save</a> was called before and <a href="bmh_SkCanvas_Reference?cl=9919#restore">restore</a> was called after <a href="bmh_SkCanvas_Reference?cl=9919#drawPicture">drawPicture</a>. + +<a href="bmh_undocumented?cl=9919#Picture">Picture</a> records a series of draw commands for later playback. + +### Parameters + +<table> <tr> <td><code><strong>picture </strong></code></td> <td> +Recorded drawing commands to play.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="fde216281ff93d612768a49f2cf309ae"></fiddle-embed></div> + +--- + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void drawPicture(const sk_sp<SkPicture>& picture) +</pre> + +Draw <a href="bmh_undocumented?cl=9919#Picture">Picture</a> <a href="bmh_SkCanvas_Reference?cl=9919#picture">picture</a>, using <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> and <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>. +<a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> and <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a> are unchanged by <a href="bmh_SkCanvas_Reference?cl=9919#picture">picture</a> contents, as if +<a href="bmh_SkCanvas_Reference?cl=9919#save">save</a> was called before and <a href="bmh_SkCanvas_Reference?cl=9919#restore">restore</a> was called after <a href="bmh_SkCanvas_Reference?cl=9919#drawPicture">drawPicture</a>. + +<a href="bmh_undocumented?cl=9919#Picture">Picture</a> records a series of draw commands for later playback. + +### Parameters + +<table> <tr> <td><code><strong>picture </strong></code></td> <td> +Recorded drawing commands to play.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="a7373b01354dda73dafe8718f4fd0cfc"></fiddle-embed></div> + +--- + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void drawPicture(const SkPicture* picture, const SkMatrix* matrix, + const SkPaint* paint) +</pre> + +Draw <a href="bmh_undocumented?cl=9919#Picture">Picture</a> <a href="bmh_SkCanvas_Reference?cl=9919#picture">picture</a>, using <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> and <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>; +transforming <a href="bmh_SkCanvas_Reference?cl=9919#picture">picture</a> with <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a> <a href="bmh_SkCanvas_Reference?cl=9919#matrix">matrix</a>, if provided; +and use <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a> <a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a>, <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>, <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a>, and <a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a>, if provided. + +<a href="bmh_SkCanvas_Reference?cl=9919#matrix">matrix</a> transformation is equivalent to: <a href="bmh_SkCanvas_Reference?cl=9919#save">save</a>, <a href="bmh_SkCanvas_Reference?cl=9919#concat">concat</a>, <a href="bmh_SkCanvas_Reference?cl=9919#drawPicture">drawPicture</a>, <a href="bmh_SkCanvas_Reference?cl=9919#restore">restore</a>. +<a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a> use is equivalent to: <a href="bmh_SkCanvas_Reference?cl=9919#saveLayer">saveLayer</a>, <a href="bmh_SkCanvas_Reference?cl=9919#drawPicture">drawPicture</a>, <a href="bmh_SkCanvas_Reference?cl=9919#restore">restore</a>. + +### Parameters + +<table> <tr> <td><code><strong>picture </strong></code></td> <td> +Recorded drawing commands to play.</td> + </tr> <tr> <td><code><strong>matrix </strong></code></td> <td> +Optional <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a> to rotate, scale, translate, and so on; or nullptr.</td> + </tr> <tr> <td><code><strong>paint </strong></code></td> <td> +Optional <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> to apply transparency, filtering, and so on; or nullptr.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="4ec028d8ffa0a6ae1a99ff8d094b02bc"></fiddle-embed></div> + +--- + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void drawPicture(const sk_sp<SkPicture>& picture, const SkMatrix* matrix, + const SkPaint* paint) +</pre> + +Draw <a href="bmh_undocumented?cl=9919#Picture">Picture</a> <a href="bmh_SkCanvas_Reference?cl=9919#picture">picture</a>, using <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> and <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>; +transforming <a href="bmh_SkCanvas_Reference?cl=9919#picture">picture</a> with <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a> <a href="bmh_SkCanvas_Reference?cl=9919#matrix">matrix</a>, if provided; +and use <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a> <a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a>, <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>, <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a>, and <a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a>, if provided. + +<a href="bmh_SkCanvas_Reference?cl=9919#matrix">matrix</a> transformation is equivalent to: <a href="bmh_SkCanvas_Reference?cl=9919#save">save</a>, <a href="bmh_SkCanvas_Reference?cl=9919#concat">concat</a>, <a href="bmh_SkCanvas_Reference?cl=9919#drawPicture">drawPicture</a>, <a href="bmh_SkCanvas_Reference?cl=9919#restore">restore</a>. +<a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a> use is equivalent to: <a href="bmh_SkCanvas_Reference?cl=9919#saveLayer">saveLayer</a>, <a href="bmh_SkCanvas_Reference?cl=9919#drawPicture">drawPicture</a>, <a href="bmh_SkCanvas_Reference?cl=9919#restore">restore</a>. + +### Parameters + +<table> <tr> <td><code><strong>picture </strong></code></td> <td> +Recorded drawing commands to play.</td> + </tr> <tr> <td><code><strong>matrix </strong></code></td> <td> +Optional <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a> to rotate, scale, translate, and so on; or nullptr.</td> + </tr> <tr> <td><code><strong>paint </strong></code></td> <td> +Optional <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> to apply transparency, filtering, and so on; or nullptr.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="7295eb14091e98565cec0353661a6a7d"></fiddle-embed></div> + +--- + +<a name="drawVertices"></a> +## drawVertices + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void drawVertices(const SkVertices* vertices, SkBlendMode mode, + const SkPaint& paint) +</pre> + +Draw <a href="bmh_undocumented?cl=9919#Vertices">Vertices</a> <a href="bmh_SkCanvas_Reference?cl=9919#vertices">vertices</a>, a triangle mesh, using <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> and <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>. +If <a href="bmh_undocumented?cl=9919#Texs">Vertices Texs</a> and <a href="bmh_undocumented?cl=9919#Colors">Vertices Colors</a> are defined in <a href="bmh_SkCanvas_Reference?cl=9919#vertices">vertices</a>, and <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a> contains <a href="bmh_undocumented?cl=9919#Shader">Shader</a>, +<a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a> <a href="bmh_SkCanvas_Reference?cl=9919#mode">mode</a> combines <a href="bmh_undocumented?cl=9919#Colors">Vertices Colors</a> with <a href="bmh_undocumented?cl=9919#Shader">Shader</a>. + +### Parameters + +<table> <tr> <td><code><strong>vertices </strong></code></td> <td> +The triangle mesh to draw.</td> + </tr> <tr> <td><code><strong>mode </strong></code></td> <td> +Combines <a href="bmh_undocumented?cl=9919#Colors">Vertices Colors</a> with <a href="bmh_undocumented?cl=9919#Shader">Shader</a>, if both are present.</td> + </tr> <tr> <td><code><strong>paint </strong></code></td> <td> +Specifies the <a href="bmh_undocumented?cl=9919#Shader">Shader</a>, used as <a href="bmh_undocumented?cl=9919#Vertices">Vertices</a> texture, if present.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="f48b22eaad1bb7adcc3faaa321754af6"></fiddle-embed></div> + +--- + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void drawVertices(const sk_sp<SkVertices>& vertices, SkBlendMode mode, + const SkPaint& paint) +</pre> + +Draw <a href="bmh_undocumented?cl=9919#Vertices">Vertices</a> <a href="bmh_SkCanvas_Reference?cl=9919#vertices">vertices</a>, a triangle mesh, using <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> and <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>. +If <a href="bmh_undocumented?cl=9919#Texs">Vertices Texs</a> and <a href="bmh_undocumented?cl=9919#Colors">Vertices Colors</a> are defined in <a href="bmh_SkCanvas_Reference?cl=9919#vertices">vertices</a>, and <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a> contains <a href="bmh_undocumented?cl=9919#Shader">Shader</a>, +<a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a> <a href="bmh_SkCanvas_Reference?cl=9919#mode">mode</a> combines <a href="bmh_undocumented?cl=9919#Colors">Vertices Colors</a> with <a href="bmh_undocumented?cl=9919#Shader">Shader</a>. + +### Parameters + +<table> <tr> <td><code><strong>vertices </strong></code></td> <td> +The triangle mesh to draw.</td> + </tr> <tr> <td><code><strong>mode </strong></code></td> <td> +Combines <a href="bmh_undocumented?cl=9919#Colors">Vertices Colors</a> with <a href="bmh_undocumented?cl=9919#Shader">Shader</a>, if both are present.</td> + </tr> <tr> <td><code><strong>paint </strong></code></td> <td> +Specifies the <a href="bmh_undocumented?cl=9919#Shader">Shader</a>, used as <a href="bmh_undocumented?cl=9919#Vertices">Vertices</a> texture, if present.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="94e32538646d5f1299c427e473f9ec87"></fiddle-embed></div> + +--- + +<a name="drawPatch"></a> +## drawPatch + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void drawPatch(const SkPoint cubics[12], const SkColor colors[4], + const SkPoint texCoords[4], SkBlendMode mode, + const SkPaint& paint) +</pre> + +Draw a cubic <a href="bmh_undocumented?cl=9919#Coons">Coons</a> patch: the interpolation of four <a href="bmh_SkCanvas_Reference?cl=9919#drawPatch">cubics</a> with shared corners, +associating a color, and optionally a texture coordinate, with each corner. + +The <a href="bmh_undocumented?cl=9919#Coons">Coons</a> patch uses <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> and <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>, <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a>'s <a href="bmh_undocumented?cl=9919#Shader">Shader</a>, <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>, <a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a>, +<a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a>, and <a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a>. If <a href="bmh_undocumented?cl=9919#Shader">Shader</a> is provided it is treated as the <a href="bmh_undocumented?cl=9919#Coons">Coons</a> +patch texture; <a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a> <a href="bmh_SkCanvas_Reference?cl=9919#mode">mode</a> combines <a href="bmh_undocumented?cl=9919#Color">Color</a> <a href="bmh_SkCanvas_Reference?cl=9919#drawPatch">colors</a> and <a href="bmh_undocumented?cl=9919#Shader">Shader</a> if both are provided. + +### Parameters + +<table> <tr> <td><code><strong>cubics </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#Point">Point</a> array <a href="bmh_SkCanvas_Reference?cl=9919#drawPatch">cubics</a> specifying the four <a href="bmh_SkCanvas_Reference?cl=9919#drawPatch">cubics</a> starting at the top left corner,</td> + </tr> <tr> <td><code><strong>colors </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#Color">Color</a> array color associating <a href="bmh_SkCanvas_Reference?cl=9919#drawPatch">colors</a> with corners in top left, top right, bottom right,</td> + </tr> <tr> <td><code><strong>texCoords </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#Point">Point</a> array <a href="bmh_SkCanvas_Reference?cl=9919#drawPatch">texCoords</a> mapping <a href="bmh_undocumented?cl=9919#Shader">Shader</a> as texture to corners in same order, if <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a></td> + </tr> <tr> <td><code><strong>mode </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a> for <a href="bmh_SkCanvas_Reference?cl=9919#drawPatch">colors</a> and <a href="bmh_undocumented?cl=9919#Shader">Shader</a> if present.</td> + </tr> <tr> <td><code><strong>paint </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#Shader">Shader</a>, <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>, <a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a>, used to draw.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="accb545d67984ced168f5be6ab824795"></fiddle-embed></div> + +--- + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void drawPatch(const SkPoint cubics[12], const SkColor colors[4], + const SkPoint texCoords[4], const SkPaint& paint) +</pre> + +Draw a cubic <a href="bmh_undocumented?cl=9919#Coons">Coons</a> patch: the interpolation of four <a href="bmh_SkCanvas_Reference?cl=9919#drawPatch_2">cubics</a> with shared corners, +associating a color, a texture coordinate, or both, with each corner. + +The <a href="bmh_undocumented?cl=9919#Coons">Coons</a> patch uses <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> and <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>, <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a>'s <a href="bmh_undocumented?cl=9919#Shader">Shader</a>, <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>, <a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a>, +<a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a>, (?) and <a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a>. If <a href="bmh_undocumented?cl=9919#Shader">Shader</a> is provided it is treated as the <a href="bmh_undocumented?cl=9919#Coons">Coons</a> +patch texture. + +### Parameters + +<table> <tr> <td><code><strong>cubics </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#Point">Point</a> array <a href="bmh_SkCanvas_Reference?cl=9919#drawPatch_2">cubics</a> specifying the four <a href="bmh_SkCanvas_Reference?cl=9919#drawPatch_2">cubics</a> starting at the top left corner,</td> + </tr> <tr> <td><code><strong>colors </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#Color">Color</a> array color associating <a href="bmh_SkCanvas_Reference?cl=9919#drawPatch_2">colors</a> with corners in top left, top right, bottom right,</td> + </tr> <tr> <td><code><strong>texCoords </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#Point">Point</a> array <a href="bmh_SkCanvas_Reference?cl=9919#drawPatch_2">texCoords</a> mapping <a href="bmh_undocumented?cl=9919#Shader">Shader</a> as texture to corners in same order, if <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a></td> + </tr> <tr> <td><code><strong>paint </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#Shader">Shader</a>, <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>, <a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a>, used to draw.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="4cf70f8d194867d053d7e177e5088445"></fiddle-embed></div> + +### Example + +<div><fiddle-embed name="3412c2a16cb529af0e04878d264451f2"></fiddle-embed></div> + +--- + +<a name="drawAtlas"></a> +## drawAtlas + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void drawAtlas(const SkImage* atlas, const SkRSXform xform[], const SkRect tex[], + const SkColor colors[], int count, SkBlendMode mode, + const SkRect* cullRect, const SkPaint* paint) +</pre> + +Draw a set of sprites from <a href="bmh_SkCanvas_Reference?cl=9919#atlas">atlas</a>, using <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>, <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>, and optional <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a>. +<a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a> uses <a href="bmh_SkPaint_Reference?cl=9919#Anti_alias">Anti-alias</a>, <a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a>, <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>, <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a>, and <a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a> to draw, if present. +For each entry in the array, <a href="bmh_undocumented?cl=9919#Rect">Rect</a> <a href="bmh_SkCanvas_Reference?cl=9919#tex">tex</a> locates sprite in <a href="bmh_SkCanvas_Reference?cl=9919#atlas">atlas</a>, and <a href="bmh_undocumented?cl=9919#RSXform">RSXform</a> <a href="bmh_SkCanvas_Reference?cl=9919#xform">xform</a> transforms it +into destination space. +<a href="bmh_SkCanvas_Reference?cl=9919#xform">xform</a>, text, and <a href="bmh_SkCanvas_Reference?cl=9919#colors">colors</a> if present, must contain <a href="bmh_SkCanvas_Reference?cl=9919#count">count</a> entries. +Optional <a href="bmh_SkCanvas_Reference?cl=9919#colors">colors</a> is applied for each sprite using <a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a>. +Optional <a href="bmh_SkCanvas_Reference?cl=9919#cullRect">cullRect</a> is a conservative bounds of all transformed sprites. +If cullrect is outside of <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>, canvas can skip drawing. + +### Parameters + +<table> <tr> <td><code><strong>atlas </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#Image">Image</a> containing sprites.</td> + </tr> <tr> <td><code><strong>xform </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#RSXform">RSXform</a> mappings for sprites in <a href="bmh_SkCanvas_Reference?cl=9919#atlas">atlas</a>.</td> + </tr> <tr> <td><code><strong>tex </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#Rect">Rect</a> locations of sprites in <a href="bmh_SkCanvas_Reference?cl=9919#atlas">atlas</a>.</td> + </tr> <tr> <td><code><strong>colors </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#Color">Color</a>, one per sprite, blended with sprite using <a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a>; or nullptr.</td> + </tr> <tr> <td><code><strong>count </strong></code></td> <td> +Number of sprites to draw.</td> + </tr> <tr> <td><code><strong>mode </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a> combining <a href="bmh_SkCanvas_Reference?cl=9919#colors">colors</a> and sprites.</td> + </tr> <tr> <td><code><strong>cullRect </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#Rect">Rect</a> bounds of transformed sprites for efficient clipping; or nullptr.</td> + </tr> <tr> <td><code><strong>paint </strong></code></td> <td> +<a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>, <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a>, <a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a>, and so on; or nullptr.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="1df575f9b8132306ce0552a2554ed132"></fiddle-embed></div> + +--- + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void drawAtlas(const sk_sp<SkImage>& atlas, const SkRSXform xform[], + const SkRect tex[], const SkColor colors[], int count, + SkBlendMode mode, const SkRect* cullRect, const SkPaint* paint) +</pre> + +Draw a set of sprites from <a href="bmh_SkCanvas_Reference?cl=9919#atlas">atlas</a>, using <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>, <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>, and optional <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a>. +<a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a> uses <a href="bmh_SkPaint_Reference?cl=9919#Anti_alias">Anti-alias</a>, <a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a>, <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>, <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a>, and <a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a> to draw, if present. +For each entry in the array, <a href="bmh_undocumented?cl=9919#Rect">Rect</a> <a href="bmh_SkCanvas_Reference?cl=9919#tex">tex</a> locates sprite in <a href="bmh_SkCanvas_Reference?cl=9919#atlas">atlas</a>, and <a href="bmh_undocumented?cl=9919#RSXform">RSXform</a> <a href="bmh_SkCanvas_Reference?cl=9919#xform">xform</a> transforms it +into destination space. +<a href="bmh_SkCanvas_Reference?cl=9919#xform">xform</a>, text, and <a href="bmh_SkCanvas_Reference?cl=9919#colors">colors</a> if present, must contain <a href="bmh_SkCanvas_Reference?cl=9919#count">count</a> entries. +Optional <a href="bmh_SkCanvas_Reference?cl=9919#colors">colors</a> is applied for each sprite using <a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a>. +Optional <a href="bmh_SkCanvas_Reference?cl=9919#cullRect">cullRect</a> is a conservative bounds of all transformed sprites. +If cullrect is outside of <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>, canvas can skip drawing. + +### Parameters + +<table> <tr> <td><code><strong>atlas </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#Image">Image</a> containing sprites.</td> + </tr> <tr> <td><code><strong>xform </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#RSXform">RSXform</a> mappings for sprites in <a href="bmh_SkCanvas_Reference?cl=9919#atlas">atlas</a>.</td> + </tr> <tr> <td><code><strong>tex </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#Rect">Rect</a> locations of sprites in <a href="bmh_SkCanvas_Reference?cl=9919#atlas">atlas</a>.</td> + </tr> <tr> <td><code><strong>colors </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#Color">Color</a>, one per sprite, blended with sprite using <a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a>; or nullptr.</td> + </tr> <tr> <td><code><strong>count </strong></code></td> <td> +Number of sprites to draw.</td> + </tr> <tr> <td><code><strong>mode </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a> combining <a href="bmh_SkCanvas_Reference?cl=9919#colors">colors</a> and sprites.</td> + </tr> <tr> <td><code><strong>cullRect </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#Rect">Rect</a> bounds of transformed sprites for efficient clipping; or nullptr.</td> + </tr> <tr> <td><code><strong>paint </strong></code></td> <td> +<a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>, <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a>, <a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a>, and so on; or nullptr.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="0e66a8f230a8d531bcef9f5ebdc5aac1"></fiddle-embed></div> + +--- + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void drawAtlas(const SkImage* atlas, const SkRSXform xform[], const SkRect tex[], + int count, const SkRect* cullRect, const SkPaint* paint) +</pre> + +Draw a set of sprites from <a href="bmh_SkCanvas_Reference?cl=9919#atlas">atlas</a>, using <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>, <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>, and optional <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a>. +<a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a> uses <a href="bmh_SkPaint_Reference?cl=9919#Anti_alias">Anti-alias</a>, <a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a>, <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>, <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a>, and <a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a> to draw, if present. +For each entry in the array, <a href="bmh_undocumented?cl=9919#Rect">Rect</a> <a href="bmh_SkCanvas_Reference?cl=9919#tex">tex</a> locates sprite in <a href="bmh_SkCanvas_Reference?cl=9919#atlas">atlas</a>, and <a href="bmh_undocumented?cl=9919#RSXform">RSXform</a> <a href="bmh_SkCanvas_Reference?cl=9919#xform">xform</a> transforms it +into destination space. +<a href="bmh_SkCanvas_Reference?cl=9919#xform">xform</a> and text must contain <a href="bmh_SkCanvas_Reference?cl=9919#count">count</a> entries. +Optional <a href="bmh_SkCanvas_Reference?cl=9919#cullRect">cullRect</a> is a conservative bounds of all transformed sprites. +If cullrect is outside of <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>, canvas can skip drawing. + +### Parameters + +<table> <tr> <td><code><strong>atlas </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#Image">Image</a> containing sprites.</td> + </tr> <tr> <td><code><strong>xform </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#RSXform">RSXform</a> mappings for sprites in <a href="bmh_SkCanvas_Reference?cl=9919#atlas">atlas</a>.</td> + </tr> <tr> <td><code><strong>tex </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#Rect">Rect</a> locations of sprites in <a href="bmh_SkCanvas_Reference?cl=9919#atlas">atlas</a>.</td> + </tr> <tr> <td><code><strong>count </strong></code></td> <td> +Number of sprites to draw.</td> + </tr> <tr> <td><code><strong>cullRect </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#Rect">Rect</a> bounds of transformed sprites for efficient clipping; or nullptr.</td> + </tr> <tr> <td><code><strong>paint </strong></code></td> <td> +<a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>, <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a>, <a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a>, and so on; or nullptr.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="8dc0d0fdeab20bbc21cac6874ddbefcd"></fiddle-embed></div> + +--- + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void drawAtlas(const sk_sp<SkImage>& atlas, const SkRSXform xform[], + const SkRect tex[], int count, const SkRect* cullRect, + const SkPaint* paint) +</pre> + +Draw a set of sprites from <a href="bmh_SkCanvas_Reference?cl=9919#atlas">atlas</a>, using <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>, <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>, and optional <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> <a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a>. +<a href="bmh_SkCanvas_Reference?cl=9919#paint">paint</a> uses <a href="bmh_SkPaint_Reference?cl=9919#Anti_alias">Anti-alias</a>, <a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a>, <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>, <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a>, and <a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a> to draw, if present. +For each entry in the array, <a href="bmh_undocumented?cl=9919#Rect">Rect</a> <a href="bmh_SkCanvas_Reference?cl=9919#tex">tex</a> locates sprite in <a href="bmh_SkCanvas_Reference?cl=9919#atlas">atlas</a>, and <a href="bmh_undocumented?cl=9919#RSXform">RSXform</a> <a href="bmh_SkCanvas_Reference?cl=9919#xform">xform</a> transforms it +into destination space. +<a href="bmh_SkCanvas_Reference?cl=9919#xform">xform</a> and text must contain <a href="bmh_SkCanvas_Reference?cl=9919#count">count</a> entries. +Optional <a href="bmh_SkCanvas_Reference?cl=9919#cullRect">cullRect</a> is a conservative bounds of all transformed sprites. +If cullrect is outside of <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a>, canvas can skip drawing. + +### Parameters + +<table> <tr> <td><code><strong>atlas </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#Image">Image</a> containing sprites.</td> + </tr> <tr> <td><code><strong>xform </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#RSXform">RSXform</a> mappings for sprites in <a href="bmh_SkCanvas_Reference?cl=9919#atlas">atlas</a>.</td> + </tr> <tr> <td><code><strong>tex </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#Rect">Rect</a> locations of sprites in <a href="bmh_SkCanvas_Reference?cl=9919#atlas">atlas</a>.</td> + </tr> <tr> <td><code><strong>count </strong></code></td> <td> +Number of sprites to draw.</td> + </tr> <tr> <td><code><strong>cullRect </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#Rect">Rect</a> bounds of transformed sprites for efficient clipping; or nullptr.</td> + </tr> <tr> <td><code><strong>paint </strong></code></td> <td> +<a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>, <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a>, <a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a>, and so on; or nullptr.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="c093c2b14bd3e6171ede7cd4049d9b57"></fiddle-embed></div> + +--- + +<a name="drawDrawable"></a> +## drawDrawable + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void drawDrawable(SkDrawable* drawable, const SkMatrix* matrix = NULL) +</pre> + +Draw <a href="bmh_undocumented?cl=9919#Drawable">Drawable</a> <a href="bmh_SkCanvas_Reference?cl=9919#drawable">drawable</a> using <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> and <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>, concatenated with +optional <a href="bmh_SkCanvas_Reference?cl=9919#matrix">matrix</a>. + +If <a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> has an asynchronous implementation, as is the case +when it is recording into <a href="bmh_undocumented?cl=9919#Picture">Picture</a>, then <a href="bmh_SkCanvas_Reference?cl=9919#drawable">drawable</a> will be referenced, +so that <a href="bmh_undocumented?cl=9919#draw">SkDrawable::draw()</a> can be called when the operation is finalized. To force +immediate drawing, call <a href="bmh_undocumented?cl=9919#draw">SkDrawable::draw()</a> instead. + +### Parameters + +<table> <tr> <td><code><strong>drawable </strong></code></td> <td> +Custom struct encapsulating drawing commands.</td> + </tr> <tr> <td><code><strong>matrix </strong></code></td> <td> +Transformation applied to drawing; or nullptr.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="3a4dfcd08838866b5cfc0d82489195ba"></fiddle-embed></div> + +--- + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void drawDrawable(SkDrawable* drawable, SkScalar x, SkScalar y) +</pre> + +Draw <a href="bmh_undocumented?cl=9919#Drawable">Drawable</a> <a href="bmh_SkCanvas_Reference?cl=9919#drawable">drawable</a> using <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> and <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Matrix</a>, offset by (<a href="bmh_SkCanvas_Reference?cl=9919#x">x</a>, <a href="bmh_SkCanvas_Reference?cl=9919#y">y</a>). + +If <a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> has an asynchronous implementation, as is the case +when it is recording into <a href="bmh_undocumented?cl=9919#Picture">Picture</a>, then <a href="bmh_SkCanvas_Reference?cl=9919#drawable">drawable</a> will be referenced, +so that <a href="bmh_undocumented?cl=9919#draw">SkDrawable::draw()</a> can be called when the operation is finalized. To force +immediate drawing, call <a href="bmh_undocumented?cl=9919#draw">SkDrawable::draw()</a> instead. + +### Parameters + +<table> <tr> <td><code><strong>drawable </strong></code></td> <td> +Custom struct encapsulating drawing commands.</td> + </tr> <tr> <td><code><strong>x </strong></code></td> <td> +Offset into <a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> writable pixels in <a href="bmh_SkCanvas_Reference?cl=9919#x">x</a>.</td> + </tr> <tr> <td><code><strong>y </strong></code></td> <td> +Offset into <a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> writable pixels in <a href="bmh_SkCanvas_Reference?cl=9919#y">y</a>.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="1bdc07ad3b154c89b771722c2fcaee3f"></fiddle-embed></div> + +--- + +<a name="drawAnnotation"></a> +## drawAnnotation + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void drawAnnotation(const SkRect& rect, const char key[], SkData* value) +</pre> + +Associate <a href="bmh_undocumented?cl=9919#Rect">Rect</a> on <a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> when an annotation; a key-value pair, where the <a href="bmh_SkCanvas_Reference?cl=9919#key">key</a> is +a null-terminated utf8 string, and optional <a href="bmh_SkCanvas_Reference?cl=9919#value">value</a> is stored as <a href="bmh_undocumented?cl=9919#Data">Data</a>. + +Only some canvas implementations, such as recording to <a href="bmh_undocumented?cl=9919#Picture">Picture</a>, or drawing to +<a href="bmh_undocumented?cl=9919#PDF">Document PDF</a>, use annotations. + +### Parameters + +<table> <tr> <td><code><strong>rect </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#Rect">Rect</a> extent of canvas to annotate.</td> + </tr> <tr> <td><code><strong>key </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#String">String</a> used for lookup.</td> + </tr> <tr> <td><code><strong>value </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#Data">Data</a> holding <a href="bmh_SkCanvas_Reference?cl=9919#value">value</a> stored in annotation.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="00b430bd80d740e19c6d020a940f56d5"></fiddle-embed></div> + +--- + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void drawAnnotation(const SkRect& rect, const char key[], + const sk_sp<SkData>& value) +</pre> + +Associate <a href="bmh_undocumented?cl=9919#Rect">Rect</a> on <a href="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> when an annotation; a key-value pair, where the <a href="bmh_SkCanvas_Reference?cl=9919#key">key</a> is +a null-terminated utf8 string, and optional <a href="bmh_SkCanvas_Reference?cl=9919#value">value</a> is stored as <a href="bmh_undocumented?cl=9919#Data">Data</a>. + +Only some canvas implementations, such as recording to <a href="bmh_undocumented?cl=9919#Picture">Picture</a>, or drawing to +<a href="bmh_undocumented?cl=9919#PDF">Document PDF</a>, use annotations. + +### Parameters + +<table> <tr> <td><code><strong>rect </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#Rect">Rect</a> extent of canvas to annotate.</td> + </tr> <tr> <td><code><strong>key </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#String">String</a> used for lookup.</td> + </tr> <tr> <td><code><strong>value </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#Data">Data</a> holding <a href="bmh_SkCanvas_Reference?cl=9919#value">value</a> stored in annotation.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="00b430bd80d740e19c6d020a940f56d5"></fiddle-embed></div> + +--- + +<a name="getDrawFilter"></a> +## getDrawFilter + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +SkDrawFilter* getDrawFilter() const +</pre> + +Legacy call to be deprecated. + +--- + +<a name="setDrawFilter"></a> +## setDrawFilter + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +virtual SkDrawFilter* setDrawFilter(SkDrawFilter* filter) +</pre> + +Legacy call to be deprecated. + +--- + +<a name="isClipEmpty"></a> +## isClipEmpty + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +virtual bool isClipEmpty() const +</pre> + +Returns true if <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> is empty; that is, nothing will draw. + +<a href="bmh_SkCanvas_Reference?cl=9919#isClipEmpty">isClipEmpty</a> may do work when called; it should not be called +more often than needed. However, once called, subsequent calls perform no +work until <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> changes. + +### Return Value + +true if <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> is empty. + +### Example + +<div><fiddle-embed name="f106f146a58c8604308d4d8d7086d2f5"> + +#### Example Output + +~~~~ +clip is not empty +clip is empty +~~~~ + +</fiddle-embed></div> + +--- + +<a name="isClipRect"></a> +## isClipRect + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +virtual bool isClipRect() const +</pre> + +Returns true if <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> is <a href="bmh_undocumented?cl=9919#Rect">Rect</a> and not empty. +Returns false if the clip is empty, or if it is not <a href="bmh_undocumented?cl=9919#Rect">Rect</a>. + +### Return Value + +true if <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Clip</a> is <a href="bmh_undocumented?cl=9919#Rect">Rect</a> and not empty. + +### Example + +<div><fiddle-embed name="9894bfb476c78a8f6c8f49fbbca3d50d"> + +#### Example Output + +~~~~ +clip is rect +clip is not rect +~~~~ + +</fiddle-embed></div> + +--- + diff --git a/site/user/api/SkPaint_Reference.md b/site/user/api/SkPaint_Reference.md new file mode 100644 index 0000000000..ae938fbffe --- /dev/null +++ b/site/user/api/SkPaint_Reference.md @@ -0,0 +1,5190 @@ +SkPaint Reference +=== + +# <a name="Paint"></a> Paint +<a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> controls options applied when drawing and measuring. <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> collects all +options outside of the <a href="bmh_SkCanvas_Reference?cl=9919#Clip">Canvas Clip</a> and <a href="bmh_SkCanvas_Reference?cl=9919#Matrix">Canvas Matrix</a>. + +Various options apply to text, strokes and fills, and images. + +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="bmh_SkCanvas_Reference?cl=9919#Canvas">Canvas</a> +functionality; for instance, text size is identical to matrix scale. + +<a href="bmh_SkPaint_Reference?cl=9919#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="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a>. + +<a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> collects effects and filters that describe single-pass and multiple-pass +algorithms that alter the drawing geometry, color, and transparency. For instance, +<a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> does not directly implement dashing or blur, but contains the objects that do so. + +The objects contained by <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> are opaque, and cannot be edited outside of the <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> +to affect it. The implementation is free to defer computations associated with the +<a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a>, or ignore them altogether. For instance, some <a href="bmh_undocumented?cl=9919#GPU">GPU</a> implementations draw all +<a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> geometries with anti-aliasing, regardless of <a href="bmh_SkPaint_Reference?cl=9919#kAntiAlias_Flag">SkPaint::kAntiAlias Flag</a> setting. + +<a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> describes a single color, a single font, a single image quality, and so on. +Multiple colors are drawn either by using multiple paints or with objects like +<a href="bmh_undocumented?cl=9919#Shader">Shader</a> attached to <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a>. + +# <a name="SkPaint"></a> Class SkPaint + +# <a name="Overview"></a> Overview + +## <a name="Subtopics"></a> Subtopics + +| topics | description | +| --- | --- | +| <a href="bmh_SkPaint_Reference?cl=9919#Initializers">Initializers</a> | Constructors and initialization. | +| <a href="bmh_SkPaint_Reference?cl=9919#Destructor">Destructor</a> | <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> termination. | +| <a href="bmh_SkPaint_Reference?cl=9919#Management">Management</a> | <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> copying, moving, comparing. | +| <a href="bmh_SkPaint_Reference?cl=9919#Hinting">Hinting</a> | <a href="bmh_undocumented?cl=9919#Glyph">Glyph</a> outline adjustment. | +| <a href="bmh_SkPaint_Reference?cl=9919#Flags">Flags</a> | Attributes represented by single bits. | +| <a href="bmh_SkPaint_Reference?cl=9919#Anti_alias">Anti-alias</a> | Approximating coverage with transparency. | +| <a href="bmh_SkPaint_Reference?cl=9919#Dither">Dither</a> | Distributing color error. | +| <a href="bmh_SkPaint_Reference?cl=9919#Device_Text">Device Text</a> | Increase precision of glyph position. | +| <a href="bmh_SkPaint_Reference?cl=9919#Font_Embedded_Bitmaps">Font Embedded Bitmaps</a> | Custom-sized bitmap glyphs. | +| <a href="bmh_SkPaint_Reference?cl=9919#Automatic_Hinting">Automatic Hinting</a> | Always adjust glyph paths. | +| <a href="bmh_SkPaint_Reference?cl=9919#Vertical_Text">Vertical Text</a> | Orient text from top to bottom. | +| <a href="bmh_SkPaint_Reference?cl=9919#Fake_Bold">Fake Bold</a> | Approximate font styles. | +| <a href="bmh_SkPaint_Reference?cl=9919#Full_Hinting_Spacing">Full Hinting Spacing</a> | <a href="bmh_undocumented?cl=9919#Glyph">Glyph</a> spacing affected by hinting. | +| <a href="bmh_SkPaint_Reference?cl=9919#Filter_Quality_Methods">Filter Quality Methods</a> | Get and set <a href="bmh_undocumented?cl=9919#Filter_Quality">Filter Quality</a>. | +| <a href="bmh_SkPaint_Reference?cl=9919#Color_Methods">Color Methods</a> | Get and set <a href="bmh_undocumented?cl=9919#Color">Color</a>. | +| <a href="bmh_SkPaint_Reference?cl=9919#Style">Style</a> | Geometry filling, stroking. | +| <a href="bmh_SkPaint_Reference?cl=9919#Stroke_Width">Stroke Width</a> | Thickness perpendicular to geometry. | +| <a href="bmh_SkPaint_Reference?cl=9919#Miter_Limit">Miter Limit</a> | Maximum length of stroked corners. | +| <a href="bmh_SkPaint_Reference?cl=9919#Stroke_Cap">Stroke Cap</a> | Decorations at ends of open strokes. | +| <a href="bmh_SkPaint_Reference?cl=9919#Stroke_Join">Stroke Join</a> | Decoration at corners of strokes. | +| <a href="bmh_SkPaint_Reference?cl=9919#Fill_Path">Fill Path</a> | Make <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> from <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a>, stroking. | +| <a href="bmh_SkPaint_Reference?cl=9919#Shader_Methods">Shader Methods</a> | Get and set <a href="bmh_undocumented?cl=9919#Shader">Shader</a>. | +| <a href="bmh_SkPaint_Reference?cl=9919#Color_Filter_Methods">Color Filter Methods</a> | Get and set <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>. | +| <a href="bmh_SkPaint_Reference?cl=9919#Blend_Mode_Methods">Blend Mode Methods</a> | Get and set <a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a>. | +| <a href="bmh_SkPaint_Reference?cl=9919#Path_Effect_Methods">Path Effect Methods</a> | Get and set <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a>. | +| <a href="bmh_SkPaint_Reference?cl=9919#Mask_Filter_Methods">Mask Filter Methods</a> | Get and set <a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a>. | +| <a href="bmh_SkPaint_Reference?cl=9919#Typeface_Methods">Typeface Methods</a> | Get and set <a href="bmh_undocumented?cl=9919#Typeface">Typeface</a>. | +| <a href="bmh_SkPaint_Reference?cl=9919#Rasterizer_Methods">Rasterizer Methods</a> | Get and set <a href="bmh_undocumented?cl=9919#Rasterizer">Rasterizer</a>. | +| <a href="bmh_SkPaint_Reference?cl=9919#Image_Filter_Methods">Image Filter Methods</a> | Get and set <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a>. | +| <a href="bmh_SkPaint_Reference?cl=9919#Draw_Looper_Methods">Draw Looper Methods</a> | Get and set <a href="bmh_undocumented?cl=9919#Draw_Looper">Draw Looper</a>. | +| <a href="bmh_SkPaint_Reference?cl=9919#Text_Align">Text Align</a> | <a href="bmh_undocumented?cl=9919#Text">Text</a> placement relative to position. | +| <a href="bmh_SkPaint_Reference?cl=9919#Text_Size">Text Size</a> | Overall height in points. | +| <a href="bmh_SkPaint_Reference?cl=9919#Text_Scale_X">Text Scale X</a> | <a href="bmh_undocumented?cl=9919#Text">Text</a> horizontal scale. | +| <a href="bmh_SkPaint_Reference?cl=9919#Text_Skew_X">Text Skew X</a> | <a href="bmh_undocumented?cl=9919#Text">Text</a> horizontal slant. | +| <a href="bmh_SkPaint_Reference?cl=9919#Text_Encoding">Text Encoding</a> | <a href="bmh_undocumented?cl=9919#Text">Text</a> encoded as characters or glyphs. | +| <a href="bmh_SkPaint_Reference?cl=9919#Font_Metrics">Font Metrics</a> | Common glyph dimensions. | +| <a href="bmh_SkPaint_Reference?cl=9919#Measure_Text">Measure Text</a> | Width, height, bounds of text. | +| <a href="bmh_SkPaint_Reference?cl=9919#Text_Path">Text Path</a> | Geometry of glyphs. | +| <a href="bmh_SkPaint_Reference?cl=9919#Text_Intercepts">Text Intercepts</a> | Advanced underline, strike through. | +| <a href="bmh_SkPaint_Reference?cl=9919#Fast_Bounds">Fast Bounds</a> | Appproxiate area required by <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a>. | + +## <a name="Constants"></a> Constants + +| constants | description | +| --- | --- | +| <a href="bmh_SkPaint_Reference?cl=9919#Align">Align</a> | <a href="bmh_undocumented?cl=9919#Glyph">Glyph</a> locations relative to text position. | +| <a href="bmh_SkPaint_Reference?cl=9919#Cap">Cap</a> | Start and end geometry on stroked shapes. | +| <a href="bmh_SkPaint_Reference?cl=9919#Flags">Flags</a> | Values described by bits and masks. | +| <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_FontMetricsFlags">FontMetrics::FontMetricsFlags</a> | Valid <a href="bmh_SkPaint_Reference?cl=9919#Font_Metrics">Font Metrics</a>. | +| <a href="bmh_SkPaint_Reference?cl=9919#Hinting">Hinting</a> | Level of glyph outline adjustment. | +| <a href="bmh_SkPaint_Reference?cl=9919#Join">Join</a> | Corner geometry on stroked shapes. | +| <a href="bmh_SkPaint_Reference?cl=9919#Style">Style</a> | Stroke, fill, or both. | +| <a href="bmh_SkPaint_Reference?cl=9919#TextEncoding">TextEncoding</a> | Character or glyph encoding size. | + +## <a name="Structs"></a> Structs + +| struct | description | +| --- | --- | +| <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics">FontMetrics</a> | <a href="bmh_undocumented?cl=9919#Typeface">Typeface</a> values. | + +## <a name="Constructors"></a> Constructors + +| | description | +| --- | --- | +| <a href="bmh_SkPaint_Reference?cl=9919#empty_constructor">SkPaint()</a> | Constructs with default values. | +| <a href="bmh_SkPaint_Reference?cl=9919#copy_constructor">SkPaint(const SkPaint& paint)</a> | Makes a shallow copy. | +| <a href="bmh_SkPaint_Reference?cl=9919#move_constructor">SkPaint(SkPaint&& paint)</a> | Moves paint without copying it. | +| | Decreases <a href="bmh_undocumented?cl=9919#Reference_Count">Reference Count</a> of owned objects. | + +## <a name="Operators"></a> Operators + +| operator | description | +| --- | --- | +| <a href="bmh_SkPaint_Reference?cl=9919#copy_assignment_operator">operator=(const SkPaint& paint)</a> | Makes a shallow copy. | +| <a href="bmh_SkPaint_Reference?cl=9919#move_assignment_operator">operator=(SkPaint&& paint)</a> | Moves paint without copying it. | +| <a href="bmh_SkPaint_Reference?cl=9919#equal_operator">operator==(const SkPaint& a, const SkPaint& b)</a> | Compares paints for equality. | +| <a href="bmh_SkPaint_Reference?cl=9919#not_equal_operator">operator!=(const SkPaint& a, const SkPaint& b)</a> | Compares paints for inequality. | + +## <a name="Member_Functions"></a> Member Functions + +| function | description | +| --- | --- | +| <a href="bmh_SkPaint_Reference?cl=9919#breakText">breakText</a> | Returns text that fits in a width. | +| <a href="bmh_SkPaint_Reference?cl=9919#canComputeFastBounds">canComputeFastBounds</a> | Returns true if settings allow for fast bounds computation. | +| <a href="bmh_SkPaint_Reference?cl=9919#computeFastBounds">computeFastBounds</a> | Returns fill bounds for quick reject tests. | +| <a href="bmh_SkPaint_Reference?cl=9919#computeFastStrokeBounds">computeFastStrokeBounds</a> | Returns stroke bounds for quick reject tests. | +| <a href="bmh_SkPaint_Reference?cl=9919#containsText">containsText</a> | Returns if all text corresponds to glyphs. | +| <a href="bmh_SkPaint_Reference?cl=9919#countText">countText</a> | Returns number of glyphs in text. | +| <a href="bmh_SkPaint_Reference?cl=9919#doComputeFastBounds">doComputeFastBounds</a> | Returns bounds for quick reject tests. | +| <a href="bmh_SkPaint_Reference?cl=9919#flatten">flatten</a> | Serializes into a buffer. | +| <a href="bmh_SkPaint_Reference?cl=9919#getAlpha">getAlpha</a> | Returns <a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a>, color opacity. | +| <a href="bmh_SkPaint_Reference?cl=9919#getBlendMode">getBlendMode</a> | Returns <a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a>, how colors combine with dest. | +| <a href="bmh_SkPaint_Reference?cl=9919#getColor">getColor</a> | Returns <a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a> and <a href="bmh_undocumented?cl=9919#RGB">Color RGB</a>, one drawing color. | +| <a href="bmh_SkPaint_Reference?cl=9919#getColorFilter">getColorFilter</a> | Returns <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>, how colors are altered. | +| <a href="bmh_SkPaint_Reference?cl=9919#getDrawLooper">getDrawLooper</a> | Returns <a href="bmh_undocumented?cl=9919#Draw_Looper">Draw Looper</a>, multiple layers. | +| <a href="bmh_SkPaint_Reference?cl=9919#getFillPath">getFillPath</a> | Returns fill path equivalent to stroke. | +| <a href="bmh_SkPaint_Reference?cl=9919#getFilterQuality">getFilterQuality</a> | Returns <a href="bmh_undocumented?cl=9919#Filter_Quality">Filter Quality</a>, image filtering level. | +| <a href="bmh_SkPaint_Reference?cl=9919#getFlags">getFlags</a> | Returns <a href="bmh_SkPaint_Reference?cl=9919#Flags">Flags</a> stored in a bit field. | +| <a href="bmh_SkPaint_Reference?cl=9919#getFontBounds">getFontBounds</a> | Returns union all glyph bounds. | +| <a href="bmh_SkPaint_Reference?cl=9919#getFontMetrics">getFontMetrics</a> | Returns <a href="bmh_undocumented?cl=9919#Typeface">Typeface</a> metrics scaled by text size. | +| <a href="bmh_SkPaint_Reference?cl=9919#getFontSpacing">getFontSpacing</a> | Returns recommended spacing between lines. | +| <a href="bmh_SkPaint_Reference?cl=9919#getHash">getHash</a> | Returns a shallow hash for equality checks. | +| <a href="bmh_SkPaint_Reference?cl=9919#getHinting">getHinting</a> | Returns <a href="bmh_SkPaint_Reference?cl=9919#Hinting">Hinting</a>, glyph outline adjustment level. | +| <a href="bmh_SkPaint_Reference?cl=9919#getImageFilter">getImageFilter</a> | Returns <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a>, alter pixels; blur. | +| <a href="bmh_SkPaint_Reference?cl=9919#getMaskFilter">getMaskFilter</a> | Returns <a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a>, alterations to <a href="bmh_undocumented?cl=9919#Mask_Alpha">Mask Alpha</a>. | +| <a href="bmh_SkPaint_Reference?cl=9919#getPathEffect">getPathEffect</a> | Returns <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a>, modifications to path geometry; dashing. | +| <a href="bmh_SkPaint_Reference?cl=9919#getPosTextPath">getPosTextPath</a> | Returns <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> equivalent to positioned text. | +| <a href="bmh_SkPaint_Reference?cl=9919#getPosTextIntercepts">getPosTextIntercepts</a> | Returns where lines intersect positioned text; underlines. | +| <a href="bmh_SkPaint_Reference?cl=9919#getPosTextHIntercepts">getPosTextHIntercepts</a> | Returns where lines intersect horizontally positioned text; underlines. | +| <a href="bmh_SkPaint_Reference?cl=9919#getRasterizer">getRasterizer</a> | Returns <a href="bmh_undocumented?cl=9919#Rasterizer">Rasterizer</a>, <a href="bmh_undocumented?cl=9919#Mask_Alpha">Mask Alpha</a> generation from <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>. | +| <a href="bmh_SkPaint_Reference?cl=9919#getShader">getShader</a> | Returns <a href="bmh_undocumented?cl=9919#Shader">Shader</a>, multiple drawing colors; gradients. | +| <a href="bmh_SkPaint_Reference?cl=9919#getStrokeCap">getStrokeCap</a> | Returns <a href="bmh_SkPaint_Reference?cl=9919#Cap">Cap</a>, the area drawn at path ends. | +| <a href="bmh_SkPaint_Reference?cl=9919#getStrokeJoin">getStrokeJoin</a> | Returns <a href="bmh_SkPaint_Reference?cl=9919#Join">Join</a>, geometry on path corners. | +| <a href="bmh_SkPaint_Reference?cl=9919#getStrokeMiter">getStrokeMiter</a> | Returns <a href="bmh_SkPaint_Reference?cl=9919#Miter_Limit">Miter Limit</a>, angles with sharp corners. | +| <a href="bmh_SkPaint_Reference?cl=9919#getStrokeWidth">getStrokeWidth</a> | Returns thickness of the stroke. | +| <a href="bmh_SkPaint_Reference?cl=9919#getStyle">getStyle</a> | Returns <a href="bmh_SkPaint_Reference?cl=9919#Style">Style</a>: stroke, fill, or both. | +| <a href="bmh_SkPaint_Reference?cl=9919#getTextAlign">getTextAlign</a> | Returns <a href="bmh_SkPaint_Reference?cl=9919#Align">Align</a>: left, center, or right. | +| <a href="bmh_SkPaint_Reference?cl=9919#getTextBlobIntercepts">getTextBlobIntercepts</a> | Returns where lines intersect <a href="bmh_undocumented?cl=9919#Text_Blob">Text Blob</a>; underlines. | +| <a href="bmh_SkPaint_Reference?cl=9919#getTextEncoding">getTextEncoding</a> | Returns character or glyph encoding size. | +| <a href="bmh_SkPaint_Reference?cl=9919#getTextIntercepts">getTextIntercepts</a> | Returns where lines intersect text; underlines. | +| <a href="bmh_SkPaint_Reference?cl=9919#getTextPath">getTextPath</a> | Returns <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> equivalent to text. | +| <a href="bmh_SkPaint_Reference?cl=9919#getTextScaleX">getTextScaleX</a> | Returns the text horizontal scale; condensed text. | +| <a href="bmh_SkPaint_Reference?cl=9919#getTextSkewX">getTextSkewX</a> | Returns the text horizontal skew; oblique text. | +| <a href="bmh_SkPaint_Reference?cl=9919#getTextSize">getTextSize</a> | Returns text size in points. | +| <a href="bmh_SkPaint_Reference?cl=9919#getTextWidths">getTextWidths</a> | Returns advance and bounds for each glyph in text. | +| <a href="bmh_SkPaint_Reference?cl=9919#getTypeface">getTypeface</a> | Returns <a href="bmh_undocumented?cl=9919#Typeface">Typeface</a>, font description. | +| <a href="bmh_SkPaint_Reference?cl=9919#glyphsToUnichars">glyphsToUnichars</a> | Converts glyphs into text. | +| <a href="bmh_SkPaint_Reference?cl=9919#isAntiAlias">isAntiAlias</a> | Returns true if <a href="bmh_SkPaint_Reference?cl=9919#Anti_alias">Anti-alias</a> is set. | +| <a href="bmh_SkPaint_Reference?cl=9919#isAutohinted">isAutohinted</a> | Returns true if glyphs are always hinted. | +| <a href="bmh_SkPaint_Reference?cl=9919#isDevKernText">isDevKernText</a> | Returns true if <a href="bmh_SkPaint_Reference?cl=9919#Full_Hinting_Spacing">Full Hinting Spacing</a> is set. | +| <a href="bmh_SkPaint_Reference?cl=9919#isDither">isDither</a> | Returns true if <a href="bmh_SkPaint_Reference?cl=9919#Dither">Dither</a> is set. | +| <a href="bmh_SkPaint_Reference?cl=9919#isEmbeddedBitmapText">isEmbeddedBitmapText</a> | Returns true if <a href="bmh_SkPaint_Reference?cl=9919#Font_Embedded_Bitmaps">Font Embedded Bitmaps</a> is set. | +| <a href="bmh_SkPaint_Reference?cl=9919#isFakeBoldText">isFakeBoldText</a> | Returns true if <a href="bmh_SkPaint_Reference?cl=9919#Fake_Bold">Fake Bold</a> is set. | +| <a href="bmh_SkPaint_Reference?cl=9919#isLCDRenderText">isLCDRenderText</a> | Returns true if <a href="bmh_SkPaint_Reference?cl=9919#LCD_Text">LCD Text</a> is set. | +| <a href="bmh_SkPaint_Reference?cl=9919#isSrcOver">isSrcOver</a> | Returns true if <a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a> is <a href="bmh_undocumented?cl=9919#kSrcOver">SkBlendMode::kSrcOver</a>. | +| <a href="bmh_SkPaint_Reference?cl=9919#isSubpixelText">isSubpixelText</a> | Returns true if <a href="bmh_SkPaint_Reference?cl=9919#Subpixel_Text">Subpixel Text</a> is set. | +| <a href="bmh_SkPaint_Reference?cl=9919#isVerticalText">isVerticalText</a> | Returns true if <a href="bmh_SkPaint_Reference?cl=9919#Vertical_Text">Vertical Text</a> is set. | +| <a href="bmh_SkPaint_Reference?cl=9919#measureText">measureText</a> | Returns advance width and bounds of text. | +| <a href="bmh_SkPaint_Reference?cl=9919#nothingToDraw">nothingToDraw</a> | Returns true if <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> prevents all drawing. | +| <a href="bmh_SkPaint_Reference?cl=9919#refColorFilter">refColorFilter</a> | References <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>, how colors are altered. | +| <a href="bmh_SkPaint_Reference?cl=9919#refDrawLooper">refDrawLooper</a> | References <a href="bmh_undocumented?cl=9919#Draw_Looper">Draw Looper</a>, multiple layers. | +| <a href="bmh_SkPaint_Reference?cl=9919#refImageFilter">refImageFilter</a> | References <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a>, alter pixels; blur. | +| <a href="bmh_SkPaint_Reference?cl=9919#refMaskFilter">refMaskFilter</a> | References <a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a>, alterations to <a href="bmh_undocumented?cl=9919#Mask_Alpha">Mask Alpha</a>. | +| <a href="bmh_SkPaint_Reference?cl=9919#refPathEffect">refPathEffect</a> | References <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a>, modifications to path geometry; dashing. | +| <a href="bmh_SkPaint_Reference?cl=9919#refRasterizer">refRasterizer</a> | References <a href="bmh_undocumented?cl=9919#Rasterizer">Rasterizer</a>, mask generation from path. | +| <a href="bmh_SkPaint_Reference?cl=9919#refShader">refShader</a> | References <a href="bmh_undocumented?cl=9919#Shader">Shader</a>, multiple drawing colors; gradients. | +| <a href="bmh_SkPaint_Reference?cl=9919#refTypeface">refTypeface</a> | References <a href="bmh_undocumented?cl=9919#Typeface">Typeface</a>, font description. | +| <a href="bmh_SkPaint_Reference?cl=9919#reset">reset</a> | Sets to default values. | +| <a href="bmh_SkPaint_Reference?cl=9919#setAlpha">setAlpha</a> | Sets <a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a>, color opacity. | +| <a href="bmh_SkPaint_Reference?cl=9919#setAntiAlias">setAntiAlias</a> | Sets or clears <a href="bmh_SkPaint_Reference?cl=9919#Anti_alias">Anti-alias</a>. | +| <a href="bmh_SkPaint_Reference?cl=9919#setARGB">setARGB</a> | Sets color by component. | +| <a href="bmh_SkPaint_Reference?cl=9919#setAutohinted">setAutohinted</a> | Sets glyphs to always be hinted. | +| <a href="bmh_SkPaint_Reference?cl=9919#setBlendMode">setBlendMode</a> | Sets <a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a>, how colors combine with destination. | +| <a href="bmh_SkPaint_Reference?cl=9919#setColor">setColor</a> | Sets <a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a> and <a href="bmh_undocumented?cl=9919#RGB">Color RGB</a>, one drawing color. | +| <a href="bmh_SkPaint_Reference?cl=9919#setColorFilter">setColorFilter</a> | Sets <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>, alters color. | +| <a href="bmh_SkPaint_Reference?cl=9919#setDevKernText">setDevKernText</a> | Sets or clears <a href="bmh_SkPaint_Reference?cl=9919#Full_Hinting_Spacing">Full Hinting Spacing</a>. | +| <a href="bmh_SkPaint_Reference?cl=9919#setDither">setDither</a> | Sets or clears <a href="bmh_SkPaint_Reference?cl=9919#Dither">Dither</a>. | +| <a href="bmh_SkPaint_Reference?cl=9919#setDrawLooper">setDrawLooper</a> | Sets <a href="bmh_undocumented?cl=9919#Draw_Looper">Draw Looper</a>, multiple layers. | +| <a href="bmh_SkPaint_Reference?cl=9919#setEmbeddedBitmapText">setEmbeddedBitmapText</a> | Sets or clears <a href="bmh_SkPaint_Reference?cl=9919#Font_Embedded_Bitmaps">Font Embedded Bitmaps</a>. | +| <a href="bmh_SkPaint_Reference?cl=9919#setFakeBoldText">setFakeBoldText</a> | Sets or clears <a href="bmh_SkPaint_Reference?cl=9919#Fake_Bold">Fake Bold</a>. | +| <a href="bmh_SkPaint_Reference?cl=9919#setFilterQuality">setFilterQuality</a> | Sets <a href="bmh_undocumented?cl=9919#Filter_Quality">Filter Quality</a>, the image filtering level. | +| <a href="bmh_SkPaint_Reference?cl=9919#setFlags">setFlags</a> | Sets multiple <a href="bmh_SkPaint_Reference?cl=9919#Flags">Flags</a> in a bit field. | +| <a href="bmh_SkPaint_Reference?cl=9919#setHinting">setHinting</a> | Sets <a href="bmh_SkPaint_Reference?cl=9919#Hinting">Hinting</a>, glyph outline adjustment level. | +| <a href="bmh_SkPaint_Reference?cl=9919#setLCDRenderText">setLCDRenderText</a> | Sets or clears <a href="bmh_SkPaint_Reference?cl=9919#LCD_Text">LCD Text</a>. | +| <a href="bmh_SkPaint_Reference?cl=9919#setMaskFilter">setMaskFilter</a> | Sets <a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a>, alterations to <a href="bmh_undocumented?cl=9919#Mask_Alpha">Mask Alpha</a>. | +| <a href="bmh_SkPaint_Reference?cl=9919#setPathEffect">setPathEffect</a> | Sets <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a>, modifications to path geometry; dashing. | +| <a href="bmh_SkPaint_Reference?cl=9919#setRasterizer">setRasterizer</a> | Sets <a href="bmh_undocumented?cl=9919#Rasterizer">Rasterizer</a>, <a href="bmh_undocumented?cl=9919#Mask_Alpha">Mask Alpha</a> generation from <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>. | +| <a href="bmh_SkPaint_Reference?cl=9919#setImageFilter">setImageFilter</a> | Sets <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a>, alter pixels; blur. | +| <a href="bmh_SkPaint_Reference?cl=9919#setShader">setShader</a> | Sets <a href="bmh_undocumented?cl=9919#Shader">Shader</a>, multiple drawing colors; gradients. | +| <a href="bmh_SkPaint_Reference?cl=9919#setStrokeCap">setStrokeCap</a> | Sets <a href="bmh_SkPaint_Reference?cl=9919#Cap">Cap</a>, the area drawn at path ends. | +| <a href="bmh_SkPaint_Reference?cl=9919#setStrokeJoin">setStrokeJoin</a> | Sets <a href="bmh_SkPaint_Reference?cl=9919#Join">Join</a>, geometry on path corners. | +| <a href="bmh_SkPaint_Reference?cl=9919#setStrokeMiter">setStrokeMiter</a> | Sets <a href="bmh_SkPaint_Reference?cl=9919#Miter_Limit">Miter Limit</a>, angles with sharp corners. | +| <a href="bmh_SkPaint_Reference?cl=9919#setStrokeWidth">setStrokeWidth</a> | Sets thickness of the stroke. | +| <a href="bmh_SkPaint_Reference?cl=9919#setStyle">setStyle</a> | Sets <a href="bmh_SkPaint_Reference?cl=9919#Style">Style</a>: stroke, fill, or both. | +| <a href="bmh_SkPaint_Reference?cl=9919#setSubpixelText">setSubpixelText</a> | Sets or clears <a href="bmh_SkPaint_Reference?cl=9919#Subpixel_Text">Subpixel Text</a>. | +| <a href="bmh_SkPaint_Reference?cl=9919#setTextAlign">setTextAlign</a> | Sets <a href="bmh_SkPaint_Reference?cl=9919#Align">Align</a>: left, center, or right. | +| <a href="bmh_SkPaint_Reference?cl=9919#setTextEncoding">setTextEncoding</a> | Sets character or glyph encoding size. | +| <a href="bmh_SkPaint_Reference?cl=9919#setTextScaleX">setTextScaleX</a> | Sets the text horizontal scale; condensed text. | +| <a href="bmh_SkPaint_Reference?cl=9919#setTextSkewX">setTextSkewX</a> | Sets the text horizontal skew; oblique text. | +| <a href="bmh_SkPaint_Reference?cl=9919#setTextSize">setTextSize</a> | Sets text size in points. | +| <a href="bmh_SkPaint_Reference?cl=9919#setTypeface">setTypeface</a> | Sets <a href="bmh_undocumented?cl=9919#Typeface">Typeface</a>, font description. | +| <a href="bmh_SkPaint_Reference?cl=9919#setVerticalText">setVerticalText</a> | Sets or clears <a href="bmh_SkPaint_Reference?cl=9919#Vertical_Text">Vertical Text</a>. | +| <a href="bmh_SkPaint_Reference?cl=9919#textToGlyphs">textToGlyphs</a> | Converts text into glyph indices. | +| <a href="bmh_SkPaint_Reference?cl=9919#toString">toString</a> | Converts <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> to machine parsable form (<a href="bmh_undocumented?cl=9919#Developer_Mode">Developer Mode</a>) | +| <a href="bmh_SkPaint_Reference?cl=9919#unflatten">unflatten</a> | Populates from a serialized stream. | + +# <a name="Initializers"></a> Initializers + +<a name="empty_constructor"></a> +## SkPaint + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +SkPaint() +</pre> + +Constructs <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> with default values. + +| attribute | default value | +| --- | --- | +| <a href="bmh_SkPaint_Reference?cl=9919#Anti_alias">Anti-alias</a> | false | +| <a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a> | <a href="bmh_undocumented?cl=9919#kSrcOver">SkBlendMode::kSrcOver</a> | +| <a href="bmh_undocumented?cl=9919#Color">Color</a> | <a href="bmh_undocumented?cl=9919#SK_ColorBLACK">SK ColorBLACK</a> | +| <a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a> | 255 | +| <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a> | nullptr | +| <a href="bmh_SkPaint_Reference?cl=9919#Dither">Dither</a> | false | +| <a href="bmh_undocumented?cl=9919#Draw_Looper">Draw Looper</a> | nullptr | +| <a href="bmh_SkPaint_Reference?cl=9919#Fake_Bold">Fake Bold</a> | false | +| <a href="bmh_undocumented?cl=9919#Filter_Quality">Filter Quality</a> | <a href="bmh_undocumented?cl=9919#SkFilterQuality">kNone SkFilterQuality</a> | +| <a href="bmh_SkPaint_Reference?cl=9919#Font_Embedded_Bitmaps">Font Embedded Bitmaps</a> | false | +| <a href="bmh_SkPaint_Reference?cl=9919#Automatic_Hinting">Automatic Hinting</a> | false | +| <a href="bmh_SkPaint_Reference?cl=9919#Full_Hinting_Spacing">Full Hinting Spacing</a> | false | +| <a href="bmh_SkPaint_Reference?cl=9919#Hinting">Hinting</a> | <a href="bmh_SkPaint_Reference?cl=9919#kNormal_Hinting">kNormal Hinting</a> | +| <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a> | nullptr | +| <a href="bmh_SkPaint_Reference?cl=9919#LCD_Text">LCD Text</a> | false | +| <a href="bmh_SkPaint_Reference?cl=9919#Linear_Text">Linear Text</a> | false | +| <a href="bmh_SkPaint_Reference?cl=9919#Miter_Limit">Miter Limit</a> | 4 | +| <a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a> | nullptr | +| <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a> | nullptr | +| <a href="bmh_undocumented?cl=9919#Rasterizer">Rasterizer</a> | nullptr | +| <a href="bmh_undocumented?cl=9919#Shader">Shader</a> | nullptr | +| <a href="bmh_SkPaint_Reference?cl=9919#Style">Style</a> | <a href="bmh_SkPaint_Reference?cl=9919#kFill_Style">kFill Style</a> | +| <a href="bmh_SkPaint_Reference?cl=9919#Text_Align">Text Align</a> | <a href="bmh_SkPaint_Reference?cl=9919#kLeft_Align">kLeft Align</a> | +| <a href="bmh_SkPaint_Reference?cl=9919#Text_Encoding">Text Encoding</a> | <a href="bmh_SkPaint_Reference?cl=9919#kUTF8_TextEncoding">kUTF8 TextEncoding</a> | +| <a href="bmh_SkPaint_Reference?cl=9919#Text_Scale_X">Text Scale X</a> | 1 | +| <a href="bmh_SkPaint_Reference?cl=9919#Text_Size">Text Size</a> | 12 | +| <a href="bmh_SkPaint_Reference?cl=9919#Text_Skew_X">Text Skew X</a> | 0 | +| <a href="bmh_undocumented?cl=9919#Typeface">Typeface</a> | nullptr | +| <a href="bmh_SkPaint_Reference?cl=9919#Stroke_Cap">Stroke Cap</a> | <a href="bmh_SkPaint_Reference?cl=9919#kButt_Cap">kButt Cap</a> | +| <a href="bmh_SkPaint_Reference?cl=9919#Stroke_Join">Stroke Join</a> | <a href="bmh_SkPaint_Reference?cl=9919#kMiter_Join">kMiter Join</a> | +| <a href="bmh_SkPaint_Reference?cl=9919#Stroke_Width">Stroke Width</a> | 0 | +| <a href="bmh_SkPaint_Reference?cl=9919#Subpixel_Text">Subpixel Text</a> | false | +| <a href="bmh_SkPaint_Reference?cl=9919#Vertical_Text">Vertical Text</a> | false | + +The flags, text size, hinting, and miter limit may be overridden at compile time by defining +paint default values. The overrides may be included in <a href="bmh_undocumented?cl=9919#SkUserConfig.h">SkUserConfig.h</a> or predefined by the +build system. + +### Return Value + +default initialized <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> + +### Example + +<div><fiddle-embed name="c4b2186d85c142a481298f7144295ffd"></fiddle-embed></div> + +--- + +<a name="copy_constructor"></a> +## SkPaint + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +SkPaint(const SkPaint& paint) +</pre> + +Makes a shallow copy of <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a>. <a href="bmh_undocumented?cl=9919#Typeface">Typeface</a>, <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a>, <a href="bmh_undocumented?cl=9919#Shader">Shader</a>, +<a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a>, <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>, <a href="bmh_undocumented?cl=9919#Rasterizer">Rasterizer</a>, <a href="bmh_undocumented?cl=9919#Draw_Looper">Draw Looper</a>, and <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a> are shared +between the original <a href="bmh_SkPaint_Reference?cl=9919#paint">paint</a> and the copy. These objects' <a href="bmh_undocumented?cl=9919#Reference_Count">Reference Count</a> are increased. + +The referenced objects <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a>, <a href="bmh_undocumented?cl=9919#Shader">Shader</a>, <a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a>, <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>, <a href="bmh_undocumented?cl=9919#Rasterizer">Rasterizer</a>, +<a href="bmh_undocumented?cl=9919#Draw_Looper">Draw Looper</a>, and <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a> cannot be modified after they are created. +This prevents objects with <a href="bmh_undocumented?cl=9919#Reference_Count">Reference Count</a> from being modified once <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> refers to them. + +### Parameters + +<table> <tr> <td><code><strong>paint </strong></code></td> <td> +original to copy</td> + </tr> +</table> + +### Return Value + +shallow copy of <a href="bmh_SkPaint_Reference?cl=9919#paint">paint</a> + +### Example + +<div><fiddle-embed name="b99971ad0ef243d617925289d963b62d"> + +#### Example Output + +~~~~ +SK_ColorRED == paint1.getColor() +SK_ColorBLUE == paint2.getColor() +~~~~ + +</fiddle-embed></div> + +--- + +<a name="move_constructor"></a> +## SkPaint + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +SkPaint(SkPaint&& paint) +</pre> + +Implements a move constructor to avoid incrementing the reference counts +of objects referenced by the <a href="bmh_SkPaint_Reference?cl=9919#paint">paint</a>. + +After the call, <a href="bmh_SkPaint_Reference?cl=9919#paint">paint</a> is undefined, and can be safely destructed. + +### Parameters + +<table> <tr> <td><code><strong>paint </strong></code></td> <td> +original to move</td> + </tr> +</table> + +### Return Value + +content of <a href="bmh_SkPaint_Reference?cl=9919#paint">paint</a> + +### Example + +<div><fiddle-embed name="8ed1488a503cd5282b86a51614aa90b1"> + +#### Example Output + +~~~~ +path effect unique: true +~~~~ + +</fiddle-embed></div> + +--- + +<a name="reset"></a> +## reset + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void reset() +</pre> + +Sets all paint's contents to their initial values. This is equivalent to replacing +the paint with the result of <a href="bmh_SkPaint_Reference?cl=9919#empty_constructor">SkPaint()</a>. + +### Example + +<div><fiddle-embed name="ef269937ade7e7353635121d9a64f9f7"> + +#### Example Output + +~~~~ +paint1 == paint2 +~~~~ + +</fiddle-embed></div> + +--- + +# <a name="Destructor"></a> Destructor + +<a name="destructor"></a> +## ~SkPaint + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +~SkPaint() +</pre> + +Decreases <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> <a href="bmh_undocumented?cl=9919#Reference_Count">Reference Count</a> of owned objects: <a href="bmh_undocumented?cl=9919#Typeface">Typeface</a>, <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a>, <a href="bmh_undocumented?cl=9919#Shader">Shader</a>, +<a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a>, <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>, <a href="bmh_undocumented?cl=9919#Rasterizer">Rasterizer</a>, <a href="bmh_undocumented?cl=9919#Draw_Looper">Draw Looper</a>, and <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a>. If the +objects' reference count goes to zero, they are deleted. + +--- + +# <a name="Management"></a> Management + +<a name="copy_assignment_operator"></a> +## operator= + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +SkPaint& operator=(const SkPaint& paint) +</pre> + +Makes a shallow copy of <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a>. <a href="bmh_undocumented?cl=9919#Typeface">Typeface</a>, <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a>, <a href="bmh_undocumented?cl=9919#Shader">Shader</a>, +<a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a>, <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>, <a href="bmh_undocumented?cl=9919#Rasterizer">Rasterizer</a>, <a href="bmh_undocumented?cl=9919#Draw_Looper">Draw Looper</a>, and <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a> are shared +between the original <a href="bmh_SkPaint_Reference?cl=9919#paint">paint</a> and the copy. The objects' <a href="bmh_undocumented?cl=9919#Reference_Count">Reference Count</a> are in the +prior destination are decreased by one, and the referenced objects are deleted if the +resulting count is zero. The objects' <a href="bmh_undocumented?cl=9919#Reference_Count">Reference Count</a> in the parameter <a href="bmh_SkPaint_Reference?cl=9919#paint">paint</a> are increased +by one. <a href="bmh_SkPaint_Reference?cl=9919#paint">paint</a> is unmodified. + +### Parameters + +<table> <tr> <td><code><strong>paint </strong></code></td> <td> +original to copy</td> + </tr> +</table> + +### Return Value + +content of <a href="bmh_SkPaint_Reference?cl=9919#paint">paint</a> + +### Example + +<div><fiddle-embed name="b476a9088f80dece176ed577807d3992"> + +#### Example Output + +~~~~ +SK_ColorRED == paint1.getColor() +SK_ColorRED == paint2.getColor() +~~~~ + +</fiddle-embed></div> + +--- + +<a name="move_assignment_operator"></a> +## operator= + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +SkPaint& operator=(SkPaint&& paint) +</pre> + +Moves the <a href="bmh_SkPaint_Reference?cl=9919#paint">paint</a> to avoid incrementing the reference counts +of objects referenced by the <a href="bmh_SkPaint_Reference?cl=9919#paint">paint</a> parameter. The objects' <a href="bmh_undocumented?cl=9919#Reference_Count">Reference Count</a> are in the +prior destination are decreased by one, and the referenced objects are deleted if the +resulting count is zero. + +After the call, <a href="bmh_SkPaint_Reference?cl=9919#paint">paint</a> is undefined, and can be safely destructed. + +### Parameters + +<table> <tr> <td><code><strong>paint </strong></code></td> <td> +original to move</td> + </tr> +</table> + +### Return Value + +content of <a href="bmh_SkPaint_Reference?cl=9919#paint">paint</a> + +### Example + +<div><fiddle-embed name="9fb7459b097d713f5f1fe5675afe14f5"> + +#### Example Output + +~~~~ +SK_ColorRED == paint2.getColor() +~~~~ + +</fiddle-embed></div> + +--- + +<a name="equal_operator"></a> +## operator== + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +bool operator==(const SkPaint& a, const SkPaint& b) +</pre> + +Compares <a href="bmh_SkPaint_Reference?cl=9919#a">a</a> and <a href="bmh_SkPaint_Reference?cl=9919#b">b</a>, and returns true if <a href="bmh_SkPaint_Reference?cl=9919#a">a</a> and <a href="bmh_SkPaint_Reference?cl=9919#b">b</a> are equivalent. May return false +if <a href="bmh_undocumented?cl=9919#Typeface">Typeface</a>, <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a>, <a href="bmh_undocumented?cl=9919#Shader">Shader</a>, <a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a>, <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>, <a href="bmh_undocumented?cl=9919#Rasterizer">Rasterizer</a>, +<a href="bmh_undocumented?cl=9919#Draw_Looper">Draw Looper</a>, or <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a> have identical contents but different pointers. + +### Parameters + +<table> <tr> <td><code><strong>a </strong></code></td> <td> +<a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> to compare</td> + </tr> <tr> <td><code><strong>b </strong></code></td> <td> +<a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> to compare</td> + </tr> +</table> + +### Return Value + +true if <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> pair are equivalent + +### Example + +<div><fiddle-embed name="7481a948e34672720337a631830586dd"> + +#### Example Output + +~~~~ +paint1 == paint2 +paint1 != paint2 +~~~~ + +</fiddle-embed></div> + +--- + +<a name="not_equal_operator"></a> +## operator!= + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +bool operator!=(const SkPaint& a, const SkPaint& b) +</pre> + +Compares <a href="bmh_SkPaint_Reference?cl=9919#a">a</a> and <a href="bmh_SkPaint_Reference?cl=9919#b">b</a>, and returns true if <a href="bmh_SkPaint_Reference?cl=9919#a">a</a> and <a href="bmh_SkPaint_Reference?cl=9919#b">b</a> are not equivalent. May return true +if <a href="bmh_undocumented?cl=9919#Typeface">Typeface</a>, <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a>, <a href="bmh_undocumented?cl=9919#Shader">Shader</a>, <a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a>, <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>, <a href="bmh_undocumented?cl=9919#Rasterizer">Rasterizer</a>, +<a href="bmh_undocumented?cl=9919#Draw_Looper">Draw Looper</a>, or <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a> have identical contents but different pointers. + +### Parameters + +<table> <tr> <td><code><strong>a </strong></code></td> <td> +<a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> to compare</td> + </tr> <tr> <td><code><strong>b </strong></code></td> <td> +<a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> to compare</td> + </tr> +</table> + +### Return Value + +true if <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> pair are not equivalent + +### Example + +<div><fiddle-embed name="b6c8484b1187f555b435ad5369833be4"> + +#### Example Output + +~~~~ +paint1 == paint2 +paint1 == paint2 +~~~~ + +</fiddle-embed></div> + +--- + +<a name="getHash"></a> +## getHash + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +uint32_t getHash() const +</pre> + +Returns a hash generated from <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> values and pointers. +Identical hashes guarantee that the paints are +equivalent, but differing hashes do not guarantee that the paints have differing +contents. + +If <a href="bmh_SkPaint_Reference?cl=9919#equal_operator">operator==(const SkPaint& a, const SkPaint& b)</a> returns true for two paints, +their hashes are also equal. + +The hash returned is platform and implementation specific. + +### Return Value + +a shallow hash + +### Example + +<div><fiddle-embed name="7f7e1b701361912b344f90ae6b530393"> + +#### Example Output + +~~~~ +paint1 == paint2 +paint1.getHash() == paint2.getHash() +~~~~ + +</fiddle-embed></div> + +--- + +<a name="flatten"></a> +## flatten + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void flatten(SkWriteBuffer& buffer) const +</pre> + +Serializes <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> into a <a href="bmh_SkPaint_Reference?cl=9919#buffer">buffer</a>. A companion <a href="bmh_SkPaint_Reference?cl=9919#unflatten">unflatten</a> call +can reconstitute the paint at a later time. + +### Parameters + +<table> <tr> <td><code><strong>buffer </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#Write_Buffer">Write Buffer</a> receiving the flattened <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> data</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="670672b146b50eced4d3dd10c701e0a7"> + +#### Example Output + +~~~~ +color = 0xffff0000 +~~~~ + +</fiddle-embed></div> + +--- + +<a name="unflatten"></a> +## unflatten + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void unflatten(SkReadBuffer& buffer) +</pre> + +Populates <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a>, typically from a serialized stream, created by calling +<a href="bmh_SkPaint_Reference?cl=9919#flatten">flatten</a> at an earlier time. + +<a href="bmh_undocumented?cl=9919#SkReadBuffer">SkReadBuffer</a> class is not public, so <a href="bmh_SkPaint_Reference?cl=9919#unflatten">unflatten</a> cannot be meaningfully called +by the client. + +### Parameters + +<table> <tr> <td><code><strong>buffer </strong></code></td> <td> +serialized data to unflatten</td> + </tr> +</table> + +--- + +# <a name="Hinting"></a> Hinting + +## <a name="SkPaint::Hinting"></a> Enum SkPaint::Hinting + +<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0"> +enum <a href="bmh_SkPaint_Reference?cl=9919#Hinting">Hinting</a> { +<a href="bmh_SkPaint_Reference?cl=9919#kNo_Hinting">kNo Hinting</a> = 0, +<a href="bmh_SkPaint_Reference?cl=9919#kSlight_Hinting">kSlight Hinting</a> = 1, +<a href="bmh_SkPaint_Reference?cl=9919#kNormal_Hinting">kNormal Hinting</a> = 2, +<a href="bmh_SkPaint_Reference?cl=9919#kFull_Hinting">kFull Hinting</a> = 3 +};</pre> + +<a href="bmh_SkPaint_Reference?cl=9919#Hinting">Hinting</a> adjusts the glyph outlines so that the shape provides a uniform +look at a given point size on font engines that support it. <a href="bmh_SkPaint_Reference?cl=9919#Hinting">Hinting</a> may have a +muted effect or no effect at all depending on the platform. + +The four levels roughly control corresponding features on platforms that use <a href="bmh_undocumented?cl=9919#FreeType">FreeType</a> +as the <a href="bmh_undocumented?cl=9919#Engine">Font Engine</a>. + +### Constants + +<table> + <tr> + <td><a name="SkPaint::kNo_Hinting"></a> <code><strong>SkPaint::kNo_Hinting </strong></code></td><td>0</td><td>Leaves glyph outlines unchanged from their native representation. +With <a href="bmh_undocumented?cl=9919#FreeType">FreeType</a>, this is equivalent to the <a href="bmh_undocumented?cl=9919#FT_LOAD_NO_HINTING">FT LOAD NO HINTING</a> +bit-field constant supplied to <a href="bmh_undocumented?cl=9919#FT_Load_Glyph">FT Load Glyph</a>, which indicates that the vector +outline being loaded should not be fitted to the pixel grid but simply scaled +to 26.6 fractional pixels.</td> + </tr> + <tr> + <td><a name="SkPaint::kSlight_Hinting"></a> <code><strong>SkPaint::kSlight_Hinting </strong></code></td><td>1</td><td>Modifies glyph outlines minimally to improve constrast. +With <a href="bmh_undocumented?cl=9919#FreeType">FreeType</a>, this is equivalent in spirit to the +<a href="bmh_undocumented?cl=9919#FT_LOAD_TARGET_LIGHT">FT LOAD TARGET LIGHT</a> value supplied to <a href="bmh_undocumented?cl=9919#FT_Load_Glyph">FT Load Glyph</a>. It chooses a +lighter hinting algorithm for non-monochrome modes. +Generated glyphs may be fuzzy but better resemble their original shape.</td> + </tr> + <tr> + <td><a name="SkPaint::kNormal_Hinting"></a> <code><strong>SkPaint::kNormal_Hinting </strong></code></td><td>2</td><td>Modifies glyph outlines to improve constrast. This is the default. +With <a href="bmh_undocumented?cl=9919#FreeType">FreeType</a>, this supplies <a href="bmh_undocumented?cl=9919#FT_LOAD_TARGET_NORMAL">FT LOAD TARGET NORMAL</a> to <a href="bmh_undocumented?cl=9919#FT_Load_Glyph">FT Load Glyph</a>, +choosing the default hinting algorithm, which is optimized for standard +gray-level rendering.</td> + </tr> + <tr> + <td><a name="SkPaint::kFull_Hinting"></a> <code><strong>SkPaint::kFull_Hinting </strong></code></td><td>3</td><td>Modifies glyph outlines for maxiumum constrast. With <a href="bmh_undocumented?cl=9919#FreeType">FreeType</a>, this selects +<a href="bmh_undocumented?cl=9919#FT_LOAD_TARGET_LCD">FT LOAD TARGET LCD</a> or <a href="bmh_undocumented?cl=9919#FT_LOAD_TARGET_LCD_V">FT LOAD TARGET LCD V</a> if <a href="bmh_SkPaint_Reference?cl=9919#kLCDRenderText_Flag">kLCDRenderText Flag</a> is set. +<a href="bmh_undocumented?cl=9919#FT_LOAD_TARGET_LCD">FT LOAD TARGET LCD</a> is a variant of <a href="bmh_undocumented?cl=9919#FT_LOAD_TARGET_NORMAL">FT LOAD TARGET NORMAL</a> optimized for +horizontally decimated <a href="bmh_undocumented?cl=9919#LCD">LCD</a> displays; <a href="bmh_undocumented?cl=9919#FT_LOAD_TARGET_LCD_V">FT LOAD TARGET LCD V</a> is a +variant of <a href="bmh_undocumented?cl=9919#FT_LOAD_TARGET_NORMAL">FT LOAD TARGET NORMAL</a> optimized for vertically decimated <a href="bmh_undocumented?cl=9919#LCD">LCD</a> displays.</td> + </tr> +</table> + +On <a href="bmh_undocumented?cl=9919#Windows">Windows</a> with <a href="bmh_undocumented?cl=9919#DirectWrite">DirectWrite</a>, <a href="bmh_SkPaint_Reference?cl=9919#Hinting">Hinting</a> has no effect. + +<a href="bmh_SkPaint_Reference?cl=9919#Hinting">Hinting</a> defaults to <a href="bmh_SkPaint_Reference?cl=9919#kNormal_Hinting">kNormal Hinting</a>. +Set <a href="bmh_undocumented?cl=9919#SkPaintDefaults_Hinting">SkPaintDefaults Hinting</a> at compile time to change the default setting. + + + +<a name="getHinting"></a> +## getHinting + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +Hinting getHinting() const +</pre> + +Returns level of glyph outline adjustment. + +### Return Value + +one of: <a href="bmh_SkPaint_Reference?cl=9919#kNo_Hinting">kNo Hinting</a>, <a href="bmh_SkPaint_Reference?cl=9919#kSlight_Hinting">kSlight Hinting</a>, <a href="bmh_SkPaint_Reference?cl=9919#kNormal_Hinting">kNormal Hinting</a>, <a href="bmh_SkPaint_Reference?cl=9919#kFull_Hinting">kFull Hinting</a> + +### Example + +<div><fiddle-embed name="329e2e5a5919ac431e1c58878a5b99e0"> + +#### Example Output + +~~~~ +SkPaint::kNormal_Hinting == paint.getHinting() +~~~~ + +</fiddle-embed></div> + +--- + +<a name="setHinting"></a> +## setHinting + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void setHinting(Hinting hintingLevel) +</pre> + +Sets level of glyph outline adjustment. +Does not check for valid values of <a href="bmh_SkPaint_Reference?cl=9919#hintingLevel">hintingLevel</a>. + +| <a href="bmh_SkPaint_Reference?cl=9919#Hinting">Hinting</a> | value | effect on generated glyph outlines | +| --- | --- | --- | +| <a href="bmh_SkPaint_Reference?cl=9919#kNo_Hinting">kNo Hinting</a> | 0 | leaves glyph outlines unchanged from their native representation | +| <a href="bmh_SkPaint_Reference?cl=9919#kSlight_Hinting">kSlight Hinting</a> | 1 | modifies glyph outlines minimally to improve constrast | +| <a href="bmh_SkPaint_Reference?cl=9919#kNormal_Hinting">kNormal Hinting</a> | 2 | modifies glyph outlines to improve constrast | +| <a href="bmh_SkPaint_Reference?cl=9919#kFull_Hinting">kFull Hinting</a> | 3 | modifies glyph outlines for maxiumum constrast | + +### Parameters + +<table> <tr> <td><code><strong>hintingLevel </strong></code></td> <td> +one of: <a href="bmh_SkPaint_Reference?cl=9919#kNo_Hinting">kNo Hinting</a>, <a href="bmh_SkPaint_Reference?cl=9919#kSlight_Hinting">kSlight Hinting</a>, <a href="bmh_SkPaint_Reference?cl=9919#kNormal_Hinting">kNormal Hinting</a>, <a href="bmh_SkPaint_Reference?cl=9919#kFull_Hinting">kFull Hinting</a></td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="78153fbd3f1000cb33b97bbe831ed34e"> + +#### Example Output + +~~~~ +paint1 == paint2 +~~~~ + +</fiddle-embed></div> + +--- + +# <a name="Flags"></a> Flags + +## <a name="SkPaint::Flags"></a> Enum SkPaint::Flags + +<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0"> +enum <a href="bmh_SkPaint_Reference?cl=9919#Flags">Flags</a> { +<a href="bmh_SkPaint_Reference?cl=9919#kAntiAlias_Flag">kAntiAlias Flag</a> = 0x01, +<a href="bmh_SkPaint_Reference?cl=9919#kDither_Flag">kDither Flag</a> = 0x04, +<a href="bmh_SkPaint_Reference?cl=9919#kFakeBoldText_Flag">kFakeBoldText Flag</a> = 0x20, +<a href="bmh_SkPaint_Reference?cl=9919#kLinearText_Flag">kLinearText Flag</a> = 0x40, +<a href="bmh_SkPaint_Reference?cl=9919#kSubpixelText_Flag">kSubpixelText Flag</a> = 0x80, +<a href="bmh_SkPaint_Reference?cl=9919#kDevKernText_Flag">kDevKernText Flag</a> = 0x100, +<a href="bmh_SkPaint_Reference?cl=9919#kLCDRenderText_Flag">kLCDRenderText Flag</a> = 0x200, +<a href="bmh_SkPaint_Reference?cl=9919#kEmbeddedBitmapText_Flag">kEmbeddedBitmapText Flag</a> = 0x400, +<a href="bmh_SkPaint_Reference?cl=9919#kAutoHinting_Flag">kAutoHinting Flag</a> = 0x800, +<a href="bmh_SkPaint_Reference?cl=9919#kVerticalText_Flag">kVerticalText Flag</a> = 0x1000, +<a href="bmh_SkPaint_Reference?cl=9919#kGenA8FromLCD_Flag">kGenA8FromLCD Flag</a> = 0x2000, + +<a href="bmh_SkPaint_Reference?cl=9919#kAllFlags">kAllFlags</a> = 0xFFFF, +}; +</pre> + +The bit values stored in <a href="bmh_SkPaint_Reference?cl=9919#Flags">Flags</a>. +The default value for <a href="bmh_SkPaint_Reference?cl=9919#Flags">Flags</a>, normally zero, can be changed at compile time +with a custom definition of <a href="bmh_undocumented?cl=9919#SkPaintDefaults_Flags">SkPaintDefaults Flags</a>. +All flags can be read and written explicitly; <a href="bmh_SkPaint_Reference?cl=9919#Flags">Flags</a> allows manipulating +multiple settings at once. + +### Constants + +<table> + <tr> + <td><a name="SkPaint::kAntiAlias_Flag"></a> <code><strong>SkPaint::kAntiAlias_Flag </strong></code></td><td>0x0001 </td><td>mask for setting <a href="bmh_SkPaint_Reference?cl=9919#Anti_alias">Anti-alias</a></td> + </tr> + <tr> + <td><a name="SkPaint::kDither_Flag"></a> <code><strong>SkPaint::kDither_Flag </strong></code></td><td>0x0004</td><td>mask for setting <a href="bmh_SkPaint_Reference?cl=9919#Dither">Dither</a></td> + </tr> + <tr> + <td><a name="SkPaint::kFakeBoldText_Flag"></a> <code><strong>SkPaint::kFakeBoldText_Flag </strong></code></td><td>0x0020</td><td>mask for setting <a href="bmh_SkPaint_Reference?cl=9919#Fake_Bold">Fake Bold</a></td> + </tr> + <tr> + <td><a name="SkPaint::kLinearText_Flag"></a> <code><strong>SkPaint::kLinearText_Flag </strong></code></td><td>0x0040</td><td>mask for setting <a href="bmh_SkPaint_Reference?cl=9919#Linear_Text">Linear Text</a></td> + </tr> + <tr> + <td><a name="SkPaint::kSubpixelText_Flag"></a> <code><strong>SkPaint::kSubpixelText_Flag </strong></code></td><td>0x0080</td><td>mask for setting <a href="bmh_SkPaint_Reference?cl=9919#Subpixel_Text">Subpixel Text</a></td> + </tr> + <tr> + <td><a name="SkPaint::kDevKernText_Flag"></a> <code><strong>SkPaint::kDevKernText_Flag </strong></code></td><td>0x0100</td><td>mask for setting <a href="bmh_SkPaint_Reference?cl=9919#Full_Hinting_Spacing">Full Hinting Spacing</a></td> + </tr> + <tr> + <td><a name="SkPaint::kLCDRenderText_Flag"></a> <code><strong>SkPaint::kLCDRenderText_Flag </strong></code></td><td>0x0200</td><td>mask for setting <a href="bmh_SkPaint_Reference?cl=9919#LCD_Text">LCD Text</a></td> + </tr> + <tr> + <td><a name="SkPaint::kEmbeddedBitmapText_Flag"></a> <code><strong>SkPaint::kEmbeddedBitmapText_Flag </strong></code></td><td>0x0400</td><td>mask for setting <a href="bmh_SkPaint_Reference?cl=9919#Font_Embedded_Bitmaps">Font Embedded Bitmaps</a></td> + </tr> + <tr> + <td><a name="SkPaint::kAutoHinting_Flag"></a> <code><strong>SkPaint::kAutoHinting_Flag </strong></code></td><td>0x0800</td><td>mask for setting <a href="bmh_SkPaint_Reference?cl=9919#Automatic_Hinting">Automatic Hinting</a></td> + </tr> + <tr> + <td><a name="SkPaint::kVerticalText_Flag"></a> <code><strong>SkPaint::kVerticalText_Flag </strong></code></td><td>0x1000</td><td>mask for setting <a href="bmh_SkPaint_Reference?cl=9919#Vertical_Text">Vertical Text</a></td> + </tr> + <tr> + <td><a name="SkPaint::kGenA8FromLCD_Flag"></a> <code><strong>SkPaint::kGenA8FromLCD_Flag </strong></code></td><td>0x2000</td><td>not intended for public use</td> + </tr> + <tr> + <td><a name="SkPaint::kAllFlags"></a> <code><strong>SkPaint::kAllFlags </strong></code></td><td>0xFFFF</td><td>mask of all <a href="bmh_SkPaint_Reference?cl=9919#Flags">Flags</a>, including private flags and flags reserved for future use</td> + </tr> +<a href="bmh_SkPaint_Reference?cl=9919#Flags">Flags</a> default to all flags clear, disabling the associated feature. + +</table> + +## <a name="SkPaint::ReserveFlags"></a> Enum SkPaint::ReserveFlags + +<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0"> +enum <a href="bmh_SkPaint_Reference?cl=9919#ReserveFlags">ReserveFlags</a> { +<a href="bmh_SkPaint_Reference?cl=9919#kUnderlineText_ReserveFlag">kUnderlineText ReserveFlag</a> = 0x08, +<a href="bmh_SkPaint_Reference?cl=9919#kStrikeThruText_ReserveFlag">kStrikeThruText ReserveFlag</a> = 0x10, +};</pre> + +### Constants + +<table> + <tr> + <td><a name="SkPaint::kUnderlineText_ReserveFlag"></a> <code><strong>SkPaint::kUnderlineText_ReserveFlag </strong></code></td><td>0x0008</td><td>mask for underline text</td> + </tr> + <tr> + <td><a name="SkPaint::kStrikeThruText_ReserveFlag"></a> <code><strong>SkPaint::kStrikeThruText_ReserveFlag </strong></code></td><td>0x0010</td><td>mask for strike-thru text</td> + </tr> +</table> + + + +<a name="getFlags"></a> +## getFlags + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +uint32_t getFlags() const +</pre> + +Returns paint settings described by <a href="bmh_SkPaint_Reference?cl=9919#Flags">Flags</a>. Each setting uses one +bit, and can be tested with <a href="bmh_SkPaint_Reference?cl=9919#Flags">Flags</a> members. + +### Return Value + +zero, one, or more bits described by <a href="bmh_SkPaint_Reference?cl=9919#Flags">Flags</a> + +### Example + +<div><fiddle-embed name="8a3f8c309533388b01aa66e1267f322d"> + +#### Example Output + +~~~~ +(SkPaint::kAntiAlias_Flag & paint.getFlags()) != 0 +~~~~ + +</fiddle-embed></div> + +--- + +<a name="setFlags"></a> +## setFlags + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void setFlags(uint32_t flags) +</pre> + +Replaces <a href="bmh_SkPaint_Reference?cl=9919#Flags">Flags</a> with <a href="bmh_SkPaint_Reference?cl=9919#flags">flags</a>, the union of the <a href="bmh_SkPaint_Reference?cl=9919#Flags">Flags</a> members. +All <a href="bmh_SkPaint_Reference?cl=9919#Flags">Flags</a> members may be cleared, or one or more may be set. + +### Parameters + +<table> <tr> <td><code><strong>flags </strong></code></td> <td> +union of <a href="bmh_SkPaint_Reference?cl=9919#Flags">Flags</a> for <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a></td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="54baed3f6bc4b9c31ba664e27767fdc7"> + +#### Example Output + +~~~~ +paint.isAntiAlias() +paint.isDither() +~~~~ + +</fiddle-embed></div> + +--- + +# <a name="Anti-alias"></a> Anti-alias +<a href="bmh_SkPaint_Reference?cl=9919#Anti_alias">Anti-alias</a> drawing approximates partial pixel coverage with transparency. +If <a href="bmh_SkPaint_Reference?cl=9919#kAntiAlias_Flag">kAntiAlias Flag</a> is clear, pixel centers contained by the shape edge are drawn opaque. +If <a href="bmh_SkPaint_Reference?cl=9919#kAntiAlias_Flag">kAntiAlias Flag</a> is set, pixels are drawn with <a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a> equal to their coverage. + +The rule for aliased pixels is inconsistent across platforms. A shape edge +passing through the pixel center may, but is not required to, draw the pixel. + +<a href="bmh_undocumented?cl=9919#Raster_Engine">Raster Engine</a> draws aliased pixels whose centers are on or to the right of the start of an +active <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> edge, and whose center is to the left of the end of the active <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> edge. + +A platform may only support anti-aliased drawing. Some <a href="bmh_undocumented?cl=9919#GPU_backed">GPU-backed</a> platforms use +supersampling to anti-alias all drawing, and have no mechanism to selectively +alias. + +The amount of coverage computed for anti-aliased pixels also varies across platforms. + +<a href="bmh_SkPaint_Reference?cl=9919#Anti_alias">Anti-alias</a> is disabled by default. +<a href="bmh_SkPaint_Reference?cl=9919#Anti_alias">Anti-alias</a> can be enabled by default by setting <a href="bmh_undocumented?cl=9919#SkPaintDefaults_Flags">SkPaintDefaults Flags</a> to <a href="bmh_SkPaint_Reference?cl=9919#kAntiAlias_Flag">kAntiAlias Flag</a> +at compile time. + +### Example + +<div><fiddle-embed name="a6575a49467ce8d28bb01cc7638fa04d"><div>A red line is drawn with transparency on the edges to make it look smoother. +A blue line draws only where the pixel centers are contained. +The lines are drawn into an offscreen bitmap, then drawn magified to make the +aliasing easier to see.</div></fiddle-embed></div> + +<a name="isAntiAlias"></a> +## isAntiAlias + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +bool isAntiAlias() const +</pre> + +If true, pixels on the active edges of <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> may be drawn with partial transparency. + +Equivalent to <a href="bmh_SkPaint_Reference?cl=9919#getFlags">getFlags</a> masked with <a href="bmh_SkPaint_Reference?cl=9919#kAntiAlias_Flag">kAntiAlias Flag</a>. + +### Return Value + +<a href="bmh_SkPaint_Reference?cl=9919#kAntiAlias_Flag">kAntiAlias Flag</a> state + +### Example + +<div><fiddle-embed name="d7d5f4f7da7acd5104a652f490c6f7b8"> + +#### Example Output + +~~~~ +paint.isAntiAlias() == !!(paint.getFlags() & SkPaint::kAntiAlias_Flag) +paint.isAntiAlias() == !!(paint.getFlags() & SkPaint::kAntiAlias_Flag) +~~~~ + +</fiddle-embed></div> + +--- + +<a name="setAntiAlias"></a> +## setAntiAlias + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void setAntiAlias(bool aa) +</pre> + +Requests, but does not require, that <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> edge pixels draw opaque or with +partial transparency. + +Sets <a href="bmh_SkPaint_Reference?cl=9919#kAntiAlias_Flag">kAntiAlias Flag</a> if <a href="bmh_SkPaint_Reference?cl=9919#aa">aa</a> is true. +Clears <a href="bmh_SkPaint_Reference?cl=9919#kAntiAlias_Flag">kAntiAlias Flag</a> if <a href="bmh_SkPaint_Reference?cl=9919#aa">aa</a> is false. + +### Parameters + +<table> <tr> <td><code><strong>aa </strong></code></td> <td> +setting for <a href="bmh_SkPaint_Reference?cl=9919#kAntiAlias_Flag">kAntiAlias Flag</a></td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="c2ff148374d01cbef845b223e725905c"> + +#### Example Output + +~~~~ +paint1 == paint2 +~~~~ + +</fiddle-embed></div> + +--- + +# <a name="Dither"></a> Dither +<a href="bmh_SkPaint_Reference?cl=9919#Dither">Dither</a> increases fidelity by adjusting the color of adjcent pixels. +This can help to smooth color transitions and reducing banding in gradients. +Dithering lessens visible banding from <a href="bmh_undocumented?cl=9919#SkColorType">kRGB 565 SkColorType</a> +and <a href="bmh_undocumented?cl=9919#SkColorType">kRGBA 8888 SkColorType</a> gradients, +and improves rendering into a <a href="bmh_undocumented?cl=9919#SkColorType">kRGB 565 SkColorType</a> <a href="bmh_undocumented?cl=9919#Surface">Surface</a>. + +Dithering is always enabled for linear gradients drawing into +<a href="bmh_undocumented?cl=9919#SkColorType">kRGB 565 SkColorType</a> <a href="bmh_undocumented?cl=9919#Surface">Surface</a> and <a href="bmh_undocumented?cl=9919#SkColorType">kRGBA 8888 SkColorType</a> <a href="bmh_undocumented?cl=9919#Surface">Surface</a>. +<a href="bmh_SkPaint_Reference?cl=9919#Dither">Dither</a> cannot be enabled for <a href="bmh_undocumented?cl=9919#SkColorType">kAlpha 8 SkColorType</a> <a href="bmh_undocumented?cl=9919#Surface">Surface</a> and +<a href="bmh_undocumented?cl=9919#SkColorType">kRGBA F16 SkColorType</a> <a href="bmh_undocumented?cl=9919#Surface">Surface</a>. + +<a href="bmh_SkPaint_Reference?cl=9919#Dither">Dither</a> is disabled by default. +<a href="bmh_SkPaint_Reference?cl=9919#Dither">Dither</a> can be enabled by default by setting <a href="bmh_undocumented?cl=9919#SkPaintDefaults_Flags">SkPaintDefaults Flags</a> to <a href="bmh_SkPaint_Reference?cl=9919#kDither_Flag">kDither Flag</a> +at compile time. + +Some platform implementations may ignore dithering. Setto ignore <a href="bmh_SkPaint_Reference?cl=9919#Dither">Dither</a> on <a href="bmh_undocumented?cl=9919#GPU">GPU Surface</a>. + +### Example + +<div><fiddle-embed name="8b26507690b71462f44642b911890bbf"><div>Dithering in the bottom half more closely approximates the requested color by +alternating nearby colors from pixel to pixel.</div></fiddle-embed></div> + +### Example + +<div><fiddle-embed name="76d4d4a7931a48495e4d5f54e073be53"><div>Dithering introduces subtle adjustments to color to smooth gradients. +Drawing the gradient repeatedly with <a href="bmh_undocumented?cl=9919#kPlus">SkBlendMode::kPlus</a> exaggerates the +dither, making it easier to see.</div></fiddle-embed></div> + +<a name="isDither"></a> +## isDither + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +bool isDither() const +</pre> + +If true, color error may be distributed to smooth color transition. +Equivalent to <a href="bmh_SkPaint_Reference?cl=9919#getFlags">getFlags</a> masked with <a href="bmh_SkPaint_Reference?cl=9919#kDither_Flag">kDither Flag</a>. + +### Return Value + +<a href="bmh_SkPaint_Reference?cl=9919#kDither_Flag">kDither Flag</a> state + +### 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> + +--- + +<a name="setDither"></a> +## setDither + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void setDither(bool dither) +</pre> + +Requests, but does not require, to distribute color error. + +Sets <a href="bmh_SkPaint_Reference?cl=9919#kDither_Flag">kDither Flag</a> if <a href="bmh_SkPaint_Reference?cl=9919#dither">dither</a> is true. +Clears <a href="bmh_SkPaint_Reference?cl=9919#kDither_Flag">kDither Flag</a> if <a href="bmh_SkPaint_Reference?cl=9919#dither">dither</a> is false. + +### Parameters + +<table> <tr> <td><code><strong>dither </strong></code></td> <td> +setting for <a href="bmh_SkPaint_Reference?cl=9919#kDither_Flag">kDither Flag</a></td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="69b7162e8324d9239dd02dd9ada2bdff"> + +#### Example Output + +~~~~ +paint1 == paint2 +~~~~ + +</fiddle-embed></div> + +### See Also + +<a href="bmh_undocumented?cl=9919#SkColorType">kRGB 565 SkColorType</a> + +--- + +### See Also + +Gradient <a href="bmh_undocumented?cl=9919#RGB_565">Color RGB-565</a> + +# <a name="Device_Text"></a> Device Text +<a href="bmh_SkPaint_Reference?cl=9919#LCD_Text">LCD Text</a> and <a href="bmh_SkPaint_Reference?cl=9919#Subpixel_Text">Subpixel Text</a> increase the precision of glyph position. + +When set, <a href="bmh_SkPaint_Reference?cl=9919#Flags">Flags</a> <a href="bmh_SkPaint_Reference?cl=9919#kLCDRenderText_Flag">kLCDRenderText Flag</a> takes advantage of the organization of <a href="bmh_undocumented?cl=9919#RGB">Color RGB</a> stripes that +create a color, and relies +on the small size of the stripe and visual perception to make the color fringing inperceptible. +<a href="bmh_SkPaint_Reference?cl=9919#LCD_Text">LCD Text</a> can be enabled on devices that orient stripes horizontally or vertically, and that order +the color components as <a href="bmh_undocumented?cl=9919#RGB">Color RGB</a> or <a href="bmh_undocumented?cl=9919#RBG">Color RBG</a>. + +<a href="bmh_SkPaint_Reference?cl=9919#Flags">Flags</a> <a href="bmh_SkPaint_Reference?cl=9919#kSubpixelText_Flag">kSubpixelText Flag</a> uses the pixel transparency to represent a fractional offset. +As the opaqueness +of the color increases, the edge of the glyph appears to move towards the outside of the pixel. + +Either or both techniques can be enabled. +<a href="bmh_SkPaint_Reference?cl=9919#kLCDRenderText_Flag">kLCDRenderText Flag</a> and <a href="bmh_SkPaint_Reference?cl=9919#kSubpixelText_Flag">kSubpixelText Flag</a> are clear by default. +<a href="bmh_SkPaint_Reference?cl=9919#LCD_Text">LCD Text</a> or <a href="bmh_SkPaint_Reference?cl=9919#Subpixel_Text">Subpixel Text</a> can be enabled by default by setting <a href="bmh_undocumented?cl=9919#SkPaintDefaults_Flags">SkPaintDefaults Flags</a> to +<a href="bmh_SkPaint_Reference?cl=9919#kLCDRenderText_Flag">kLCDRenderText Flag</a> or <a href="bmh_SkPaint_Reference?cl=9919#kSubpixelText_Flag">kSubpixelText Flag</a> (or both) at compile time. + +### Example + +<div><fiddle-embed name="4606ae1be792d6bc46d496432f050ee9"><div>Four commas are drawn normally and with combinations of <a href="bmh_SkPaint_Reference?cl=9919#LCD_Text">LCD Text</a> and <a href="bmh_SkPaint_Reference?cl=9919#Subpixel_Text">Subpixel Text</a>. +When <a href="bmh_SkPaint_Reference?cl=9919#Subpixel_Text">Subpixel Text</a> is disabled, the comma glyphs are indentical, but not evenly spaced. +When <a href="bmh_SkPaint_Reference?cl=9919#Subpixel_Text">Subpixel Text</a> is enabled, the comma glyphs are unique, but appear evenly spaced.</div></fiddle-embed></div> + +## <a name="Linear_Text"></a> Linear Text + +<a href="bmh_SkPaint_Reference?cl=9919#Linear_Text">Linear Text</a> selects whether text is rendered as a <a href="bmh_undocumented?cl=9919#Glyph">Glyph</a> or as a <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>. +If <a href="bmh_SkPaint_Reference?cl=9919#kLinearText_Flag">kLinearText Flag</a> is set, it has the same effect as setting <a href="bmh_SkPaint_Reference?cl=9919#Hinting">Hinting</a> to <a href="bmh_SkPaint_Reference?cl=9919#kNormal_Hinting">kNormal Hinting</a>. +If <a href="bmh_SkPaint_Reference?cl=9919#kLinearText_Flag">kLinearText Flag</a> is clear, it's the same as setting <a href="bmh_SkPaint_Reference?cl=9919#Hinting">Hinting</a> to <a href="bmh_SkPaint_Reference?cl=9919#kNo_Hinting">kNo Hinting</a>. + +<a name="isLinearText"></a> +## isLinearText + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +bool isLinearText() const +</pre> + +If true, text is converted to <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> before drawing and measuring. + +Equivalent to <a href="bmh_SkPaint_Reference?cl=9919#getFlags">getFlags</a> masked with <a href="bmh_SkPaint_Reference?cl=9919#kLinearText_Flag">kLinearText Flag</a>. + +### Return Value + +<a href="bmh_SkPaint_Reference?cl=9919#kLinearText_Flag">kLinearText Flag</a> state + +### Example + +<div><fiddle-embed name="2890ad644f980637837e6fcb386fb462"></fiddle-embed></div> + +### See Also + +<a href="bmh_SkPaint_Reference?cl=9919#setLinearText">setLinearText</a> <a href="bmh_SkPaint_Reference?cl=9919#Hinting">Hinting</a> + +--- + +<a name="setLinearText"></a> +## setLinearText + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void setLinearText(bool linearText) +</pre> + +If true, text is converted to <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> before drawing and measuring. +By default, <a href="bmh_SkPaint_Reference?cl=9919#kLinearText_Flag">kLinearText Flag</a> is clear. + +Sets <a href="bmh_SkPaint_Reference?cl=9919#kLinearText_Flag">kLinearText Flag</a> if <a href="bmh_SkPaint_Reference?cl=9919#linearText">linearText</a> is true. +Clears <a href="bmh_SkPaint_Reference?cl=9919#kLinearText_Flag">kLinearText Flag</a> if <a href="bmh_SkPaint_Reference?cl=9919#linearText">linearText</a> is false. + +### Parameters + +<table> <tr> <td><code><strong>linearText </strong></code></td> <td> +setting for <a href="bmh_SkPaint_Reference?cl=9919#kLinearText_Flag">kLinearText Flag</a></td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="c93bb912f3bddfb4d96d3ad70ada552b"></fiddle-embed></div> + +### See Also + +<a href="bmh_SkPaint_Reference?cl=9919#isLinearText">isLinearText</a> <a href="bmh_SkPaint_Reference?cl=9919#Hinting">Hinting</a> + +--- + +## <a name="Subpixel_Text"></a> Subpixel Text + +<a href="bmh_SkPaint_Reference?cl=9919#Flags">Flags</a> <a href="bmh_SkPaint_Reference?cl=9919#kSubpixelText_Flag">kSubpixelText Flag</a> uses the pixel transparency to represent a fractional offset. +As the opaqueness +of the color increases, the edge of the glyph appears to move towards the outside of the pixel. + +<a name="isSubpixelText"></a> +## isSubpixelText + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +bool isSubpixelText() const +</pre> + +If true, glyphs at different sub-pixel positions may differ on pixel edge coverage. + +Equivalent to <a href="bmh_SkPaint_Reference?cl=9919#getFlags">getFlags</a> masked with <a href="bmh_SkPaint_Reference?cl=9919#kSubpixelText_Flag">kSubpixelText Flag</a>. + +### Return Value + +<a href="bmh_SkPaint_Reference?cl=9919#kSubpixelText_Flag">kSubpixelText Flag</a> state + +### 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> + +--- + +<a name="setSubpixelText"></a> +## setSubpixelText + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void setSubpixelText(bool subpixelText) +</pre> + +Requests, but does not require, that glyphs respect sub-pixel positioning. + +Sets <a href="bmh_SkPaint_Reference?cl=9919#kSubpixelText_Flag">kSubpixelText Flag</a> if <a href="bmh_SkPaint_Reference?cl=9919#subpixelText">subpixelText</a> is true. +Clears <a href="bmh_SkPaint_Reference?cl=9919#kSubpixelText_Flag">kSubpixelText Flag</a> if <a href="bmh_SkPaint_Reference?cl=9919#subpixelText">subpixelText</a> is false. + +### Parameters + +<table> <tr> <td><code><strong>subpixelText </strong></code></td> <td> +setting for <a href="bmh_SkPaint_Reference?cl=9919#kSubpixelText_Flag">kSubpixelText Flag</a></td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="a77bbc1a4e3be9a8ab0f842f877c5ee4"> + +#### Example Output + +~~~~ +paint1 == paint2 +~~~~ + +</fiddle-embed></div> + +--- + +## <a name="LCD_Text"></a> LCD Text + +When set, <a href="bmh_SkPaint_Reference?cl=9919#Flags">Flags</a> <a href="bmh_SkPaint_Reference?cl=9919#kLCDRenderText_Flag">kLCDRenderText Flag</a> takes advantage of the organization of <a href="bmh_undocumented?cl=9919#RGB">Color RGB</a> stripes that +create a color, and relies +on the small size of the stripe and visual perception to make the color fringing inperceptible. +<a href="bmh_SkPaint_Reference?cl=9919#LCD_Text">LCD Text</a> can be enabled on devices that orient stripes horizontally or vertically, and that order +the color components as <a href="bmh_undocumented?cl=9919#RGB">Color RGB</a> or <a href="bmh_undocumented?cl=9919#RBG">Color RBG</a>. + +<a name="isLCDRenderText"></a> +## isLCDRenderText + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +bool isLCDRenderText() const +</pre> + +If true, glyphs may use <a href="bmh_undocumented?cl=9919#LCD">LCD</a> striping to improve glyph edges. + +Returns true if <a href="bmh_SkPaint_Reference?cl=9919#Flags">Flags</a> <a href="bmh_SkPaint_Reference?cl=9919#kLCDRenderText_Flag">kLCDRenderText Flag</a> is set. + +### Return Value + +<a href="bmh_SkPaint_Reference?cl=9919#kLCDRenderText_Flag">kLCDRenderText Flag</a> state + +### Example + +<div><fiddle-embed name="68e1fd95dd2fd06a333899d2bd2396b9"> + +#### Example Output + +~~~~ +paint.isLCDRenderText() == !!(paint.getFlags() & SkPaint::kLCDRenderText_Flag) +paint.isLCDRenderText() == !!(paint.getFlags() & SkPaint::kLCDRenderText_Flag) +~~~~ + +</fiddle-embed></div> + +--- + +<a name="setLCDRenderText"></a> +## setLCDRenderText + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void setLCDRenderText(bool lcdText) +</pre> + +Requests, but does not require, that glyphs use <a href="bmh_undocumented?cl=9919#LCD">LCD</a> striping for glyph edges. + +Sets <a href="bmh_SkPaint_Reference?cl=9919#kLCDRenderText_Flag">kLCDRenderText Flag</a> if <a href="bmh_SkPaint_Reference?cl=9919#lcdText">lcdText</a> is true. +Clears <a href="bmh_SkPaint_Reference?cl=9919#kLCDRenderText_Flag">kLCDRenderText Flag</a> if <a href="bmh_SkPaint_Reference?cl=9919#lcdText">lcdText</a> is false. + +### Parameters + +<table> <tr> <td><code><strong>lcdText </strong></code></td> <td> +setting for <a href="bmh_SkPaint_Reference?cl=9919#kLCDRenderText_Flag">kLCDRenderText Flag</a></td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="50dedf8450159571a3edaf4f0050defe"> + +#### Example Output + +~~~~ +paint1 == paint2 +~~~~ + +</fiddle-embed></div> + +--- + +# <a name="Font_Embedded_Bitmaps"></a> Font Embedded Bitmaps +<a href="bmh_SkPaint_Reference?cl=9919#Font_Embedded_Bitmaps">Font Embedded Bitmaps</a> allows selecting custom-sized bitmap glyphs. +<a href="bmh_SkPaint_Reference?cl=9919#Flags">Flags</a> <a href="bmh_SkPaint_Reference?cl=9919#kEmbeddedBitmapText_Flag">kEmbeddedBitmapText Flag</a> when set chooses an embedded bitmap glyph over an outline contained +in a font if the platform supports this option. + +<a href="bmh_undocumented?cl=9919#FreeType">FreeType</a> selects the bitmap glyph if available when <a href="bmh_SkPaint_Reference?cl=9919#kEmbeddedBitmapText_Flag">kEmbeddedBitmapText Flag</a> is set, and selects +the outline glyph if <a href="bmh_SkPaint_Reference?cl=9919#kEmbeddedBitmapText_Flag">kEmbeddedBitmapText Flag</a> is clear. +<a href="bmh_undocumented?cl=9919#Windows">Windows</a> may select the bitmap glyph but is not required to do so. +<a href="bmh_undocumented?cl=9919#OS_X">OS X</a> and <a href="bmh_undocumented?cl=9919#iOS">iOS</a> do not support this option. + +<a href="bmh_SkPaint_Reference?cl=9919#Font_Embedded_Bitmaps">Font Embedded Bitmaps</a> is disabled by default. +<a href="bmh_SkPaint_Reference?cl=9919#Font_Embedded_Bitmaps">Font Embedded Bitmaps</a> can be enabled by default by setting <a href="bmh_undocumented?cl=9919#SkPaintDefaults_Flags">SkPaintDefaults Flags</a> to +<a href="bmh_SkPaint_Reference?cl=9919#kEmbeddedBitmapText_Flag">kEmbeddedBitmapText Flag</a> at compile time. + +### Example + +<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0"> +!fiddle<div>The hintgasp <a href="bmh_undocumented?cl=9919#TrueType">TrueType</a> font in the <a href="bmh_undocumented?cl=9919#Skia">Skia</a> resources/fonts directory includes an embedded +bitmap glyph at odd font sizes. This example works on platforms that use <a href="bmh_undocumented?cl=9919#FreeType">FreeType</a> +as their <a href="bmh_undocumented?cl=9919#Engine">Font Engine</a>. +<a href="bmh_undocumented?cl=9919#Windows">Windows</a> may, but is not required to, return a bitmap glyph if <a href="bmh_SkPaint_Reference?cl=9919#kEmbeddedBitmapText_Flag">kEmbeddedBitmapText Flag</a> is set.</div><a href="bmh_undocumented?cl=9919#SkBitmap">SkBitmap</a> bitmap; +bitmap.allocN32Pixels(30, 15); +bitmap.eraseColor(0); +<a href="bmh_SkCanvas_Reference?cl=9919#SkCanvas">SkCanvas</a> offscreen(bitmap); +<a href="bmh_SkPaint_Reference?cl=9919#SkPaint">SkPaint</a> paint; +paint.</pre> + +<a name="isEmbeddedBitmapText"></a> +## isEmbeddedBitmapText + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +bool isEmbeddedBitmapText() const +</pre> + +If true, <a href="bmh_undocumented?cl=9919#Engine">Font Engine</a> may return glyphs from font bitmaps instead of from outlines. + +Equivalent to <a href="bmh_SkPaint_Reference?cl=9919#getFlags">getFlags</a> masked with <a href="bmh_SkPaint_Reference?cl=9919#kEmbeddedBitmapText_Flag">kEmbeddedBitmapText Flag</a>. + +### Return Value + +<a href="bmh_SkPaint_Reference?cl=9919#kEmbeddedBitmapText_Flag">kEmbeddedBitmapText Flag</a> state + +### 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> + +--- + +<a name="setEmbeddedBitmapText"></a> +## setEmbeddedBitmapText + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void setEmbeddedBitmapText(bool useEmbeddedBitmapText) +</pre> + +Requests, but does not require, to use bitmaps in fonts instead of outlines. + +Sets <a href="bmh_SkPaint_Reference?cl=9919#kEmbeddedBitmapText_Flag">kEmbeddedBitmapText Flag</a> if <a href="bmh_SkPaint_Reference?cl=9919#useEmbeddedBitmapText">useEmbeddedBitmapText</a> is true. +Clears <a href="bmh_SkPaint_Reference?cl=9919#kEmbeddedBitmapText_Flag">kEmbeddedBitmapText Flag</a> if <a href="bmh_SkPaint_Reference?cl=9919#useEmbeddedBitmapText">useEmbeddedBitmapText</a> is false. + +### Parameters + +<table> <tr> <td><code><strong>useEmbeddedBitmapText </strong></code></td> <td> +setting for <a href="bmh_SkPaint_Reference?cl=9919#kEmbeddedBitmapText_Flag">kEmbeddedBitmapText Flag</a></td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="246dffdd93a484ba4ad7ecf71198a5d4"> + +#### Example Output + +~~~~ +paint1 == paint2 +~~~~ + +</fiddle-embed></div> + +--- + +# <a name="Automatic_Hinting"></a> Automatic Hinting +If <a href="bmh_SkPaint_Reference?cl=9919#Hinting">Hinting</a> is set to <a href="bmh_SkPaint_Reference?cl=9919#kNormal_Hinting">kNormal Hinting</a> or <a href="bmh_SkPaint_Reference?cl=9919#kFull_Hinting">kFull Hinting</a>, <a href="bmh_SkPaint_Reference?cl=9919#Automatic_Hinting">Automatic Hinting</a> +instructs the <a href="bmh_undocumented?cl=9919#Font_Manager">Font Manager</a> to always hint Glyphs. +<a href="bmh_SkPaint_Reference?cl=9919#Automatic_Hinting">Automatic Hinting</a> has no effect if <a href="bmh_SkPaint_Reference?cl=9919#Hinting">Hinting</a> is set to <a href="bmh_SkPaint_Reference?cl=9919#kNo_Hinting">kNo Hinting</a> or +<a href="bmh_SkPaint_Reference?cl=9919#kSlight_Hinting">kSlight Hinting</a>. + +<a href="bmh_SkPaint_Reference?cl=9919#Automatic_Hinting">Automatic Hinting</a> only affects platforms that use <a href="bmh_undocumented?cl=9919#FreeType">FreeType</a> as the <a href="bmh_undocumented?cl=9919#Font_Manager">Font Manager</a>. + +<a name="isAutohinted"></a> +## isAutohinted + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +bool isAutohinted() const +</pre> + +If true, and if <a href="bmh_SkPaint_Reference?cl=9919#Hinting">Hinting</a> is set to <a href="bmh_SkPaint_Reference?cl=9919#kNormal_Hinting">kNormal Hinting</a> or <a href="bmh_SkPaint_Reference?cl=9919#kFull_Hinting">kFull Hinting</a>, and if +platform uses <a href="bmh_undocumented?cl=9919#FreeType">FreeType</a> as the <a href="bmh_undocumented?cl=9919#Font_Manager">Font Manager</a>, instruct the <a href="bmh_undocumented?cl=9919#Font_Manager">Font Manager</a> to always hint +Glyphs. + +Equivalent to <a href="bmh_SkPaint_Reference?cl=9919#getFlags">getFlags</a> masked with <a href="bmh_SkPaint_Reference?cl=9919#kAutoHinting_Flag">kAutoHinting Flag</a>. + +### Return Value + +<a href="bmh_SkPaint_Reference?cl=9919#kAutoHinting_Flag">kAutoHinting Flag</a> state + +### 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 + +<a href="bmh_SkPaint_Reference?cl=9919#setAutohinted">setAutohinted</a> <a href="bmh_SkPaint_Reference?cl=9919#Hinting">Hinting</a> + +--- + +<a name="setAutohinted"></a> +## setAutohinted + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void setAutohinted(bool useAutohinter) +</pre> + +If <a href="bmh_SkPaint_Reference?cl=9919#Hinting">Hinting</a> is set to <a href="bmh_SkPaint_Reference?cl=9919#kNormal_Hinting">kNormal Hinting</a> or <a href="bmh_SkPaint_Reference?cl=9919#kFull_Hinting">kFull Hinting</a> and <a href="bmh_SkPaint_Reference?cl=9919#useAutohinter">useAutohinter</a> is set, +instruct the <a href="bmh_undocumented?cl=9919#Font_Manager">Font Manager</a> to always hint Glyphs. +<a href="bmh_SkPaint_Reference?cl=9919#Automatic_Hinting">Automatic Hinting</a> has no effect if <a href="bmh_SkPaint_Reference?cl=9919#Hinting">Hinting</a> is set to <a href="bmh_SkPaint_Reference?cl=9919#kNo_Hinting">kNo Hinting</a> or +<a href="bmh_SkPaint_Reference?cl=9919#kSlight_Hinting">kSlight Hinting</a>. + +<a href="bmh_SkPaint_Reference?cl=9919#setAutohinted">setAutohinted</a> only affects platforms that use <a href="bmh_undocumented?cl=9919#FreeType">FreeType</a> as the <a href="bmh_undocumented?cl=9919#Font_Manager">Font Manager</a>. + +Sets <a href="bmh_SkPaint_Reference?cl=9919#kAutoHinting_Flag">kAutoHinting Flag</a> if <a href="bmh_SkPaint_Reference?cl=9919#useAutohinter">useAutohinter</a> is true. +Clears <a href="bmh_SkPaint_Reference?cl=9919#kAutoHinting_Flag">kAutoHinting Flag</a> if <a href="bmh_SkPaint_Reference?cl=9919#useAutohinter">useAutohinter</a> is false. + +### Parameters + +<table> <tr> <td><code><strong>useAutohinter </strong></code></td> <td> +setting for <a href="bmh_SkPaint_Reference?cl=9919#kAutoHinting_Flag">kAutoHinting Flag</a></td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="4e185306d7de9390fe8445eed0139309"></fiddle-embed></div> + +### See Also + +<a href="bmh_SkPaint_Reference?cl=9919#isAutohinted">isAutohinted</a> <a href="bmh_SkPaint_Reference?cl=9919#Hinting">Hinting</a> + +--- + +# <a name="Vertical_Text"></a> Vertical Text +<a href="bmh_undocumented?cl=9919#Text">Text</a> may be drawn by positioning each glyph, or by positioning the first glyph and +using <a href="bmh_undocumented?cl=9919#Advance">Font Advance</a> to position subsequent glyphs. By default, each successive glyph +is positioned to the right of the preceeding glyph. <a href="bmh_SkPaint_Reference?cl=9919#Vertical_Text">Vertical Text</a> sets successive +glyphs to position below the preceeding glyph. + +<a href="bmh_undocumented?cl=9919#Skia">Skia</a> can translate text character codes as a series of glyphs, but does not implement +font substitution, +textual substitution, line layout, or contextual spacing like kerning pairs. Use +a text shaping engine likeHarfBuzzhttp://harfbuzz.org/to translate text runs +into glyph series. + +<a href="bmh_SkPaint_Reference?cl=9919#Vertical_Text">Vertical Text</a> is clear if text is drawn left to right or set if drawn from top to bottom. + +<a href="bmh_SkPaint_Reference?cl=9919#Flags">Flags</a> <a href="bmh_SkPaint_Reference?cl=9919#kVerticalText_Flag">kVerticalText Flag</a> if clear draws text left to right. +<a href="bmh_SkPaint_Reference?cl=9919#Flags">Flags</a> <a href="bmh_SkPaint_Reference?cl=9919#kVerticalText_Flag">kVerticalText Flag</a> if set draws text top to bottom. + +<a href="bmh_SkPaint_Reference?cl=9919#Vertical_Text">Vertical Text</a> is clear by default. +<a href="bmh_SkPaint_Reference?cl=9919#Vertical_Text">Vertical Text</a> can be set by default by setting <a href="bmh_undocumented?cl=9919#SkPaintDefaults_Flags">SkPaintDefaults Flags</a> to +<a href="bmh_SkPaint_Reference?cl=9919#kVerticalText_Flag">kVerticalText Flag</a> at compile time. + +### Example + +<div><fiddle-embed name="8df5800819311b71373d9abb669b49b8"></fiddle-embed></div> + +<a name="isVerticalText"></a> +## isVerticalText + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +bool isVerticalText() const +</pre> + +If true, glyphs are drawn top to bottom instead of left to right. + +Equivalent to <a href="bmh_SkPaint_Reference?cl=9919#getFlags">getFlags</a> masked with <a href="bmh_SkPaint_Reference?cl=9919#kVerticalText_Flag">kVerticalText Flag</a>. + +### Return Value + +<a href="bmh_SkPaint_Reference?cl=9919#kVerticalText_Flag">kVerticalText Flag</a> state + +### Example + +<div><fiddle-embed name="4a269b16e644d473870ffa873396f139"> + +#### Example Output + +~~~~ +paint.isVerticalText() == !!(paint.getFlags() & SkPaint::kVerticalText_Flag) +paint.isVerticalText() == !!(paint.getFlags() & SkPaint::kVerticalText_Flag) +~~~~ + +</fiddle-embed></div> + +--- + +<a name="setVerticalText"></a> +## setVerticalText + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void setVerticalText(bool verticalText) +</pre> + +If true, text advance positions the next glyph below the previous glyph instead of to the +right of previous glyph. + +Sets <a href="bmh_SkPaint_Reference?cl=9919#kVerticalText_Flag">kVerticalText Flag</a> if vertical is true. +Clears <a href="bmh_SkPaint_Reference?cl=9919#kVerticalText_Flag">kVerticalText Flag</a> if vertical is false. + +### Parameters + +<table> <tr> <td><code><strong>verticalText </strong></code></td> <td> +setting for <a href="bmh_SkPaint_Reference?cl=9919#kVerticalText_Flag">kVerticalText Flag</a></td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="6fbd7e9e1a346cb8d7f537786009c736"> + +#### Example Output + +~~~~ +paint1 == paint2 +~~~~ + +</fiddle-embed></div> + +--- + +# <a name="Fake_Bold"></a> Fake Bold +<a href="bmh_SkPaint_Reference?cl=9919#Fake_Bold">Fake Bold</a> approximates the bold font style accompanying a normal font when a bold font face +is not available. <a href="bmh_undocumented?cl=9919#Skia">Skia</a> does not provide font substitution; it is up to the client to find the +bold font face using the platform's <a href="bmh_undocumented?cl=9919#Font_Manager">Font Manager</a>. + +Use <a href="bmh_SkPaint_Reference?cl=9919#Text_Skew_X">Text Skew X</a> to approximate an italic font style when the italic font face +is not available. + +A <a href="bmh_undocumented?cl=9919#FreeType_based">FreeType-based</a> port may define <a href="bmh_undocumented?cl=9919#SK_USE_FREETYPE_EMBOLDEN">SK USE FREETYPE EMBOLDEN</a> at compile time to direct +the font engine to create the bold glyphs. Otherwise, the extra bold is computed +by increasing the stroke width and setting the <a href="bmh_SkPaint_Reference?cl=9919#Style">Style</a> to <a href="bmh_SkPaint_Reference?cl=9919#kStrokeAndFill_Style">kStrokeAndFill Style</a> as needed. + +<a href="bmh_SkPaint_Reference?cl=9919#Fake_Bold">Fake Bold</a> is disabled by default. + +### Example + +<div><fiddle-embed name="e811f4829a2daaaeaad3795504a7e02a"></fiddle-embed></div> + +<a name="isFakeBoldText"></a> +## isFakeBoldText + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +bool isFakeBoldText() const +</pre> + +If true, approximate bold by increasing the stroke width when creating glyph bitmaps +from outlines. + +Equivalent to <a href="bmh_SkPaint_Reference?cl=9919#getFlags">getFlags</a> masked with <a href="bmh_SkPaint_Reference?cl=9919#kFakeBoldText_Flag">kFakeBoldText Flag</a>. + +### Return Value + +<a href="bmh_SkPaint_Reference?cl=9919#kFakeBoldText_Flag">kFakeBoldText Flag</a> state + +### 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> + +--- + +<a name="setFakeBoldText"></a> +## setFakeBoldText + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void setFakeBoldText(bool fakeBoldText) +</pre> + +Use increased stroke width when creating glyph bitmaps to approximate bolding. + +Sets <a href="bmh_SkPaint_Reference?cl=9919#kFakeBoldText_Flag">kFakeBoldText Flag</a> if <a href="bmh_SkPaint_Reference?cl=9919#fakeBoldText">fakeBoldText</a> is true. +Clears <a href="bmh_SkPaint_Reference?cl=9919#kFakeBoldText_Flag">kFakeBoldText Flag</a> if <a href="bmh_SkPaint_Reference?cl=9919#fakeBoldText">fakeBoldText</a> is false. + +### Parameters + +<table> <tr> <td><code><strong>fakeBoldText </strong></code></td> <td> +setting for <a href="bmh_SkPaint_Reference?cl=9919#kFakeBoldText_Flag">kFakeBoldText Flag</a></td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="594d47858eb11028cb626515a520910a"> + +#### Example Output + +~~~~ +paint1 == paint2 +~~~~ + +</fiddle-embed></div> + +--- + +# <a name="Full_Hinting_Spacing"></a> Full Hinting Spacing +<a href="bmh_SkPaint_Reference?cl=9919#Full_Hinting_Spacing">Full Hinting Spacing</a> adjusts the character spacing by the difference of the +hinted and unhinted left and right side bearings, +if <a href="bmh_SkPaint_Reference?cl=9919#Hinting">Hinting</a> is set to <a href="bmh_SkPaint_Reference?cl=9919#kFull_Hinting">kFull Hinting</a>. <a href="bmh_SkPaint_Reference?cl=9919#Full_Hinting_Spacing">Full Hinting Spacing</a> only +applies to platforms that use <a href="bmh_undocumented?cl=9919#FreeType">FreeType</a> as their <a href="bmh_undocumented?cl=9919#Engine">Font Engine</a>. + +<a href="bmh_SkPaint_Reference?cl=9919#Full_Hinting_Spacing">Full Hinting Spacing</a> is not related to text kerning, where the space between +a specific pair of characters is adjusted using data in the font's kerning tables. + +<a name="isDevKernText"></a> +## isDevKernText + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +bool isDevKernText() const +</pre> + +Returns if character spacing may be adjusted by the hinting difference. + +Equivalent to <a href="bmh_SkPaint_Reference?cl=9919#getFlags">getFlags</a> masked with <a href="bmh_SkPaint_Reference?cl=9919#kDevKernText_Flag">kDevKernText Flag</a>. + +### Return Value + +<a href="bmh_SkPaint_Reference?cl=9919#kDevKernText_Flag">kDevKernText Flag</a> state + +### Example + +<div><fiddle-embed name="4f69a84b2505b12809c30b0cc09c5157"></fiddle-embed></div> + +--- + +<a name="setDevKernText"></a> +## setDevKernText + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void setDevKernText(bool devKernText) +</pre> + +Requests, but does not require, to use hinting to adjust glyph spacing. + +Sets <a href="bmh_SkPaint_Reference?cl=9919#kDevKernText_Flag">kDevKernText Flag</a> if <a href="bmh_SkPaint_Reference?cl=9919#devKernText">devKernText</a> is true. +Clears <a href="bmh_SkPaint_Reference?cl=9919#kDevKernText_Flag">kDevKernText Flag</a> if <a href="bmh_SkPaint_Reference?cl=9919#devKernText">devKernText</a> is false. + +### Parameters + +<table> <tr> <td><code><strong>devKernText </strong></code></td> <td> +setting for <a href="bmh_SkPaint_Reference?cl=9919#devKernText">devKernText</a></td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="2b718a059072908bf68942503f264797"> + +#### Example Output + +~~~~ +paint1 == paint2 +~~~~ + +</fiddle-embed></div> + +--- + +# <a name="Filter_Quality_Methods"></a> Filter Quality Methods +<a href="bmh_undocumented?cl=9919#Filter_Quality">Filter Quality</a> trades speed for image filtering when the image is scaled. +A lower <a href="bmh_undocumented?cl=9919#Filter_Quality">Filter Quality</a> draws faster, but has less fidelity. +A higher <a href="bmh_undocumented?cl=9919#Filter_Quality">Filter Quality</a> draws slower, but looks better. +If the image is unscaled, the <a href="bmh_undocumented?cl=9919#Filter_Quality">Filter Quality</a> choice will not result in a noticable +difference. + +<a href="bmh_undocumented?cl=9919#Filter_Quality">Filter Quality</a> is used in <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> passed as a parameter to + +<table> <tr> + <td><a href="bmh_SkCanvas_Reference?cl=9919#drawBitmap">SkCanvas::drawBitmap</a></td> </tr> <tr> + <td><a href="bmh_SkCanvas_Reference?cl=9919#drawBitmapRect">SkCanvas::drawBitmapRect</a></td> </tr> <tr> + <td><a href="bmh_SkCanvas_Reference?cl=9919#drawImage">SkCanvas::drawImage</a></td> </tr> <tr> + <td><a href="bmh_SkCanvas_Reference?cl=9919#drawImageRect">SkCanvas::drawImageRect</a></td> </tr> +</table> + +and when <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> has a <a href="bmh_undocumented?cl=9919#Shader">Shader</a> specialization that uses <a href="bmh_undocumented?cl=9919#Image">Image</a> or <a href="bmh_undocumented?cl=9919#Bitmap">Bitmap</a>. + +<a href="bmh_undocumented?cl=9919#Filter_Quality">Filter Quality</a> is <a href="bmh_undocumented?cl=9919#SkFilterQuality">kNone SkFilterQuality</a> by default. + +### Example + +<div><fiddle-embed name="ee77f83f7291e07ae0d89f1380c7d67c"></fiddle-embed></div> + +<a name="getFilterQuality"></a> +## getFilterQuality + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +SkFilterQuality getFilterQuality() const +</pre> + +Returns <a href="bmh_undocumented?cl=9919#Filter_Quality">Filter Quality</a>, the image filtering level. A lower setting +draws faster; a higher setting looks better when the image is scaled. + +### Return Value + +one of: <a href="bmh_undocumented?cl=9919#SkFilterQuality">kNone SkFilterQuality</a>, <a href="bmh_undocumented?cl=9919#SkFilterQuality">kLow SkFilterQuality</a>, +<a href="bmh_undocumented?cl=9919#SkFilterQuality">kMedium SkFilterQuality</a>, <a href="bmh_undocumented?cl=9919#SkFilterQuality">kHigh SkFilterQuality</a> + +### Example + +<div><fiddle-embed name="d4ca1f23809b6835c4ba46ea98a86900"> + +#### Example Output + +~~~~ +kNone_SkFilterQuality == paint.getFilterQuality() +~~~~ + +</fiddle-embed></div> + +--- + +<a name="setFilterQuality"></a> +## setFilterQuality + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void setFilterQuality(SkFilterQuality quality) +</pre> + +Sets <a href="bmh_undocumented?cl=9919#Filter_Quality">Filter Quality</a>, the image filtering level. A lower setting +draws faster; a higher setting looks better when the image is scaled. +<a href="bmh_SkPaint_Reference?cl=9919#setFilterQuality">setFilterQuality</a> does not check to see if <a href="bmh_SkPaint_Reference?cl=9919#setFilterQuality">quality</a> is valid. + +### Parameters + +<table> <tr> <td><code><strong>quality </strong></code></td> <td> +one of: <a href="bmh_undocumented?cl=9919#SkFilterQuality">kNone SkFilterQuality</a>, <a href="bmh_undocumented?cl=9919#SkFilterQuality">kLow SkFilterQuality</a>, +<a href="bmh_undocumented?cl=9919#SkFilterQuality">kMedium SkFilterQuality</a>, <a href="bmh_undocumented?cl=9919#SkFilterQuality">kHigh SkFilterQuality</a></td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="e4288fabf24ee60b645e8bb6ea0afadf"> + +#### Example Output + +~~~~ +kHigh_SkFilterQuality == paint.getFilterQuality() +~~~~ + +</fiddle-embed></div> + +### See Also + +<a href="bmh_undocumented?cl=9919#SkFilterQuality">SkFilterQuality</a> <a href="bmh_undocumented?cl=9919#Image_Scaling">Image Scaling</a> + +--- + +# <a name="Color_Methods"></a> Color Methods +<a href="bmh_undocumented?cl=9919#Color">Color</a> specifies the <a href="bmh_undocumented?cl=9919#RGB_Red">Color RGB Red</a>, <a href="bmh_undocumented?cl=9919#RGB_Blue">Color RGB Blue</a>, <a href="bmh_undocumented?cl=9919#RGB_Green">Color RGB Green</a>, and <a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a> values used to draw a filled +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. + +<a href="bmh_undocumented?cl=9919#Color">Color</a> is not premultiplied; +<a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a> sets the transparency independent of <a href="bmh_undocumented?cl=9919#RGB">Color RGB</a>: <a href="bmh_undocumented?cl=9919#RGB_Red">Color RGB Red</a>, <a href="bmh_undocumented?cl=9919#RGB_Blue">Color RGB Blue</a>, and <a href="bmh_undocumented?cl=9919#RGB_Green">Color RGB Green</a>. + +The bit positions of <a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a> and <a href="bmh_undocumented?cl=9919#RGB">Color RGB</a> are independent of the bit positions +on the output device, which may have more or fewer bits, and may have a different arrangement. + +| bit positions | <a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a> | <a href="bmh_undocumented?cl=9919#RGB_Red">Color RGB Red</a> | <a href="bmh_undocumented?cl=9919#RGB_Blue">Color RGB Blue</a> | <a href="bmh_undocumented?cl=9919#RGB_Green">Color RGB Green</a> | +| --- | --- | --- | --- | --- | +| | 31 - 24 | 23 - 16 | 15 - 8 | 7 - 0 | + +### Example + +<div><fiddle-embed name="214b559d75c65a7bef6ef4be1f860053"></fiddle-embed></div> + +<a name="getColor"></a> +## getColor + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +SkColor getColor() const +</pre> + +Retrieves <a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a> and <a href="bmh_undocumented?cl=9919#RGB">Color RGB</a>, unpremultiplied, packed into 32 bits. +Use helpers <a href="bmh_undocumented?cl=9919#SkColorGetA">SkColorGetA</a>, <a href="bmh_undocumented?cl=9919#SkColorGetR">SkColorGetR</a>, <a href="bmh_undocumented?cl=9919#SkColorGetG">SkColorGetG</a>, and <a href="bmh_undocumented?cl=9919#SkColorGetB">SkColorGetB</a> to extract +a color component. + +### Return Value + +<a href="bmh_undocumented?cl=9919#Unpremultiplied">Unpremultiplied</a> <a href="bmh_undocumented?cl=9919#ARGB">Color ARGB</a> + +### Example + +<div><fiddle-embed name="72d41f890203109a41f589a7403acae9"> + +#### Example Output + +~~~~ +Yellow is 100% red, 100% green, and 0% blue. +~~~~ + +</fiddle-embed></div> + +### See Also + +<a href="bmh_undocumented?cl=9919#SkColor">SkColor</a> + +--- + +<a name="setColor"></a> +## setColor + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void setColor(SkColor color) +</pre> + +Sets <a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a> and <a href="bmh_undocumented?cl=9919#RGB">Color RGB</a> used when stroking and filling. The <a href="bmh_SkPaint_Reference?cl=9919#color">color</a> is a 32-bit value, +unpremutiplied, packing 8-bit components for <a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a>, <a href="bmh_undocumented?cl=9919#RGB_Red">Color RGB Red</a>, <a href="bmh_undocumented?cl=9919#RGB_Blue">Color RGB Blue</a>, and <a href="bmh_undocumented?cl=9919#RGB_Green">Color RGB Green</a>. + +### Parameters + +<table> <tr> <td><code><strong>color </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#Unpremultiplied">Unpremultiplied</a> <a href="bmh_undocumented?cl=9919#ARGB">Color ARGB</a></td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="6e70f18300bd676a3c056ceb6b62f8df"> + +#### Example Output + +~~~~ +green1 == green2 +~~~~ + +</fiddle-embed></div> + +### See Also + +<a href="bmh_undocumented?cl=9919#SkColor">SkColor</a> <a href="bmh_SkPaint_Reference?cl=9919#setARGB">setARGB</a> <a href="bmh_undocumented?cl=9919#SkColorSetARGB">SkColorSetARGB</a> + +--- + +## <a name="Alpha_Methods"></a> Alpha Methods + +<a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a> sets the transparency independent of <a href="bmh_undocumented?cl=9919#RGB">Color RGB</a>: <a href="bmh_undocumented?cl=9919#RGB_Red">Color RGB Red</a>, <a href="bmh_undocumented?cl=9919#RGB_Blue">Color RGB Blue</a>, and <a href="bmh_undocumented?cl=9919#RGB_Green">Color RGB Green</a>. + +<a name="getAlpha"></a> +## getAlpha + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +uint8_t getAlpha() const +</pre> + +Retrieves <a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a> from the <a href="bmh_undocumented?cl=9919#Color">Color</a> used when stroking and filling. + +### Return Value + +<a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a> ranging from zero, fully transparent, to 255, fully opaque + +### Example + +<div><fiddle-embed name="9a85bb62fe3d877b18fb7f952c4fa7f7"> + +#### Example Output + +~~~~ +255 == paint.getAlpha() +~~~~ + +</fiddle-embed></div> + +--- + +<a name="setAlpha"></a> +## setAlpha + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void setAlpha(U8CPU a) +</pre> + +Replaces <a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a>, leaving <a href="bmh_undocumented?cl=9919#RGB">Color RGB</a> +unchanged. An out of range value triggers an assert in the debug +build. <a href="bmh_SkPaint_Reference?cl=9919#a">a</a> is <a href="bmh_SkPaint_Reference?cl=9919#a">a</a> value from zero to 255. +<a href="bmh_SkPaint_Reference?cl=9919#a">a</a> set to zero makes <a href="bmh_undocumented?cl=9919#Color">Color</a> fully transparent; <a href="bmh_SkPaint_Reference?cl=9919#a">a</a> set to 255 makes <a href="bmh_undocumented?cl=9919#Color">Color</a> +fully opaque. + +### Parameters + +<table> <tr> <td><code><strong>a </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a> component of <a href="bmh_undocumented?cl=9919#Color">Color</a></td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="6ddc0360512dfb9947e75c17e6a8103d"> + +#### Example Output + +~~~~ +0x44112233 == paint.getColor() +~~~~ + +</fiddle-embed></div> + +--- + +<a name="setARGB"></a> +## setARGB + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void setARGB(U8CPU a, U8CPU r, U8CPU g, U8CPU b) +</pre> + +Sets <a href="bmh_undocumented?cl=9919#Color">Color</a> used when drawing solid fills. The color components range from 0 to 255. +The color is unpremultiplied; +<a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a> sets the transparency independent of <a href="bmh_undocumented?cl=9919#RGB">Color RGB</a>. + +### Parameters + +<table> <tr> <td><code><strong>a </strong></code></td> <td> +amount of <a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a>, from fully transparent (0) to fully opaque (255)</td> + </tr> <tr> <td><code><strong>r </strong></code></td> <td> +amount of <a href="bmh_undocumented?cl=9919#RGB_Red">Color RGB Red</a>, from no red (0) to full red (255)</td> + </tr> <tr> <td><code><strong>g </strong></code></td> <td> +amount of <a href="bmh_undocumented?cl=9919#RGB_Green">Color RGB Green</a>, from no green (0) to full green (255)</td> + </tr> <tr> <td><code><strong>b </strong></code></td> <td> +amount of <a href="bmh_undocumented?cl=9919#RGB_Blue">Color RGB Blue</a>, from no blue (0) to full blue (255)</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="cb62e4755789ed32f7120dc55984959d"> + +#### Example Output + +~~~~ +transRed1 == transRed2 +~~~~ + +</fiddle-embed></div> + +### See Also + +<a href="bmh_SkPaint_Reference?cl=9919#setColor">setColor</a> <a href="bmh_undocumented?cl=9919#SkColorSetARGB">SkColorSetARGB</a> + +--- + +# <a name="Style"></a> Style +<a href="bmh_SkPaint_Reference?cl=9919#Style">Style</a> specifies if the geometry is filled, stroked, or both filled and stroked. +Some shapes ignore <a href="bmh_SkPaint_Reference?cl=9919#Style">Style</a> and are always drawn filled or stroked. + +Set <a href="bmh_SkPaint_Reference?cl=9919#Style">Style</a> to <a href="bmh_SkPaint_Reference?cl=9919#kFill_Style">kFill Style</a> to fill the shape. +The fill covers the area inside the geometry for most shapes. + +Set <a href="bmh_SkPaint_Reference?cl=9919#Style">Style</a> to <a href="bmh_SkPaint_Reference?cl=9919#kStroke_Style">kStroke Style</a> to stroke the shape. + +## <a name="Fill"></a> Fill + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#Fill_Type">Path Fill Type</a> + +## <a name="Stroke"></a> Stroke + +The stroke covers the area described by following the shape's edge with a pen or brush of +<a href="bmh_SkPaint_Reference?cl=9919#Stroke_Width">Stroke Width</a>. The area covered where the shape starts and stops is described by <a href="bmh_SkPaint_Reference?cl=9919#Stroke_Cap">Stroke Cap</a>. +The area covered where the shape turns a corner is described by <a href="bmh_SkPaint_Reference?cl=9919#Stroke_Join">Stroke Join</a>. +The stroke is centered on the shape; it extends equally on either side of the shape's edge. + +As <a href="bmh_SkPaint_Reference?cl=9919#Stroke_Width">Stroke Width</a> gets smaller, the drawn path frame is thinner. <a href="bmh_SkPaint_Reference?cl=9919#Stroke_Width">Stroke Width</a> less than one +may have gaps, and if <a href="bmh_SkPaint_Reference?cl=9919#kAntiAlias_Flag">kAntiAlias Flag</a> is set, <a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a> will increase to visually decrease coverage. + +## <a name="Hairline"></a> Hairline + +<a href="bmh_SkPaint_Reference?cl=9919#Stroke_Width">Stroke Width</a> of zero has a special meaning and switches drawing to use <a href="bmh_SkPaint_Reference?cl=9919#Hairline">Hairline</a>. +<a href="bmh_SkPaint_Reference?cl=9919#Hairline">Hairline</a> draws the thinnest continuous frame. If <a href="bmh_SkPaint_Reference?cl=9919#kAntiAlias_Flag">kAntiAlias Flag</a> is clear, adjacent pixels +flow horizontally, vertically,or diagonally. + +<a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> drawing with <a href="bmh_SkPaint_Reference?cl=9919#Hairline">Hairline</a> may hit the same pixel more than once. For instance, <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> containing +two lines in one <a href="bmh_SkPath_Reference?cl=9919#Contour">Path Contour</a> will draw the corner point once, but may both lines may draw the adjacent +pixel. If <a href="bmh_SkPaint_Reference?cl=9919#kAntiAlias_Flag">kAntiAlias Flag</a> is set, transparency is applied twice, resulting in a darker pixel. Some +<a href="bmh_undocumented?cl=9919#GPU_backed">GPU-backed</a> implementations apply transparency at a later drawing stage, avoiding double hit pixels +while stroking. + +## <a name="SkPaint::Style"></a> Enum SkPaint::Style + +<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0"> +enum <a href="bmh_SkPaint_Reference?cl=9919#Style">Style</a> { +<a href="bmh_SkPaint_Reference?cl=9919#kFill_Style">kFill Style</a>, +<a href="bmh_SkPaint_Reference?cl=9919#kStroke_Style">kStroke Style</a>, +<a href="bmh_SkPaint_Reference?cl=9919#kStrokeAndFill_Style">kStrokeAndFill Style</a>, +};</pre> + +Set <a href="bmh_SkPaint_Reference?cl=9919#Style">Style</a> to fill, stroke, or both fill and stroke geometry. +The stroke and fill +share all paint attributes; for instance, they are drawn with the same color. + +Use <a href="bmh_SkPaint_Reference?cl=9919#kStrokeAndFill_Style">kStrokeAndFill Style</a> to avoid hitting the same pixels twice with a stroke draw and +a fill draw. + +### Constants + +<table> + <tr> + <td><a name="SkPaint::kFill_Style"></a> <code><strong>SkPaint::kFill_Style </strong></code></td><td>0</td><td>Set to fill geometry. +Applies to <a href="bmh_undocumented?cl=9919#Rect">Rect</a>, <a href="bmh_undocumented?cl=9919#Region">Region</a>, <a href="bmh_undocumented?cl=9919#Round_Rect">Round Rect</a>, <a href="bmh_undocumented?cl=9919#Circle">Circle</a>, <a href="bmh_undocumented?cl=9919#Oval">Oval</a>, <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>, and <a href="bmh_undocumented?cl=9919#Text">Text</a>. +<a href="bmh_undocumented?cl=9919#Bitmap">Bitmap</a>, <a href="bmh_undocumented?cl=9919#Image">Image</a>, <a href="bmh_undocumented?cl=9919#Patch">Patch</a>, <a href="bmh_undocumented?cl=9919#Region">Region</a>, <a href="bmh_undocumented?cl=9919#Sprite">Sprite</a>, and <a href="bmh_undocumented?cl=9919#Vertices">Vertices</a> are painted as if +<a href="bmh_SkPaint_Reference?cl=9919#kFill_Style">kFill Style</a> is set, and ignore the set <a href="bmh_SkPaint_Reference?cl=9919#Style">Style</a>. +The <a href="bmh_SkPath_Reference?cl=9919#Fill_Type">Path Fill Type</a> specifies additional rules to fill the area outside the path edge, +and to create an unfilled hole inside the shape. +<a href="bmh_SkPaint_Reference?cl=9919#Style">Style</a> is set to <a href="bmh_SkPaint_Reference?cl=9919#kFill_Style">kFill Style</a> by default.</td> + </tr> + <tr> + <td><a name="SkPaint::kStroke_Style"></a> <code><strong>SkPaint::kStroke_Style </strong></code></td><td>1</td><td>Set to stroke geometry. +Applies to <a href="bmh_undocumented?cl=9919#Rect">Rect</a>, <a href="bmh_undocumented?cl=9919#Region">Region</a>, <a href="bmh_undocumented?cl=9919#Round_Rect">Round Rect</a>, <a href="bmh_undocumented?cl=9919#Arc">Arc</a>, <a href="bmh_undocumented?cl=9919#Circle">Circle</a>, <a href="bmh_undocumented?cl=9919#Oval">Oval</a>, +<a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>, and <a href="bmh_undocumented?cl=9919#Text">Text</a>. +<a href="bmh_undocumented?cl=9919#Arc">Arc</a>, <a href="bmh_undocumented?cl=9919#Line">Line</a>, <a href="bmh_undocumented?cl=9919#Point">Point</a>, and <a href="bmh_undocumented?cl=9919#Array">Point Array</a> are always drawn as if <a href="bmh_SkPaint_Reference?cl=9919#kStroke_Style">kStroke Style</a> is set, +and ignore the set <a href="bmh_SkPaint_Reference?cl=9919#Style">Style</a>. +The stroke construction is unaffected by the <a href="bmh_SkPath_Reference?cl=9919#Fill_Type">Path Fill Type</a>.</td> + </tr> + <tr> + <td><a name="SkPaint::kStrokeAndFill_Style"></a> <code><strong>SkPaint::kStrokeAndFill_Style </strong></code></td><td>2</td><td>Set to stroke and fill geometry. +Applies to <a href="bmh_undocumented?cl=9919#Rect">Rect</a>, <a href="bmh_undocumented?cl=9919#Region">Region</a>, <a href="bmh_undocumented?cl=9919#Round_Rect">Round Rect</a>, <a href="bmh_undocumented?cl=9919#Circle">Circle</a>, <a href="bmh_undocumented?cl=9919#Oval">Oval</a>, <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>, and <a href="bmh_undocumented?cl=9919#Text">Text</a>. +<a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> is treated as if it is set to <a href="bmh_SkPath_Reference?cl=9919#kWinding_FillType">SkPath::kWinding FillType</a>, +and the set <a href="bmh_SkPath_Reference?cl=9919#Fill_Type">Path Fill Type</a> is ignored.</td> + </tr> + +</table> + +## <a name="SkPaint::_anonymous"></a> Enum SkPaint::_anonymous + +<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0"> +enum { +<a href="bmh_SkPaint_Reference?cl=9919#kStyleCount">kStyleCount</a> = <a href="bmh_SkPaint_Reference?cl=9919#kStrokeAndFill_Style">kStrokeAndFill Style</a> + 1 +};</pre> + +### Constants + +<table> + <tr> + <td><a name="SkPaint::kStyleCount"></a> <code><strong>SkPaint::kStyleCount </strong></code></td><td>3</td><td>The number of different <a href="bmh_SkPaint_Reference?cl=9919#Style">Style</a> values defined. +May be used to verify that <a href="bmh_SkPaint_Reference?cl=9919#Style">Style</a> is a legal value.</td> + </tr> + +</table> + +<a name="getStyle"></a> +## getStyle + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +Style getStyle() const +</pre> + +Whether the geometry is filled, stroked, or filled and stroked. + +### Return Value + +one of:<a href="bmh_SkPaint_Reference?cl=9919#kFill_Style">kFill Style</a>, <a href="bmh_SkPaint_Reference?cl=9919#kStroke_Style">kStroke Style</a>, <a href="bmh_SkPaint_Reference?cl=9919#kStrokeAndFill_Style">kStrokeAndFill Style</a> + +### Example + +<div><fiddle-embed name="1c5e18c3c0102d2dac86a78ba8c8ce01"> + +#### Example Output + +~~~~ +SkPaint::kFill_Style == paint.getStyle() +~~~~ + +</fiddle-embed></div> + +### See Also + +<a href="bmh_SkPaint_Reference?cl=9919#Style">Style</a> <a href="bmh_SkPaint_Reference?cl=9919#setStyle">setStyle</a> + +--- + +<a name="setStyle"></a> +## setStyle + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void setStyle(Style style) +</pre> + +Sets whether the geometry is filled, stroked, or filled and stroked. +Has no effect if <a href="bmh_SkPaint_Reference?cl=9919#setStyle">style</a> is not a legal <a href="bmh_SkPaint_Reference?cl=9919#Style">Style</a> value. + +### Parameters + +<table> <tr> <td><code><strong>style </strong></code></td> <td> +one of: <a href="bmh_SkPaint_Reference?cl=9919#kFill_Style">kFill Style</a>, <a href="bmh_SkPaint_Reference?cl=9919#kStroke_Style">kStroke Style</a>, <a href="bmh_SkPaint_Reference?cl=9919#kStrokeAndFill_Style">kStrokeAndFill Style</a></td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="c7bb6248e4735b8d1a32d02fba40d344"></fiddle-embed></div> + +### See Also + +<a href="bmh_SkPaint_Reference?cl=9919#Style">Style</a> <a href="bmh_SkPaint_Reference?cl=9919#getStyle">getStyle</a> + +--- + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#Fill_Type">Path Fill Type</a> <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a> <a href="bmh_SkPaint_Reference?cl=9919#Style_Fill">Style Fill</a> <a href="bmh_SkPaint_Reference?cl=9919#Style_Stroke">Style Stroke</a> + +# <a name="Stroke_Width"></a> Stroke Width +<a href="bmh_SkPaint_Reference?cl=9919#Stroke_Width">Stroke Width</a> sets the width for stroking. The width is the thickness +of the stroke perpendicular to the path's direction when the paint's style is +set to <a href="bmh_SkPaint_Reference?cl=9919#kStroke_Style">kStroke Style</a> or <a href="bmh_SkPaint_Reference?cl=9919#kStrokeAndFill_Style">kStrokeAndFill Style</a>. + +When width is greater than zero, the stroke encompasses as many pixels partially +or fully as needed. When the width equals zero, the paint enables hairlines; +the stroke is always one pixel wide. + +The stroke's dimensions are scaled by the canvas matrix, but <a href="bmh_SkPaint_Reference?cl=9919#Hairline">Hairline</a> stroke +remains one pixel wide regardless of scaling. + +The default width for the paint is zero. + +### Example + +<div><fiddle-embed name="01e3e08a3022a351628ff54e84887756">raster gpu<div>The pixels hit to represent thin lines vary with the angle of the +line and the platform's implementation.</div></fiddle-embed></div> + +<a name="getStrokeWidth"></a> +## getStrokeWidth + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +SkScalar getStrokeWidth() const +</pre> + +Returns the thickness of the pen used by <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> to +outline the shape. + +### Return Value + +zero for <a href="bmh_SkPaint_Reference?cl=9919#Hairline">Hairline</a>, greater than zero for pen thickness + +### Example + +<div><fiddle-embed name="99aa73f64df8bbf06e656cd891a81b9e"> + +#### Example Output + +~~~~ +0 == paint.getStrokeWidth() +~~~~ + +</fiddle-embed></div> + +--- + +<a name="setStrokeWidth"></a> +## setStrokeWidth + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void setStrokeWidth(SkScalar width) +</pre> + +Sets the thickness of the pen used by the paint to +outline the shape. +Has no effect if <a href="bmh_SkPaint_Reference?cl=9919#setStrokeWidth">width</a> is less than zero. + +### Parameters + +<table> <tr> <td><code><strong>width </strong></code></td> <td> +zero thickness for <a href="bmh_SkPaint_Reference?cl=9919#Hairline">Hairline</a>; greater than zero for pen thickness</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="0c4446c0870b5c7b5a2efe77ff92afb8"> + +#### Example Output + +~~~~ +5 == paint.getStrokeWidth() +~~~~ + +</fiddle-embed></div> + +--- + +# <a name="Miter_Limit"></a> Miter Limit +<a href="bmh_SkPaint_Reference?cl=9919#Miter_Limit">Miter Limit</a> specifies the maximum miter length, +relative to the stroke width. + +<a href="bmh_SkPaint_Reference?cl=9919#Miter_Limit">Miter Limit</a> is used when the <a href="bmh_SkPaint_Reference?cl=9919#Stroke_Join">Stroke Join</a> +is set to <a href="bmh_SkPaint_Reference?cl=9919#kMiter_Join">kMiter Join</a>, and the <a href="bmh_SkPaint_Reference?cl=9919#Style">Style</a> is either <a href="bmh_SkPaint_Reference?cl=9919#kStroke_Style">kStroke Style</a> +or <a href="bmh_SkPaint_Reference?cl=9919#kStrokeAndFill_Style">kStrokeAndFill Style</a>. + +If the miter at a corner exceeds this limit, <a href="bmh_SkPaint_Reference?cl=9919#kMiter_Join">kMiter Join</a> +is replaced with <a href="bmh_SkPaint_Reference?cl=9919#kBevel_Join">kBevel Join</a>. + +<a href="bmh_SkPaint_Reference?cl=9919#Miter_Limit">Miter Limit</a> can be computed from the corner angle: + +miter limit = 1 / sin ( angle / 2 )<a href="bmh_SkPaint_Reference?cl=9919#Miter_Limit">Miter Limit</a> default value is 4. +The default may be changed at compile time by setting <a href="bmh_undocumented?cl=9919#SkPaintDefaults_MiterLimit">SkPaintDefaults MiterLimit</a> +in <a href="bmh_undocumented?cl=9919#SkUserConfig.h">SkUserConfig.h</a> or as a define supplied by the build environment. + +Here are some miter limits and the angles that triggers them. + +| miter limit | angle in degrees | +| --- | --- | +| 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 + +<div><fiddle-embed name="5de2de0f00354e59074a9bb1a42d5a63"><div>This example draws a stroked corner and the miter length beneath. +When the miter limit is decreased slightly, the miter join is replaced +by a bevel join.</div></fiddle-embed></div> + +<a name="getStrokeMiter"></a> +## getStrokeMiter + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +SkScalar getStrokeMiter() const +</pre> + +The limit at which a sharp corner is drawn beveled. + +### Return Value + +zero and greater <a href="bmh_SkPaint_Reference?cl=9919#Miter_Limit">Miter Limit</a> + +### Example + +<div><fiddle-embed name="50da74a43b725f07a914df588c867d36"> + +#### Example Output + +~~~~ +default miter limit == 4 +~~~~ + +</fiddle-embed></div> + +### See Also + +<a href="bmh_SkPaint_Reference?cl=9919#Miter_Limit">Miter Limit</a> <a href="bmh_SkPaint_Reference?cl=9919#setStrokeMiter">setStrokeMiter</a> <a href="bmh_SkPaint_Reference?cl=9919#Join">Join</a> + +--- + +<a name="setStrokeMiter"></a> +## setStrokeMiter + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void setStrokeMiter(SkScalar miter) +</pre> + +The limit at which a sharp corner is drawn beveled. +Valid values are zero and greater. +Has no effect if <a href="bmh_SkPaint_Reference?cl=9919#setStrokeMiter">miter</a> is less than zero. + +### Parameters + +<table> <tr> <td><code><strong>miter </strong></code></td> <td> +zero and greater <a href="bmh_SkPaint_Reference?cl=9919#Miter_Limit">Miter Limit</a></td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="700b284dbc97785c6a9c9636088713ad"> + +#### Example Output + +~~~~ +default miter limit == 8 +~~~~ + +</fiddle-embed></div> + +### See Also + +<a href="bmh_SkPaint_Reference?cl=9919#Miter_Limit">Miter Limit</a> <a href="bmh_SkPaint_Reference?cl=9919#getStrokeMiter">getStrokeMiter</a> <a href="bmh_SkPaint_Reference?cl=9919#Join">Join</a> + +--- + +# <a name="Stroke_Cap"></a> Stroke Cap + +## <a name="SkPaint::Cap"></a> Enum SkPaint::Cap + +<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0"> +enum <a href="bmh_SkPaint_Reference?cl=9919#Cap">Cap</a> { +<a href="bmh_SkPaint_Reference?cl=9919#kButt_Cap">kButt Cap</a>, +<a href="bmh_SkPaint_Reference?cl=9919#kRound_Cap">kRound Cap</a>, +<a href="bmh_SkPaint_Reference?cl=9919#kSquare_Cap">kSquare Cap</a>, + +<a href="bmh_SkPaint_Reference?cl=9919#kLast_Cap">kLast Cap</a> = <a href="bmh_SkPaint_Reference?cl=9919#kSquare_Cap">kSquare Cap</a>, +<a href="bmh_SkPaint_Reference?cl=9919#kDefault_Cap">kDefault Cap</a> = <a href="bmh_SkPaint_Reference?cl=9919#kButt_Cap">kButt Cap</a> +}; +static constexpr int <a href="bmh_SkPaint_Reference?cl=9919#kCapCount">kCapCount</a> = <a href="bmh_SkPaint_Reference?cl=9919#kLast_Cap">kLast Cap</a> + 1;</pre> + +<a href="bmh_SkPaint_Reference?cl=9919#Stroke_Cap">Stroke Cap</a> draws at the beginning and end of an open <a href="bmh_SkPath_Reference?cl=9919#Contour">Path Contour</a>. + +### Constants + +<table> + <tr> + <td><a name="SkPaint::kButt_Cap"></a> <code><strong>SkPaint::kButt_Cap </strong></code></td><td>0</td><td>Does not extend the stroke past the beginning or the end.</td> + </tr> + <tr> + <td><a name="SkPaint::kRound_Cap"></a> <code><strong>SkPaint::kRound_Cap </strong></code></td><td>1</td><td>Adds a circle with a diameter equal to <a href="bmh_SkPaint_Reference?cl=9919#Stroke_Width">Stroke Width</a> at the beginning +and end.</td> + </tr> + <tr> + <td><a name="SkPaint::kSquare_Cap"></a> <code><strong>SkPaint::kSquare_Cap </strong></code></td><td>2</td><td>Adds a square with sides equal to <a href="bmh_SkPaint_Reference?cl=9919#Stroke_Width">Stroke Width</a> at the beginning +and end. The square sides are parallel to the initial and final direction +of the stroke.</td> + </tr> + <tr> + <td><a name="SkPaint::kLast_Cap"></a> <code><strong>SkPaint::kLast_Cap </strong></code></td><td>2</td><td>Equivalent to the largest value for <a href="bmh_SkPaint_Reference?cl=9919#Stroke_Cap">Stroke Cap</a>.</td> + </tr> + <tr> + <td><a name="SkPaint::kDefault_Cap"></a> <code><strong>SkPaint::kDefault_Cap </strong></code></td><td>0</td><td>Equivalent to <a href="bmh_SkPaint_Reference?cl=9919#kButt_Cap">kButt Cap</a>. +<a href="bmh_SkPaint_Reference?cl=9919#Stroke_Cap">Stroke Cap</a> is set to <a href="bmh_SkPaint_Reference?cl=9919#kButt_Cap">kButt Cap</a> by default.</td> + </tr> + <tr> + <td><a name="SkPaint::kCapCount"></a> <code><strong>SkPaint::kCapCount </strong></code></td><td>3</td><td>The number of different <a href="bmh_SkPaint_Reference?cl=9919#Stroke_Cap">Stroke Cap</a> values defined. +May be used to verify that <a href="bmh_SkPaint_Reference?cl=9919#Stroke_Cap">Stroke Cap</a> is a legal value.</td> + </tr> + +Stroke describes the area covered by a pen of <a href="bmh_SkPaint_Reference?cl=9919#Stroke_Width">Stroke Width</a> as it +follows the <a href="bmh_SkPath_Reference?cl=9919#Contour">Path Contour</a>, moving parallel to the contours's direction. + +If the <a href="bmh_SkPath_Reference?cl=9919#Contour">Path Contour</a> is not terminated by <a href="bmh_SkPath_Reference?cl=9919#kClose_Verb">SkPath::kClose Verb</a>, the contour has a +visible beginning and end. + +<a href="bmh_SkPath_Reference?cl=9919#Contour">Path Contour</a> may start and end at the same point; defining <a href="bmh_SkPath_Reference?cl=9919#Zero_Length">Zero Length Contour</a>. + +<a href="bmh_SkPaint_Reference?cl=9919#kButt_Cap">kButt Cap</a> and <a href="bmh_SkPath_Reference?cl=9919#Zero_Length">Zero Length Contour</a> is not drawn. +<a href="bmh_SkPaint_Reference?cl=9919#kRound_Cap">kRound Cap</a> and <a href="bmh_SkPath_Reference?cl=9919#Zero_Length">Zero Length Contour</a> draws a circle of diameter <a href="bmh_SkPaint_Reference?cl=9919#Stroke_Width">Stroke Width</a> +at the contour point. +<a href="bmh_SkPaint_Reference?cl=9919#kSquare_Cap">kSquare Cap</a> and <a href="bmh_SkPath_Reference?cl=9919#Zero_Length">Zero Length Contour</a> draws an upright square with a side of +<a href="bmh_SkPaint_Reference?cl=9919#Stroke_Width">Stroke Width</a> at the contour point. + +<a href="bmh_SkPaint_Reference?cl=9919#Stroke_Cap">Stroke Cap</a> is <a href="bmh_SkPaint_Reference?cl=9919#kButt_Cap">kButt Cap</a> by default. + +</table> + +### Example + +<div><fiddle-embed name="3d92b449b298b4ce4004cfca6b91cee7"></fiddle-embed></div> + +<a name="getStrokeCap"></a> +## getStrokeCap + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +Cap getStrokeCap() const +</pre> + +The geometry drawn at the beginning and end of strokes. + +### Return Value + +one of: <a href="bmh_SkPaint_Reference?cl=9919#kButt_Cap">kButt Cap</a>, <a href="bmh_SkPaint_Reference?cl=9919#kRound_Cap">kRound Cap</a>, <a href="bmh_SkPaint_Reference?cl=9919#kSquare_Cap">kSquare Cap</a> + +### Example + +<div><fiddle-embed name="aabf9baee8e026fae36fca30e955512b"> + +#### Example Output + +~~~~ +kButt_Cap == default stroke cap +~~~~ + +</fiddle-embed></div> + +### See Also + +<a href="bmh_SkPaint_Reference?cl=9919#Stroke_Cap">Stroke Cap</a> <a href="bmh_SkPaint_Reference?cl=9919#setStrokeCap">setStrokeCap</a> + +--- + +<a name="setStrokeCap"></a> +## setStrokeCap + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void setStrokeCap(Cap cap) +</pre> + +The geometry drawn at the beginning and end of strokes. + +### Parameters + +<table> <tr> <td><code><strong>cap </strong></code></td> <td> +one of: <a href="bmh_SkPaint_Reference?cl=9919#kButt_Cap">kButt Cap</a>, <a href="bmh_SkPaint_Reference?cl=9919#kRound_Cap">kRound Cap</a>, <a href="bmh_SkPaint_Reference?cl=9919#kSquare_Cap">kSquare Cap</a>; +has no effect if <a href="bmh_SkPaint_Reference?cl=9919#setStrokeCap">cap</a> is not valid</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="de83fbd848a4625345b4b87a6e55d98a"> + +#### Example Output + +~~~~ +kRound_Cap == paint.getStrokeCap() +~~~~ + +</fiddle-embed></div> + +### See Also + +<a href="bmh_SkPaint_Reference?cl=9919#Stroke_Cap">Stroke Cap</a> <a href="bmh_SkPaint_Reference?cl=9919#getStrokeCap">getStrokeCap</a> + +--- + +# <a name="Stroke_Join"></a> Stroke Join +<a href="bmh_SkPaint_Reference?cl=9919#Stroke_Join">Stroke Join</a> draws at the sharp corners of an open or closed <a href="bmh_SkPath_Reference?cl=9919#Contour">Path Contour</a>. + +Stroke describes the area covered by a pen of <a href="bmh_SkPaint_Reference?cl=9919#Stroke_Width">Stroke Width</a> as it +follows the <a href="bmh_SkPath_Reference?cl=9919#Contour">Path Contour</a>, moving parallel to the contours's direction. + +If the contour direction changes abruptly, because the tangent direction leading +to the end of a curve within the contour does not match the tangent direction of +the following curve, the pair of curves meet at <a href="bmh_SkPaint_Reference?cl=9919#Stroke_Join">Stroke Join</a>. + +### Example + +<div><fiddle-embed name="4a4e41ed89a57d47eab5d1600c33b0e8"></fiddle-embed></div> + +## <a name="SkPaint::Join"></a> Enum SkPaint::Join + +<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0"> +enum <a href="bmh_SkPaint_Reference?cl=9919#Join">Join</a> { +<a href="bmh_SkPaint_Reference?cl=9919#kMiter_Join">kMiter Join</a>, +<a href="bmh_SkPaint_Reference?cl=9919#kRound_Join">kRound Join</a>, +<a href="bmh_SkPaint_Reference?cl=9919#kBevel_Join">kBevel Join</a>, + +<a href="bmh_SkPaint_Reference?cl=9919#kLast_Join">kLast Join</a> = <a href="bmh_SkPaint_Reference?cl=9919#kBevel_Join">kBevel Join</a>, +<a href="bmh_SkPaint_Reference?cl=9919#kDefault_Join">kDefault Join</a> = <a href="bmh_SkPaint_Reference?cl=9919#kMiter_Join">kMiter Join</a> +}; +static constexpr int <a href="bmh_SkPaint_Reference?cl=9919#kJoinCount">kJoinCount</a> = <a href="bmh_SkPaint_Reference?cl=9919#kLast_Join">kLast Join</a> + 1;</pre> + +<a href="bmh_SkPaint_Reference?cl=9919#Join">Join</a> specifies how corners are drawn when a shape is stroked. The paint's <a href="bmh_SkPaint_Reference?cl=9919#Join">Join</a> setting +affects the four corners of a stroked rectangle, and the connected segments in a +stroked path. + +Choose miter join to draw sharp corners. Choose round join to draw a circle with a +radius equal to the stroke width on top of the corner. Choose bevel join to minimally +connect the thick strokes. + +The fill path constructed to describe the stroked path respects the join setting but may +not contain the actual join. For instance, a fill path constructed with round joins does +not necessarily include circles at each connected segment. + +### Constants + +<table> + <tr> + <td><a name="SkPaint::kMiter_Join"></a> <code><strong>SkPaint::kMiter_Join </strong></code></td><td>0</td><td>Extends the outside corner to the extent allowed by <a href="bmh_SkPaint_Reference?cl=9919#Miter_Limit">Miter Limit</a>. +If the extension exceeds <a href="bmh_SkPaint_Reference?cl=9919#Miter_Limit">Miter Limit</a>, <a href="bmh_SkPaint_Reference?cl=9919#kBevel_Join">kBevel Join</a> is used instead.</td> + </tr> + <tr> + <td><a name="SkPaint::kRound_Join"></a> <code><strong>SkPaint::kRound_Join </strong></code></td><td>1</td><td>Adds a circle with a diameter of <a href="bmh_SkPaint_Reference?cl=9919#Stroke_Width">Stroke Width</a> at the sharp corner.</td> + </tr> + <tr> + <td><a name="SkPaint::kBevel_Join"></a> <code><strong>SkPaint::kBevel_Join </strong></code></td><td>2</td><td>Connects the outside edges of the sharp corner.</td> + </tr> + <tr> + <td><a name="SkPaint::kLast_Join"></a> <code><strong>SkPaint::kLast_Join </strong></code></td><td>2</td><td>Equivalent to the largest value for <a href="bmh_SkPaint_Reference?cl=9919#Stroke_Join">Stroke Join</a>.</td> + </tr> + <tr> + <td><a name="SkPaint::kDefault_Join"></a> <code><strong>SkPaint::kDefault_Join </strong></code></td><td>1</td><td>Equivalent to <a href="bmh_SkPaint_Reference?cl=9919#kMiter_Join">kMiter Join</a>. +<a href="bmh_SkPaint_Reference?cl=9919#Stroke_Join">Stroke Join</a> is set to <a href="bmh_SkPaint_Reference?cl=9919#kMiter_Join">kMiter Join</a> by default.</td> + </tr> + <tr> + <td><a name="SkPaint::kJoinCount"></a> <code><strong>SkPaint::kJoinCount </strong></code></td><td>3</td><td>The number of different <a href="bmh_SkPaint_Reference?cl=9919#Stroke_Join">Stroke Join</a> values defined. +May be used to verify that <a href="bmh_SkPaint_Reference?cl=9919#Stroke_Join">Stroke Join</a> is a legal value.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="3b1aebacc21c1836a52876b9b0b3905e"></fiddle-embed></div> + +### See Also + +<a href="bmh_SkPaint_Reference?cl=9919#setStrokeJoin">setStrokeJoin</a> <a href="bmh_SkPaint_Reference?cl=9919#getStrokeJoin">getStrokeJoin</a> <a href="bmh_SkPaint_Reference?cl=9919#setStrokeMiter">setStrokeMiter</a> <a href="bmh_SkPaint_Reference?cl=9919#getStrokeMiter">getStrokeMiter</a> + + + +<a name="getStrokeJoin"></a> +## getStrokeJoin + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +Join getStrokeJoin() const +</pre> + +The geometry drawn at the corners of strokes. + +### Return Value + +one of: <a href="bmh_SkPaint_Reference?cl=9919#kMiter_Join">kMiter Join</a>, <a href="bmh_SkPaint_Reference?cl=9919#kRound_Join">kRound Join</a>, <a href="bmh_SkPaint_Reference?cl=9919#kBevel_Join">kBevel Join</a> + +### Example + +<div><fiddle-embed name="31bf751d0a8ddf176b871810820d8199"> + +#### Example Output + +~~~~ +kMiter_Join == default stroke join +~~~~ + +</fiddle-embed></div> + +### See Also + +<a href="bmh_SkPaint_Reference?cl=9919#Stroke_Join">Stroke Join</a> <a href="bmh_SkPaint_Reference?cl=9919#setStrokeJoin">setStrokeJoin</a> + +--- + +<a name="setStrokeJoin"></a> +## setStrokeJoin + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void setStrokeJoin(Join join) +</pre> + +The geometry drawn at the corners of strokes. + +### Parameters + +<table> <tr> <td><code><strong>join </strong></code></td> <td> +one of: <a href="bmh_SkPaint_Reference?cl=9919#kMiter_Join">kMiter Join</a>, <a href="bmh_SkPaint_Reference?cl=9919#kRound_Join">kRound Join</a>, <a href="bmh_SkPaint_Reference?cl=9919#kBevel_Join">kBevel Join</a>; +otherwise, <a href="bmh_SkPaint_Reference?cl=9919#setStrokeJoin">setStrokeJoin</a> has no effect</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="48d963ad4286eddf680f9c511eb6da91"> + +#### Example Output + +~~~~ +kMiter_Join == paint.getStrokeJoin() +~~~~ + +</fiddle-embed></div> + +### See Also + +<a href="bmh_SkPaint_Reference?cl=9919#Stroke_Join">Stroke Join</a> <a href="bmh_SkPaint_Reference?cl=9919#getStrokeJoin">getStrokeJoin</a> + +--- + +### See Also + +<a href="bmh_SkPaint_Reference?cl=9919#Miter_Limit">Miter Limit</a> + +# <a name="Fill_Path"></a> Fill Path +<a href="bmh_SkPaint_Reference?cl=9919#Fill_Path">Fill Path</a> creates a <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> by applying the <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a>, followed by the <a href="bmh_SkPaint_Reference?cl=9919#Style_Stroke">Style Stroke</a>. + +If <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> contains <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a>, <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a> operates on the source <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>; the result +replaces the destination <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>. Otherwise, the source <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> is replaces the +destination <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>. + +Fill <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> can request the <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a> to restrict to a culling rectangle, but +the <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a> is not required to do so. + +If <a href="bmh_SkPaint_Reference?cl=9919#Style">Style</a> is <a href="bmh_SkPaint_Reference?cl=9919#kStroke_Style">kStroke Style</a> or <a href="bmh_SkPaint_Reference?cl=9919#kStrokeAndFill_Style">kStrokeAndFill Style</a>, +and <a href="bmh_SkPaint_Reference?cl=9919#Stroke_Width">Stroke Width</a> is greater than zero, the <a href="bmh_SkPaint_Reference?cl=9919#Stroke_Width">Stroke Width</a>, <a href="bmh_SkPaint_Reference?cl=9919#Stroke_Cap">Stroke Cap</a>, <a href="bmh_SkPaint_Reference?cl=9919#Stroke_Join">Stroke Join</a>, +and <a href="bmh_SkPaint_Reference?cl=9919#Miter_Limit">Miter Limit</a> operate on the destination <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>, replacing it. + +Fill <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> can specify the precision used by <a href="bmh_SkPaint_Reference?cl=9919#Stroke_Width">Stroke Width</a> to approximate the stroke geometry. + +If the <a href="bmh_SkPaint_Reference?cl=9919#Style">Style</a> is <a href="bmh_SkPaint_Reference?cl=9919#kStroke_Style">kStroke Style</a> and the <a href="bmh_SkPaint_Reference?cl=9919#Stroke_Width">Stroke Width</a> is zero, <a href="bmh_SkPaint_Reference?cl=9919#getFillPath">getFillPath</a> +returns false since <a href="bmh_SkPaint_Reference?cl=9919#Hairline">Hairline</a> has no filled equivalent. + +<a name="getFillPath"></a> +## getFillPath + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +bool getFillPath(const SkPath& src, SkPath* dst, const SkRect* cullRect, + SkScalar resScale = 1) const +</pre> + +The filled equivalent of the stroked path. + +### Parameters + +<table> <tr> <td><code><strong>src </strong></code></td> <td> +<a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> read to create a filled version</td> + </tr> <tr> <td><code><strong>dst </strong></code></td> <td> +resulting <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>; may be the same as <a href="bmh_SkPaint_Reference?cl=9919#src">src</a>, but may not be nullptr</td> + </tr> <tr> <td><code><strong>cullRect </strong></code></td> <td> +optional limit passed to <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a></td> + </tr> <tr> <td><code><strong>resScale </strong></code></td> <td> +if > 1, increase precision, else if (0 < res < 1) reduce precision +to favor speed and size</td> + </tr> +</table> + +### Return Value + +true if the path represents <a href="bmh_SkPaint_Reference?cl=9919#Style_Fill">Style Fill</a>, or false if it represents <a href="bmh_SkPaint_Reference?cl=9919#Hairline">Hairline</a> + +### Example + +<div><fiddle-embed name="cedd6233848198e1fca4d1e14816baaf"><div>A very small quad stroke is turned into a filled path with increasing levels of precision. +At the lowest precision, the quad stroke is approximated by a rectangle. +At the highest precision, the filled path has high fidelity compared to the original stroke.</div></fiddle-embed></div> + +--- + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +bool getFillPath(const SkPath& src, SkPath* dst) const +</pre> + +The filled equivalent of the stroked path. + +Replaces <a href="bmh_SkPaint_Reference?cl=9919#dst">dst</a> with the <a href="bmh_SkPaint_Reference?cl=9919#src">src</a> path modified by <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a> and <a href="bmh_SkPaint_Reference?cl=9919#Style_Stroke">Style Stroke</a>. +<a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a>, if any, is not culled. <a href="bmh_SkPaint_Reference?cl=9919#Stroke_Width">Stroke Width</a> is created with default precision. + +### Parameters + +<table> <tr> <td><code><strong>src </strong></code></td> <td> +<a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> read to create a filled version</td> + </tr> <tr> <td><code><strong>dst </strong></code></td> <td> +resulting <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> <a href="bmh_SkPaint_Reference?cl=9919#dst">dst</a> may be the same as <a href="bmh_SkPaint_Reference?cl=9919#src">src</a>, but may not be nullptr</td> + </tr> +</table> + +### Return Value + +true if the path represents <a href="bmh_SkPaint_Reference?cl=9919#Style_Fill">Style Fill</a>, or false if it represents <a href="bmh_SkPaint_Reference?cl=9919#Hairline">Hairline</a> + +### Example + +<div><fiddle-embed name="e6d8ca0cc17e0b475bd54dd995825468"></fiddle-embed></div> + +--- + +### See Also + +<a href="bmh_SkPaint_Reference?cl=9919#Style_Stroke">Style Stroke</a> <a href="bmh_SkPaint_Reference?cl=9919#Stroke_Width">Stroke Width</a> <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a> + +# <a name="Shader_Methods"></a> Shader Methods +<a href="bmh_undocumented?cl=9919#Shader">Shader</a> defines the colors used when drawing a shape. +<a href="bmh_undocumented?cl=9919#Shader">Shader</a> may be an image, a gradient, or a computed fill. +If <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> has no <a href="bmh_undocumented?cl=9919#Shader">Shader</a>, then <a href="bmh_undocumented?cl=9919#Color">Color</a> fills the shape. + +<a href="bmh_undocumented?cl=9919#Shader">Shader</a> is modulated by <a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a> component of <a href="bmh_undocumented?cl=9919#Color">Color</a>. +If <a href="bmh_undocumented?cl=9919#Shader">Shader</a> object defines only <a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a>, then <a href="bmh_undocumented?cl=9919#Color">Color</a> modulated by <a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a> describes +the fill. + +The drawn transparency can be modified without altering <a href="bmh_undocumented?cl=9919#Shader">Shader</a>, by changing <a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a>. + +### Example + +<div><fiddle-embed name="c015dc2010c15e1c00b4f7330232b0f7"></fiddle-embed></div> + +If <a href="bmh_undocumented?cl=9919#Shader">Shader</a> generates only <a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a> then all components of <a href="bmh_undocumented?cl=9919#Color">Color</a> modulate the output. + +### Example + +<div><fiddle-embed name="9673be7720ba3adcdae42ddc1565b588"></fiddle-embed></div> + +<a name="getShader"></a> +## getShader + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +SkShader* getShader() const +</pre> + +Optional colors used when filling a path, such as a gradient. + +Does not alter <a href="bmh_undocumented?cl=9919#Shader">Shader</a> <a href="bmh_undocumented?cl=9919#Reference_Count">Reference Count</a>. + +### Return Value + +<a href="bmh_undocumented?cl=9919#Shader">Shader</a> if previously set, nullptr otherwise + +### Example + +<div><fiddle-embed name="09f15b9fd88882850da2d235eb86292f"> + +#### Example Output + +~~~~ +nullptr == shader +nullptr != shader +~~~~ + +</fiddle-embed></div> + +--- + +<a name="refShader"></a> +## refShader + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +sk_sp<SkShader> refShader() const +</pre> + +Optional colors used when filling a path, such as a gradient. + +Increases <a href="bmh_undocumented?cl=9919#Shader">Shader</a> <a href="bmh_undocumented?cl=9919#Reference_Count">Reference Count</a> by one. + +### Return Value + +<a href="bmh_undocumented?cl=9919#Shader">Shader</a> if previously set, nullptr otherwise + +### Example + +<div><fiddle-embed name="53da0295972a418cbc9607bbb17feaa8"> + +#### Example Output + +~~~~ +shader unique: true +shader unique: false +~~~~ + +</fiddle-embed></div> + +--- + +<a name="setShader"></a> +## setShader + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void setShader(sk_sp<SkShader> shader) +</pre> + +Optional colors used when filling a path, such as a gradient. + +Sets <a href="bmh_undocumented?cl=9919#Shader">Shader</a> to <a href="bmh_SkPaint_Reference?cl=9919#shader">shader</a>, decrementing <a href="bmh_undocumented?cl=9919#Reference_Count">Reference Count</a> of the previous <a href="bmh_undocumented?cl=9919#Shader">Shader</a>. +Does not alter <a href="bmh_SkPaint_Reference?cl=9919#shader">shader</a> <a href="bmh_undocumented?cl=9919#Reference_Count">Reference Count</a>. + +### Parameters + +<table> <tr> <td><code><strong>shader </strong></code></td> <td> +how geometry is filled with color; if nullptr, <a href="bmh_undocumented?cl=9919#Color">Color</a> is used instead</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="77e64d5bae9b1ba037fd99252bb4aa58"></fiddle-embed></div> + +--- + +# <a name="Color_Filter_Methods"></a> Color Filter Methods +<a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a> alters the color used when drawing a shape. +<a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a> may apply <a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a>, transform the color through a matrix, or composite multiple filters. +If <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> has no <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>, the color is unaltered. + +The drawn transparency can be modified without altering <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>, by changing <a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a>. + +### Example + +<div><fiddle-embed name="5abde56ca2f89a18b8e231abd1b57c56"></fiddle-embed></div> + +<a name="getColorFilter"></a> +## getColorFilter + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +SkColorFilter* getColorFilter() const +</pre> + +Returns <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a> if set, or nullptr. +Does not alter <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a> <a href="bmh_undocumented?cl=9919#Reference_Count">Reference Count</a>. + +### Return Value + +<a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a> if previously set, nullptr otherwise + +### Example + +<div><fiddle-embed name="093bdc627d6b59002670fd290931f6c9"> + +#### Example Output + +~~~~ +nullptr == color filter +nullptr != color filter +~~~~ + +</fiddle-embed></div> + +--- + +<a name="refColorFilter"></a> +## refColorFilter + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +sk_sp<SkColorFilter> refColorFilter() const +</pre> + +Returns <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a> if set, or nullptr. +Increases <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a> <a href="bmh_undocumented?cl=9919#Reference_Count">Reference Count</a> by one. + +### Return Value + +<a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a> if set, or nullptr + +### Example + +<div><fiddle-embed name="b588c95fa4c86ddbc4b0546762f08297"> + +#### Example Output + +~~~~ +color filter unique: true +color filter unique: false +~~~~ + +</fiddle-embed></div> + +--- + +<a name="setColorFilter"></a> +## setColorFilter + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void setColorFilter(sk_sp<SkColorFilter> colorFilter) +</pre> + +Sets <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a> to filter, decrementing <a href="bmh_undocumented?cl=9919#Reference_Count">Reference Count</a> of the previous <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>. +Pass nullptr to clear <a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a>. +Does not alter filter <a href="bmh_undocumented?cl=9919#Reference_Count">Reference Count</a>. + +### Parameters + +<table> <tr> <td><code><strong>colorFilter </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#Color_Filter">Color Filter</a> to apply to subsequent draw</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="c7b786dc9b3501cd0eaba47494b6fa31"></fiddle-embed></div> + +--- + +# <a name="Blend_Mode_Methods"></a> Blend Mode Methods +<a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a> describes how <a href="bmh_undocumented?cl=9919#Color">Color</a> combines with the destination color. +The default setting, <a href="bmh_undocumented?cl=9919#kSrcOver">SkBlendMode::kSrcOver</a>, draws the source color +over the destination color. + +### Example + +<div><fiddle-embed name="73092d4d06faecea3c204d852a4dd8a8"></fiddle-embed></div> + +### See Also + +<a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a> + +<a name="getBlendMode"></a> +## getBlendMode + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +SkBlendMode getBlendMode() const +</pre> + +Returns <a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a>. +By default, <a href="bmh_SkPaint_Reference?cl=9919#getBlendMode">getBlendMode</a> returns <a href="bmh_undocumented?cl=9919#kSrcOver">SkBlendMode::kSrcOver</a>. + +### Return Value + +mode used to combine source color with destination color + +### Example + +<div><fiddle-embed name="4ec1864b8203d52c0810e8605092f45c"> + +#### Example Output + +~~~~ +kSrcOver == getBlendMode +kSrcOver != getBlendMode +~~~~ + +</fiddle-embed></div> + +--- + +<a name="isSrcOver"></a> +## isSrcOver + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +bool isSrcOver() const +</pre> + +Returns true if <a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a> is <a href="bmh_undocumented?cl=9919#kSrcOver">SkBlendMode::kSrcOver</a>, the default. + +### Return Value + +true if <a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a> is <a href="bmh_undocumented?cl=9919#kSrcOver">SkBlendMode::kSrcOver</a> + +### Example + +<div><fiddle-embed name="257c9473db7a2b3a0fb2b9e2431e59a6"> + +#### Example Output + +~~~~ +isSrcOver == true +isSrcOver != true +~~~~ + +</fiddle-embed></div> + +--- + +<a name="setBlendMode"></a> +## setBlendMode + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void setBlendMode(SkBlendMode mode) +</pre> + +Sets <a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a> to <a href="bmh_SkPaint_Reference?cl=9919#mode">mode</a>. +Does not check for valid input. + +### Parameters + +<table> <tr> <td><code><strong>mode </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#SkBlendMode">SkBlendMode</a> used to combine source color and destination</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="257c9473db7a2b3a0fb2b9e2431e59a6"> + +#### Example Output + +~~~~ +isSrcOver == true +isSrcOver != true +~~~~ + +</fiddle-embed></div> + +--- + +# <a name="Path_Effect_Methods"></a> Path Effect Methods +<a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a> modifies the path geometry before drawing it. +<a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a> may implement dashing, custom fill effects and custom stroke effects. +If <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> has no <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a>, the path geometry is unaltered when filled or stroked. + +### Example + +<div><fiddle-embed name="8cf5684b187d60f09e11c4a48993ea39"></fiddle-embed></div> + +### See Also + +<a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a> + +<a name="getPathEffect"></a> +## getPathEffect + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +SkPathEffect* getPathEffect() const +</pre> + +Returns <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a> if set, or nullptr. +Does not alter <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a> <a href="bmh_undocumented?cl=9919#Reference_Count">Reference Count</a>. + +### Return Value + +<a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a> if previously set, nullptr otherwise + +### Example + +<div><fiddle-embed name="211a1b14bfa6c4332082c8eab4fbc5fd"> + +#### Example Output + +~~~~ +nullptr == path effect +nullptr != path effect +~~~~ + +</fiddle-embed></div> + +--- + +<a name="refPathEffect"></a> +## refPathEffect + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +sk_sp<SkPathEffect> refPathEffect() const +</pre> + +Returns <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a> if set, or nullptr. +Increases <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a> <a href="bmh_undocumented?cl=9919#Reference_Count">Reference Count</a> by one. + +### Return Value + +<a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a> if previously set, nullptr otherwise + +### Example + +<div><fiddle-embed name="c55c74f8f581870bd2c18f2f99765579"> + +#### Example Output + +~~~~ +path effect unique: true +path effect unique: false +~~~~ + +</fiddle-embed></div> + +--- + +<a name="setPathEffect"></a> +## setPathEffect + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void setPathEffect(sk_sp<SkPathEffect> pathEffect) +</pre> + +Sets <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a> to <a href="bmh_SkPaint_Reference?cl=9919#pathEffect">pathEffect</a>, +decrementing <a href="bmh_undocumented?cl=9919#Reference_Count">Reference Count</a> of the previous <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a>. +Pass nullptr to leave the path geometry unaltered. +Does not alter <a href="bmh_SkPaint_Reference?cl=9919#pathEffect">pathEffect</a> <a href="bmh_undocumented?cl=9919#Reference_Count">Reference Count</a>. + +### Parameters + +<table> <tr> <td><code><strong>pathEffect </strong></code></td> <td> +replace <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> with a modification when drawn</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="52dd55074ca0b7d520d04e750ca2a0d7"></fiddle-embed></div> + +--- + +# <a name="Mask_Filter_Methods"></a> Mask Filter Methods +<a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a> uses <a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a> of the shape drawn to create <a href="bmh_undocumented?cl=9919#Mask_Alpha">Mask Alpha</a>. +<a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a> operates at a lower level than <a href="bmh_undocumented?cl=9919#Rasterizer">Rasterizer</a>; <a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a> takes a <a href="bmh_undocumented?cl=9919#Mask">Mask</a>, +and returns a <a href="bmh_undocumented?cl=9919#Mask">Mask</a>. +<a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a> may change the geometry and transparency of the shape, such as creating a blur effect. +Set <a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a> to nullptr to prevent <a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a> from modifying the draw. + +### Example + +<div><fiddle-embed name="320b04ea1e1291d49f1e61994a0410fe"></fiddle-embed></div> + +<a name="getMaskFilter"></a> +## getMaskFilter + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +SkMaskFilter* getMaskFilter() const +</pre> + +Returns <a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a> if set, or nullptr. +Does not alter <a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a> <a href="bmh_undocumented?cl=9919#Reference_Count">Reference Count</a>. + +### Return Value + +<a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a> if previously set, nullptr otherwise + +### Example + +<div><fiddle-embed name="8cd53ece8fc83e4560599ace094b0f16"> + +#### Example Output + +~~~~ +nullptr == mask filter +nullptr != mask filter +~~~~ + +</fiddle-embed></div> + +--- + +<a name="refMaskFilter"></a> +## refMaskFilter + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +sk_sp<SkMaskFilter> refMaskFilter() const +</pre> + +Returns <a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a> if set, or nullptr. +Increases <a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a> <a href="bmh_undocumented?cl=9919#Reference_Count">Reference Count</a> by one. + +### Return Value + +<a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a> if previously set, nullptr otherwise + +### Example + +<div><fiddle-embed name="35a397dce5d44658ee4e9e9dfb9fee22"> + +#### Example Output + +~~~~ +mask filter unique: true +mask filter unique: false +~~~~ + +</fiddle-embed></div> + +--- + +<a name="setMaskFilter"></a> +## setMaskFilter + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void setMaskFilter(sk_sp<SkMaskFilter> maskFilter) +</pre> + +Sets <a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a> to <a href="bmh_SkPaint_Reference?cl=9919#maskFilter">maskFilter</a>, +decrementing <a href="bmh_undocumented?cl=9919#Reference_Count">Reference Count</a> of the previous <a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a>. +Pass nullptr to clear <a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a> and leave <a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a> effect on <a href="bmh_undocumented?cl=9919#Mask_Alpha">Mask Alpha</a> unaltered. +Does not affect <a href="bmh_undocumented?cl=9919#Rasterizer">Rasterizer</a>. +Does not alter <a href="bmh_SkPaint_Reference?cl=9919#maskFilter">maskFilter</a> <a href="bmh_undocumented?cl=9919#Reference_Count">Reference Count</a>. + +### Parameters + +<table> <tr> <td><code><strong>maskFilter </strong></code></td> <td> +modifies clipping mask generated from drawn geometry</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="62c5a826692f85c3de3bab65e9e97aa9"></fiddle-embed></div> + +--- + +# <a name="Typeface_Methods"></a> Typeface Methods +<a href="bmh_undocumented?cl=9919#Typeface">Typeface</a> identifies the font used when drawing and measuring text. +<a href="bmh_undocumented?cl=9919#Typeface">Typeface</a> may be specified by name, from a file, or from a data stream. +The default <a href="bmh_undocumented?cl=9919#Typeface">Typeface</a> defers to the platform-specific default font +implementation. + +### Example + +<div><fiddle-embed name="c18b1696b8c1649bebf7eb1f8b89e0b0"></fiddle-embed></div> + +<a name="getTypeface"></a> +## getTypeface + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +SkTypeface* getTypeface() const +</pre> + +Returns <a href="bmh_undocumented?cl=9919#Typeface">Typeface</a> if set, or nullptr. +Does not alter <a href="bmh_undocumented?cl=9919#Typeface">Typeface</a> <a href="bmh_undocumented?cl=9919#Reference_Count">Reference Count</a>. + +### Return Value + +<a href="bmh_undocumented?cl=9919#Typeface">Typeface</a> if previously set, nullptr otherwise + +### Example + +<div><fiddle-embed name="4d9ffb5761b62a9e3bc9b0bca8787bce"> + +#### Example Output + +~~~~ +nullptr == typeface +nullptr != typeface +~~~~ + +</fiddle-embed></div> + +--- + +<a name="refTypeface"></a> +## refTypeface + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +sk_sp<SkTypeface> refTypeface() const +</pre> + +Increases <a href="bmh_undocumented?cl=9919#Typeface">Typeface</a> <a href="bmh_undocumented?cl=9919#Reference_Count">Reference Count</a> by one. + +### Return Value + +<a href="bmh_undocumented?cl=9919#Typeface">Typeface</a> if previously set, nullptr otherwise + +### Example + +<div><fiddle-embed name="c8edce7b36a3ffda8af4fe89d7187dbc"> + +#### Example Output + +~~~~ +typeface1 != typeface2 +typeface1 == typeface2 +~~~~ + +</fiddle-embed></div> + +--- + +<a name="setTypeface"></a> +## setTypeface + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void setTypeface(sk_sp<SkTypeface> typeface) +</pre> + +Sets <a href="bmh_undocumented?cl=9919#Typeface">Typeface</a> to <a href="bmh_SkPaint_Reference?cl=9919#typeface">typeface</a>, +decrementing <a href="bmh_undocumented?cl=9919#Reference_Count">Reference Count</a> of the previous <a href="bmh_undocumented?cl=9919#Typeface">Typeface</a>. +Pass nullptr to clear <a href="bmh_undocumented?cl=9919#Typeface">Typeface</a> and use the default <a href="bmh_SkPaint_Reference?cl=9919#typeface">typeface</a>. +Does not alter <a href="bmh_SkPaint_Reference?cl=9919#typeface">typeface</a> <a href="bmh_undocumented?cl=9919#Reference_Count">Reference Count</a>. + +### Parameters + +<table> <tr> <td><code><strong>typeface </strong></code></td> <td> +font and style used to draw text</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="3d2656ec4c555ed2c7ec086720124a2a"></fiddle-embed></div> + +--- + +# <a name="Rasterizer_Methods"></a> Rasterizer Methods +<a href="bmh_undocumented?cl=9919#Rasterizer">Rasterizer</a> controls how shapes are converted to <a href="bmh_undocumented?cl=9919#Mask_Alpha">Mask Alpha</a>. +<a href="bmh_undocumented?cl=9919#Rasterizer">Rasterizer</a> operates at a higher level than <a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a>; <a href="bmh_undocumented?cl=9919#Rasterizer">Rasterizer</a> takes a <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>, +and returns a <a href="bmh_undocumented?cl=9919#Mask">Mask</a>. +<a href="bmh_undocumented?cl=9919#Rasterizer">Rasterizer</a> may change the geometry and transparency of the shape, such as +creating a shadow effect. <a href="bmh_undocumented?cl=9919#Rasterizer">Rasterizer</a> forms the base of <a href="bmh_undocumented?cl=9919#Layer">Rasterizer Layer</a>, which +creates effects like embossing and outlining. +<a href="bmh_undocumented?cl=9919#Rasterizer">Rasterizer</a> applies to <a href="bmh_undocumented?cl=9919#Rect">Rect</a>, <a href="bmh_undocumented?cl=9919#Region">Region</a>, <a href="bmh_undocumented?cl=9919#Round_Rect">Round Rect</a>, <a href="bmh_undocumented?cl=9919#Arc">Arc</a>, <a href="bmh_undocumented?cl=9919#Circle">Circle</a>, <a href="bmh_undocumented?cl=9919#Oval">Oval</a>, +<a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>, and <a href="bmh_undocumented?cl=9919#Text">Text</a>. + +### Example + +<div><fiddle-embed name="e63f8a50996699342a14c6e54d684108"></fiddle-embed></div> + +<a name="getRasterizer"></a> +## getRasterizer + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +SkRasterizer* getRasterizer() const +</pre> + +Returns <a href="bmh_undocumented?cl=9919#Rasterizer">Rasterizer</a> if set, or nullptr. +Does not alter <a href="bmh_undocumented?cl=9919#Rasterizer">Rasterizer</a> <a href="bmh_undocumented?cl=9919#Reference_Count">Reference Count</a>. + +### Return Value + +<a href="bmh_undocumented?cl=9919#Rasterizer">Rasterizer</a> if previously set, nullptr otherwise + +### Example + +<div><fiddle-embed name="0707d407c3a14388b107af8ae5873e55"> + +#### Example Output + +~~~~ +nullptr == rasterizer +nullptr != rasterizer +~~~~ + +</fiddle-embed></div> + +--- + +<a name="refRasterizer"></a> +## refRasterizer + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +sk_sp<SkRasterizer> refRasterizer() const +</pre> + +Returns <a href="bmh_undocumented?cl=9919#Rasterizer">Rasterizer</a> if set, or nullptr. +Increases <a href="bmh_undocumented?cl=9919#Rasterizer">Rasterizer</a> <a href="bmh_undocumented?cl=9919#Reference_Count">Reference Count</a> by one. + +### Return Value + +<a href="bmh_undocumented?cl=9919#Rasterizer">Rasterizer</a> if previously set, nullptr otherwise + +### Example + +<div><fiddle-embed name="c0855ce19a33cb7e5747750ef341b7b3"> + +#### Example Output + +~~~~ +rasterizer unique: true +rasterizer unique: false +~~~~ + +</fiddle-embed></div> + +--- + +<a name="setRasterizer"></a> +## setRasterizer + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void setRasterizer(sk_sp<SkRasterizer> rasterizer) +</pre> + +Sets <a href="bmh_undocumented?cl=9919#Rasterizer">Rasterizer</a> to <a href="bmh_SkPaint_Reference?cl=9919#rasterizer">rasterizer</a>, +decrementing <a href="bmh_undocumented?cl=9919#Reference_Count">Reference Count</a> of the previous <a href="bmh_undocumented?cl=9919#Rasterizer">Rasterizer</a>. +Pass nullptr to clear <a href="bmh_undocumented?cl=9919#Rasterizer">Rasterizer</a> and leave <a href="bmh_undocumented?cl=9919#Rasterizer">Rasterizer</a> effect on <a href="bmh_undocumented?cl=9919#Mask_Alpha">Mask Alpha</a> unaltered. +Does not affect <a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a>. +Does not alter <a href="bmh_SkPaint_Reference?cl=9919#rasterizer">rasterizer</a> <a href="bmh_undocumented?cl=9919#Reference_Count">Reference Count</a>. + +### Parameters + +<table> <tr> <td><code><strong>rasterizer </strong></code></td> <td> +how geometry is converted to <a href="bmh_undocumented?cl=9919#Mask_Alpha">Mask Alpha</a></td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="aec8ed9296c1628073086a33039f62b7"></fiddle-embed></div> + +--- + +# <a name="Image_Filter_Methods"></a> Image Filter Methods +<a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a> operates on the pixel representation of the shape, as modified by <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> +with <a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a> set to <a href="bmh_undocumented?cl=9919#kSrcOver">SkBlendMode::kSrcOver</a>. <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a> creates a new bitmap, +which is drawn to the device using the set <a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a>. +<a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a> is higher level than <a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a>; for instance, an <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a> +can operate on all channels of <a href="bmh_undocumented?cl=9919#Color">Color</a>, while <a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a> generates <a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a> only. +<a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a> operates independently of and can be used in combination with +<a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a> and <a href="bmh_undocumented?cl=9919#Rasterizer">Rasterizer</a>. + +### Example + +<div><fiddle-embed name="88804938b49eb4f7c7f01ad52f4db0d8"></fiddle-embed></div> + +<a name="getImageFilter"></a> +## getImageFilter + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +SkImageFilter* getImageFilter() const +</pre> + +Returns <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a> if set, or nullptr. +Does not alter <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a> <a href="bmh_undocumented?cl=9919#Reference_Count">Reference Count</a>. + +### Return Value + +<a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a> if previously set, nullptr otherwise + +### Example + +<div><fiddle-embed name="38788d42772641606e08c60d9dd418a2"> + +#### Example Output + +~~~~ +nullptr == image filter +nullptr != image filter +~~~~ + +</fiddle-embed></div> + +--- + +<a name="refImageFilter"></a> +## refImageFilter + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +sk_sp<SkImageFilter> refImageFilter() const +</pre> + +Returns <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a> if set, or nullptr. +Increases <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a> <a href="bmh_undocumented?cl=9919#Reference_Count">Reference Count</a> by one. + +### Return Value + +<a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a> if previously set, nullptr otherwise + +### Example + +<div><fiddle-embed name="13f09088b569251547107d14ae989dc1"> + +#### Example Output + +~~~~ +image filter unique: true +image filter unique: false +~~~~ + +</fiddle-embed></div> + +--- + +<a name="setImageFilter"></a> +## setImageFilter + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void setImageFilter(sk_sp<SkImageFilter> imageFilter) +</pre> + +Sets <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a> to <a href="bmh_SkPaint_Reference?cl=9919#imageFilter">imageFilter</a>, +decrementing <a href="bmh_undocumented?cl=9919#Reference_Count">Reference Count</a> of the previous <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a>. +Pass nullptr to clear <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a>, and remove <a href="bmh_undocumented?cl=9919#Image_Filter">Image Filter</a> effect +on drawing. +Does not affect <a href="bmh_undocumented?cl=9919#Rasterizer">Rasterizer</a> or <a href="bmh_undocumented?cl=9919#Mask_Filter">Mask Filter</a>. +Does not alter <a href="bmh_SkPaint_Reference?cl=9919#imageFilter">imageFilter</a> <a href="bmh_undocumented?cl=9919#Reference_Count">Reference Count</a>. + +### Parameters + +<table> <tr> <td><code><strong>imageFilter </strong></code></td> <td> +how <a href="bmh_undocumented?cl=9919#Image">Image</a> is sampled when transformed</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="6679d6e4ec632715ee03e68391bd7f9a"></fiddle-embed></div> + +--- + +# <a name="Draw_Looper_Methods"></a> Draw Looper Methods +<a href="bmh_undocumented?cl=9919#Draw_Looper">Draw Looper</a> sets a modifier that communicates state from one <a href="bmh_undocumented?cl=9919#Draw_Layer">Draw Layer</a> +to another to construct the draw. +<a href="bmh_undocumented?cl=9919#Draw_Looper">Draw Looper</a> draws one or more times, modifying the canvas and paint each time. +<a href="bmh_undocumented?cl=9919#Draw_Looper">Draw Looper</a> may be used to draw multiple colors or create a colored shadow. +Set <a href="bmh_undocumented?cl=9919#Draw_Looper">Draw Looper</a> to nullptr to prevent <a href="bmh_undocumented?cl=9919#Draw_Looper">Draw Looper</a> from modifying the draw. + +### Example + +<div><fiddle-embed name="84ec12a36e50df5ac565cc7a75ffbe9f"></fiddle-embed></div> + +<a name="getDrawLooper"></a> +## getDrawLooper + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +SkDrawLooper* getDrawLooper() const +</pre> + +Returns <a href="bmh_undocumented?cl=9919#Draw_Looper">Draw Looper</a> if set, or nullptr. +Does not alter <a href="bmh_undocumented?cl=9919#Draw_Looper">Draw Looper</a> <a href="bmh_undocumented?cl=9919#Reference_Count">Reference Count</a>. + +### Return Value + +<a href="bmh_undocumented?cl=9919#Draw_Looper">Draw Looper</a> if previously set, nullptr otherwise + +### Example + +<div><fiddle-embed name="af4c5acc7a91e7f23c2af48018903ad4"> + +#### Example Output + +~~~~ +nullptr == draw looper +nullptr != draw looper +~~~~ + +</fiddle-embed></div> + +--- + +<a name="refDrawLooper"></a> +## refDrawLooper + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +sk_sp<SkDrawLooper> refDrawLooper() const +</pre> + +Returns <a href="bmh_undocumented?cl=9919#Draw_Looper">Draw Looper</a> if set, or nullptr. +Increases <a href="bmh_undocumented?cl=9919#Draw_Looper">Draw Looper</a> <a href="bmh_undocumented?cl=9919#Reference_Count">Reference Count</a> by one. + +### Return Value + +<a href="bmh_undocumented?cl=9919#Draw_Looper">Draw Looper</a> if previously set, nullptr otherwise + +### Example + +<div><fiddle-embed name="2a3782c33f04ed17a725d0e449c6f7c3"> + +#### Example Output + +~~~~ +draw looper unique: true +draw looper unique: false +~~~~ + +</fiddle-embed></div> + +--- + +<a name="getLooper"></a> +## getLooper + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +SkDrawLooper* getLooper() const +</pre> + +Deprecated. + +(see bug.skia.org/6259) + +### Return Value + +<a href="bmh_undocumented?cl=9919#Draw_Looper">Draw Looper</a> if previously set, nullptr otherwise + +--- + +<a name="setDrawLooper"></a> +## setDrawLooper + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void setDrawLooper(sk_sp<SkDrawLooper> drawLooper) +</pre> + +Sets <a href="bmh_undocumented?cl=9919#Draw_Looper">Draw Looper</a> to <a href="bmh_SkPaint_Reference?cl=9919#drawLooper">drawLooper</a>, +decrementing <a href="bmh_undocumented?cl=9919#Reference_Count">Reference Count</a> of the previous <a href="bmh_SkPaint_Reference?cl=9919#drawLooper">drawLooper</a>. +Pass nullptr to clear <a href="bmh_undocumented?cl=9919#Draw_Looper">Draw Looper</a> and leave <a href="bmh_undocumented?cl=9919#Draw_Looper">Draw Looper</a> effect on drawing unaltered. +<a href="bmh_SkPaint_Reference?cl=9919#setDrawLooper">setDrawLooper</a> does not alter <a href="bmh_SkPaint_Reference?cl=9919#drawLooper">drawLooper</a> <a href="bmh_undocumented?cl=9919#Reference_Count">Reference Count</a>. + +### Parameters + +<table> <tr> <td><code><strong>drawLooper </strong></code></td> <td> +Iterates through drawing one or more time, altering <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a></td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="bf10f838b330f0a3a3266d42ea68a638"></fiddle-embed></div> + +--- + +<a name="setLooper"></a> +## setLooper + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void setLooper(sk_sp<SkDrawLooper> drawLooper) +</pre> + +Deprecated. + +(see bug.skia.org/6259) + +### Parameters + +<table> <tr> <td><code><strong>drawLooper </strong></code></td> <td> +sets <a href="bmh_undocumented?cl=9919#Draw_Looper">Draw Looper</a> to <a href="bmh_SkPaint_Reference?cl=9919#drawLooper">drawLooper</a></td> + </tr> + +--- + +</table> + +# <a name="Text_Align"></a> Text Align + +## <a name="SkPaint::Align"></a> Enum SkPaint::Align + +<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0"> +enum <a href="bmh_SkPaint_Reference?cl=9919#Align">Align</a> { +<a href="bmh_SkPaint_Reference?cl=9919#kLeft_Align">kLeft Align</a>, +<a href="bmh_SkPaint_Reference?cl=9919#kCenter_Align">kCenter Align</a>, +<a href="bmh_SkPaint_Reference?cl=9919#kRight_Align">kRight Align</a>, +};</pre> + +<a href="bmh_SkPaint_Reference?cl=9919#Align">Align</a> adjusts the text relative to the text position. +<a href="bmh_SkPaint_Reference?cl=9919#Align">Align</a> affects glyphs drawn with: <a href="bmh_SkCanvas_Reference?cl=9919#drawText">SkCanvas::drawText</a>, <a href="bmh_SkCanvas_Reference?cl=9919#drawPosText">SkCanvas::drawPosText</a>, +<a href="bmh_SkCanvas_Reference?cl=9919#drawPosTextH">SkCanvas::drawPosTextH</a>, <a href="bmh_SkCanvas_Reference?cl=9919#drawTextOnPath">SkCanvas::drawTextOnPath</a>, +<a href="bmh_SkCanvas_Reference?cl=9919#drawTextOnPathHV">SkCanvas::drawTextOnPathHV</a>, <a href="bmh_SkCanvas_Reference?cl=9919#drawTextRSXform">SkCanvas::drawTextRSXform</a>, <a href="bmh_SkCanvas_Reference?cl=9919#drawTextBlob">SkCanvas::drawTextBlob</a>, +and <a href="bmh_SkCanvas_Reference?cl=9919#drawString">SkCanvas::drawString</a>; +as well as calls that place text glyphs like <a href="bmh_SkPaint_Reference?cl=9919#getTextWidths">getTextWidths</a> and <a href="bmh_SkPaint_Reference?cl=9919#getTextPath">getTextPath</a>. + +The text position is set by the font for both horizontal and vertical text. +Typically, for horizontal text, the position is to the left side of the glyph on the +base line; and for vertical text, the position is the horizontal center of the glyph +at the caps height. + +<a href="bmh_SkPaint_Reference?cl=9919#Align">Align</a> adjusts the glyph position to center it or move it to abut the position +using the metrics returned by the font. + +<a href="bmh_SkPaint_Reference?cl=9919#Align">Align</a> defaults to <a href="bmh_SkPaint_Reference?cl=9919#kLeft_Align">kLeft Align</a>. + +### Constants + +<table> + <tr> + <td><a name="SkPaint::kLeft_Align"></a> <code><strong>SkPaint::kLeft_Align </strong></code></td><td>0</td><td>Leaves the glyph at the position computed by the font offset by the text position.</td> + </tr> + <tr> + <td><a name="SkPaint::kCenter_Align"></a> <code><strong>SkPaint::kCenter_Align </strong></code></td><td>1</td><td>Moves the glyph half its width if <a href="bmh_SkPaint_Reference?cl=9919#Flags">Flags</a> has <a href="bmh_SkPaint_Reference?cl=9919#kVerticalText_Flag">kVerticalText Flag</a> clear, and +half its height if <a href="bmh_SkPaint_Reference?cl=9919#Flags">Flags</a> has <a href="bmh_SkPaint_Reference?cl=9919#kVerticalText_Flag">kVerticalText Flag</a> set.</td> + </tr> + <tr> + <td><a name="SkPaint::kRight_Align"></a> <code><strong>SkPaint::kRight_Align </strong></code></td><td>2</td><td>Moves the glyph by its width if <a href="bmh_SkPaint_Reference?cl=9919#Flags">Flags</a> has <a href="bmh_SkPaint_Reference?cl=9919#kVerticalText_Flag">kVerticalText Flag</a> clear, +and by its height if <a href="bmh_SkPaint_Reference?cl=9919#Flags">Flags</a> has <a href="bmh_SkPaint_Reference?cl=9919#kVerticalText_Flag">kVerticalText Flag</a> set.</td> + </tr> + +</table> + +## <a name="SkPaint::_anonymous_2"></a> Enum SkPaint::_anonymous_2 + +<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0"> +enum { +<a href="bmh_SkPaint_Reference?cl=9919#kAlignCount">kAlignCount</a> = 3 +};</pre> + +### Constants + +<table> + <tr> + <td><a name="SkPaint::kAlignCount"></a> <code><strong>SkPaint::kAlignCount </strong></code></td><td>3</td><td>The number of different <a href="bmh_SkPaint_Reference?cl=9919#Text_Align">Text Align</a> values defined.</td> + </tr> + +</table> + +### Example + +<div><fiddle-embed name="702617fd9ebc3f12e30081b5db93e8a8"><div>Each position separately moves the glyph in drawPosText.</div></fiddle-embed></div> + +### Example + +<div><fiddle-embed name="f1cbbbafe6b3c52b81309cccbf96a308"><div><a href="bmh_SkPaint_Reference?cl=9919#Vertical_Text">Vertical Text</a> treats <a href="bmh_SkPaint_Reference?cl=9919#kLeft_Align">kLeft Align</a> as top align, and <a href="bmh_SkPaint_Reference?cl=9919#kRight_Align">kRight Align</a> as bottom align.</div></fiddle-embed></div> + +<a name="getTextAlign"></a> +## getTextAlign + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +Align getTextAlign() const +</pre> + +Returns <a href="bmh_SkPaint_Reference?cl=9919#Text_Align">Text Align</a>. +Returns <a href="bmh_SkPaint_Reference?cl=9919#kLeft_Align">kLeft Align</a> if <a href="bmh_SkPaint_Reference?cl=9919#Text_Align">Text Align</a> has not been set. + +### Return Value + +text placement relative to position + +### Example + +<div><fiddle-embed name="2df932f526e810f74c89d30ec3f4c947"> + +#### Example Output + +~~~~ +kLeft_Align == default +~~~~ + +</fiddle-embed></div> + +--- + +<a name="setTextAlign"></a> +## setTextAlign + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void setTextAlign(Align align) +</pre> + +Sets <a href="bmh_SkPaint_Reference?cl=9919#Text_Align">Text Align</a> to <a href="bmh_SkPaint_Reference?cl=9919#align">align</a>. +Has no effect if <a href="bmh_SkPaint_Reference?cl=9919#align">align</a> is an invalid value. + +### Parameters + +<table> <tr> <td><code><strong>align </strong></code></td> <td> +text placement relative to position</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="d37540afd918506ac2594665ca63979b"><div><a href="bmh_undocumented?cl=9919#Text">Text</a> is left-aligned by default, and then set to center. Setting the +alignment out of range has no effect.</div></fiddle-embed></div> + +--- + +# <a name="Text_Size"></a> Text Size +<a href="bmh_SkPaint_Reference?cl=9919#Text_Size">Text Size</a> adjusts the overall text size in points. +<a href="bmh_SkPaint_Reference?cl=9919#Text_Size">Text Size</a> can be set to any positive value or zero. +<a href="bmh_SkPaint_Reference?cl=9919#Text_Size">Text Size</a> defaults to 12. +Set <a href="bmh_undocumented?cl=9919#SkPaintDefaults_TextSize">SkPaintDefaults TextSize</a> at compile time to change the default setting. + +### Example + +<div><fiddle-embed name="91c9a3e498bb9412e4522a95d076ed5f"></fiddle-embed></div> + +<a name="getTextSize"></a> +## getTextSize + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +SkScalar getTextSize() const +</pre> + +Returns <a href="bmh_SkPaint_Reference?cl=9919#Text_Size">Text Size</a> in points. + +### Return Value + +typographic height of text + +### Example + +<div><fiddle-embed name="983e2a71ba72d4ba8c945420040b8f1c"></fiddle-embed></div> + +--- + +<a name="setTextSize"></a> +## setTextSize + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void setTextSize(SkScalar textSize) +</pre> + +Sets <a href="bmh_SkPaint_Reference?cl=9919#Text_Size">Text Size</a> in points. +Has no effect if <a href="bmh_SkPaint_Reference?cl=9919#textSize">textSize</a> is not greater than or equal to zero. + +### Parameters + +<table> <tr> <td><code><strong>textSize </strong></code></td> <td> +typographic height of text</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="6510c9e2f57b83c47e67829e7a68d493"></fiddle-embed></div> + +--- + +# <a name="Text_Scale_X"></a> Text Scale X +<a href="bmh_SkPaint_Reference?cl=9919#Text_Scale_X">Text Scale X</a> adjusts the text horizontal scale. +<a href="bmh_undocumented?cl=9919#Text">Text</a> scaling approximates condensed and expanded type faces when the actual face +is not available. +<a href="bmh_SkPaint_Reference?cl=9919#Text_Scale_X">Text Scale X</a> can be set to any value. +<a href="bmh_SkPaint_Reference?cl=9919#Text_Scale_X">Text Scale X</a> defaults to 1. + +### Example + +<div><fiddle-embed name="d13d787c1e36f515319fc998411c1d91"></fiddle-embed></div> + +<a name="getTextScaleX"></a> +## getTextScaleX + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +SkScalar getTextScaleX() const +</pre> + +Returns <a href="bmh_SkPaint_Reference?cl=9919#Text_Scale_X">Text Scale X</a>. +Default value is 1. + +### Return Value + +text horizontal scale + +### Example + +<div><fiddle-embed name="5dc8e58f6910cb8e4de9ed60f888188b"></fiddle-embed></div> + +--- + +<a name="setTextScaleX"></a> +## setTextScaleX + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void setTextScaleX(SkScalar scaleX) +</pre> + +Sets <a href="bmh_SkPaint_Reference?cl=9919#Text_Scale_X">Text Scale X</a>. +Default value is 1. + +### Parameters + +<table> <tr> <td><code><strong>scaleX </strong></code></td> <td> +text horizontal scale</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="a75bbdb8bb866b125c4c1dd5e967d470"></fiddle-embed></div> + +--- + +# <a name="Text_Skew_X"></a> Text Skew X +<a href="bmh_SkPaint_Reference?cl=9919#Text_Skew_X">Text Skew X</a> adjusts the text horizontal slant. +<a href="bmh_undocumented?cl=9919#Text">Text</a> skewing approximates italic and oblique type faces when the actual face +is not available. +<a href="bmh_SkPaint_Reference?cl=9919#Text_Skew_X">Text Skew X</a> can be set to any value. +<a href="bmh_SkPaint_Reference?cl=9919#Text_Skew_X">Text Skew X</a> defaults to 0. + +### Example + +<div><fiddle-embed name="aff208b0aab265f273045b27e683c17c"></fiddle-embed></div> + +<a name="getTextSkewX"></a> +## getTextSkewX + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +SkScalar getTextSkewX() const +</pre> + +Returns <a href="bmh_SkPaint_Reference?cl=9919#Text_Skew_X">Text Skew X</a>. +Default value is zero. + +### Return Value + +additional shear in x-axis relative to y-axis + +### Example + +<div><fiddle-embed name="11c10f466dae0d1639dbb9f6a0040218"></fiddle-embed></div> + +--- + +<a name="setTextSkewX"></a> +## setTextSkewX + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void setTextSkewX(SkScalar skewX) +</pre> + +Sets <a href="bmh_SkPaint_Reference?cl=9919#Text_Skew_X">Text Skew X</a>. +Default value is zero. + +### Parameters + +<table> <tr> <td><code><strong>skewX </strong></code></td> <td> +additional shear in x-axis relative to y-axis</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="6bd705a6e0c5f8ee24f302fe531bfabc"></fiddle-embed></div> + +--- + +# <a name="Text_Encoding"></a> Text Encoding + +## <a name="SkPaint::TextEncoding"></a> Enum SkPaint::TextEncoding + +<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0"> +enum <a href="bmh_SkPaint_Reference?cl=9919#TextEncoding">TextEncoding</a> { +<a href="bmh_SkPaint_Reference?cl=9919#kUTF8_TextEncoding">kUTF8 TextEncoding</a>, +<a href="bmh_SkPaint_Reference?cl=9919#kUTF16_TextEncoding">kUTF16 TextEncoding</a>, +<a href="bmh_SkPaint_Reference?cl=9919#kUTF32_TextEncoding">kUTF32 TextEncoding</a>, +<a href="bmh_SkPaint_Reference?cl=9919#kGlyphID_TextEncoding">kGlyphID TextEncoding</a> +};</pre> + +<a href="bmh_SkPaint_Reference?cl=9919#TextEncoding">TextEncoding</a> determines whether text specifies character codes and their encoded size, +or glyph indices. Character codes use the encoding specified by the<a href="bmh_undocumented?cl=9919#Unicode">Unicode</a> standardhttp://unicode.org/standard/standard.html. +Character codes encoded size are specified by <a href="bmh_undocumented?cl=9919#UTF_8">UTF-8</a>, <a href="bmh_undocumented?cl=9919#UTF_16">UTF-16</a>, or <a href="bmh_undocumented?cl=9919#UTF_32">UTF-32</a>. +All character encoding are able to represent all of <a href="bmh_undocumented?cl=9919#Unicode">Unicode</a>, differing only +in the total storage required. + +<a href="bmh_undocumented?cl=9919#UTF_8">UTF-8</a> (<a href="bmh_undocumented?cl=9919#RFC">RFC</a> 3629)https://tools.ietf.org/html/rfc3629is made up of 8-bit bytes, +and is a superset of <a href="bmh_undocumented?cl=9919#ASCII">ASCII</a>. +<a href="bmh_undocumented?cl=9919#UTF_16">UTF-16</a> (<a href="bmh_undocumented?cl=9919#RFC">RFC</a> 2781)https://tools.ietf.org/html/rfc2781is made up of 16-bit words, +and is a superset of <a href="bmh_undocumented?cl=9919#Unicode">Unicode</a> ranges 0x0000 to 0xD7FF and 0xE000 to 0xFFFF. +<a href="bmh_undocumented?cl=9919#UTF_32">UTF-32</a>http://www.unicode.org/versions/<a href="bmh_undocumented?cl=9919#Unicode5">Unicode5</a>.0.0/ch03.pdfis +made up of 32-bit words, and is a superset of <a href="bmh_undocumented?cl=9919#Unicode">Unicode</a>. + +<a href="bmh_undocumented?cl=9919#Font_Manager">Font Manager</a> uses font data to convert character code points into glyph indices. +A glyph index is a 16-bit word. + +<a href="bmh_SkPaint_Reference?cl=9919#TextEncoding">TextEncoding</a> is set to <a href="bmh_SkPaint_Reference?cl=9919#kUTF8_TextEncoding">kUTF8 TextEncoding</a> by default. + +### Constants + +<table> + <tr> + <td><a name="SkPaint::kUTF8_TextEncoding"></a> <code><strong>SkPaint::kUTF8_TextEncoding </strong></code></td><td>0</td><td>Uses bytes to represent <a href="bmh_undocumented?cl=9919#UTF_8">UTF-8</a> or <a href="bmh_undocumented?cl=9919#ASCII">ASCII</a>.</td> + </tr> + <tr> + <td><a name="SkPaint::kUTF16_TextEncoding"></a> <code><strong>SkPaint::kUTF16_TextEncoding </strong></code></td><td>1</td><td>Uses two byte words to represent most of <a href="bmh_undocumented?cl=9919#Unicode">Unicode</a>.</td> + </tr> + <tr> + <td><a name="SkPaint::kUTF32_TextEncoding"></a> <code><strong>SkPaint::kUTF32_TextEncoding </strong></code></td><td>2</td><td>Uses four byte words to represent all of <a href="bmh_undocumented?cl=9919#Unicode">Unicode</a>.</td> + </tr> + <tr> + <td><a name="SkPaint::kGlyphID_TextEncoding"></a> <code><strong>SkPaint::kGlyphID_TextEncoding </strong></code></td><td>3</td><td>Uses two byte words to represent glyph indices.</td> + </tr> + +</table> + +### Example + +<div><fiddle-embed name="b29294e7f29d160a1b46abf2dcec9d2a"><div>First line has <a href="bmh_undocumented?cl=9919#UTF_8">UTF-8</a> encoding. +Second line has <a href="bmh_undocumented?cl=9919#UTF_16">UTF-16</a> encoding. +Third line has <a href="bmh_undocumented?cl=9919#UTF_32">UTF-32</a> encoding. +Fourth line has 16 bit glyph indices.</div></fiddle-embed></div> + +<a name="getTextEncoding"></a> +## getTextEncoding + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +TextEncoding getTextEncoding() const +</pre> + +Returns <a href="bmh_SkPaint_Reference?cl=9919#Text_Encoding">Text Encoding</a>. +<a href="bmh_SkPaint_Reference?cl=9919#Text_Encoding">Text Encoding</a> determines how character code points are mapped to font glyph indices. + +### Return Value + +one of: <a href="bmh_SkPaint_Reference?cl=9919#kUTF8_TextEncoding">kUTF8 TextEncoding</a>, <a href="bmh_SkPaint_Reference?cl=9919#kUTF16_TextEncoding">kUTF16 TextEncoding</a>, <a href="bmh_SkPaint_Reference?cl=9919#kUTF32_TextEncoding">kUTF32 TextEncoding</a>, or +<a href="bmh_SkPaint_Reference?cl=9919#kGlyphID_TextEncoding">kGlyphID TextEncoding</a> + +### Example + +<div><fiddle-embed name="70ad28bbf7668b38474d7f225e3540bc"> + +#### Example Output + +~~~~ +kUTF8_TextEncoding == text encoding +kGlyphID_TextEncoding == text encoding +~~~~ + +</fiddle-embed></div> + +--- + +<a name="setTextEncoding"></a> +## setTextEncoding + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void setTextEncoding(TextEncoding encoding) +</pre> + +Sets <a href="bmh_SkPaint_Reference?cl=9919#Text_Encoding">Text Encoding</a> to <a href="bmh_SkPaint_Reference?cl=9919#setTextEncoding">encoding</a>. +<a href="bmh_SkPaint_Reference?cl=9919#Text_Encoding">Text Encoding</a> determines how character code points are mapped to font glyph indices. +Invalid values for <a href="bmh_SkPaint_Reference?cl=9919#setTextEncoding">encoding</a> are ignored. + +### Parameters + +<table> <tr> <td><code><strong>encoding </strong></code></td> <td> +one of: <a href="bmh_SkPaint_Reference?cl=9919#kUTF8_TextEncoding">kUTF8 TextEncoding</a>, <a href="bmh_SkPaint_Reference?cl=9919#kUTF16_TextEncoding">kUTF16 TextEncoding</a>, <a href="bmh_SkPaint_Reference?cl=9919#kUTF32_TextEncoding">kUTF32 TextEncoding</a>, or</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="329b92fbc35151dee9aa0c0e70107665"> + +#### Example Output + +~~~~ +4 != text encoding +~~~~ + +</fiddle-embed></div> + +--- + +# <a name="Font_Metrics"></a> Font Metrics +<a href="bmh_SkPaint_Reference?cl=9919#Font_Metrics">Font Metrics</a> describe dimensions common to the glyphs in <a href="bmh_undocumented?cl=9919#Typeface">Typeface</a>. +The dimensions are computed by <a href="bmh_undocumented?cl=9919#Font_Manager">Font Manager</a> from font data and do not take +<a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> settings other than <a href="bmh_SkPaint_Reference?cl=9919#Text_Size">Text Size</a> into account. + +<a href="bmh_undocumented?cl=9919#Font">Font</a> dimensions specify the anchor to the left of the glyph at baseline as the origin. +X-axis values to the left of the glyph are negative, and to the right of the left glyph edge +are positive. +Y-axis values above the baseline are negative, and below the baseline are positive. + +### Example + +<div><fiddle-embed name="b5b76e0a15da0c3530071186a9006498"></fiddle-embed></div> + +# <a name="SkPaint::FontMetrics"></a> Struct SkPaint::FontMetrics + +<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0"> +struct <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics">FontMetrics</a> { +enum <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_FontMetricsFlags">FontMetricsFlags</a> { +<a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_kUnderlineThicknessIsValid_Flag">kUnderlineThicknessIsValid Flag</a> = 1 << 0, +<a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_kUnderlinePositionIsValid_Flag">kUnderlinePositionIsValid Flag</a> = 1 << 1, +<a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_kStrikeoutThicknessIsValid_Flag">kStrikeoutThicknessIsValid Flag</a> = 1 << 2, +<a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_kStrikeoutPositionIsValid_Flag">kStrikeoutPositionIsValid Flag</a> = 1 << 3, +}; + +uint32_t <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_fFlags">fFlags</a>; +<a href="bmh_undocumented?cl=9919#SkScalar">SkScalar</a> <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_fTop">fTop</a>; +<a href="bmh_undocumented?cl=9919#SkScalar">SkScalar</a> <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_fAscent">fAscent</a>; +<a href="bmh_undocumented?cl=9919#SkScalar">SkScalar</a> <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_fDescent">fDescent</a>; +<a href="bmh_undocumented?cl=9919#SkScalar">SkScalar</a> <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_fBottom">fBottom</a>; +<a href="bmh_undocumented?cl=9919#SkScalar">SkScalar</a> <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_fLeading">fLeading</a>; +<a href="bmh_undocumented?cl=9919#SkScalar">SkScalar</a> <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_fAvgCharWidth">fAvgCharWidth</a>; +<a href="bmh_undocumented?cl=9919#SkScalar">SkScalar</a> <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_fMaxCharWidth">fMaxCharWidth</a>; +<a href="bmh_undocumented?cl=9919#SkScalar">SkScalar</a> <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_fXMin">fXMin</a>; +<a href="bmh_undocumented?cl=9919#SkScalar">SkScalar</a> <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_fXMax">fXMax</a>; +<a href="bmh_undocumented?cl=9919#SkScalar">SkScalar</a> <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_fXHeight">fXHeight</a>; +<a href="bmh_undocumented?cl=9919#SkScalar">SkScalar</a> <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_fCapHeight">fCapHeight</a>; +<a href="bmh_undocumented?cl=9919#SkScalar">SkScalar</a> <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_fUnderlineThickness">fUnderlineThickness</a>; +<a href="bmh_undocumented?cl=9919#SkScalar">SkScalar</a> <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_fUnderlinePosition">fUnderlinePosition</a>; +<a href="bmh_undocumented?cl=9919#SkScalar">SkScalar</a> <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_fStrikeoutThickness">fStrikeoutThickness</a>; +<a href="bmh_undocumented?cl=9919#SkScalar">SkScalar</a> <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_fStrikeoutPosition">fStrikeoutPosition</a>; + +bool <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_hasUnderlineThickness">hasUnderlineThickness(SkScalar* thickness)</a> const; +bool <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_hasUnderlinePosition">hasUnderlinePosition(SkScalar* position)</a> const; +bool <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_hasStrikeoutThickness">hasStrikeoutThickness(SkScalar* thickness)</a> const; +bool <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_hasStrikeoutPosition">hasStrikeoutPosition(SkScalar* position)</a> const; +};</pre> + +<a href="bmh_SkPaint_Reference?cl=9919#FontMetrics">FontMetrics</a> is filled out by <a href="bmh_SkPaint_Reference?cl=9919#getFontMetrics">getFontMetrics</a>. <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics">FontMetrics</a> contents reflect the values +computed by <a href="bmh_undocumented?cl=9919#Font_Manager">Font Manager</a> using <a href="bmh_undocumented?cl=9919#Typeface">Typeface</a>. Values are set to zero if they are +not availble. + +<a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_fUnderlineThickness">fUnderlineThickness</a> and <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_fUnderlinePosition">fUnderlinePosition</a> have a bit set in <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_fFlags">fFlags</a> if their values +are valid, since their value may be zero. +<a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_fStrikeoutThickness">fStrikeoutThickness</a> and <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_fStrikeoutPosition">fStrikeoutPosition</a> have a bit set in <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_fFlags">fFlags</a> if their values +are valid, since their value may be zero. + +## <a name="SkPaint::FontMetrics::FontMetricsFlags"></a> Enum SkPaint::FontMetrics::FontMetricsFlags + +<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0"> +enum <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_FontMetricsFlags">FontMetricsFlags</a> { +<a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_kUnderlineThicknessIsValid_Flag">kUnderlineThicknessIsValid Flag</a> = 1 << 0, +<a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_kUnderlinePositionIsValid_Flag">kUnderlinePositionIsValid Flag</a> = 1 << 1, +<a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_kStrikeoutThicknessIsValid_Flag">kStrikeoutThicknessIsValid Flag</a> = 1 << 2, +<a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_kStrikeoutPositionIsValid_Flag">kStrikeoutPositionIsValid Flag</a> = 1 << 3, +};</pre> + +<a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_FontMetricsFlags">FontMetricsFlags</a> are set in <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_fFlags">fFlags</a> when underline and strikeout metrics are valid; +the underline or strikeout metric may be valid and zero. +Fonts with embedded bitmaps may not have valid underline or strikeout metrics. + +### Constants + +<table> + <tr> + <td><a name="SkPaint::FontMetrics::kUnderlineThicknessIsValid_Flag"></a> <code><strong>SkPaint::FontMetrics::kUnderlineThicknessIsValid_Flag </strong></code></td><td>0x0001</td><td>Set if <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_fUnderlineThickness">fUnderlineThickness</a> is valid.</td> + </tr> + <tr> + <td><a name="SkPaint::FontMetrics::kUnderlinePositionIsValid_Flag"></a> <code><strong>SkPaint::FontMetrics::kUnderlinePositionIsValid_Flag </strong></code></td><td>0x0002</td><td>Set if <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_fUnderlinePosition">fUnderlinePosition</a> is valid.</td> + </tr> + <tr> + <td><a name="SkPaint::FontMetrics::kStrikeoutThicknessIsValid_Flag"></a> <code><strong>SkPaint::FontMetrics::kStrikeoutThicknessIsValid_Flag </strong></code></td><td>0x0004</td><td>Set if <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_fStrikeoutThickness">fStrikeoutThickness</a> is valid.</td> + </tr> + <tr> + <td><a name="SkPaint::FontMetrics::kStrikeoutPositionIsValid_Flag"></a> <code><strong>SkPaint::FontMetrics::kStrikeoutPositionIsValid_Flag </strong></code></td><td>0x0008</td><td>Set if <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_fStrikeoutPosition">fStrikeoutPosition</a> is valid.</td> + </tr> + +</table> + +<code><strong>uint32_t fFlags</strong></code> + +<a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_fFlags">fFlags</a> is set when underline metrics are valid. + +<code><strong>SkScalar fTop</strong></code> + +Largest height for any glyph. +A measure from the baseline, and is less than or equal to zero. + +<code><strong>SkScalar fAscent</strong></code> + +Recommended distance above the baseline to reserve for a line of text. +A measure from the baseline, and is less than or equal to zero. + +<code><strong>SkScalar fDescent</strong></code> + +Recommended distance below the baseline to reserve for a line of text. +A measure from the baseline, and is greater than or equal to zero. + +<code><strong>SkScalar fBottom</strong></code> + +Greatest extent below the baseline for any glyph. +A measure from the baseline, and is greater than or equal to zero. + +<code><strong>SkScalar fLeading</strong></code> + +Recommended distance to add between lines of text. +Greater than or equal to zero. + +<code><strong>SkScalar fAvgCharWidth</strong></code> + +Average character width, if it is available. +Zero if no average width is stored in the font. + +<code><strong>SkScalar fMaxCharWidth</strong></code> + +Maximum character width. + +<code><strong>SkScalar fXMin</strong></code> + +Minimum bounding box x value for all glyphs. +Typically less than zero. + +<code><strong>SkScalar fXMax</strong></code> + +Maximum bounding box x value for all glyphs. +Typically greater than zero. + +<code><strong>SkScalar fXHeight</strong></code> + +Height of a lower-case 'x'. +May be zero if no lower-case height is stored in the font. + +<code><strong>SkScalar fCapHeight</strong></code> + +Height of an upper-case letter. +May be zero if no upper-case height is stored in the font. + +<code><strong>SkScalar fUnderlineThickness</strong></code> + +Underline thickness. If the metric +is valid, the <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_kUnderlineThicknessIsValid_Flag">kUnderlineThicknessIsValid Flag</a> is set in <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_fFlags">fFlags</a>. +If <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_kUnderlineThicknessIsValid_Flag">kUnderlineThicknessIsValid Flag</a> is clear, <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_fUnderlineThickness">fUnderlineThickness</a> is zero. + +<code><strong>SkScalar fUnderlinePosition</strong></code> + +Underline position relative to the baseline. +It may be negative, to draw the underline above the baseline, zero +to draw the underline on the baseline, or positive to draw the underline +below the baseline. + +If the metric is valid, the <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_kUnderlinePositionIsValid_Flag">kUnderlinePositionIsValid Flag</a> is set in <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_fFlags">fFlags</a>. +If <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_kUnderlinePositionIsValid_Flag">kUnderlinePositionIsValid Flag</a> is clear, <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_fUnderlinePosition">fUnderlinePosition</a> is zero. + +<code><strong>SkScalar fStrikeoutThickness</strong></code> + +Strikeout thickness. If the metric +is valid, the <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_kStrikeoutThicknessIsValid_Flag">kStrikeoutThicknessIsValid Flag</a> is set in <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_fFlags">fFlags</a>. +If <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_kStrikeoutThicknessIsValid_Flag">kStrikeoutThicknessIsValid Flag</a> is clear, <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_fStrikeoutThickness">fStrikeoutThickness</a> is zero. + +<code><strong>SkScalar fStrikeoutPosition</strong></code> + +Strikeout position relative to the baseline. +It may be negative, to draw the strikeout above the baseline, zero +to draw the strikeout on the baseline, or positive to draw the strikeout +below the baseline. + +If the metric is valid, the <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_kStrikeoutPositionIsValid_Flag">kStrikeoutPositionIsValid Flag</a> is set in <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_fFlags">fFlags</a>. +If <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_kStrikeoutPositionIsValid_Flag">kStrikeoutPositionIsValid Flag</a> is clear, <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_fStrikeoutPosition">fStrikeoutPosition</a> is zero. + +<a name="hasUnderlineThickness"></a> +## hasUnderlineThickness + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +bool hasUnderlineThickness(SkScalar* thickness) const +</pre> + +If <a href="bmh_SkPaint_Reference?cl=9919#Font_Metrics">Font Metrics</a> has a valid underline <a href="bmh_SkPaint_Reference?cl=9919#thickness">thickness</a>, return true, and set +<a href="bmh_SkPaint_Reference?cl=9919#thickness">thickness</a> to that value. If it doesn't, return false, and ignore +<a href="bmh_SkPaint_Reference?cl=9919#thickness">thickness</a>. + +### Parameters + +<table> <tr> <td><code><strong>thickness </strong></code></td> <td> +storage for underline width</td> + </tr> +</table> + +### Return Value + +true if font specifies underline width + +--- + +<a name="hasUnderlinePosition"></a> +## hasUnderlinePosition + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +bool hasUnderlinePosition(SkScalar* position) const +</pre> + +If <a href="bmh_SkPaint_Reference?cl=9919#Font_Metrics">Font Metrics</a> has a valid underline <a href="bmh_SkPaint_Reference?cl=9919#position">position</a>, return true, and set +<a href="bmh_SkPaint_Reference?cl=9919#position">position</a> to that value. If it doesn't, return false, and ignore +<a href="bmh_SkPaint_Reference?cl=9919#position">position</a>. + +### Parameters + +<table> <tr> <td><code><strong>position </strong></code></td> <td> +storage for underline <a href="bmh_SkPaint_Reference?cl=9919#position">position</a></td> + </tr> +</table> + +### Return Value + +true if font specifies underline <a href="bmh_SkPaint_Reference?cl=9919#position">position</a> + +--- + +<a name="hasStrikeoutThickness"></a> +## hasStrikeoutThickness + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +bool hasStrikeoutThickness(SkScalar* thickness) const +</pre> + +If <a href="bmh_SkPaint_Reference?cl=9919#Font_Metrics">Font Metrics</a> has a valid strikeout <a href="bmh_SkPaint_Reference?cl=9919#thickness">thickness</a>, return true, and set +<a href="bmh_SkPaint_Reference?cl=9919#thickness">thickness</a> to that value. If it doesn't, return false, and ignore +<a href="bmh_SkPaint_Reference?cl=9919#thickness">thickness</a>. + +### Parameters + +<table> <tr> <td><code><strong>thickness </strong></code></td> <td> +storage for strikeout width</td> + </tr> +</table> + +### Return Value + +true if font specifies strikeout width + +--- + +<a name="hasStrikeoutPosition"></a> +## hasStrikeoutPosition + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +bool hasStrikeoutPosition(SkScalar* position) const +</pre> + +If <a href="bmh_SkPaint_Reference?cl=9919#Font_Metrics">Font Metrics</a> has a valid strikeout <a href="bmh_SkPaint_Reference?cl=9919#position">position</a>, return true, and set +<a href="bmh_SkPaint_Reference?cl=9919#position">position</a> to that value. If it doesn't, return false, and ignore +<a href="bmh_SkPaint_Reference?cl=9919#position">position</a>. + +### Parameters + +<table> <tr> <td><code><strong>position </strong></code></td> <td> +storage for strikeout <a href="bmh_SkPaint_Reference?cl=9919#position">position</a></td> + </tr> +</table> + +### Return Value + +true if font specifies strikeout <a href="bmh_SkPaint_Reference?cl=9919#position">position</a> + +--- + +<a name="getFontMetrics"></a> +## getFontMetrics + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +SkScalar getFontMetrics(FontMetrics* metrics, SkScalar scale = 0) const +</pre> + +Returns <a href="bmh_SkPaint_Reference?cl=9919#Font_Metrics">Font Metrics</a> associated with <a href="bmh_undocumented?cl=9919#Typeface">Typeface</a>. +The return value is the recommended spacing between lines: the sum of <a href="bmh_SkPaint_Reference?cl=9919#metrics">metrics</a> +descent, ascent, and leading. +If <a href="bmh_SkPaint_Reference?cl=9919#metrics">metrics</a> is not nullptr, <a href="bmh_SkPaint_Reference?cl=9919#Font_Metrics">Font Metrics</a> is copied to <a href="bmh_SkPaint_Reference?cl=9919#metrics">metrics</a>. +Results are scaled by <a href="bmh_SkPaint_Reference?cl=9919#Text_Size">Text Size</a> but does not take into account +dimensions required by <a href="bmh_SkPaint_Reference?cl=9919#Text_Scale_X">Text Scale X</a>, <a href="bmh_SkPaint_Reference?cl=9919#Text_Skew_X">Text Skew X</a>, <a href="bmh_SkPaint_Reference?cl=9919#Fake_Bold">Fake Bold</a>, +<a href="bmh_SkPaint_Reference?cl=9919#Style_Stroke">Style Stroke</a>, and <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a>. +Results can be additionally scaled by <a href="bmh_SkPaint_Reference?cl=9919#scale">scale</a>; a <a href="bmh_SkPaint_Reference?cl=9919#scale">scale</a> of zero +is ignored. + +### Parameters + +<table> <tr> <td><code><strong>metrics </strong></code></td> <td> +storage for <a href="bmh_SkPaint_Reference?cl=9919#Font_Metrics">Font Metrics</a> from <a href="bmh_undocumented?cl=9919#Typeface">Typeface</a>; may be nullptr</td> + </tr> <tr> <td><code><strong>scale </strong></code></td> <td> +additional multiplier for returned values</td> + </tr> +</table> + +### Return Value + +recommended spacing between lines + +### Example + +<div><fiddle-embed name="b899d84caba6607340322d317992d070"></fiddle-embed></div> + +### See Also + +<a href="bmh_SkPaint_Reference?cl=9919#Text_Size">Text Size</a> <a href="bmh_undocumented?cl=9919#Typeface">Typeface</a> <a href="bmh_SkPaint_Reference?cl=9919#Typeface_Methods">Typeface Methods</a> + +--- + +<a name="getFontSpacing"></a> +## getFontSpacing + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +SkScalar getFontSpacing() const +</pre> + +Returns the recommended spacing between lines: the sum of metrics +descent, ascent, and leading. +Result is scaled by <a href="bmh_SkPaint_Reference?cl=9919#Text_Size">Text Size</a> but does not take into account +dimensions required by stroking and <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a>. +<a href="bmh_SkPaint_Reference?cl=9919#getFontSpacing">getFontSpacing</a> returns the same result as <a href="bmh_SkPaint_Reference?cl=9919#getFontMetrics">getFontMetrics</a>. + +### Return Value + +recommended spacing between lines + +### 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> + +--- + +<a name="getFontBounds"></a> +## getFontBounds + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +SkRect getFontBounds() const +</pre> + +Returns the union of bounds of all glyphs. +Returned dimensions are computed by <a href="bmh_undocumented?cl=9919#Font_Manager">Font Manager</a> from font data, +ignoring <a href="bmh_SkPaint_Reference?cl=9919#Hinting">Hinting</a>. <a href="bmh_SkPaint_Reference?cl=9919#getFontBounds">getFontBounds</a> includes <a href="bmh_SkPaint_Reference?cl=9919#Text_Size">Text Size</a>, <a href="bmh_SkPaint_Reference?cl=9919#Text_Scale_X">Text Scale X</a>, +and <a href="bmh_SkPaint_Reference?cl=9919#Text_Skew_X">Text Skew X</a>, but not <a href="bmh_SkPaint_Reference?cl=9919#Fake_Bold">Fake Bold</a> or <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a>. + +If <a href="bmh_SkPaint_Reference?cl=9919#Text_Size">Text Size</a> is large, <a href="bmh_SkPaint_Reference?cl=9919#Text_Scale_X">Text Scale X</a> is one, and <a href="bmh_SkPaint_Reference?cl=9919#Text_Skew_X">Text Skew X</a> is zero, +<a href="bmh_SkPaint_Reference?cl=9919#getFontBounds">getFontBounds</a> returns the same bounds as <a href="bmh_SkPaint_Reference?cl=9919#Font_Metrics">Font Metrics</a> { <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_fXMin">FontMetrics::fXMin</a>, +<a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_fTop">FontMetrics::fTop</a>, <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_fXMax">FontMetrics::fXMax</a>, <a href="bmh_SkPaint_Reference?cl=9919#FontMetrics_fBottom">FontMetrics::fBottom</a> }. + +### Return Value + +union of bounds of all glyphs + +### Example + +<div><fiddle-embed name="facaddeec7943bc491988e345e27e65f"> + +#### Example Output + +~~~~ +metrics bounds = { -12.2461, -14.7891, 21.5215, 5.55469 } +font bounds = { -12.2461, -14.7891, 21.5215, 5.55469 } +~~~~ + +</fiddle-embed></div> + +--- + +<a name="textToGlyphs"></a> +## textToGlyphs + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +int textToGlyphs(const void* text, size_t byteLength, SkGlyphID glyphs[]) const +</pre> + +Converts <a href="bmh_SkPaint_Reference?cl=9919#text">text</a> into glyph indices. +Returns the number of glyph indices represented by <a href="bmh_SkPaint_Reference?cl=9919#text">text</a>. +<a href="bmh_SkPaint_Reference?cl=9919#Text_Encoding">Text Encoding</a> specifies how <a href="bmh_SkPaint_Reference?cl=9919#text">text</a> represents characters or <a href="bmh_SkPaint_Reference?cl=9919#glyphs">glyphs</a>. +<a href="bmh_SkPaint_Reference?cl=9919#glyphs">glyphs</a> may be nullptr, to compute the glyph count. + +Does not check <a href="bmh_SkPaint_Reference?cl=9919#text">text</a> for valid character encoding or valid +glyph indices. + +If <a href="bmh_SkPaint_Reference?cl=9919#byteLength">byteLength</a> equals zero, <a href="bmh_SkPaint_Reference?cl=9919#textToGlyphs">textToGlyphs</a> returns zero. +If <a href="bmh_SkPaint_Reference?cl=9919#byteLength">byteLength</a> includes a partial character, the partial character is ignored. + +If <a href="bmh_SkPaint_Reference?cl=9919#Text_Encoding">Text Encoding</a> is <a href="bmh_SkPaint_Reference?cl=9919#kUTF8_TextEncoding">kUTF8 TextEncoding</a> and +<a href="bmh_SkPaint_Reference?cl=9919#text">text</a> contains an invalid <a href="bmh_undocumented?cl=9919#UTF_8">UTF-8</a> sequence, zero is returned. + +### Parameters + +<table> <tr> <td><code><strong>text </strong></code></td> <td> +character stroage encoded with <a href="bmh_SkPaint_Reference?cl=9919#Text_Encoding">Text Encoding</a></td> + </tr> <tr> <td><code><strong>byteLength </strong></code></td> <td> +length of character storage in bytes</td> + </tr> <tr> <td><code><strong>glyphs </strong></code></td> <td> +storage for glyph indices; may be nullptr</td> + </tr> +</table> + +### Return Value + +number of <a href="bmh_SkPaint_Reference?cl=9919#glyphs">glyphs</a> represented by <a href="bmh_SkPaint_Reference?cl=9919#text">text</a> of length <a href="bmh_SkPaint_Reference?cl=9919#byteLength">byteLength</a> + +### Example + +<div><fiddle-embed name="343e9471a7f7b5f09abdc3b44983433b"></fiddle-embed></div> + +--- + +<a name="countText"></a> +## countText + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +int countText(const void* text, size_t byteLength) const +</pre> + +Returns the number of glyphs in <a href="bmh_SkPaint_Reference?cl=9919#text">text</a>. +Uses <a href="bmh_SkPaint_Reference?cl=9919#Text_Encoding">Text Encoding</a> to count the glyphs. +Returns the same result as <a href="bmh_SkPaint_Reference?cl=9919#textToGlyphs">textToGlyphs</a>. + +### Parameters + +<table> <tr> <td><code><strong>text </strong></code></td> <td> +character stroage encoded with <a href="bmh_SkPaint_Reference?cl=9919#Text_Encoding">Text Encoding</a></td> + </tr> <tr> <td><code><strong>byteLength </strong></code></td> <td> +length of character storage in bytes</td> + </tr> +</table> + +### Return Value + +number of glyphs represented by <a href="bmh_SkPaint_Reference?cl=9919#text">text</a> of length <a href="bmh_SkPaint_Reference?cl=9919#byteLength">byteLength</a> + +### Example + +<div><fiddle-embed name="85436c71aab5410767fc688ab0573e09"> + +#### Example Output + +~~~~ +count = 5 +~~~~ + +</fiddle-embed></div> + +--- + +<a name="containsText"></a> +## containsText + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +bool containsText(const void* text, size_t byteLength) const +</pre> + +Returns true if all <a href="bmh_SkPaint_Reference?cl=9919#text">text</a> corresponds to a non-zero glyph index. +Returns false if any characters in <a href="bmh_SkPaint_Reference?cl=9919#text">text</a> are not supported in +<a href="bmh_undocumented?cl=9919#Typeface">Typeface</a>. + +If <a href="bmh_SkPaint_Reference?cl=9919#Text_Encoding">Text Encoding</a> is <a href="bmh_SkPaint_Reference?cl=9919#kGlyphID_TextEncoding">kGlyphID TextEncoding</a>, <a href="bmh_SkPaint_Reference?cl=9919#containsText">containsText</a> +returns true if all glyph indices in <a href="bmh_SkPaint_Reference?cl=9919#text">text</a> are non-zero; <a href="bmh_SkPaint_Reference?cl=9919#containsText">containsText</a> +does not check to see if <a href="bmh_SkPaint_Reference?cl=9919#text">text</a> contains valid glyph indices for <a href="bmh_undocumented?cl=9919#Typeface">Typeface</a>. + +Returns true if bytelength is zero. + +### Parameters + +<table> <tr> <td><code><strong>text </strong></code></td> <td> +array of characters or glyphs</td> + </tr> <tr> <td><code><strong>byteLength </strong></code></td> <td> +number of bytes in <a href="bmh_SkPaint_Reference?cl=9919#text">text</a> array</td> + </tr> +</table> + +### Return Value + +true if all <a href="bmh_SkPaint_Reference?cl=9919#text">text</a> corresponds to a non-zero glyph index + +### Example + +<div><fiddle-embed name="9202369019552f09cd4bec7f3046fee4"><div><a href="bmh_SkPaint_Reference?cl=9919#containsText">containsText</a> succeeds for degree symbol, but cannot find a glyph index +corresponding to the <a href="bmh_undocumented?cl=9919#Unicode">Unicode</a> surrogate code point.</div> + +#### Example Output + +~~~~ +0x00b0 == has char +0xd800 != has char +~~~~ + +</fiddle-embed></div> + +### Example + +<div><fiddle-embed name="904227febfd1c2e264955da0ef66da73"><div><a href="bmh_SkPaint_Reference?cl=9919#containsText">containsText</a> returns true that glyph index is greater than zero, not +that it corresponds to an entry in <a href="bmh_undocumented?cl=9919#Typeface">Typeface</a>.</div> + +#### Example Output + +~~~~ +0x01ff == has glyph +0x0000 != has glyph +0xffff == has glyph +~~~~ + +</fiddle-embed></div> + +### See Also + +<a href="bmh_SkPaint_Reference?cl=9919#setTextEncoding">setTextEncoding</a> <a href="bmh_undocumented?cl=9919#Typeface">Typeface</a> + +--- + +<a name="glyphsToUnichars"></a> +## glyphsToUnichars + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void glyphsToUnichars(const SkGlyphID glyphs[], int count, SkUnichar text[]) const +</pre> + +Converts <a href="bmh_SkPaint_Reference?cl=9919#glyphs">glyphs</a> into <a href="bmh_SkPaint_Reference?cl=9919#text">text</a> if possible. +<a href="bmh_undocumented?cl=9919#Glyph">Glyph</a> values without direct <a href="bmh_undocumented?cl=9919#Unicode">Unicode</a> equivalents are mapped to zero. +Uses the <a href="bmh_undocumented?cl=9919#Typeface">Typeface</a>, but is unaffected +by <a href="bmh_SkPaint_Reference?cl=9919#Text_Encoding">Text Encoding</a>; the <a href="bmh_SkPaint_Reference?cl=9919#text">text</a> values returned are equivalent to <a href="bmh_SkPaint_Reference?cl=9919#kUTF32_TextEncoding">kUTF32 TextEncoding</a>. + +Only supported on platforms that use <a href="bmh_undocumented?cl=9919#FreeType">FreeType</a> as the <a href="bmh_undocumented?cl=9919#Engine">Font Engine</a>. + +### Parameters + +<table> <tr> <td><code><strong>glyphs </strong></code></td> <td> +array of indices into font</td> + </tr> <tr> <td><code><strong>count </strong></code></td> <td> +length of glyph array</td> + </tr> <tr> <td><code><strong>text </strong></code></td> <td> +storage for character codes, one per glyph</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="c12686b0b3e0a87d0a248bbfc57e9492"><div>Convert <a href="bmh_undocumented?cl=9919#UTF_8">UTF-8</a> <a href="bmh_SkPaint_Reference?cl=9919#text">text</a> to <a href="bmh_SkPaint_Reference?cl=9919#glyphs">glyphs</a>; then convert <a href="bmh_SkPaint_Reference?cl=9919#glyphs">glyphs</a> to <a href="bmh_undocumented?cl=9919#Unichar">Unichar</a> code points.</div></fiddle-embed></div> + +--- + +# <a name="Measure_Text"></a> Measure Text + +<a name="measureText"></a> +## measureText + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +SkScalar measureText(const void* text, size_t length, SkRect* bounds) const +</pre> + +Returns the advance width of <a href="bmh_SkPaint_Reference?cl=9919#text">text</a> if <a href="bmh_SkPaint_Reference?cl=9919#kVerticalText_Flag">kVerticalText Flag</a> is clear, +and the height of <a href="bmh_SkPaint_Reference?cl=9919#text">text</a> if <a href="bmh_SkPaint_Reference?cl=9919#kVerticalText_Flag">kVerticalText Flag</a> is set. +The advance is the normal distance to move before drawing additional <a href="bmh_SkPaint_Reference?cl=9919#text">text</a>. +Uses <a href="bmh_SkPaint_Reference?cl=9919#Text_Encoding">Text Encoding</a> to decode <a href="bmh_SkPaint_Reference?cl=9919#text">text</a>, <a href="bmh_undocumented?cl=9919#Typeface">Typeface</a> to get the font metrics, +and <a href="bmh_SkPaint_Reference?cl=9919#Text_Size">Text Size</a>, <a href="bmh_SkPaint_Reference?cl=9919#Text_Scale_X">Text Scale X</a>, <a href="bmh_SkPaint_Reference?cl=9919#Text_Skew_X">Text Skew X</a>, <a href="bmh_SkPaint_Reference?cl=9919#Stroke_Width">Stroke Width</a>, and +<a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a> to scale the metrics and <a href="bmh_SkPaint_Reference?cl=9919#bounds">bounds</a>. +Returns the bounding box of <a href="bmh_SkPaint_Reference?cl=9919#text">text</a> if <a href="bmh_SkPaint_Reference?cl=9919#bounds">bounds</a> is not nullptr. +The bounding box is computed as if the <a href="bmh_SkPaint_Reference?cl=9919#text">text</a> was drawn at the origin. + +### Parameters + +<table> <tr> <td><code><strong>text </strong></code></td> <td> +character codes or glyph indices to be measured</td> + </tr> <tr> <td><code><strong>length </strong></code></td> <td> +number of bytes of <a href="bmh_SkPaint_Reference?cl=9919#text">text</a> to measure</td> + </tr> <tr> <td><code><strong>bounds </strong></code></td> <td> +returns bounding box relative to (0, 0) if not nullptr</td> + </tr> +</table> + +### Return Value + +advance width or height + +### Example + +<div><fiddle-embed name="06084f609184470135a9cd9ebc5af149"></fiddle-embed></div> + +--- + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +SkScalar measureText(const void* text, size_t length) const +</pre> + +Returns the advance width of <a href="bmh_SkPaint_Reference?cl=9919#text">text</a> if <a href="bmh_SkPaint_Reference?cl=9919#kVerticalText_Flag">kVerticalText Flag</a> is clear, +and the height of <a href="bmh_SkPaint_Reference?cl=9919#text">text</a> if <a href="bmh_SkPaint_Reference?cl=9919#kVerticalText_Flag">kVerticalText Flag</a> is set. +The advance is the normal distance to move before drawing additional <a href="bmh_SkPaint_Reference?cl=9919#text">text</a>. +Uses <a href="bmh_SkPaint_Reference?cl=9919#Text_Encoding">Text Encoding</a> to decode <a href="bmh_SkPaint_Reference?cl=9919#text">text</a>, <a href="bmh_undocumented?cl=9919#Typeface">Typeface</a> to get the font metrics, +and <a href="bmh_SkPaint_Reference?cl=9919#Text_Size">Text Size</a> to scale the metrics. +Does not scale the advance or bounds by <a href="bmh_SkPaint_Reference?cl=9919#Fake_Bold">Fake Bold</a> or <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a>. + +### Parameters + +<table> <tr> <td><code><strong>text </strong></code></td> <td> +character codes or glyph indices to be measured</td> + </tr> <tr> <td><code><strong>length </strong></code></td> <td> +number of bytes of <a href="bmh_SkPaint_Reference?cl=9919#text">text</a> to measure</td> + </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> + +--- + +<a name="breakText"></a> +## breakText + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +size_t breakText(const void* text, size_t length, SkScalar maxWidth, + SkScalar* measuredWidth = NULL) const +</pre> + +Returns the bytes of <a href="bmh_SkPaint_Reference?cl=9919#text">text</a> that fit within <a href="bmh_SkPaint_Reference?cl=9919#maxWidth">maxWidth</a>. +If <a href="bmh_SkPaint_Reference?cl=9919#kVerticalText_Flag">kVerticalText Flag</a> is clear, the <a href="bmh_SkPaint_Reference?cl=9919#text">text</a> fragment fits if its advance width is less than or +equal to <a href="bmh_SkPaint_Reference?cl=9919#maxWidth">maxWidth</a>. +If <a href="bmh_SkPaint_Reference?cl=9919#kVerticalText_Flag">kVerticalText Flag</a> is set, the <a href="bmh_SkPaint_Reference?cl=9919#text">text</a> fragment fits if its advance height is less than or +equal to <a href="bmh_SkPaint_Reference?cl=9919#maxWidth">maxWidth</a>. +Measures only while the advance is less than or equal to <a href="bmh_SkPaint_Reference?cl=9919#maxWidth">maxWidth</a>. +Returns the advance or the <a href="bmh_SkPaint_Reference?cl=9919#text">text</a> fragment in <a href="bmh_SkPaint_Reference?cl=9919#measuredWidth">measuredWidth</a> if it not nullptr. +Uses <a href="bmh_SkPaint_Reference?cl=9919#Text_Encoding">Text Encoding</a> to decode <a href="bmh_SkPaint_Reference?cl=9919#text">text</a>, <a href="bmh_undocumented?cl=9919#Typeface">Typeface</a> to get the font metrics, +and <a href="bmh_SkPaint_Reference?cl=9919#Text_Size">Text Size</a> to scale the metrics. +Does not scale the advance or bounds by <a href="bmh_SkPaint_Reference?cl=9919#Fake_Bold">Fake Bold</a> or <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a>. + +### Parameters + +<table> <tr> <td><code><strong>text </strong></code></td> <td> +character codes or glyph indices to be measured</td> + </tr> <tr> <td><code><strong>length </strong></code></td> <td> +number of bytes of <a href="bmh_SkPaint_Reference?cl=9919#text">text</a> to measure</td> + </tr> <tr> <td><code><strong>maxWidth </strong></code></td> <td> +advance limit; <a href="bmh_SkPaint_Reference?cl=9919#text">text</a> is measured while advance is less than <a href="bmh_SkPaint_Reference?cl=9919#maxWidth">maxWidth</a></td> + </tr> <tr> <td><code><strong>measuredWidth </strong></code></td> <td> +returns the width of the <a href="bmh_SkPaint_Reference?cl=9919#text">text</a> less than or equal to <a href="bmh_SkPaint_Reference?cl=9919#maxWidth">maxWidth</a></td> + </tr> +</table> + +### Return Value + +bytes of <a href="bmh_SkPaint_Reference?cl=9919#text">text</a> that fit, always less than or equal to <a href="bmh_SkPaint_Reference?cl=9919#length">length</a> + +### Example + +<div><fiddle-embed name="fd0033470ccbd5c7059670fdbf96cffc"><div><a href="bmh_undocumented?cl=9919#Line">Line</a> under "" shows desired width, shorter than available characters. +<a href="bmh_undocumented?cl=9919#Line">Line</a> under "" shows measured width after breaking <a href="bmh_SkPaint_Reference?cl=9919#text">text</a>.</div></fiddle-embed></div> + +--- + +<a name="getTextWidths"></a> +## getTextWidths + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +int getTextWidths(const void* text, size_t byteLength, SkScalar widths[], + SkRect bounds[] = NULL) const +</pre> + +Retrieves the advance and <a href="bmh_SkPaint_Reference?cl=9919#bounds">bounds</a> for each glyph in <a href="bmh_SkPaint_Reference?cl=9919#text">text</a>, and returns +the glyph count in <a href="bmh_SkPaint_Reference?cl=9919#text">text</a>. +Both <a href="bmh_SkPaint_Reference?cl=9919#widths">widths</a> and <a href="bmh_SkPaint_Reference?cl=9919#bounds">bounds</a> may be nullptr. +If <a href="bmh_SkPaint_Reference?cl=9919#widths">widths</a> is not nullptr, <a href="bmh_SkPaint_Reference?cl=9919#widths">widths</a> must be an array of glyph count entries. +if <a href="bmh_SkPaint_Reference?cl=9919#bounds">bounds</a> is not nullptr, <a href="bmh_SkPaint_Reference?cl=9919#bounds">bounds</a> must be an array of glyph count entries. +If <a href="bmh_SkPaint_Reference?cl=9919#kVerticalText_Flag">kVerticalText Flag</a> is clear, <a href="bmh_SkPaint_Reference?cl=9919#widths">widths</a> returns the horizontal advance. +If <a href="bmh_SkPaint_Reference?cl=9919#kVerticalText_Flag">kVerticalText Flag</a> is set, <a href="bmh_SkPaint_Reference?cl=9919#widths">widths</a> returns the vertical advance. +Uses <a href="bmh_SkPaint_Reference?cl=9919#Text_Encoding">Text Encoding</a> to decode <a href="bmh_SkPaint_Reference?cl=9919#text">text</a>, <a href="bmh_undocumented?cl=9919#Typeface">Typeface</a> to get the font metrics, +and <a href="bmh_SkPaint_Reference?cl=9919#Text_Size">Text Size</a> to scale the <a href="bmh_SkPaint_Reference?cl=9919#widths">widths</a> and <a href="bmh_SkPaint_Reference?cl=9919#bounds">bounds</a>. +Does not scale the advance by <a href="bmh_SkPaint_Reference?cl=9919#Fake_Bold">Fake Bold</a> or <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a>. +Does include <a href="bmh_SkPaint_Reference?cl=9919#Fake_Bold">Fake Bold</a> and <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a> in the <a href="bmh_SkPaint_Reference?cl=9919#bounds">bounds</a>. + +### Parameters + +<table> <tr> <td><code><strong>text </strong></code></td> <td> +character codes or glyph indices to be measured</td> + </tr> <tr> <td><code><strong>byteLength </strong></code></td> <td> +number of bytes of <a href="bmh_SkPaint_Reference?cl=9919#text">text</a> to measure</td> + </tr> <tr> <td><code><strong>widths </strong></code></td> <td> +returns <a href="bmh_SkPaint_Reference?cl=9919#text">text</a> advances for each glyph; may be nullptr</td> + </tr> <tr> <td><code><strong>bounds </strong></code></td> <td> +returns <a href="bmh_SkPaint_Reference?cl=9919#bounds">bounds</a> for each glyph relative to (0, 0); may be nullptr</td> + </tr> +</table> + +### Return Value + +glyph count in <a href="bmh_SkPaint_Reference?cl=9919#text">text</a> + +### Example + +<div><fiddle-embed name="6b9e101f49e9c2c28755c5bdcef64dfb"><div>Bounds of glyphs increase for stroked <a href="bmh_SkPaint_Reference?cl=9919#text">text</a>, but <a href="bmh_SkPaint_Reference?cl=9919#text">text</a> advance remains the same. +The underlines show the <a href="bmh_SkPaint_Reference?cl=9919#text">text</a> advance, spaced to keep them distinct.</div></fiddle-embed></div> + +--- + +# <a name="Text_Path"></a> Text Path +<a href="bmh_SkPaint_Reference?cl=9919#Text_Path">Text Path</a> describes the geometry of glyphs used to draw text. + +<a name="getTextPath"></a> +## getTextPath + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void getTextPath(const void* text, size_t length, SkScalar x, SkScalar y, + SkPath* path) const +</pre> + +Returns the geometry as <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> equivalent to the drawn <a href="bmh_SkPaint_Reference?cl=9919#text">text</a>. +Uses <a href="bmh_SkPaint_Reference?cl=9919#Text_Encoding">Text Encoding</a> to decode <a href="bmh_SkPaint_Reference?cl=9919#text">text</a>, <a href="bmh_undocumented?cl=9919#Typeface">Typeface</a> to get the glyph paths, +and <a href="bmh_SkPaint_Reference?cl=9919#Text_Size">Text Size</a>, <a href="bmh_SkPaint_Reference?cl=9919#Fake_Bold">Fake Bold</a>, and <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a> to scale and modify the glyph paths. +All of the glyph paths are stored in <a href="bmh_SkPaint_Reference?cl=9919#path">path</a>. +<a href="bmh_SkPaint_Reference?cl=9919#getTextPath">getTextPath</a> uses <a href="bmh_SkPaint_Reference?cl=9919#x">x</a>, <a href="bmh_SkPaint_Reference?cl=9919#y">y</a>, and <a href="bmh_SkPaint_Reference?cl=9919#Text_Align">Text Align</a> to position <a href="bmh_SkPaint_Reference?cl=9919#path">path</a>. + +### Parameters + +<table> <tr> <td><code><strong>text </strong></code></td> <td> +character codes or glyph indices</td> + </tr> <tr> <td><code><strong>length </strong></code></td> <td> +number of bytes of <a href="bmh_SkPaint_Reference?cl=9919#text">text</a></td> + </tr> <tr> <td><code><strong>x </strong></code></td> <td> +x-coordinate of the origin of the <a href="bmh_SkPaint_Reference?cl=9919#text">text</a></td> + </tr> <tr> <td><code><strong>y </strong></code></td> <td> +y-coordinate of the origin of the <a href="bmh_SkPaint_Reference?cl=9919#text">text</a></td> + </tr> <tr> <td><code><strong>path </strong></code></td> <td> +geometry of the glyphs</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="7c9e6a399f898d68026c1f0865e6f73e"><div><a href="bmh_undocumented?cl=9919#Text">Text</a> is added to <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>, offset, and subtracted from <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>, then added at +the offset location. The result is rendered with one draw call.</div></fiddle-embed></div> + +--- + +<a name="getPosTextPath"></a> +## getPosTextPath + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void getPosTextPath(const void* text, size_t length, const SkPoint pos[], + SkPath* path) const +</pre> + +Returns the geometry as <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> equivalent to the drawn <a href="bmh_SkPaint_Reference?cl=9919#text">text</a>. +Uses <a href="bmh_SkPaint_Reference?cl=9919#Text_Encoding">Text Encoding</a> to decode <a href="bmh_SkPaint_Reference?cl=9919#text">text</a>, <a href="bmh_undocumented?cl=9919#Typeface">Typeface</a> to get the glyph paths, +and <a href="bmh_SkPaint_Reference?cl=9919#Text_Size">Text Size</a>, <a href="bmh_SkPaint_Reference?cl=9919#Fake_Bold">Fake Bold</a>, and <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a> to scale and modify the glyph paths. +All of the glyph paths are stored in <a href="bmh_SkPaint_Reference?cl=9919#path">path</a>. +Uses <a href="bmh_SkPaint_Reference?cl=9919#pos">pos</a> array and <a href="bmh_SkPaint_Reference?cl=9919#Text_Align">Text Align</a> to position <a href="bmh_SkPaint_Reference?cl=9919#path">path</a>. +<a href="bmh_SkPaint_Reference?cl=9919#pos">pos</a> contains a position for each glyph. + +### Parameters + +<table> <tr> <td><code><strong>text </strong></code></td> <td> +character codes or glyph indices</td> + </tr> <tr> <td><code><strong>length </strong></code></td> <td> +number of bytes of <a href="bmh_SkPaint_Reference?cl=9919#text">text</a></td> + </tr> <tr> <td><code><strong>pos </strong></code></td> <td> +positions of each glyph</td> + </tr> <tr> <td><code><strong>path </strong></code></td> <td> +geometry of the glyphs</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="7f27c93472aa99a7542fb3493076f072"><div>Simplifies three glyphs to eliminate overlaps, and strokes the result.</div></fiddle-embed></div> + +--- + +# <a name="Text_Intercepts"></a> Text Intercepts +<a href="bmh_SkPaint_Reference?cl=9919#Text_Intercepts">Text Intercepts</a> describe the intersection of drawn text glyphs with a pair +of lines parallel to the text advance. <a href="bmh_SkPaint_Reference?cl=9919#Text_Intercepts">Text Intercepts</a> permits creating a +underline that skips descenders. + +<a name="getTextIntercepts"></a> +## getTextIntercepts + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +int getTextIntercepts(const void* text, size_t length, SkScalar x, SkScalar y, + const SkScalar bounds[2], SkScalar* intervals) const +</pre> + +Returns the number of <a href="bmh_SkPaint_Reference?cl=9919#intervals">intervals</a> that intersect <a href="bmh_SkPaint_Reference?cl=9919#bounds">bounds</a>. +<a href="bmh_SkPaint_Reference?cl=9919#bounds">bounds</a> describes a pair of lines parallel to the <a href="bmh_SkPaint_Reference?cl=9919#text">text</a> advance. +The return count is zero or a multiple of two, and is at most twice the number of glyphs in +the string. +Uses <a href="bmh_SkPaint_Reference?cl=9919#Text_Encoding">Text Encoding</a> to decode <a href="bmh_SkPaint_Reference?cl=9919#text">text</a>, <a href="bmh_undocumented?cl=9919#Typeface">Typeface</a> to get the glyph paths, +and <a href="bmh_SkPaint_Reference?cl=9919#Text_Size">Text Size</a>, <a href="bmh_SkPaint_Reference?cl=9919#Fake_Bold">Fake Bold</a>, and <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a> to scale and modify the glyph paths. +Uses <a href="bmh_SkPaint_Reference?cl=9919#x">x</a>, <a href="bmh_SkPaint_Reference?cl=9919#y">y</a>, and <a href="bmh_SkPaint_Reference?cl=9919#Text_Align">Text Align</a> to position <a href="bmh_SkPaint_Reference?cl=9919#intervals">intervals</a>. +Pass nullptr for <a href="bmh_SkPaint_Reference?cl=9919#intervals">intervals</a> to determine the size of the interval array. +<a href="bmh_SkPaint_Reference?cl=9919#intervals">intervals</a> are cached to improve performance for multiple calls. + +### Parameters + +<table> <tr> <td><code><strong>text </strong></code></td> <td> +character codes or glyph indices</td> + </tr> <tr> <td><code><strong>length </strong></code></td> <td> +number of bytes of <a href="bmh_SkPaint_Reference?cl=9919#text">text</a></td> + </tr> <tr> <td><code><strong>x </strong></code></td> <td> +x-coordinate of the origin of the <a href="bmh_SkPaint_Reference?cl=9919#text">text</a></td> + </tr> <tr> <td><code><strong>y </strong></code></td> <td> +y-coordinate of the origin of the <a href="bmh_SkPaint_Reference?cl=9919#text">text</a></td> + </tr> <tr> <td><code><strong>bounds </strong></code></td> <td> +lower and upper line parallel to the advance</td> + </tr> <tr> <td><code><strong>intervals </strong></code></td> <td> +returned intersections; may be nullptr</td> + </tr> +</table> + +### Return Value + +number of intersections; may be zero + +### Example + +<div><fiddle-embed name="2a0b80ed20d193c688085b79deb5bdc9"><div>Underline uses intercepts to draw on either side of the glyph descender.</div></fiddle-embed></div> + +--- + +<a name="getPosTextIntercepts"></a> +## getPosTextIntercepts + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +int getPosTextIntercepts(const void* text, size_t length, const SkPoint pos[], + const SkScalar bounds[2], SkScalar* intervals) const +</pre> + +Returns the number of <a href="bmh_SkPaint_Reference?cl=9919#intervals">intervals</a> that intersect <a href="bmh_SkPaint_Reference?cl=9919#bounds">bounds</a>. +<a href="bmh_SkPaint_Reference?cl=9919#bounds">bounds</a> describes a pair of lines parallel to the <a href="bmh_SkPaint_Reference?cl=9919#text">text</a> advance. +The return count is zero or a multiple of two, and is at most twice the number of glyphs in +the string. +Uses <a href="bmh_SkPaint_Reference?cl=9919#Text_Encoding">Text Encoding</a> to decode <a href="bmh_SkPaint_Reference?cl=9919#text">text</a>, <a href="bmh_undocumented?cl=9919#Typeface">Typeface</a> to get the glyph paths, +and <a href="bmh_SkPaint_Reference?cl=9919#Text_Size">Text Size</a>, <a href="bmh_SkPaint_Reference?cl=9919#Fake_Bold">Fake Bold</a>, and <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a> to scale and modify the glyph paths. +Uses <a href="bmh_SkPaint_Reference?cl=9919#pos">pos</a> array and <a href="bmh_SkPaint_Reference?cl=9919#Text_Align">Text Align</a> to position <a href="bmh_SkPaint_Reference?cl=9919#intervals">intervals</a>. +Pass nullptr for <a href="bmh_SkPaint_Reference?cl=9919#intervals">intervals</a> to determine the size of the interval array. +<a href="bmh_SkPaint_Reference?cl=9919#intervals">intervals</a> are cached to improve performance for multiple calls. + +### Parameters + +<table> <tr> <td><code><strong>text </strong></code></td> <td> +character codes or glyph indices</td> + </tr> <tr> <td><code><strong>length </strong></code></td> <td> +number of bytes of <a href="bmh_SkPaint_Reference?cl=9919#text">text</a></td> + </tr> <tr> <td><code><strong>pos </strong></code></td> <td> +positions of each glyph</td> + </tr> <tr> <td><code><strong>bounds </strong></code></td> <td> +lower and upper line parallel to the advance</td> + </tr> <tr> <td><code><strong>intervals </strong></code></td> <td> +returned intersections; may be nullptr</td> + </tr> +</table> + +### Return Value + +The number of intersections; may be zero + +### Example + +<div><fiddle-embed name="98b2dfc552d0540a7c041fe7a2839bd7"><div><a href="bmh_undocumented?cl=9919#Text">Text</a> intercepts draw on either side of, but not inside, glyphs in a run.</div></fiddle-embed></div> + +--- + +<a name="getPosTextHIntercepts"></a> +## getPosTextHIntercepts + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +int getPosTextHIntercepts(const void* text, size_t length, const SkScalar xpos[], + SkScalar constY, const SkScalar bounds[2], + SkScalar* intervals) const +</pre> + +Returns the number of <a href="bmh_SkPaint_Reference?cl=9919#intervals">intervals</a> that intersect <a href="bmh_SkPaint_Reference?cl=9919#bounds">bounds</a>. +<a href="bmh_SkPaint_Reference?cl=9919#bounds">bounds</a> describes a pair of lines parallel to the <a href="bmh_SkPaint_Reference?cl=9919#text">text</a> advance. +The return count is zero or a multiple of two, and is at most twice the number of glyphs in +the string. +Uses <a href="bmh_SkPaint_Reference?cl=9919#Text_Encoding">Text Encoding</a> to decode <a href="bmh_SkPaint_Reference?cl=9919#text">text</a>, <a href="bmh_undocumented?cl=9919#Typeface">Typeface</a> to get the glyph paths, +and <a href="bmh_SkPaint_Reference?cl=9919#Text_Size">Text Size</a>, <a href="bmh_SkPaint_Reference?cl=9919#Fake_Bold">Fake Bold</a>, and <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a> to scale and modify the glyph paths. +Uses <a href="bmh_SkPaint_Reference?cl=9919#xpos">xpos</a> array, <a href="bmh_SkPaint_Reference?cl=9919#constY">constY</a>, and <a href="bmh_SkPaint_Reference?cl=9919#Text_Align">Text Align</a> to position <a href="bmh_SkPaint_Reference?cl=9919#intervals">intervals</a>. +Pass nullptr for <a href="bmh_SkPaint_Reference?cl=9919#intervals">intervals</a> to determine the size of the interval array. +<a href="bmh_SkPaint_Reference?cl=9919#intervals">intervals</a> are cached to improve performance for multiple calls. + +### Parameters + +<table> <tr> <td><code><strong>text </strong></code></td> <td> +character codes or glyph indices</td> + </tr> <tr> <td><code><strong>length </strong></code></td> <td> +number of bytes of <a href="bmh_SkPaint_Reference?cl=9919#text">text</a></td> + </tr> <tr> <td><code><strong>xpos </strong></code></td> <td> +positions of each glyph in x</td> + </tr> <tr> <td><code><strong>constY </strong></code></td> <td> +position of each glyph in y</td> + </tr> <tr> <td><code><strong>bounds </strong></code></td> <td> +lower and upper line parallel to the advance</td> + </tr> <tr> <td><code><strong>intervals </strong></code></td> <td> +returned intersections; may be nullptr</td> + </tr> +</table> + +### Return Value + +number of intersections; may be zero + +### Example + +<div><fiddle-embed name="dc9851c43acc3716aca8c9a4d40d452d"><div><a href="bmh_undocumented?cl=9919#Text">Text</a> intercepts do not take stroke thickness into consideration.</div></fiddle-embed></div> + +--- + +<a name="getTextBlobIntercepts"></a> +## getTextBlobIntercepts + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +int getTextBlobIntercepts(const SkTextBlob* blob, const SkScalar bounds[2], + SkScalar* intervals) const +</pre> + +Returns the number of <a href="bmh_SkPaint_Reference?cl=9919#intervals">intervals</a> that intersect <a href="bmh_SkPaint_Reference?cl=9919#bounds">bounds</a>. +<a href="bmh_SkPaint_Reference?cl=9919#bounds">bounds</a> describes a pair of lines parallel to the text advance. +The return count is zero or a multiple of two, and is at most twice the number of glyphs in +the string. +Uses <a href="bmh_SkPaint_Reference?cl=9919#Text_Encoding">Text Encoding</a> to decode text, <a href="bmh_undocumented?cl=9919#Typeface">Typeface</a> to get the glyph paths, +and <a href="bmh_SkPaint_Reference?cl=9919#Text_Size">Text Size</a>, <a href="bmh_SkPaint_Reference?cl=9919#Fake_Bold">Fake Bold</a>, and <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a> to scale and modify the glyph paths. +Uses pos array and <a href="bmh_SkPaint_Reference?cl=9919#Text_Align">Text Align</a> to position <a href="bmh_SkPaint_Reference?cl=9919#intervals">intervals</a>. +Pass nullptr for <a href="bmh_SkPaint_Reference?cl=9919#intervals">intervals</a> to determine the size of the interval array. +<a href="bmh_SkPaint_Reference?cl=9919#intervals">intervals</a> are cached to improve performance for multiple calls. + +### Parameters + +<table> <tr> <td><code><strong>blob </strong></code></td> <td> +glyphs, positions, and text paint attributes</td> + </tr> <tr> <td><code><strong>bounds </strong></code></td> <td> +lower and upper line parallel to the advance</td> + </tr> <tr> <td><code><strong>intervals </strong></code></td> <td> +returned intersections; may be nullptr</td> + </tr> +</table> + +### Return Value + +number of intersections; may be zero + +### Example + +<div><fiddle-embed name="4961b05f4f26cf270ab4948a57876341"></fiddle-embed></div> + +--- + +<a name="nothingToDraw"></a> +## nothingToDraw + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +bool nothingToDraw() const +</pre> + +Returns true if <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> prevents all drawing. +If <a href="bmh_SkPaint_Reference?cl=9919#nothingToDraw">nothingToDraw</a> returns false, the <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> may or may not allow drawing. + +Returns true if <a href="bmh_undocumented?cl=9919#Blend_Mode">Blend Mode</a> and <a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a> are enabled, +and computed <a href="bmh_undocumented?cl=9919#Alpha">Color Alpha</a> is zero. + +### Return Value + +true if <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> prevents all drawing + +### Example + +<div><fiddle-embed name="fc5a771b915ac341f56554f01d282831"> + +#### 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> + +--- + +# <a name="Fast_Bounds"></a> Fast Bounds +<a href="bmh_SkPaint_Reference?cl=9919#Fast_Bounds">Fast Bounds</a> methods conservatively outset a drawing bounds by additional area +<a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> may draw to. + +<a name="canComputeFastBounds"></a> +## canComputeFastBounds + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +bool canComputeFastBounds() const +</pre> + +Returns true if <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> does not include elements requiring extensive computation +to compute <a href="bmh_undocumented?cl=9919#Device">Device</a> bounds of drawn geometry. For instance, <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> with <a href="bmh_undocumented?cl=9919#Path_Effect">Path Effect</a> +always returns false. + +### Return Value + +true if <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> allows for fast computation of bounds + +--- + +<a name="computeFastBounds"></a> +## computeFastBounds + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +const SkRect& computeFastBounds(const SkRect& orig, SkRect* storage) const +</pre> + +Only call this if <a href="bmh_SkPaint_Reference?cl=9919#canComputeFastBounds">canComputeFastBounds</a> returned true. This takes a +raw rectangle (the raw bounds of a shape), and adjusts it for stylistic +effects in the paint (e.g. stroking). If needed, it uses the <a href="bmh_SkPaint_Reference?cl=9919#storage">storage</a> +rect parameter. It returns the adjusted bounds that can then be used +for <a href="bmh_SkCanvas_Reference?cl=9919#quickReject">SkCanvas::quickReject</a> tests. + +The returned rect will either be <a href="bmh_SkPaint_Reference?cl=9919#orig">orig</a> or <a href="bmh_SkPaint_Reference?cl=9919#storage">storage</a>, thus the caller +should not rely on <a href="bmh_SkPaint_Reference?cl=9919#storage">storage</a> being set to the result, but should always +use the retured value. It is legal for <a href="bmh_SkPaint_Reference?cl=9919#orig">orig</a> and <a href="bmh_SkPaint_Reference?cl=9919#storage">storage</a> to be the same +rect. + +### Parameters + +<table> <tr> <td><code><strong>orig </strong></code></td> <td> +geometry modified by <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> when drawn</td> + </tr> <tr> <td><code><strong>storage </strong></code></td> <td> +computed bounds of geometry; may not be nullptr</td> + </tr> +</table> + +### Return Value + +fast computed bounds + +--- + +<a name="computeFastStrokeBounds"></a> +## computeFastStrokeBounds + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +const SkRect& computeFastStrokeBounds(const SkRect& orig, SkRect* storage) const +</pre> + +### Parameters + +<table> <tr> <td><code><strong>orig </strong></code></td> <td> +geometry modified by <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> when drawn</td> + </tr> <tr> <td><code><strong>storage </strong></code></td> <td> +computed bounds of geometry</td> + </tr> +</table> + +### Return Value + +fast computed bounds + +--- + +<a name="doComputeFastBounds"></a> +## doComputeFastBounds + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +const SkRect& doComputeFastBounds(const SkRect& orig, SkRect* storage, + Style style) const +</pre> + +Take the <a href="bmh_SkPaint_Reference?cl=9919#style">style</a> explicitly, so the caller can force us to be stroked +without having to make a copy of the paint just to change that field. + +### Parameters + +<table> <tr> <td><code><strong>orig </strong></code></td> <td> +geometry modified by <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> when drawn</td> + </tr> <tr> <td><code><strong>storage </strong></code></td> <td> +computed bounds of geometry</td> + </tr> <tr> <td><code><strong>style </strong></code></td> <td> +overrides <a href="bmh_SkPaint_Reference?cl=9919#Style">Style</a></td> + </tr> +</table> + +### Return Value + +fast computed bounds + +--- + +<a name="toString"></a> +## toString + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void toString(SkString* str) const; +</pre> + +Converts <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a> to machine parsable form in developer mode. + +### Parameters + +<table> <tr> <td><code><strong>str </strong></code></td> <td> +storage for string containing parsable <a href="bmh_SkPaint_Reference?cl=9919#Paint">Paint</a></td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="5670c04b4562908169a776c48c92d104"> + +#### Example Output + +~~~~ +text size = 12 +~~~~ + +</fiddle-embed></div> + +--- + diff --git a/site/user/api/SkPath_Reference.md b/site/user/api/SkPath_Reference.md new file mode 100644 index 0000000000..c4eb275438 --- /dev/null +++ b/site/user/api/SkPath_Reference.md @@ -0,0 +1,4975 @@ +SkPath Reference +=== + +# <a name="Path"></a> Path +<a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> contains <a href="bmh_undocumented?cl=9919#Line">Lines</a> and <a href="bmh_undocumented?cl=9919#Curve">Curves</a> which can be stroked or filled. <a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a> is +composed of a series of connected <a href="bmh_undocumented?cl=9919#Line">Lines</a> and <a href="bmh_undocumented?cl=9919#Curve">Curves</a>. <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> may contain zero, +one, or more <a href="bmh_SkPath_Reference?cl=9919#Contour">Contours</a>. +Each <a href="bmh_undocumented?cl=9919#Line">Line</a> and <a href="bmh_undocumented?cl=9919#Curve">Curve</a> are described by <a href="bmh_SkPath_Reference?cl=9919#Verb">Verb</a>, <a href="bmh_undocumented?cl=9919#Point">Points</a>, and optional Weight. + +Each pair of connected <a href="bmh_undocumented?cl=9919#Line">Lines</a> and <a href="bmh_undocumented?cl=9919#Curve">Curves</a> share common <a href="bmh_undocumented?cl=9919#Point">Point</a>; for instance, <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> +containing two connected <a href="bmh_undocumented?cl=9919#Line">Lines</a> are described the <a href="bmh_SkPath_Reference?cl=9919#Verb">Verb</a> sequence: +<a href="bmh_SkPath_Reference?cl=9919#kMove_Verb">SkPath::kMove Verb</a>, <a href="bmh_SkPath_Reference?cl=9919#kLine_Verb">SkPath::kLine Verb</a>, <a href="bmh_SkPath_Reference?cl=9919#kLine_Verb">SkPath::kLine Verb</a>; and a <a href="bmh_undocumented?cl=9919#Point">Point</a> sequence +with three entries, sharing +the middle entry as the end of the first <a href="bmh_undocumented?cl=9919#Line">Line</a> and the start of the second <a href="bmh_undocumented?cl=9919#Line">Line</a>. + +<a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> components <a href="bmh_SkPath_Reference?cl=9919#Arc">Arc</a>, <a href="bmh_undocumented?cl=9919#Rect">Rect</a>, <a href="bmh_undocumented?cl=9919#Round_Rect">Round Rect</a>, <a href="bmh_undocumented?cl=9919#Circle">Circle</a>, and <a href="bmh_undocumented?cl=9919#Oval">Oval</a> are composed of +<a href="bmh_undocumented?cl=9919#Line">Lines</a> and <a href="bmh_undocumented?cl=9919#Curve">Curves</a> with as many <a href="bmh_SkPath_Reference?cl=9919#Verb">Verbs</a> and <a href="bmh_undocumented?cl=9919#Point">Points</a> required +for an exact description. Once added to <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>, these components may lose their +identity; although <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> can be inspected to determine if it decribes a single +<a href="bmh_undocumented?cl=9919#Rect">Rect</a>, <a href="bmh_undocumented?cl=9919#Oval">Oval</a>, <a href="bmh_undocumented?cl=9919#Round_Rect">Round Rect</a>, and so on. + +### Example + +<div><fiddle-embed name="93887af0c1dac49521972698cf04069c"><div><a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> contains three <a href="bmh_SkPath_Reference?cl=9919#Contour">Contours</a>: <a href="bmh_undocumented?cl=9919#Line">Line</a>, <a href="bmh_undocumented?cl=9919#Circle">Circle</a>, and <a href="bmh_SkPath_Reference?cl=9919#Quad">Quad</a>. <a href="bmh_undocumented?cl=9919#Line">Line</a> is stroked but +not filled. <a href="bmh_undocumented?cl=9919#Circle">Circle</a> is stroked and filled; <a href="bmh_undocumented?cl=9919#Circle">Circle</a> stroke forms a loop. <a href="bmh_SkPath_Reference?cl=9919#Quad">Quad</a> +is stroked and filled, but since it is not closed, <a href="bmh_SkPath_Reference?cl=9919#Quad">Quad</a> does not stroke a loop.</div></fiddle-embed></div> + +<a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> contains a <a href="bmh_SkPath_Reference?cl=9919#Fill_Type">Fill Type</a> which determines whether overlapping <a href="bmh_SkPath_Reference?cl=9919#Contour">Contours</a> +form fills or holes. <a href="bmh_SkPath_Reference?cl=9919#Fill_Type">Fill Type</a> also determines whether area inside or outside +<a href="bmh_undocumented?cl=9919#Line">Lines</a> and <a href="bmh_undocumented?cl=9919#Curve">Curves</a> is filled. + +### Example + +<div><fiddle-embed name="36a995442c081ee779ecab2962d36e69"><div><a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> is drawn filled, then stroked, then stroked and filled.</div></fiddle-embed></div> + +<a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> contents are never shared. Copying <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> by value effectively creates +a new <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> independent of the original. Internally, the copy does not duplicate +its contents until it is edited, to reduce memory use and improve performance. + +## <a name="Subtopics"></a> Subtopics + +| topics | description | +| --- | --- | + +## <a name="Contour"></a> Contour + +<a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a> contains one or more <a href="bmh_SkPath_Reference?cl=9919#Verb">Verbs</a>, and as many <a href="bmh_undocumented?cl=9919#Point">Points</a> as +are required to satisfy <a href="bmh_SkPath_Reference?cl=9919#Verb_Array">Verb Array</a>. First <a href="bmh_SkPath_Reference?cl=9919#Verb">Verb</a> in <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> is always +<a href="bmh_SkPath_Reference?cl=9919#kMove_Verb">SkPath::kMove Verb</a>; each <a href="bmh_SkPath_Reference?cl=9919#kMove_Verb">SkPath::kMove Verb</a> that follows starts a new <a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a>. + +### Example + +<div><fiddle-embed name="0374f2dcd7effeb1dd435205a6c2de6f"><div>Each <a href="bmh_SkPath_Reference?cl=9919#moveTo">SkPath::moveTo</a> starts a new <a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a>, and content after <a href="bmh_SkPath_Reference?cl=9919#close">SkPath::close()</a> +also starts a new <a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a>. Since <a href="bmh_SkPath_Reference?cl=9919#conicTo">SkPath::conicTo</a> wasn't preceded by +<a href="bmh_SkPath_Reference?cl=9919#moveTo">SkPath::moveTo</a>, the first <a href="bmh_undocumented?cl=9919#Point">Point</a> of the third <a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a> starts at the last <a href="bmh_undocumented?cl=9919#Point">Point</a> +of the second <a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a>.</div></fiddle-embed></div> + +If final <a href="bmh_SkPath_Reference?cl=9919#Verb">Verb</a> in <a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a> is <a href="bmh_SkPath_Reference?cl=9919#kClose_Verb">SkPath::kClose Verb</a>, <a href="bmh_undocumented?cl=9919#Line">Line</a> connects <a href="bmh_SkPath_Reference?cl=9919#Last_Point">Last Point</a> in +<a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a> with first <a href="bmh_undocumented?cl=9919#Point">Point</a>. A closed <a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a>, stroked, draws +<a href="bmh_SkPaint_Reference?cl=9919#Stroke_Join">Paint Stroke Join</a> at <a href="bmh_SkPath_Reference?cl=9919#Last_Point">Last Point</a> and first <a href="bmh_undocumented?cl=9919#Point">Point</a>. Without <a href="bmh_SkPath_Reference?cl=9919#kClose_Verb">SkPath::kClose Verb</a> +as final <a href="bmh_SkPath_Reference?cl=9919#Verb">Verb</a>, <a href="bmh_SkPath_Reference?cl=9919#Last_Point">Last Point</a> and first <a href="bmh_undocumented?cl=9919#Point">Point</a> are not connected; <a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a> +remains open. An open <a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a>, stroked, draws <a href="bmh_SkPaint_Reference?cl=9919#Stroke_Cap">Paint Stroke Cap</a> at +<a href="bmh_SkPath_Reference?cl=9919#Last_Point">Last Point</a> and first <a href="bmh_undocumented?cl=9919#Point">Point</a>. + +### Example + +<div><fiddle-embed name="7a1f39b12d2cd8b7f5b1190879259cb2"><div><a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> is drawn stroked, with an open <a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a> and a closed <a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a>.</div></fiddle-embed></div> + +## <a name="Zero_Length"></a> Zero Length + +<a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a> length is distance traveled from first <a href="bmh_undocumented?cl=9919#Point">Point</a> to <a href="bmh_SkPath_Reference?cl=9919#Last_Point">Last Point</a>, +plus, if <a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a> is closed, distance from <a href="bmh_SkPath_Reference?cl=9919#Last_Point">Last Point</a> to first <a href="bmh_undocumented?cl=9919#Point">Point</a>. +Even if <a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a> length is zero, stroked <a href="bmh_undocumented?cl=9919#Line">Lines</a> are drawn if <a href="bmh_SkPaint_Reference?cl=9919#Stroke_Cap">Paint Stroke Cap</a> +makes them visible. + +### Example + +<div><fiddle-embed name="62848df605af6258653d9e16b27d8f7f"></fiddle-embed></div> + +# <a name="SkPath"></a> Class SkPath + +# <a name="Overview"></a> Overview + +## <a name="Constants"></a> Constants + +| constants | description | +| --- | --- | +| <a href="bmh_SkPath_Reference?cl=9919#AddPathMode">AddPathMode</a> | Sets <a href="bmh_SkPath_Reference?cl=9919#addPath">addPath</a> options. | +| <a href="bmh_SkPath_Reference?cl=9919#ArcSize">ArcSize</a> | Sets <a href="bmh_SkPath_Reference?cl=9919#arcTo_4">arcTo(SkScalar rx, SkScalar ry, SkScalar xAxisRotate, ArcSize largeArc, Direction sweep, SkScalar x, SkScalar y)</a> options. | +| <a href="bmh_SkPath_Reference?cl=9919#Convexity">Convexity</a> | Returns if <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> is convex or concave. | +| <a href="bmh_SkPath_Reference?cl=9919#Direction">Direction</a> | Sets <a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a> clockwise or counterclockwise. | +| <a href="bmh_SkPath_Reference?cl=9919#FillType">FillType</a> | Sets winding rule and inverse fill. | +| <a href="bmh_SkPath_Reference?cl=9919#SegmentMask">SegmentMask</a> | +<a href="bmh_SkPath_Reference?cl=9919#Verb">Verb</a>| Controls how <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> <a href="bmh_undocumented?cl=9919#Point">Points</a> are interpreted. | + +## <a name="Classes_and_Structs"></a> Classes and Structs + +| class or struct | description | +| --- | --- | +| <a href="bmh_SkPath_Reference?cl=9919#Iter">Iter</a> | Iterates through lines and curves, skipping degenerates. | +| <a href="bmh_SkPath_Reference?cl=9919#RawIter">RawIter</a> | Iterates through lines and curves, including degenerates. | + +## <a name="Constructors"></a> Constructors + +| | description | +| --- | --- | +| <a href="bmh_SkPath_Reference?cl=9919#empty_constructor">SkPath()</a> | Constructs with default values. | +| <a href="bmh_SkPath_Reference?cl=9919#copy_constructor">SkPath(const SkPath& path)</a> | Makes a shallow copy. | +| | Decreases <a href="bmh_undocumented?cl=9919#Reference_Count">Reference Count</a> of owned objects. | + +## <a name="Operators"></a> Operators + +| operator | description | +| --- | --- | +| <a href="bmh_SkPath_Reference?cl=9919#copy_assignment_operator">operator=(const SkPath& path)</a> | Makes a shallow copy. | +| <a href="bmh_SkPath_Reference?cl=9919#equal_operator">operator==(const SkPath& a, const SkPath& b)</a> | Compares paths for equality. | +| <a href="bmh_SkPath_Reference?cl=9919#not_equal_operator">operator!=(const SkPath& a, const SkPath& b)</a> | Compares paths for inequality. | + +## <a name="Member_Functions"></a> Member Functions + +| function | description | +| --- | --- | +| <a href="bmh_SkPath_Reference?cl=9919#ConvertConicToQuads">ConvertConicToQuads</a> | Approximates <a href="bmh_SkPath_Reference?cl=9919#Conic">Conic</a> with <a href="bmh_SkPath_Reference?cl=9919#Quad">Quad</a> array. | +| <a href="bmh_SkPath_Reference?cl=9919#ConvertToNonInverseFillType">ConvertToNonInverseFillType</a> | Returns <a href="bmh_SkPath_Reference?cl=9919#Fill_Type">Fill Type</a> representing inside geometry. | +| <a href="bmh_SkPath_Reference?cl=9919#IsCubicDegenerate">IsCubicDegenerate</a> | Returns if <a href="bmh_SkPath_Reference?cl=9919#Cubic">Cubic</a> is very small. | +| <a href="bmh_SkPath_Reference?cl=9919#IsInverseFillType">IsInverseFillType</a> | Returns if <a href="bmh_SkPath_Reference?cl=9919#Fill_Type">Fill Type</a> represents outside geometry. | +| <a href="bmh_SkPath_Reference?cl=9919#IsLineDegenerate">IsLineDegenerate</a> | Returns if <a href="bmh_undocumented?cl=9919#Line">Line</a> is very small. | +| <a href="bmh_SkPath_Reference?cl=9919#IsQuadDegenerate">IsQuadDegenerate</a> | Returns if <a href="bmh_SkPath_Reference?cl=9919#Quad">Quad</a> is very small. | +| <a href="bmh_SkPath_Reference?cl=9919#addArc">addArc</a> | Adds one <a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a> containing <a href="bmh_SkPath_Reference?cl=9919#Arc">Arc</a>. | +| <a href="bmh_SkPath_Reference?cl=9919#addCircle">addCircle</a> | Adds one <a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a> containing <a href="bmh_undocumented?cl=9919#Circle">Circle</a>. | +| <a href="bmh_SkPath_Reference?cl=9919#addOval">addOval</a> | Adds one <a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a> containing <a href="bmh_undocumented?cl=9919#Oval">Oval</a>. | +| <a href="bmh_SkPath_Reference?cl=9919#addPath">addPath</a> | Adds contents of <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>. | +| <a href="bmh_SkPath_Reference?cl=9919#addPoly">addPoly</a> | Adds one <a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a> containing connected lines. | +| <a href="bmh_SkPath_Reference?cl=9919#addRRect">addRRect</a> | Adds one <a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a> containing <a href="bmh_undocumented?cl=9919#Round_Rect">Round Rect</a>. | +| <a href="bmh_SkPath_Reference?cl=9919#addRect">addRect</a> | Adds one <a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a> containing <a href="bmh_undocumented?cl=9919#Rect">Rect</a>. | +| <a href="bmh_SkPath_Reference?cl=9919#addRoundRect">addRoundRect</a> | Adds one <a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a> containing <a href="bmh_undocumented?cl=9919#Round_Rect">Round Rect</a> with common corner radii. | +| <a href="bmh_SkPath_Reference?cl=9919#arcTo">arcTo</a> | Appends <a href="bmh_SkPath_Reference?cl=9919#Arc">Arc</a>. | +| <a href="bmh_SkPath_Reference?cl=9919#close">close</a> | Makes last <a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a> a loop. | +| <a href="bmh_SkPath_Reference?cl=9919#computeTightBounds">computeTightBounds</a> | Returns extent of geometry. | +| <a href="bmh_SkPath_Reference?cl=9919#conicTo">conicTo</a> | Appends <a href="bmh_SkPath_Reference?cl=9919#Conic">Conic</a>. | +| <a href="bmh_SkPath_Reference?cl=9919#conservativelyContainsRect">conservativelyContainsRect</a> | Returns true if <a href="bmh_undocumented?cl=9919#Rect">Rect</a> may be inside. | +| <a href="bmh_SkPath_Reference?cl=9919#contains">contains</a> | Returns if <a href="bmh_undocumented?cl=9919#Point">Point</a> is in fill area. | +| <a href="bmh_SkPath_Reference?cl=9919#countPoints">countPoints</a> | Returns <a href="bmh_SkPath_Reference?cl=9919#Point_Array">Point Array</a> length. | +| <a href="bmh_SkPath_Reference?cl=9919#countVerbs">countVerbs</a> | Returns <a href="bmh_SkPath_Reference?cl=9919#Verb_Array">Verb Array</a> length. | +| <a href="bmh_SkPath_Reference?cl=9919#cubicTo">cubicTo</a> | Appends <a href="bmh_SkPath_Reference?cl=9919#Cubic">Cubic</a>. | +| <a href="bmh_SkPath_Reference?cl=9919#dump">dump</a> | Sends text representation using floats to stdout. | +| <a href="bmh_SkPath_Reference?cl=9919#dumpHex">dumpHex</a> | Sends text representation using hexadecimal to stdout. | +| <a href="bmh_SkPath_Reference?cl=9919#experimentalValidateRef">experimentalValidateRef</a> | Experimental; debugging only. | +| <a href="bmh_SkPath_Reference?cl=9919#getBounds">getBounds</a> | Returns maximum and minimum of <a href="bmh_SkPath_Reference?cl=9919#Point_Array">Point Array</a>. | +| <a href="bmh_SkPath_Reference?cl=9919#getConvexity">getConvexity</a> | Returns geometry convexity, computing if necessary. | +| <a href="bmh_SkPath_Reference?cl=9919#getConvexityOrUnknown">getConvexityOrUnknown</a> | Returns geometry convexity if known. | +| <a href="bmh_SkPath_Reference?cl=9919#getFillType">getFillType</a> | Returns <a href="bmh_SkPath_Reference?cl=9919#Fill_Type">Fill Type</a>: winding, even-odd, inverse. | +| <a href="bmh_SkPath_Reference?cl=9919#getGenerationID">getGenerationID</a> | Returns unique ID. | +| <a href="bmh_SkPath_Reference?cl=9919#getLastPt">getLastPt</a> | Returns <a href="bmh_SkPath_Reference?cl=9919#Last_Point">Last Point</a>. | +| <a href="bmh_SkPath_Reference?cl=9919#getPoint">getPoint</a> | Returns entry from <a href="bmh_SkPath_Reference?cl=9919#Point_Array">Point Array</a>. | +| <a href="bmh_SkPath_Reference?cl=9919#getPoints">getPoints</a> | Returns <a href="bmh_SkPath_Reference?cl=9919#Point_Array">Point Array</a>. | +| <a href="bmh_SkPath_Reference?cl=9919#getSegmentMasks">getSegmentMasks</a> | Returns types in <a href="bmh_SkPath_Reference?cl=9919#Verb_Array">Verb Array</a>. | +| <a href="bmh_SkPath_Reference?cl=9919#getVerbs">getVerbs</a> | Returns <a href="bmh_SkPath_Reference?cl=9919#Verb_Array">Verb Array</a>. | +| <a href="bmh_SkPath_Reference?cl=9919#incReserve">incReserve</a> | Hint to reserve space for additional data. | +| <a href="bmh_SkPath_Reference?cl=9919#interpolate">interpolate</a> | Interpolates between <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> pair. | +| <a href="bmh_SkPath_Reference?cl=9919#isConvex">isConvex</a> | Returns if geometry is convex. | +| <a href="bmh_SkPath_Reference?cl=9919#isEmpty">isEmpty</a> | Returns if verb count is zero. | +| <a href="bmh_SkPath_Reference?cl=9919#isFinite">isFinite</a> | Returns if all <a href="bmh_undocumented?cl=9919#Point">Point</a> values are finite. | +| <a href="bmh_SkPath_Reference?cl=9919#isInterpolatable">isInterpolatable</a> | Returns if pair contains equal counts of <a href="bmh_SkPath_Reference?cl=9919#Verb_Array">Verb Array</a> and <a href="bmh_SkPath_Reference?cl=9919#Weight">Weights</a>. | +| <a href="bmh_SkPath_Reference?cl=9919#isInverseFillType">isInverseFillType</a> | Returns if <a href="bmh_SkPath_Reference?cl=9919#Fill_Type">Fill Type</a> fills outside geometry. | +| <a href="bmh_SkPath_Reference?cl=9919#isLastContourClosed">isLastContourClosed</a> | Returns if final <a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a> forms a loop. | +| <a href="bmh_SkPath_Reference?cl=9919#isLine">isLine</a> | Returns if describes <a href="bmh_undocumented?cl=9919#Line">Line</a>. | +| <a href="bmh_SkPath_Reference?cl=9919#isNestedFillRects">isNestedFillRects</a> | Returns if describes <a href="bmh_undocumented?cl=9919#Rect">Rect</a> pair, one inside the other. | +| <a href="bmh_SkPath_Reference?cl=9919#isOval">isOval</a> | Returns if describes <a href="bmh_undocumented?cl=9919#Oval">Oval</a>. | +| <a href="bmh_SkPath_Reference?cl=9919#isRRect">isRRect</a> | Returns if describes <a href="bmh_undocumented?cl=9919#Round_Rect">Round Rect</a>. | +| <a href="bmh_SkPath_Reference?cl=9919#isRect">isRect</a> | Returns if describes <a href="bmh_undocumented?cl=9919#Rect">Rect</a>. | +| <a href="bmh_SkPath_Reference?cl=9919#isVolatile">isVolatile</a> | Returns if <a href="bmh_undocumented?cl=9919#Device">Device</a> should not cache. | +| <a href="bmh_SkPath_Reference?cl=9919#lineTo">lineTo</a> | Appends <a href="bmh_undocumented?cl=9919#Line">Line</a>. | +| <a href="bmh_SkPath_Reference?cl=9919#moveTo">moveTo</a> | Starts <a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a>. | +| <a href="bmh_SkPath_Reference?cl=9919#offset">offset</a> | Translates <a href="bmh_SkPath_Reference?cl=9919#Point_Array">Point Array</a>. | +| <a href="bmh_SkPath_Reference?cl=9919#quadTo">quadTo</a> | Appends <a href="bmh_SkPath_Reference?cl=9919#Quad">Quad</a>. | +| <a href="bmh_SkPath_Reference?cl=9919#rArcTo">rArcTo</a> | Appends <a href="bmh_SkPath_Reference?cl=9919#Arc">Arc</a> relative to <a href="bmh_SkPath_Reference?cl=9919#Last_Point">Last Point</a>. | +| <a href="bmh_SkPath_Reference?cl=9919#rConicTo">rConicTo</a> | Appends <a href="bmh_SkPath_Reference?cl=9919#Conic">Conic</a> relative to <a href="bmh_SkPath_Reference?cl=9919#Last_Point">Last Point</a>. | +| <a href="bmh_SkPath_Reference?cl=9919#rCubicTo">rCubicTo</a> | Appends <a href="bmh_SkPath_Reference?cl=9919#Cubic">Cubic</a> relative to <a href="bmh_SkPath_Reference?cl=9919#Last_Point">Last Point</a>. | +| <a href="bmh_SkPath_Reference?cl=9919#rLineTo">rLineTo</a> | Appends <a href="bmh_undocumented?cl=9919#Line">Line</a> relative to <a href="bmh_SkPath_Reference?cl=9919#Last_Point">Last Point</a>. | +| <a href="bmh_SkPath_Reference?cl=9919#rMoveTo">rMoveTo</a> | Starts <a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a> relative to <a href="bmh_SkPath_Reference?cl=9919#Last_Point">Last Point</a>. | +| <a href="bmh_SkPath_Reference?cl=9919#rQuadTo">rQuadTo</a> | Appends <a href="bmh_SkPath_Reference?cl=9919#Quad">Quad</a> relative to <a href="bmh_SkPath_Reference?cl=9919#Last_Point">Last Point</a>. | +| <a href="bmh_SkPath_Reference?cl=9919#readFromMemory">readFromMemory</a> | Initialize from buffer. | +| <a href="bmh_SkPath_Reference?cl=9919#reset">reset</a> | Removes <a href="bmh_SkPath_Reference?cl=9919#Verb_Array">Verb Array</a>, <a href="bmh_SkPath_Reference?cl=9919#Point_Array">Point Array</a>, and <a href="bmh_SkPath_Reference?cl=9919#Weight">Weights</a>; frees memory. | +| <a href="bmh_SkPath_Reference?cl=9919#reverseAddPath">reverseAddPath</a> | Adds contents of <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> back to front. | +| <a href="bmh_SkPath_Reference?cl=9919#rewind">rewind</a> | Removes <a href="bmh_SkPath_Reference?cl=9919#Verb_Array">Verb Array</a>, <a href="bmh_SkPath_Reference?cl=9919#Point_Array">Point Array</a>, and <a href="bmh_SkPath_Reference?cl=9919#Weight">Weights</a>; leaves memory allocated. | +| <a href="bmh_SkPath_Reference?cl=9919#setConvexity">setConvexity</a> | Sets if geometry is convex to avoid future computation. | +| <a href="bmh_SkPath_Reference?cl=9919#setFillType">setFillType</a> | Sets <a href="bmh_SkPath_Reference?cl=9919#Fill_Type">Fill Type</a>: winding, even-odd, inverse. | +| <a href="bmh_SkPath_Reference?cl=9919#setIsConvex">setIsConvex</a> | Deprecated. | +| <a href="bmh_SkPath_Reference?cl=9919#setIsVolatile">setIsVolatile</a> | Sets if <a href="bmh_undocumented?cl=9919#Device">Device</a> should not cache. | +| <a href="bmh_SkPath_Reference?cl=9919#setLastPt">setLastPt</a> | Replaces <a href="bmh_SkPath_Reference?cl=9919#Last_Point">Last Point</a>. | +| <a href="bmh_SkPath_Reference?cl=9919#swap">swap</a> | Exchanges <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> pair. | +| <a href="bmh_SkPath_Reference?cl=9919#toggleInverseFillType">toggleInverseFillType</a> | Toggles <a href="bmh_SkPath_Reference?cl=9919#Fill_Type">Fill Type</a> between inside and outside geometry. | +| <a href="bmh_SkPath_Reference?cl=9919#transform">transform</a> | Applies <a href="bmh_undocumented?cl=9919#Matrix">Matrix</a> to <a href="bmh_SkPath_Reference?cl=9919#Point_Array">Point Array</a> and <a href="bmh_SkPath_Reference?cl=9919#Weight">Weights</a>. | +| <a href="bmh_SkPath_Reference?cl=9919#unique">unique</a> | Returns if data has single owner. | +| <a href="bmh_SkPath_Reference?cl=9919#updateBoundsCache">updateBoundsCache</a> | Refresh result of <a href="bmh_SkPath_Reference?cl=9919#getBounds">getBounds</a>. | +| <a href="bmh_SkPath_Reference?cl=9919#writeToMemory">writeToMemory</a> | Copy data to buffer. | + +## <a name="Verb"></a> Verb + +## <a name="SkPath::Verb"></a> Enum SkPath::Verb + +<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0"> +enum <a href="bmh_SkPath_Reference?cl=9919#Verb">Verb</a> { +<a href="bmh_SkPath_Reference?cl=9919#kMove_Verb">kMove Verb</a> +<a href="bmh_SkPath_Reference?cl=9919#kLine_Verb">kLine Verb</a> +<a href="bmh_SkPath_Reference?cl=9919#kQuad_Verb">kQuad Verb</a> +<a href="bmh_SkPath_Reference?cl=9919#kConic_Verb">kConic Verb</a> +<a href="bmh_SkPath_Reference?cl=9919#kCubic_Verb">kCubic Verb</a> +<a href="bmh_SkPath_Reference?cl=9919#kClose_Verb">kClose Verb</a> +<a href="bmh_SkPath_Reference?cl=9919#kDone_Verb">kDone Verb</a> +};</pre> + +<a href="bmh_SkPath_Reference?cl=9919#Verb">Verb</a> instructs <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> how to interpret one or more <a href="bmh_undocumented?cl=9919#Point">Point</a> and optional Weight; +manage <a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a>, and terminate <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>. + +### Constants + +<table> + <tr> + <td><a name="SkPath::kMove_Verb"></a> <code><strong>SkPath::kMove_Verb </strong></code></td><td>0</td><td>Starts new <a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a> at next <a href="bmh_undocumented?cl=9919#Point">Point</a>.</td> + </tr> + <tr> + <td><a name="SkPath::kLine_Verb"></a> <code><strong>SkPath::kLine_Verb </strong></code></td><td>1</td><td>Adds <a href="bmh_undocumented?cl=9919#Line">Line</a> from <a href="bmh_SkPath_Reference?cl=9919#Last_Point">Last Point</a> to next <a href="bmh_undocumented?cl=9919#Point">Point</a>. +<a href="bmh_undocumented?cl=9919#Line">Line</a> is a straight segment from <a href="bmh_undocumented?cl=9919#Point">Point</a> to <a href="bmh_undocumented?cl=9919#Point">Point</a>.</td> + </tr> + <tr> + <td><a name="SkPath::kQuad_Verb"></a> <code><strong>SkPath::kQuad_Verb </strong></code></td><td>2</td><td>Adds <a href="bmh_SkPath_Reference?cl=9919#Quad">Quad</a> from <a href="bmh_SkPath_Reference?cl=9919#Last_Point">Last Point</a>, using control <a href="bmh_undocumented?cl=9919#Point">Point</a>, and end <a href="bmh_undocumented?cl=9919#Point">Point</a>. +<a href="bmh_SkPath_Reference?cl=9919#Quad">Quad</a> is a parabolic section within tangents from <a href="bmh_SkPath_Reference?cl=9919#Last_Point">Last Point</a> to control <a href="bmh_undocumented?cl=9919#Point">Point</a>, +and control <a href="bmh_undocumented?cl=9919#Point">Point</a> to end <a href="bmh_undocumented?cl=9919#Point">Point</a>.</td> + </tr> + <tr> + <td><a name="SkPath::kConic_Verb"></a> <code><strong>SkPath::kConic_Verb </strong></code></td><td>3</td><td>Adds <a href="bmh_SkPath_Reference?cl=9919#Conic">Conic</a> from <a href="bmh_SkPath_Reference?cl=9919#Last_Point">Last Point</a>, using control <a href="bmh_undocumented?cl=9919#Point">Point</a>, end <a href="bmh_undocumented?cl=9919#Point">Point</a>, and Weight. +<a href="bmh_SkPath_Reference?cl=9919#Conic">Conic</a> is a elliptical, parabolic, or hyperbolic section within tangents +from <a href="bmh_SkPath_Reference?cl=9919#Last_Point">Last Point</a> to control <a href="bmh_undocumented?cl=9919#Point">Point</a>, and control <a href="bmh_undocumented?cl=9919#Point">Point</a> to end <a href="bmh_undocumented?cl=9919#Point">Point</a>, constrained +by Weight. Weight less than one is elliptical; equal to one is parabolic +(and identical to <a href="bmh_SkPath_Reference?cl=9919#Quad">Quad</a>); greater than one hyperbolic.</td> + </tr> + <tr> + <td><a name="SkPath::kCubic_Verb"></a> <code><strong>SkPath::kCubic_Verb </strong></code></td><td>4</td><td>Adds <a href="bmh_SkPath_Reference?cl=9919#Cubic">Cubic</a> from <a href="bmh_SkPath_Reference?cl=9919#Last_Point">Last Point</a>, using two control <a href="bmh_undocumented?cl=9919#Point">Points</a>, and end <a href="bmh_undocumented?cl=9919#Point">Point</a>. +<a href="bmh_SkPath_Reference?cl=9919#Cubic">Cubic</a> is a third-order <a href="bmh_undocumented?cl=9919#Bezier">Bezier</a> section within tangents from <a href="bmh_SkPath_Reference?cl=9919#Last_Point">Last Point</a> to +first control <a href="bmh_undocumented?cl=9919#Point">Point</a>, and from second control <a href="bmh_undocumented?cl=9919#Point">Point</a> to end <a href="bmh_undocumented?cl=9919#Point">Point</a>.</td> + </tr> + <tr> + <td><a name="SkPath::kClose_Verb"></a> <code><strong>SkPath::kClose_Verb </strong></code></td><td>5</td><td>Closes <a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a>, connecting <a href="bmh_SkPath_Reference?cl=9919#Last_Point">Last Point</a> to <a href="bmh_SkPath_Reference?cl=9919#kMove_Verb">kMove Verb</a> <a href="bmh_undocumented?cl=9919#Point">Point</a>.</td> + </tr> + <tr> + <td><a name="SkPath::kDone_Verb"></a> <code><strong>SkPath::kDone_Verb </strong></code></td><td>6</td><td>Terminates <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>. Not in <a href="bmh_SkPath_Reference?cl=9919#Verb_Array">Verb Array</a>, but returned by <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> iterator.</td> + </tr> +Each <a href="bmh_SkPath_Reference?cl=9919#Verb">Verb</a> has zero or more <a href="bmh_undocumented?cl=9919#Point">Points</a> stored in <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>. +<a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> iterator returns complete curve descriptions, duplicating shared <a href="bmh_undocumented?cl=9919#Point">Points</a> +for consecutive entries. + +</table> + +| <a href="bmh_SkPath_Reference?cl=9919#Verb">Verb</a> | Allocated <a href="bmh_undocumented?cl=9919#Point">Points</a> | Iterated <a href="bmh_undocumented?cl=9919#Point">Points</a> | <a href="bmh_SkPath_Reference?cl=9919#Weight">Weights</a> | +| --- | --- | --- | --- | +| <a href="bmh_SkPath_Reference?cl=9919#kMove_Verb">kMove Verb</a> | 1 | 1 | 0 | +| <a href="bmh_SkPath_Reference?cl=9919#kLine_Verb">kLine Verb</a> | 1 | 2 | 0 | +| <a href="bmh_SkPath_Reference?cl=9919#kQuad_Verb">kQuad Verb</a> | 2 | 3 | 0 | +| <a href="bmh_SkPath_Reference?cl=9919#kConic_Verb">kConic Verb</a> | 2 | 3 | 1 | +| <a href="bmh_SkPath_Reference?cl=9919#kCubic_Verb">kCubic Verb</a> | 3 | 4 | 0 | +| <a href="bmh_SkPath_Reference?cl=9919#kClose_Verb">kClose Verb</a> | 0 | 1 | 0 | +| <a href="bmh_SkPath_Reference?cl=9919#kDone_Verb">kDone Verb</a> | -- | 0 | 0 | + +### Example + +<div><fiddle-embed name="799096fdc1298aa815934a74e76570ca"> + +#### Example Output + +~~~~ +verb count: 7 +verbs: kMove_Verb kLine_Verb kQuad_Verb kClose_Verb kMove_Verb kCubic_Verb kConic_Verb +~~~~ + +</fiddle-embed></div> + + + +## <a name="Direction"></a> Direction + +## <a name="SkPath::Direction"></a> Enum SkPath::Direction + +<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0"> +enum <a href="bmh_SkPath_Reference?cl=9919#Direction">Direction</a> { +<a href="bmh_SkPath_Reference?cl=9919#kCW_Direction">kCW Direction</a> +<a href="bmh_SkPath_Reference?cl=9919#kCCW_Direction">kCCW Direction</a> +};</pre> + +<a href="bmh_SkPath_Reference?cl=9919#Direction">Direction</a> describes whether <a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a> is clockwise or counterclockwise. +When <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> contains multiple overlapping <a href="bmh_SkPath_Reference?cl=9919#Contour">Contours</a>, <a href="bmh_SkPath_Reference?cl=9919#Direction">Direction</a> together with +<a href="bmh_SkPath_Reference?cl=9919#Fill_Type">Fill Type</a> determines whether overlaps are filled or form holes. + +<a href="bmh_SkPath_Reference?cl=9919#Direction">Direction</a> also determines how <a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a> is measured. For instance, dashing +measures along <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> to determine where to start and stop stroke; <a href="bmh_SkPath_Reference?cl=9919#Direction">Direction</a> +will change dashed results as it steps clockwise or counterclockwise. + +Closed <a href="bmh_SkPath_Reference?cl=9919#Contour">Contours</a> like <a href="bmh_undocumented?cl=9919#Rect">Rect</a>, <a href="bmh_undocumented?cl=9919#Round_Rect">Round Rect</a>, <a href="bmh_undocumented?cl=9919#Circle">Circle</a>, and <a href="bmh_undocumented?cl=9919#Oval">Oval</a> added with +<a href="bmh_SkPath_Reference?cl=9919#kCW_Direction">kCW Direction</a> travel clockwise; the same added with <a href="bmh_SkPath_Reference?cl=9919#kCCW_Direction">kCCW Direction</a> +travel counterclockwise. + +### Constants + +<table> + <tr> + <td><a name="SkPath::kCW_Direction"></a> <code><strong>SkPath::kCW_Direction </strong></code></td><td>Contour travels in a clockwise direction. </td><td></td> + </tr> + <tr> + <td><a name="SkPath::kCCW_Direction"></a> <code><strong>SkPath::kCCW_Direction </strong></code></td><td>Contour travels in a counterclockwise direction. </td><td></td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="0de03d9c939b6238318b7366866e8722"></fiddle-embed></div> + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#arcTo">arcTo</a> <a href="bmh_SkPath_Reference?cl=9919#rArcTo">rArcTo</a> <a href="bmh_SkPath_Reference?cl=9919#isRect">isRect</a> <a href="bmh_SkPath_Reference?cl=9919#isNestedFillRects">isNestedFillRects</a> <a href="bmh_SkPath_Reference?cl=9919#addRect">addRect</a> <a href="bmh_SkPath_Reference?cl=9919#addOval">addOval</a> + + + +<a name="empty_constructor"></a> +## SkPath + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +SkPath() +</pre> + +By default, <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> has no <a href="bmh_SkPath_Reference?cl=9919#Verb">Verbs</a>, no <a href="bmh_undocumented?cl=9919#Point">Points</a>, and no <a href="bmh_SkPath_Reference?cl=9919#Weight">Weights</a>. +<a href="bmh_SkPath_Reference?cl=9919#Fill_Type">Fill Type</a> is set to <a href="bmh_SkPath_Reference?cl=9919#kWinding_FillType">kWinding FillType</a>. + +### Return Value + +empty <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>. + +### Example + +<div><fiddle-embed name="0a0026fca638d1cd75c0ab884e3ee1c6"> + +#### Example Output + +~~~~ +path is empty +~~~~ + +</fiddle-embed></div> + +### See Also + +reset rewind + +--- + +<a name="copy_constructor"></a> +## SkPath + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +SkPath(const SkPath& path) +</pre> + +Copy constructor makes two paths identical by value. Internally, <a href="bmh_SkPath_Reference?cl=9919#path">path</a> and +the returned result share pointer values. The underlying <a href="bmh_SkPath_Reference?cl=9919#Verb_Array">Verb Array</a>, <a href="bmh_SkPath_Reference?cl=9919#Point_Array">Point Array</a> +and <a href="bmh_SkPath_Reference?cl=9919#Weight">Weights</a> are copied when modified. + +Creating a <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> copy is very efficient and never allocates memory. +<a href="bmh_SkPath_Reference?cl=9919#Path">Paths</a> are always copied by value from the interface; the underlying shared +pointers are not exposed. + +### Parameters + +<table> <tr> <td><code><strong>path </strong></code></td> <td> +<a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> to copy by value.</td> + </tr> +</table> + +### Return Value + +Copy of <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>. + +### Example + +<div><fiddle-embed name="647312aacd946c8a6eabaca797140432"><div>Modifying one <a href="bmh_SkPath_Reference?cl=9919#path">path</a> does not effect another, even if they started as copies +of each other.</div> + +#### Example Output + +~~~~ +path verbs: 2 +path2 verbs: 3 +after reset +path verbs: 0 +path2 verbs: 3 +~~~~ + +</fiddle-embed></div> + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#copy_assignment_operator">operator=(const SkPath& path)</a> + +--- + +<a name="destructor"></a> +## ~SkPath + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +~SkPath() +</pre> + +Releases ownership of any shared data and deletes data if <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> is sole owner. + +### Example + +<div><fiddle-embed name="01ad6be9b7d15a2217daea273eb3d466"><div>delete calls <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> destructor, but copy of original in path2 is unaffected.</div></fiddle-embed></div> + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#empty_constructor">SkPath()</a> <a href="bmh_SkPath_Reference?cl=9919#copy_constructor">SkPath(const SkPath& path)</a> <a href="bmh_SkPath_Reference?cl=9919#copy_assignment_operator">operator=(const SkPath& path)</a> + +--- + +<a name="copy_assignment_operator"></a> +## operator= + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +SkPath& operator=(const SkPath& path) +</pre> + +<a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> assignment makes two paths identical by value. Internally, assignment +shares pointer values. The underlying <a href="bmh_SkPath_Reference?cl=9919#Verb_Array">Verb Array</a>, <a href="bmh_SkPath_Reference?cl=9919#Point_Array">Point Array</a> and <a href="bmh_SkPath_Reference?cl=9919#Weight">Weights</a> +are copied when modified. + +Copying <a href="bmh_SkPath_Reference?cl=9919#Path">Paths</a> by assignment is very efficient and never allocates memory. +<a href="bmh_SkPath_Reference?cl=9919#Path">Paths</a> are always copied by value from the interface; the underlying shared +pointers are not exposed. + +### Parameters + +<table> <tr> <td><code><strong>path </strong></code></td> <td> +<a href="bmh_SkPath_Reference?cl=9919#Verb_Array">Verb Array</a>, <a href="bmh_SkPath_Reference?cl=9919#Point_Array">Point Array</a>, <a href="bmh_SkPath_Reference?cl=9919#Weight">Weights</a>, amd <a href="bmh_SkPath_Reference?cl=9919#Fill_Type">Fill Type</a> to copy.</td> + </tr> +</table> + +### Return Value + +<a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> copied by value. + +### Example + +<div><fiddle-embed name="bba288f5f77fc8e37e89d2ec08e0ac60"> + +#### Example Output + +~~~~ +path1 bounds = 10, 20, 30, 40 +path2 bounds = 10, 20, 30, 40 +~~~~ + +</fiddle-embed></div> + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#swap">swap</a> <a href="bmh_SkPath_Reference?cl=9919#copy_constructor">SkPath(const SkPath& path)</a> + +--- + +<a name="equal_operator"></a> +## operator== + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +friend SK_API bool operator==(const SkPath& a, const SkPath& b) +</pre> + +Compares <a href="bmh_SkPath_Reference?cl=9919#a">a</a> and <a href="bmh_SkPath_Reference?cl=9919#b">b</a>; returns true if <a href="bmh_SkPath_Reference?cl=9919#Fill_Type">Fill Type</a>, <a href="bmh_SkPath_Reference?cl=9919#Verb_Array">Verb Array</a>, <a href="bmh_SkPath_Reference?cl=9919#Point_Array">Point Array</a>, and <a href="bmh_SkPath_Reference?cl=9919#Weight">Weights</a> +are equivalent. + +### Parameters + +<table> <tr> <td><code><strong>a </strong></code></td> <td> +<a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> to compare.</td> + </tr> <tr> <td><code><strong>b </strong></code></td> <td> +<a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> to compare.</td> + </tr> +</table> + +### Return Value + +true if <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> pair are equivalent. + +### Example + +<div><fiddle-embed name="31883f51bb357f2ac5990d88f8b82e02"><div>Rewind removes <a href="bmh_SkPath_Reference?cl=9919#Verb_Array">Verb Array</a> but leaves storage; since storage is not compared, +<a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> pair are equivalent.</div> + +#### Example Output + +~~~~ +empty one == two +moveTo one != two +rewind one == two +reset one == two +~~~~ + +</fiddle-embed></div> + +--- + +<a name="not_equal_operator"></a> +## operator!= + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +friend bool operator!=(const SkPath& a, const SkPath& b) +</pre> + +Compares <a href="bmh_SkPath_Reference?cl=9919#a">a</a> and <a href="bmh_SkPath_Reference?cl=9919#b">b</a>; returns true if <a href="bmh_SkPath_Reference?cl=9919#Fill_Type">Fill Type</a>, <a href="bmh_SkPath_Reference?cl=9919#Verb_Array">Verb Array</a>, <a href="bmh_SkPath_Reference?cl=9919#Point_Array">Point Array</a>, and <a href="bmh_SkPath_Reference?cl=9919#Weight">Weights</a> +are not equivalent. + +### Parameters + +<table> <tr> <td><code><strong>a </strong></code></td> <td> +<a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> to compare.</td> + </tr> <tr> <td><code><strong>b </strong></code></td> <td> +<a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> to compare.</td> + </tr> +</table> + +### Return Value + +true if <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> pair are not equivalent. + +### Example + +<div><fiddle-embed name="0c6870ba1cea85ce6da5abd489c23d83"><div><a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> pair are equal though their convexity is not equal.</div> + +#### Example Output + +~~~~ +empty one == two +addRect one == two +setConvexity one == two +convexity != +~~~~ + +</fiddle-embed></div> + +--- + +<a name="isInterpolatable"></a> +## isInterpolatable + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +bool isInterpolatable(const SkPath& compare) const +</pre> + +Return true if <a href="bmh_SkPath_Reference?cl=9919#Path">Paths</a> contain equal <a href="bmh_SkPath_Reference?cl=9919#Verb">Verbs</a> and equal <a href="bmh_SkPath_Reference?cl=9919#Weight">Weights</a>. +If <a href="bmh_SkPath_Reference?cl=9919#Path">Paths</a> contain one or more <a href="bmh_SkPath_Reference?cl=9919#Conic">Conics</a>, the <a href="bmh_SkPath_Reference?cl=9919#Weight">Weights</a> must match. + +<a href="bmh_SkPath_Reference?cl=9919#conicTo">conicTo</a> may add different <a href="bmh_SkPath_Reference?cl=9919#Verb">Verbs</a> depending on <a href="bmh_SkPath_Reference?cl=9919#Conic_Weight">Conic Weight</a>, so it is not +trival to interpolate a pair of <a href="bmh_SkPath_Reference?cl=9919#Path">Paths</a> containing <a href="bmh_SkPath_Reference?cl=9919#Conic">Conics</a> with different +<a href="bmh_SkPath_Reference?cl=9919#Conic_Weight">Conic Weight</a> values. + +### Parameters + +<table> <tr> <td><code><strong>compare </strong></code></td> <td> +<a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> to <a href="bmh_SkPath_Reference?cl=9919#compare">compare</a>.</td> + </tr> +</table> + +### Return Value + +true if <a href="bmh_SkPath_Reference?cl=9919#Path">Paths</a> <a href="bmh_SkPath_Reference?cl=9919#Verb_Array">Verb Array</a> and <a href="bmh_SkPath_Reference?cl=9919#Weight">Weights</a> are equivalent. + +### Example + +<div><fiddle-embed name="c81fc7dfaf785c3fb77209c7f2ebe5b8"> + +#### Example Output + +~~~~ +paths are interpolatable +~~~~ + +</fiddle-embed></div> + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#isInterpolatable">isInterpolatable</a> + +--- + +<a name="interpolate"></a> +## interpolate + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +bool interpolate(const SkPath& ending, SkScalar weight, SkPath* out) const +</pre> + +Interpolate between <a href="bmh_SkPath_Reference?cl=9919#Path">Paths</a> with equal sized <a href="bmh_SkPath_Reference?cl=9919#Point_Array">Point Arrays</a>. +Copy <a href="bmh_SkPath_Reference?cl=9919#Verb_Array">Verb Array</a> and <a href="bmh_SkPath_Reference?cl=9919#Weight">Weights</a> to <a href="bmh_SkPath_Reference?cl=9919#out">out</a>, +and set <a href="bmh_SkPath_Reference?cl=9919#out">out</a> <a href="bmh_SkPath_Reference?cl=9919#Point_Array">Point Array</a> to a weighted average of this <a href="bmh_SkPath_Reference?cl=9919#Point_Array">Point Array</a> and <a href="bmh_SkPath_Reference?cl=9919#ending">ending</a> +<a href="bmh_SkPath_Reference?cl=9919#Point_Array">Point Array</a>, using the formula: +(this->points * <a href="bmh_SkPath_Reference?cl=9919#interpolate">weight</a>) + ending->points * (1 - <a href="bmh_SkPath_Reference?cl=9919#interpolate">weight</a>)<a href="bmh_SkPath_Reference?cl=9919#interpolate">interpolate</a> returns false and leaves <a href="bmh_SkPath_Reference?cl=9919#out">out</a> unchanged if <a href="bmh_SkPath_Reference?cl=9919#Point_Array">Point Array</a> is not +the same size as <a href="bmh_SkPath_Reference?cl=9919#ending">ending</a> <a href="bmh_SkPath_Reference?cl=9919#Point_Array">Point Array</a>. Call <a href="bmh_SkPath_Reference?cl=9919#isInterpolatable">isInterpolatable</a> to check <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> +compatibility prior to calling <a href="bmh_SkPath_Reference?cl=9919#interpolate">interpolate</a>. + +### Parameters + +<table> <tr> <td><code><strong>ending </strong></code></td> <td> +<a href="bmh_SkPath_Reference?cl=9919#Point_Array">Point Array</a> averaged with this <a href="bmh_SkPath_Reference?cl=9919#Point_Array">Point Array</a>.</td> + </tr> <tr> <td><code><strong>weight </strong></code></td> <td> +Most useful when between zero (<a href="bmh_SkPath_Reference?cl=9919#ending">ending</a> <a href="bmh_SkPath_Reference?cl=9919#Point_Array">Point Array</a>) and +one (this <a href="bmh_SkPath_Reference?cl=9919#Point_Array">Point Array</a>); will work with values outside of this +range.</td> + </tr> <tr> <td><code><strong>out </strong></code></td> <td> +</td> + </tr> +</table> + +### Return Value + +true if <a href="bmh_SkPath_Reference?cl=9919#Path">Paths</a> contain same number of <a href="bmh_undocumented?cl=9919#Point">Points</a>. + +### Example + +<div><fiddle-embed name="404f11c5c9c9ca8a64822d484552a473"></fiddle-embed></div> + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#isInterpolatable">isInterpolatable</a> + +--- + +<a name="unique"></a> +## unique + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +bool unique() const +</pre> + +### Return Value + +true if <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> has one owner. + +--- + +## <a name="Fill_Type"></a> Fill Type + +## <a name="SkPath::FillType"></a> Enum SkPath::FillType + +<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0"> +enum <a href="bmh_SkPath_Reference?cl=9919#FillType">FillType</a> { +<a href="bmh_SkPath_Reference?cl=9919#kWinding_FillType">kWinding FillType</a> +<a href="bmh_SkPath_Reference?cl=9919#kEvenOdd_FillType">kEvenOdd FillType</a> +<a href="bmh_SkPath_Reference?cl=9919#kInverseWinding_FillType">kInverseWinding FillType</a> +<a href="bmh_SkPath_Reference?cl=9919#kInverseEvenOdd_FillType">kInverseEvenOdd FillType</a> +};</pre> + +<a href="bmh_SkPath_Reference?cl=9919#Fill_Type">Fill Type</a> selects the rule used to fill <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>. <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> set to <a href="bmh_SkPath_Reference?cl=9919#kWinding_FillType">kWinding FillType</a> +fills if the sum of <a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a> edges is not zero, where clockwise edges add one, and +counterclockwise edges subtract one. <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> set to <a href="bmh_SkPath_Reference?cl=9919#kEvenOdd_FillType">kEvenOdd FillType</a> fills if the +number of <a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a> edges is odd. Each <a href="bmh_SkPath_Reference?cl=9919#Fill_Type">Fill Type</a> has an inverse variant that +reverses the rule: +<a href="bmh_SkPath_Reference?cl=9919#kInverseWinding_FillType">kInverseWinding FillType</a> fills where the sum of <a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a> edges is zero; +<a href="bmh_SkPath_Reference?cl=9919#kInverseEvenOdd_FillType">kInverseEvenOdd FillType</a> fills where the number of <a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a> edges is even. + +### Example + +<div><fiddle-embed name="525ed591c31960de23068dba8ea11a75"><div>The top row has two clockwise rectangles. The second row has one clockwise and +one counterclockwise rectangle. The even-odd variants draw the same. The +winding variants draw the top rectangle overlap, which has a winding of 2, the +same as the outer parts of the top rectangles, which have a winding of 1.</div></fiddle-embed></div> + +### Constants + +<table> + <tr> + <td><a name="SkPath::kWinding_FillType"></a> <code><strong>SkPath::kWinding_FillType </strong></code></td><td>Specifies fill as area is enclosed by a non-zero sum of Contour Directions.</td><td></td> + </tr> + <tr> + <td><a name="SkPath::kEvenOdd_FillType"></a> <code><strong>SkPath::kEvenOdd_FillType </strong></code></td><td>Specifies fill as area enclosed by an odd number of Contours.</td><td></td> + </tr> + <tr> + <td><a name="SkPath::kInverseWinding_FillType"></a> <code><strong>SkPath::kInverseWinding_FillType </strong></code></td><td>Specifies fill as area is enclosed by a zero sum of Contour Directions.</td><td></td> + </tr> + <tr> + <td><a name="SkPath::kInverseEvenOdd_FillType"></a> <code><strong>SkPath::kInverseEvenOdd_FillType </strong></code></td><td>Specifies fill as area enclosed by an even number of Contours.</td><td></td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="0ebf978b234a00e2c2573cfa7b04e776"></fiddle-embed></div> + +### See Also + +<a href="bmh_SkPaint_Reference?cl=9919#Style">SkPaint::Style</a> <a href="bmh_SkPath_Reference?cl=9919#Direction">Direction</a> <a href="bmh_SkPath_Reference?cl=9919#getFillType">getFillType</a> <a href="bmh_SkPath_Reference?cl=9919#setFillType">setFillType</a> + + + +<a name="getFillType"></a> +## getFillType + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +FillType getFillType() const +</pre> + +Returns <a href="bmh_SkPath_Reference?cl=9919#FillType">FillType</a>, the rule used to fill <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>. <a href="bmh_SkPath_Reference?cl=9919#FillType">FillType</a> of a new <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> is +<a href="bmh_SkPath_Reference?cl=9919#kWinding_FillType">kWinding FillType</a>. + +### Return Value + +one of: <a href="bmh_SkPath_Reference?cl=9919#kWinding_FillType">kWinding FillType</a>, <a href="bmh_SkPath_Reference?cl=9919#kEvenOdd_FillType">kEvenOdd FillType</a>, <a href="bmh_SkPath_Reference?cl=9919#kInverseWinding_FillType">kInverseWinding FillType</a>, +<a href="bmh_SkPath_Reference?cl=9919#kInverseEvenOdd_FillType">kInverseEvenOdd FillType</a>. + +### Example + +<div><fiddle-embed name="2eb8f985d1e263e70b5c0aa4a8b68d8e"> + +#### Example Output + +~~~~ +default path fill type is kWinding_FillType +~~~~ + +</fiddle-embed></div> + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#FillType">FillType</a> <a href="bmh_SkPath_Reference?cl=9919#setFillType">setFillType</a> <a href="bmh_SkPath_Reference?cl=9919#isInverseFillType">isInverseFillType</a> + +--- + +<a name="setFillType"></a> +## setFillType + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void setFillType(FillType ft) +</pre> + +Sets <a href="bmh_SkPath_Reference?cl=9919#FillType">FillType</a>, the rule used to fill <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>. While <a href="bmh_SkPath_Reference?cl=9919#setFillType">setFillType</a> does not check +that <a href="bmh_SkPath_Reference?cl=9919#setFillType">ft</a> is legal, values outside of <a href="bmh_SkPath_Reference?cl=9919#FillType">FillType</a> are not supported. + +### Parameters + +<table> <tr> <td><code><strong>ft </strong></code></td> <td> +one of: <a href="bmh_SkPath_Reference?cl=9919#kWinding_FillType">kWinding FillType</a>, <a href="bmh_SkPath_Reference?cl=9919#kEvenOdd_FillType">kEvenOdd FillType</a>, <a href="bmh_SkPath_Reference?cl=9919#kInverseWinding_FillType">kInverseWinding FillType</a>, +<a href="bmh_SkPath_Reference?cl=9919#kInverseEvenOdd_FillType">kInverseEvenOdd FillType</a>.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="b4a91cd7f50b2a0a0d1bec6d0ac823d2"><div>If empty <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> is set to inverse <a href="bmh_SkPath_Reference?cl=9919#FillType">FillType</a>, it fills all pixels.</div></fiddle-embed></div> + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#FillType">FillType</a> <a href="bmh_SkPath_Reference?cl=9919#getFillType">getFillType</a> <a href="bmh_SkPath_Reference?cl=9919#toggleInverseFillType">toggleInverseFillType</a> + +--- + +<a name="isInverseFillType"></a> +## isInverseFillType + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +bool isInverseFillType() const +</pre> + +Returns if <a href="bmh_SkPath_Reference?cl=9919#FillType">FillType</a> describes area outside <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> geometry. The inverse fill area +extends indefinitely. + +### Return Value + +true if <a href="bmh_SkPath_Reference?cl=9919#FillType">FillType</a> is <a href="bmh_SkPath_Reference?cl=9919#kInverseWinding_FillType">kInverseWinding FillType</a> or <a href="bmh_SkPath_Reference?cl=9919#kInverseEvenOdd_FillType">kInverseEvenOdd FillType</a>. + +### Example + +<div><fiddle-embed name="2a2d39f5da611545caa18bbcea873ab2"> + +#### Example Output + +~~~~ +default path fill type is inverse: false +~~~~ + +</fiddle-embed></div> + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#FillType">FillType</a> <a href="bmh_SkPath_Reference?cl=9919#getFillType">getFillType</a> <a href="bmh_SkPath_Reference?cl=9919#setFillType">setFillType</a> <a href="bmh_SkPath_Reference?cl=9919#toggleInverseFillType">toggleInverseFillType</a> + +--- + +<a name="toggleInverseFillType"></a> +## toggleInverseFillType + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void toggleInverseFillType() +</pre> + +Replace <a href="bmh_SkPath_Reference?cl=9919#FillType">FillType</a> with its inverse. The inverse of <a href="bmh_SkPath_Reference?cl=9919#FillType">FillType</a> describes the area +unmodified by the original <a href="bmh_SkPath_Reference?cl=9919#FillType">FillType</a>. + +| <a href="bmh_SkPath_Reference?cl=9919#FillType">FillType</a> | toggled <a href="bmh_SkPath_Reference?cl=9919#FillType">FillType</a> | +| --- | --- | +| <a href="bmh_SkPath_Reference?cl=9919#kWinding_FillType">kWinding FillType</a> | <a href="bmh_SkPath_Reference?cl=9919#kInverseWinding_FillType">kInverseWinding FillType</a> | +| <a href="bmh_SkPath_Reference?cl=9919#kEvenOdd_FillType">kEvenOdd FillType</a> | <a href="bmh_SkPath_Reference?cl=9919#kInverseEvenOdd_FillType">kInverseEvenOdd FillType</a> | +| <a href="bmh_SkPath_Reference?cl=9919#kInverseWinding_FillType">kInverseWinding FillType</a> | <a href="bmh_SkPath_Reference?cl=9919#kWinding_FillType">kWinding FillType</a> | +| <a href="bmh_SkPath_Reference?cl=9919#kInverseEvenOdd_FillType">kInverseEvenOdd FillType</a> | <a href="bmh_SkPath_Reference?cl=9919#kEvenOdd_FillType">kEvenOdd FillType</a> | + +### Example + +<div><fiddle-embed name="400facce23d417bc5043c5f58404afbd"><div><a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> drawn normally and through its inverse touches every pixel once.</div></fiddle-embed></div> + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#FillType">FillType</a> <a href="bmh_SkPath_Reference?cl=9919#getFillType">getFillType</a> <a href="bmh_SkPath_Reference?cl=9919#setFillType">setFillType</a> <a href="bmh_SkPath_Reference?cl=9919#isInverseFillType">isInverseFillType</a> + +--- + +## <a name="Convexity"></a> Convexity + +## <a name="SkPath::Convexity"></a> Enum SkPath::Convexity + +<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0"> +enum <a href="bmh_SkPath_Reference?cl=9919#Convexity">Convexity</a> { +<a href="bmh_SkPath_Reference?cl=9919#kUnknown_Convexity">kUnknown Convexity</a>, +<a href="bmh_SkPath_Reference?cl=9919#kConvex_Convexity">kConvex Convexity</a>, +<a href="bmh_SkPath_Reference?cl=9919#kConcave_Convexity">kConcave Convexity</a> +};</pre> + +<a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> is convex if it contains one <a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a> and <a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a> loops no more than +360 degrees, and <a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a> angles all have same <a href="bmh_SkPath_Reference?cl=9919#Direction">Direction</a>. Convex <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> +may have better performance and require fewer resources on <a href="bmh_undocumented?cl=9919#GPU">GPU Surface</a>. + +<a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> is concave when either at least one <a href="bmh_SkPath_Reference?cl=9919#Direction">Direction</a> change is clockwise and +another is counterclockwise, or the sum of the changes in <a href="bmh_SkPath_Reference?cl=9919#Direction">Direction</a> is not 360 +degrees. + +Initially <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> <a href="bmh_SkPath_Reference?cl=9919#Convexity">Convexity</a> is <a href="bmh_SkPath_Reference?cl=9919#kUnknown_Convexity">kUnknown Convexity</a>. <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> <a href="bmh_SkPath_Reference?cl=9919#Convexity">Convexity</a> is computed +if needed by destination <a href="bmh_undocumented?cl=9919#Surface">Surface</a>. + +### Constants + +<table> + <tr> + <td><a name="SkPath::kUnknown_Convexity"></a> <code><strong>SkPath::kUnknown_Convexity </strong></code></td><td>Indicates Convexity has not been determined.</td><td></td> + </tr> + <tr> + <td><a name="SkPath::kConvex_Convexity"></a> <code><strong>SkPath::kConvex_Convexity </strong></code></td><td>Path has one Contour made of a simple geometry without indentations.</td><td></td> + </tr> + <tr> + <td><a name="SkPath::kConcave_Convexity"></a> <code><strong>SkPath::kConcave_Convexity </strong></code></td><td>Path has more than one Contour, or a geometry with indentations.</td><td></td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="b7d0c0732411db76fa37b05fc18712b3"></fiddle-embed></div> + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a> <a href="bmh_SkPath_Reference?cl=9919#Direction">Direction</a> <a href="bmh_SkPath_Reference?cl=9919#getConvexity">getConvexity</a> <a href="bmh_SkPath_Reference?cl=9919#getConvexityOrUnknown">getConvexityOrUnknown</a> <a href="bmh_SkPath_Reference?cl=9919#setConvexity">setConvexity</a> <a href="bmh_SkPath_Reference?cl=9919#isConvex">isConvex</a> + + + +<a name="getConvexity"></a> +## getConvexity + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +Convexity getConvexity() const +</pre> + +Computes <a href="bmh_SkPath_Reference?cl=9919#Convexity">Convexity</a> if required, and returns stored value. +<a href="bmh_SkPath_Reference?cl=9919#Convexity">Convexity</a> is computed if stored value is <a href="bmh_SkPath_Reference?cl=9919#kUnknown_Convexity">kUnknown Convexity</a>, +or if <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> has been altered since <a href="bmh_SkPath_Reference?cl=9919#Convexity">Convexity</a> was computed or set. + +### Return Value + +Computed or stored <a href="bmh_SkPath_Reference?cl=9919#Convexity">Convexity</a>. + +### Example + +<div><fiddle-embed name="c8f5ac4040cb5026d234bf99e3f01e8e"></fiddle-embed></div> + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#Convexity">Convexity</a> <a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a> <a href="bmh_SkPath_Reference?cl=9919#Direction">Direction</a> <a href="bmh_SkPath_Reference?cl=9919#getConvexityOrUnknown">getConvexityOrUnknown</a> <a href="bmh_SkPath_Reference?cl=9919#setConvexity">setConvexity</a> <a href="bmh_SkPath_Reference?cl=9919#isConvex">isConvex</a> + +--- + +<a name="getConvexityOrUnknown"></a> +## getConvexityOrUnknown + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +Convexity getConvexityOrUnknown() const +</pre> + +Returns last computed <a href="bmh_SkPath_Reference?cl=9919#Convexity">Convexity</a>, or <a href="bmh_SkPath_Reference?cl=9919#kUnknown_Convexity">kUnknown Convexity</a> if +<a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> has been altered since <a href="bmh_SkPath_Reference?cl=9919#Convexity">Convexity</a> was computed or set. + +### Return Value + +Stored <a href="bmh_SkPath_Reference?cl=9919#Convexity">Convexity</a>. + +### Example + +<div><fiddle-embed name="bc19da9de880e3f339707247686efc0a"><div><a href="bmh_SkPath_Reference?cl=9919#Convexity">Convexity</a> is unknown unless <a href="bmh_SkPath_Reference?cl=9919#getConvexity">getConvexity</a> is called without a subsequent call +that alters the path.</div></fiddle-embed></div> + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#Convexity">Convexity</a> <a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a> <a href="bmh_SkPath_Reference?cl=9919#Direction">Direction</a> <a href="bmh_SkPath_Reference?cl=9919#getConvexity">getConvexity</a> <a href="bmh_SkPath_Reference?cl=9919#setConvexity">setConvexity</a> <a href="bmh_SkPath_Reference?cl=9919#isConvex">isConvex</a> + +--- + +<a name="setConvexity"></a> +## setConvexity + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void setConvexity(Convexity convexity) +</pre> + +Stores <a href="bmh_SkPath_Reference?cl=9919#convexity">convexity</a> so that it is later returned by <a href="bmh_SkPath_Reference?cl=9919#getConvexity">getConvexity</a> or <a href="bmh_SkPath_Reference?cl=9919#getConvexityOrUnknown">getConvexityOrUnknown</a>. +<a href="bmh_SkPath_Reference?cl=9919#convexity">convexity</a> may differ from <a href="bmh_SkPath_Reference?cl=9919#getConvexity">getConvexity</a>, although setting an incorrect value may +cause incorrect or inefficient drawing. + +If <a href="bmh_SkPath_Reference?cl=9919#convexity">convexity</a> is <a href="bmh_SkPath_Reference?cl=9919#kUnknown_Convexity">kUnknown Convexity</a>: <a href="bmh_SkPath_Reference?cl=9919#getConvexity">getConvexity</a> will +compute <a href="bmh_SkPath_Reference?cl=9919#Convexity">Convexity</a>, and <a href="bmh_SkPath_Reference?cl=9919#getConvexityOrUnknown">getConvexityOrUnknown</a> will return <a href="bmh_SkPath_Reference?cl=9919#kUnknown_Convexity">kUnknown Convexity</a>. + +If <a href="bmh_SkPath_Reference?cl=9919#convexity">convexity</a> is <a href="bmh_SkPath_Reference?cl=9919#kConvex_Convexity">kConvex Convexity</a> or <a href="bmh_SkPath_Reference?cl=9919#kConcave_Convexity">kConcave Convexity</a>, <a href="bmh_SkPath_Reference?cl=9919#getConvexity">getConvexity</a> +and <a href="bmh_SkPath_Reference?cl=9919#getConvexityOrUnknown">getConvexityOrUnknown</a> will return <a href="bmh_SkPath_Reference?cl=9919#convexity">convexity</a> until the path is +altered. + +### Parameters + +<table> <tr> <td><code><strong>convexity </strong></code></td> <td> +One of <a href="bmh_SkPath_Reference?cl=9919#kUnknown_Convexity">kUnknown Convexity</a>, <a href="bmh_SkPath_Reference?cl=9919#kConvex_Convexity">kConvex Convexity</a>, or <a href="bmh_SkPath_Reference?cl=9919#kConcave_Convexity">kConcave Convexity</a>.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="6fe0d520507eeafe118b80f7f1d9b588"></fiddle-embed></div> + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#Convexity">Convexity</a> <a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a> <a href="bmh_SkPath_Reference?cl=9919#Direction">Direction</a> <a href="bmh_SkPath_Reference?cl=9919#getConvexity">getConvexity</a> <a href="bmh_SkPath_Reference?cl=9919#getConvexityOrUnknown">getConvexityOrUnknown</a> <a href="bmh_SkPath_Reference?cl=9919#isConvex">isConvex</a> + +--- + +<a name="isConvex"></a> +## isConvex + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +bool isConvex() const +</pre> + +Computes <a href="bmh_SkPath_Reference?cl=9919#Convexity">Convexity</a> if required, and returns true if value is <a href="bmh_SkPath_Reference?cl=9919#kConvex_Convexity">kConvex Convexity</a>. +If <a href="bmh_SkPath_Reference?cl=9919#setConvexity">setConvexity</a> was called with <a href="bmh_SkPath_Reference?cl=9919#kConvex_Convexity">kConvex Convexity</a> or <a href="bmh_SkPath_Reference?cl=9919#kConcave_Convexity">kConcave Convexity</a>, and +the path has not been altered, <a href="bmh_SkPath_Reference?cl=9919#Convexity">Convexity</a> is not recomputed. + +### Return Value + +true if <a href="bmh_SkPath_Reference?cl=9919#Convexity">Convexity</a> stored or computed is <a href="bmh_SkPath_Reference?cl=9919#kConvex_Convexity">kConvex Convexity</a>. + +### Example + +<div><fiddle-embed name="dfd2c40e1c2a7b539a94aec8d040d349"><div>Concave shape is erroneously considered convex after a forced call to +<a href="bmh_SkPath_Reference?cl=9919#setConvexity">setConvexity</a>.</div></fiddle-embed></div> + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#Convexity">Convexity</a> <a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a> <a href="bmh_SkPath_Reference?cl=9919#Direction">Direction</a> <a href="bmh_SkPath_Reference?cl=9919#getConvexity">getConvexity</a> <a href="bmh_SkPath_Reference?cl=9919#getConvexityOrUnknown">getConvexityOrUnknown</a> <a href="bmh_SkPath_Reference?cl=9919#setConvexity">setConvexity</a> + +--- + +<a name="setIsConvex"></a> +## setIsConvex + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void setIsConvex(bool isConvex) +</pre> + +Use <a href="bmh_SkPath_Reference?cl=9919#setConvexity">setConvexity</a>. + +--- + +<a name="isOval"></a> +## isOval + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +bool isOval(SkRect* rect, Direction* dir = nullptr, unsigned* start = nullptr) const +</pre> + +<a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> is <a href="bmh_undocumented?cl=9919#Oval">Oval</a> if constructed by <a href="bmh_SkPath_Reference?cl=9919#addCircle">addCircle</a>, <a href="bmh_SkPath_Reference?cl=9919#addOval">addOval</a>; and in some cases, +<a href="bmh_SkPath_Reference?cl=9919#addRoundRect">addRoundRect</a>, <a href="bmh_SkPath_Reference?cl=9919#addRRect">addRRect</a>. <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> constructed with <a href="bmh_SkPath_Reference?cl=9919#conicTo">conicTo</a> or <a href="bmh_SkPath_Reference?cl=9919#rConicTo">rConicTo</a> will not +return true though <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> draws <a href="bmh_undocumented?cl=9919#Oval">Oval</a>. + +<a href="bmh_SkPath_Reference?cl=9919#isOval">isOval</a> triggers performance optimizations on some <a href="bmh_undocumented?cl=9919#GPU">GPU Surface</a> implementations. + +### Parameters + +<table> <tr> <td><code><strong>rect </strong></code></td> <td> +storage for bounding <a href="bmh_undocumented?cl=9919#Rect">Rect</a> of <a href="bmh_undocumented?cl=9919#Oval">Oval</a>. <a href="bmh_undocumented?cl=9919#Oval">Oval</a> is <a href="bmh_undocumented?cl=9919#Circle">Circle</a> if <a href="bmh_SkPath_Reference?cl=9919#isOval">rect</a> width +equals <a href="bmh_SkPath_Reference?cl=9919#isOval">rect</a> height. Unwritten if <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> is not <a href="bmh_undocumented?cl=9919#Oval">Oval</a>. May be nullptr.</td> + </tr> <tr> <td><code><strong>dir </strong></code></td> <td> +storage for <a href="bmh_SkPath_Reference?cl=9919#Direction">Direction</a>; <a href="bmh_SkPath_Reference?cl=9919#kCW_Direction">kCW Direction</a> if clockwise, <a href="bmh_SkPath_Reference?cl=9919#kCCW_Direction">kCCW Direction</a> if +counterclockwise. Unwritten if <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> is not <a href="bmh_undocumented?cl=9919#Oval">Oval</a>. May be nullptr.</td> + </tr> <tr> <td><code><strong>start </strong></code></td> <td> +storage for <a href="bmh_SkPath_Reference?cl=9919#isOval">start</a> of <a href="bmh_undocumented?cl=9919#Oval">Oval</a>: 0 for top, +1 for right, 2 for bottom, 3 for left. Unwritten if <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> is not <a href="bmh_undocumented?cl=9919#Oval">Oval</a>. May be nullptr.</td> + </tr> +</table> + +### Return Value + +true if <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> was constructed by method that reduces to <a href="bmh_undocumented?cl=9919#Oval">Oval</a>. + +### Example + +<div><fiddle-embed name="4fc7b86c9b772c5e85af480524267bde"></fiddle-embed></div> + +### See Also + +<a href="bmh_undocumented?cl=9919#Oval">Oval</a> <a href="bmh_SkPath_Reference?cl=9919#addCircle">addCircle</a> <a href="bmh_SkPath_Reference?cl=9919#addOval">addOval</a> + +--- + +<a name="isRRect"></a> +## isRRect + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +bool isRRect(SkRRect* rrect, Direction* dir = nullptr, unsigned* start = nullptr) const +</pre> + +<a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> is <a href="bmh_undocumented?cl=9919#Round_Rect">Round Rect</a> if constructed by <a href="bmh_SkPath_Reference?cl=9919#addRoundRect">addRoundRect</a>, <a href="bmh_SkPath_Reference?cl=9919#addRRect">addRRect</a>; and if construction +is not empty, not <a href="bmh_undocumented?cl=9919#Rect">Rect</a>, and not <a href="bmh_undocumented?cl=9919#Oval">Oval</a>. <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> constructed with other other calls +will not return true though <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> draws <a href="bmh_undocumented?cl=9919#Round_Rect">Round Rect</a>. + +<a href="bmh_SkPath_Reference?cl=9919#isRRect">isRRect</a> triggers performance optimizations on some <a href="bmh_undocumented?cl=9919#GPU">GPU Surface</a> implementations. + +### Parameters + +<table> <tr> <td><code><strong>rrect </strong></code></td> <td> +storage for bounding <a href="bmh_undocumented?cl=9919#Rect">Rect</a> of <a href="bmh_undocumented?cl=9919#Round_Rect">Round Rect</a>. +Unwritten if <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> is not <a href="bmh_undocumented?cl=9919#Round_Rect">Round Rect</a>. May be nullptr.</td> + </tr> <tr> <td><code><strong>dir </strong></code></td> <td> +storage for <a href="bmh_SkPath_Reference?cl=9919#Direction">Direction</a>; <a href="bmh_SkPath_Reference?cl=9919#kCW_Direction">kCW Direction</a> if clockwise, <a href="bmh_SkPath_Reference?cl=9919#kCCW_Direction">kCCW Direction</a> if +counterclockwise. Unwritten if <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> is not <a href="bmh_undocumented?cl=9919#Round_Rect">Round Rect</a>. May be nullptr.</td> + </tr> <tr> <td><code><strong>start </strong></code></td> <td> +storage for <a href="bmh_SkPath_Reference?cl=9919#isRRect">start</a> of <a href="bmh_undocumented?cl=9919#Round_Rect">Round Rect</a>: 0 for top, +1 for right, 2 for bottom, 3 for left. Unwritten if <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> is not <a href="bmh_undocumented?cl=9919#Round_Rect">Round Rect</a>. May be nullptr.</td> + </tr> +</table> + +### Return Value + +true for <a href="bmh_undocumented?cl=9919#Round_Rect">Round Rect</a> <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> constructed by <a href="bmh_SkPath_Reference?cl=9919#addRoundRect">addRoundRect</a> or <a href="bmh_SkPath_Reference?cl=9919#addRRect">addRRect</a>. + +### Example + +<div><fiddle-embed name="f2b7e57a385e6604475c99ec8daa2697"></fiddle-embed></div> + +### See Also + +<a href="bmh_undocumented?cl=9919#Round_Rect">Round Rect</a> <a href="bmh_SkPath_Reference?cl=9919#addRoundRect">addRoundRect</a> <a href="bmh_SkPath_Reference?cl=9919#addRRect">addRRect</a> + +--- + +<a name="reset"></a> +## reset + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void reset() +</pre> + +Sets <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> to its intial state. +Removes <a href="bmh_SkPath_Reference?cl=9919#Verb_Array">Verb Array</a>, <a href="bmh_SkPath_Reference?cl=9919#Point_Array">Point Array</a>, and <a href="bmh_SkPath_Reference?cl=9919#Weight">Weights</a>, and sets <a href="bmh_SkPath_Reference?cl=9919#FillType">FillType</a> to <a href="bmh_SkPath_Reference?cl=9919#kWinding_FillType">kWinding FillType</a>. +Internal storage associated with <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> is released. + +### Example + +<div><fiddle-embed name="8cdca35d2964bbbecb93d79a13f71c65"></fiddle-embed></div> + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#rewind">rewind</a> + +--- + +<a name="rewind"></a> +## rewind + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void rewind() +</pre> + +Sets <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> to its intial state, preserving internal storage. +Removes <a href="bmh_SkPath_Reference?cl=9919#Verb_Array">Verb Array</a>, <a href="bmh_SkPath_Reference?cl=9919#Point_Array">Point Array</a>, and <a href="bmh_SkPath_Reference?cl=9919#Weight">Weights</a>, and sets <a href="bmh_SkPath_Reference?cl=9919#FillType">FillType</a> to <a href="bmh_SkPath_Reference?cl=9919#kWinding_FillType">kWinding FillType</a>. +Internal storage associated with <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> is retained. + +Use <a href="bmh_SkPath_Reference?cl=9919#rewind">rewind</a> instead of <a href="bmh_SkPath_Reference?cl=9919#reset">reset</a> if <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> storage will be reused and performance +is critical. + +### Example + +<div><fiddle-embed name="f1fedbb89da9c2a33a91805175663012"><div>Although path1 retains its internal storage, it is indistinguishable from +a newly initialized path.</div></fiddle-embed></div> + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#reset">reset</a> + +--- + +<a name="isEmpty"></a> +## isEmpty + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +bool isEmpty() const +</pre> + +Empty <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> may have <a href="bmh_SkPath_Reference?cl=9919#FillType">FillType</a> but has no <a href="bmh_undocumented?cl=9919#SkPoint">SkPoint</a>, <a href="bmh_SkPath_Reference?cl=9919#Verb">Verb</a>, or <a href="bmh_SkPath_Reference?cl=9919#Conic_Weight">Conic Weight</a>. +<a href="bmh_SkPath_Reference?cl=9919#empty_constructor">SkPath()</a> constructs empty <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>; <a href="bmh_SkPath_Reference?cl=9919#reset">reset</a> and (rewind) make <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> empty. + +### Return Value + +true if the path contains no <a href="bmh_SkPath_Reference?cl=9919#Verb">Verb</a> array. + +### Example + +<div><fiddle-embed name="0b34e6d55d11586744adeb889d2a12f4"> + +#### Example Output + +~~~~ +initial path is empty +after moveTo path is not empty +after rewind path is empty +after lineTo path is not empty +after reset path is empty +~~~~ + +</fiddle-embed></div> + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#empty_constructor">SkPath()</a> <a href="bmh_SkPath_Reference?cl=9919#reset">reset</a> <a href="bmh_SkPath_Reference?cl=9919#rewind">rewind</a> + +--- + +<a name="isLastContourClosed"></a> +## isLastContourClosed + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +bool isLastContourClosed() const +</pre> + +<a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a> is closed if <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> <a href="bmh_SkPath_Reference?cl=9919#Verb">Verb</a> array was last modified by <a href="bmh_SkPath_Reference?cl=9919#close">close</a>. When stroked, +closed <a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a> draws <a href="bmh_SkPaint_Reference?cl=9919#Stroke_Join">Paint Stroke Join</a> instead of <a href="bmh_SkPaint_Reference?cl=9919#Stroke_Cap">Paint Stroke Cap</a> at first and last <a href="bmh_undocumented?cl=9919#Point">Point</a>. + +### Return Value + +true if the last <a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a> ends with a <a href="bmh_SkPath_Reference?cl=9919#kClose_Verb">kClose Verb</a>. + +### Example + +<div><fiddle-embed name="03b740ab94b9017800a52e30b5e7fee7"><div><a href="bmh_SkPath_Reference?cl=9919#close">close</a> has no effect if <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> is empty; <a href="bmh_SkPath_Reference?cl=9919#isLastContourClosed">isLastContourClosed</a> returns +false until <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> has geometry followed by <a href="bmh_SkPath_Reference?cl=9919#close">close</a>.</div> + +#### Example Output + +~~~~ +initial last contour is not closed +after close last contour is not closed +after lineTo last contour is not closed +after close last contour is closed +~~~~ + +</fiddle-embed></div> + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#close">close</a> + +--- + +<a name="isFinite"></a> +## isFinite + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +bool isFinite() const +</pre> + +Finite <a href="bmh_undocumented?cl=9919#Point">Point</a> array values are between negative <a href="bmh_undocumented?cl=9919#SK_ScalarMax">SK ScalarMax</a> and +positive <a href="bmh_undocumented?cl=9919#SK_ScalarMax">SK ScalarMax</a>. Any <a href="bmh_undocumented?cl=9919#Point">Point</a> array value of +<a href="bmh_undocumented?cl=9919#SK_ScalarInfinity">SK ScalarInfinity</a>, <a href="bmh_undocumented?cl=9919#SK_ScalarNegativeInfinity">SK ScalarNegativeInfinity</a>, or <a href="bmh_undocumented?cl=9919#SK_ScalarNaN">SK ScalarNaN</a> +cause <a href="bmh_SkPath_Reference?cl=9919#isFinite">isFinite</a> to return false. + +### Return Value + +true if all <a href="bmh_undocumented?cl=9919#Point">Point</a> values are finite. + +### Example + +<div><fiddle-embed name="dd4e4dd2aaa8039b2430729c6b3af817"> + +#### Example Output + +~~~~ +initial path is finite +after line path is finite +after scale path is not finite +~~~~ + +</fiddle-embed></div> + +### See Also + +<a href="bmh_undocumented?cl=9919#SkScalar">SkScalar</a> + +--- + +<a name="isVolatile"></a> +## isVolatile + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +bool isVolatile() const +</pre> + +Returns true if the path is volatile; it will not be altered or discarded +by the caller after it is drawn. <a href="bmh_SkPath_Reference?cl=9919#Path">Paths</a> by default have volatile set false, allowing +<a href="bmh_undocumented?cl=9919#Surface">Surface</a> to attach a cache of data which speeds repeated drawing. If true, <a href="bmh_undocumented?cl=9919#Surface">Surface</a> +may not speed repeated drawing. + +### Return Value + +true if caller will alter <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> after drawing. + +### Example + +<div><fiddle-embed name="c722ebe8ac991d77757799ce29e509e1"> + +#### Example Output + +~~~~ +volatile by default is false +~~~~ + +</fiddle-embed></div> + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#setIsVolatile">setIsVolatile</a> + +--- + +<a name="setIsVolatile"></a> +## setIsVolatile + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void setIsVolatile(bool isVolatile) +</pre> + +Specify whether <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> is volatile; whether it will be altered or discarded +by the caller after it is drawn. <a href="bmh_SkPath_Reference?cl=9919#Path">Paths</a> by default have volatile set false, allowing +<a href="bmh_undocumented?cl=9919#Device">Device</a> to attach a cache of data which speeds repeated drawing. + +Mark temporary paths, discarded or modified after use, as volatile +to inform <a href="bmh_undocumented?cl=9919#Device">Device</a> that the path need not be cached. + +Mark animating <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> volatile to improve performance. +Mark unchanging <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> non-volative to improve repeated rendering. + +<a href="bmh_undocumented?cl=9919#Raster">Raster Surface</a> <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> draws are affected by volatile for some shadows. +<a href="bmh_undocumented?cl=9919#GPU">GPU Surface</a> <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> draws are affected by volatile for some shadows and concave geometries. + +### Parameters + +<table> <tr> <td><code><strong>isVolatile </strong></code></td> <td> +true if caller will alter <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> after drawing.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="2049ff5141f0c80aac497618622b28af"></fiddle-embed></div> + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#isVolatile">isVolatile</a> + +--- + +<a name="IsLineDegenerate"></a> +## IsLineDegenerate + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +static bool IsLineDegenerate(const SkPoint& p1, const SkPoint& p2, bool exact) +</pre> + +Test if <a href="bmh_undocumented?cl=9919#Line">Line</a> between <a href="bmh_undocumented?cl=9919#Point">Point</a> pair is degenerate. +<a href="bmh_undocumented?cl=9919#Line">Line</a> with no length or that moves a very short distance is degenerate; it is +treated as a point. + +### Parameters + +<table> <tr> <td><code><strong>p1 </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#Line">Line</a> start point.</td> + </tr> <tr> <td><code><strong>p2 </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#Line">Line</a> end point.</td> + </tr> <tr> <td><code><strong>exact </strong></code></td> <td> +If true, returns true only if <a href="bmh_SkPath_Reference?cl=9919#p1">p1</a> equals <a href="bmh_SkPath_Reference?cl=9919#p2">p2</a>. If false, returns true +if <a href="bmh_SkPath_Reference?cl=9919#p1">p1</a> equals or nearly equals <a href="bmh_SkPath_Reference?cl=9919#p2">p2</a>.</td> + </tr> +</table> + +### Return Value + +true if <a href="bmh_undocumented?cl=9919#Line">Line</a> is degenerate; its length is effectively zero. + +### Example + +<div><fiddle-embed name="97a031f9186ade586928563840ce9116"><div>As single precision floats, 100 and 100.000001f have the same bit representation, +and are exactly equal. 100 and 100.0001f have different bit representations, and +are not exactly equal, but are nearly equal.</div> + +#### Example Output + +~~~~ +line from (100,100) to (100,100) is degenerate, nearly +line from (100,100) to (100,100) is degenerate, exactly +line from (100,100) to (100.0001,100.0001) is degenerate, nearly +line from (100,100) to (100.0001,100.0001) is not degenerate, exactly +~~~~ + +</fiddle-embed></div> + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#IsQuadDegenerate">IsQuadDegenerate</a> <a href="bmh_SkPath_Reference?cl=9919#IsCubicDegenerate">IsCubicDegenerate</a> <a href="bmh_undocumented?cl=9919#equalsWithinTolerance">SkPoint::equalsWithinTolerance</a> + +--- + +<a name="IsQuadDegenerate"></a> +## IsQuadDegenerate + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +static bool IsQuadDegenerate(const SkPoint& p1, const SkPoint& p2, + const SkPoint& p3, bool exact) +</pre> + +Test if <a href="bmh_SkPath_Reference?cl=9919#Quad">Quad</a> is degenerate. +<a href="bmh_SkPath_Reference?cl=9919#Quad">Quad</a> with no length or that moves a very short distance is degenerate; it is +treated as a point. + +### Parameters + +<table> <tr> <td><code><strong>p1 </strong></code></td> <td> +<a href="bmh_SkPath_Reference?cl=9919#Quad">Quad</a> start point.</td> + </tr> <tr> <td><code><strong>p2 </strong></code></td> <td> +<a href="bmh_SkPath_Reference?cl=9919#Quad">Quad</a> control point.</td> + </tr> <tr> <td><code><strong>p3 </strong></code></td> <td> +<a href="bmh_SkPath_Reference?cl=9919#Quad">Quad</a> end point.</td> + </tr> <tr> <td><code><strong>exact </strong></code></td> <td> +If true, returns true only if <a href="bmh_SkPath_Reference?cl=9919#p1">p1</a>, <a href="bmh_SkPath_Reference?cl=9919#p2">p2</a>, and <a href="bmh_SkPath_Reference?cl=9919#p3">p3</a> are equal. +If false, returns true if <a href="bmh_SkPath_Reference?cl=9919#p1">p1</a>, <a href="bmh_SkPath_Reference?cl=9919#p2">p2</a>, and <a href="bmh_SkPath_Reference?cl=9919#p3">p3</a> are equal or nearly equal.</td> + </tr> +</table> + +### Return Value + +true if <a href="bmh_SkPath_Reference?cl=9919#Quad">Quad</a> is degenerate; its length is effectively zero. + +### Example + +<div><fiddle-embed name="1d50896c528cd4581966646b7d96acff"><div>As single precision floats: 100, 100.00001f, and 100.00002f have different bit representations +but nearly the same value. Translating all three by 1000 gives them the same bit representation; +the fractional portion of the number can't be represented by the float and is lost.</div> + +#### Example Output + +~~~~ +quad (100,100), (100.00001,100.00001), (100.00002,100.00002) is degenerate, nearly +quad (1100,1100), (1100,1100), (1100,1100) is degenerate, nearly +quad (100,100), (100.00001,100.00001), (100.00002,100.00002) is not degenerate, exactly +quad (1100,1100), (1100,1100), (1100,1100) is degenerate, exactly +~~~~ + +</fiddle-embed></div> + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#IsLineDegenerate">IsLineDegenerate</a> <a href="bmh_SkPath_Reference?cl=9919#IsCubicDegenerate">IsCubicDegenerate</a> <a href="bmh_undocumented?cl=9919#equalsWithinTolerance">SkPoint::equalsWithinTolerance</a> + +--- + +<a name="IsCubicDegenerate"></a> +## IsCubicDegenerate + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +static bool IsCubicDegenerate(const SkPoint& p1, const SkPoint& p2, + const SkPoint& p3, const SkPoint& p4, bool exact) +</pre> + +Test if <a href="bmh_SkPath_Reference?cl=9919#Cubic">Cubic</a> is degenerate. +<a href="bmh_SkPath_Reference?cl=9919#Cubic">Cubic</a> with no length or that moves a very short distance is degenerate; it is +treated as a point. + +### Parameters + +<table> <tr> <td><code><strong>p1 </strong></code></td> <td> +<a href="bmh_SkPath_Reference?cl=9919#Cubic">Cubic</a> start point.</td> + </tr> <tr> <td><code><strong>p2 </strong></code></td> <td> +<a href="bmh_SkPath_Reference?cl=9919#Cubic">Cubic</a> control point 1.</td> + </tr> <tr> <td><code><strong>p3 </strong></code></td> <td> +<a href="bmh_SkPath_Reference?cl=9919#Cubic">Cubic</a> control point 2.</td> + </tr> <tr> <td><code><strong>p4 </strong></code></td> <td> +<a href="bmh_SkPath_Reference?cl=9919#Cubic">Cubic</a> end point.</td> + </tr> <tr> <td><code><strong>exact </strong></code></td> <td> +If true, returns true only if <a href="bmh_SkPath_Reference?cl=9919#p1">p1</a>, <a href="bmh_SkPath_Reference?cl=9919#p2">p2</a>, <a href="bmh_SkPath_Reference?cl=9919#p3">p3</a>, and <a href="bmh_SkPath_Reference?cl=9919#p4">p4</a> are equal. +If false, returns true if <a href="bmh_SkPath_Reference?cl=9919#p1">p1</a>, <a href="bmh_SkPath_Reference?cl=9919#p2">p2</a>, <a href="bmh_SkPath_Reference?cl=9919#p3">p3</a>, and <a href="bmh_SkPath_Reference?cl=9919#p4">p4</a> are equal or nearly equal.</td> + </tr> +</table> + +### Return Value + +true if <a href="bmh_SkPath_Reference?cl=9919#Cubic">Cubic</a> is degenerate; its length is effectively zero. + +### Example + +<div><fiddle-embed name="c79d813f0b37062cb2f7a0c83f4a09f3"> + +#### Example Output + +~~~~ +0.00024414062 is degenerate +0.00024414065 is length +~~~~ + +</fiddle-embed></div> + +--- + +<a name="isLine"></a> +## isLine + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +bool isLine(SkPoint line[2]) const +</pre> + +Returns true if <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> contains only one <a href="bmh_undocumented?cl=9919#Line">Line</a>; +<a href="bmh_SkPath_Reference?cl=9919#Verb">Path Verb</a> array has two entries: <a href="bmh_SkPath_Reference?cl=9919#kMove_Verb">kMove Verb</a>, <a href="bmh_SkPath_Reference?cl=9919#kLine_Verb">kLine Verb</a>. +If <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> contains one <a href="bmh_undocumented?cl=9919#Line">Line</a> and <a href="bmh_SkPath_Reference?cl=9919#line">line</a> is not nullptr, <a href="bmh_SkPath_Reference?cl=9919#line">line</a> is set to +<a href="bmh_undocumented?cl=9919#Line">Line</a> start point and <a href="bmh_undocumented?cl=9919#Line">Line</a> end point. +Returns false if <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> is not one <a href="bmh_undocumented?cl=9919#Line">Line</a>; <a href="bmh_SkPath_Reference?cl=9919#line">line</a> is unaltered. + +### Parameters + +<table> <tr> <td><code><strong>line </strong></code></td> <td> +storage for <a href="bmh_undocumented?cl=9919#Line">Line</a>. May be nullptr.</td> + </tr> +</table> + +### Return Value + +true if <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> contains exactly one <a href="bmh_undocumented?cl=9919#Line">Line</a>. + +### Example + +<div><fiddle-embed name="1ad07d56e4258e041606d50cad969392"> + +#### Example Output + +~~~~ +empty is not line +zero line is line (0,0) (0,0) +line is line (10,10) (20,20) +second move is not line +~~~~ + +</fiddle-embed></div> + +--- + +## <a name="Point_Array"></a> Point Array + +<a href="bmh_SkPath_Reference?cl=9919#Point_Array">Point Array</a> contains <a href="bmh_undocumented?cl=9919#Point">Points</a> satisfying the allocated <a href="bmh_undocumented?cl=9919#Point">Points</a> for +each <a href="bmh_SkPath_Reference?cl=9919#Verb">Verb</a> in <a href="bmh_SkPath_Reference?cl=9919#Verb_Array">Verb Array</a>. For instance, <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> containing one <a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a> with <a href="bmh_undocumented?cl=9919#Line">Line</a> +and <a href="bmh_SkPath_Reference?cl=9919#Quad">Quad</a> is described by <a href="bmh_SkPath_Reference?cl=9919#Verb_Array">Verb Array</a>: move to, line to, quad to; and +one <a href="bmh_undocumented?cl=9919#Point">Point</a> for move, one <a href="bmh_undocumented?cl=9919#Point">Point</a> for <a href="bmh_undocumented?cl=9919#Line">Line</a>, two <a href="bmh_undocumented?cl=9919#Point">Points</a> for <a href="bmh_SkPath_Reference?cl=9919#Quad">Quad</a>; totaling four <a href="bmh_undocumented?cl=9919#Point">Points</a>. + +<a href="bmh_SkPath_Reference?cl=9919#Point_Array">Point Array</a> may be read directly from <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> with <a href="bmh_SkPath_Reference?cl=9919#getPoints">getPoints</a>, or inspected with +<a href="bmh_SkPath_Reference?cl=9919#getPoint">getPoint</a>, with <a href="bmh_SkPath_Reference?cl=9919#Iter">Iter</a>, or with <a href="bmh_SkPath_Reference?cl=9919#RawIter">RawIter</a>. + +<a name="getPoints"></a> +## getPoints + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +int getPoints(SkPoint points[], int max) const +</pre> + +Returns number of <a href="bmh_SkPath_Reference?cl=9919#points">points</a> in <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>. Up to <a href="bmh_SkPath_Reference?cl=9919#max">max</a> <a href="bmh_SkPath_Reference?cl=9919#points">points</a> are copied. +<a href="bmh_SkPath_Reference?cl=9919#points">points</a> may be nullptr; then, <a href="bmh_SkPath_Reference?cl=9919#max">max</a> must be zero. +If <a href="bmh_SkPath_Reference?cl=9919#max">max</a> is greater than number of <a href="bmh_SkPath_Reference?cl=9919#points">points</a>, excess <a href="bmh_SkPath_Reference?cl=9919#points">points</a> storage is unaltered. + +### Parameters + +<table> <tr> <td><code><strong>points </strong></code></td> <td> +storage for <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> <a href="bmh_undocumented?cl=9919#Point">Point</a> array. May be nullptr.</td> + </tr> <tr> <td><code><strong>max </strong></code></td> <td> +Number of <a href="bmh_SkPath_Reference?cl=9919#points">points</a> alloted in <a href="bmh_SkPath_Reference?cl=9919#points">points</a> storage; must be greater than or equal to zero.</td> + </tr> +</table> + +### Return Value + +<a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> <a href="bmh_undocumented?cl=9919#Point">Point</a> array length. + +### Example + +<div><fiddle-embed name="9bc86efda08cbcd9c6f7c5f220294a24"> + +#### Example Output + +~~~~ +no points point count: 3 +zero max point count: 3 +too small point count: 3 (0,0) (20,20) +just right point count: 3 (0,0) (20,20) (-10,-10) +~~~~ + +</fiddle-embed></div> + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#countPoints">countPoints</a> <a href="bmh_SkPath_Reference?cl=9919#getPoint">getPoint</a> + +--- + +<a name="countPoints"></a> +## countPoints + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +int countPoints() const +</pre> + +Returns the number of points in <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>. +<a href="bmh_undocumented?cl=9919#Point">Point</a> count is initially zero. + +### Return Value + +<a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> <a href="bmh_undocumented?cl=9919#Point">Point</a> array length. + +### Example + +<div><fiddle-embed name="bca6379ccef62cb081b10db7381deb27"> + +#### Example Output + +~~~~ +empty point count: 0 +zero line point count: 2 +line point count: 2 +second move point count: 3 +~~~~ + +</fiddle-embed></div> + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#getPoints">getPoints</a> + +--- + +<a name="getPoint"></a> +## getPoint + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +SkPoint getPoint(int index) const +</pre> + +Returns <a href="bmh_undocumented?cl=9919#Point">Point</a> at <a href="bmh_SkPath_Reference?cl=9919#index">index</a> in <a href="bmh_SkPath_Reference?cl=9919#Point_Array">Point Array</a>. Valid range for <a href="bmh_SkPath_Reference?cl=9919#index">index</a> is +0 to <a href="bmh_SkPath_Reference?cl=9919#countPoints">countPoints</a> - 1. +If the <a href="bmh_SkPath_Reference?cl=9919#index">index</a> is out of range, <a href="bmh_SkPath_Reference?cl=9919#getPoint">getPoint</a> returns (0, 0). + +### Parameters + +<table> <tr> <td><code><strong>index </strong></code></td> <td> +<a href="bmh_SkPath_Reference?cl=9919#Point_Array">Point Array</a> element selector.</td> + </tr> +</table> + +### Return Value + +<a href="bmh_SkPath_Reference?cl=9919#Point_Array">Point Array</a> value or (0, 0). + +### Example + +<div><fiddle-embed name="1cf6b8dd2994c4ca9a2d6887ff888017"> + +#### Example Output + +~~~~ +point 0: (-10,-10) +point 1: (10,10) +~~~~ + +</fiddle-embed></div> + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#countPoints">countPoints</a> <a href="bmh_SkPath_Reference?cl=9919#getPoints">getPoints</a> + +--- + +## <a name="Verb_Array"></a> Verb Array + +<a href="bmh_SkPath_Reference?cl=9919#Verb_Array">Verb Array</a> always starts with <a href="bmh_SkPath_Reference?cl=9919#kMove_Verb">kMove Verb</a>. +If <a href="bmh_SkPath_Reference?cl=9919#kClose_Verb">kClose Verb</a> is not the last entry, it is always followed by <a href="bmh_SkPath_Reference?cl=9919#kMove_Verb">kMove Verb</a>; +the quantity of <a href="bmh_SkPath_Reference?cl=9919#kMove_Verb">kMove Verb</a> equals the <a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a> count. +<a href="bmh_SkPath_Reference?cl=9919#Verb_Array">Verb Array</a> does not include or count <a href="bmh_SkPath_Reference?cl=9919#kDone_Verb">kDone Verb</a>; it is a convenience +returned when iterating through <a href="bmh_SkPath_Reference?cl=9919#Verb_Array">Verb Array</a>. + +<a href="bmh_SkPath_Reference?cl=9919#Verb_Array">Verb Array</a> may be read directly from <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> with <a href="bmh_SkPath_Reference?cl=9919#getVerbs">getVerbs</a>, or inspected with <a href="bmh_SkPath_Reference?cl=9919#Iter">Iter</a>, +or with <a href="bmh_SkPath_Reference?cl=9919#RawIter">RawIter</a>. + +<a name="countVerbs"></a> +## countVerbs + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +int countVerbs() const +</pre> + +Returns the number of <a href="bmh_SkPath_Reference?cl=9919#Verb">Verbs</a>: <a href="bmh_SkPath_Reference?cl=9919#kMove_Verb">kMove Verb</a>, <a href="bmh_SkPath_Reference?cl=9919#kLine_Verb">kLine Verb</a>, <a href="bmh_SkPath_Reference?cl=9919#kQuad_Verb">kQuad Verb</a>, <a href="bmh_SkPath_Reference?cl=9919#kConic_Verb">kConic Verb</a>, +<a href="bmh_SkPath_Reference?cl=9919#kCubic_Verb">kCubic Verb</a>, and <a href="bmh_SkPath_Reference?cl=9919#kClose_Verb">kClose Verb</a>; added to <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>. + +### Return Value + +Length of <a href="bmh_SkPath_Reference?cl=9919#Verb_Array">Verb Array</a>. + +### Example + +<div><fiddle-embed name="af0c66aea3ef81b709664c7007f48aae"> + +#### Example Output + +~~~~ +empty verb count: 0 +round rect verb count: 10 +~~~~ + +</fiddle-embed></div> + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#getVerbs">getVerbs</a> <a href="bmh_SkPath_Reference?cl=9919#Iter">Iter</a> <a href="bmh_SkPath_Reference?cl=9919#RawIter">RawIter</a> + +--- + +<a name="getVerbs"></a> +## getVerbs + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +int getVerbs(uint8_t verbs[], int max) const +</pre> + +Returns the number of <a href="bmh_SkPath_Reference?cl=9919#verbs">verbs</a> in the path. Up to <a href="bmh_SkPath_Reference?cl=9919#max">max</a> <a href="bmh_SkPath_Reference?cl=9919#verbs">verbs</a> are copied. The +<a href="bmh_SkPath_Reference?cl=9919#verbs">verbs</a> are copied as one byte per verb. + +### Parameters + +<table> <tr> <td><code><strong>verbs </strong></code></td> <td> +If not null, receives up to <a href="bmh_SkPath_Reference?cl=9919#max">max</a> <a href="bmh_SkPath_Reference?cl=9919#verbs">verbs</a></td> + </tr> <tr> <td><code><strong>max </strong></code></td> <td> +The maximum number of <a href="bmh_SkPath_Reference?cl=9919#verbs">verbs</a> to copy into <a href="bmh_SkPath_Reference?cl=9919#verbs">verbs</a></td> + </tr> +</table> + +### Return Value + +the actual number of <a href="bmh_SkPath_Reference?cl=9919#verbs">verbs</a> in the path + +### Example + +<div><fiddle-embed name="2ec66880966a6133ddd9331ce7323438"> + +#### Example Output + +~~~~ +no verbs verb count: 3 +zero max verb count: 3 +too small verb count: 3 move line +just right verb count: 3 move line line +~~~~ + +</fiddle-embed></div> + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#countVerbs">countVerbs</a> <a href="bmh_SkPath_Reference?cl=9919#getPoints">getPoints</a> <a href="bmh_SkPath_Reference?cl=9919#Iter">Iter</a> <a href="bmh_SkPath_Reference?cl=9919#RawIter">RawIter</a> + +--- + +<a name="swap"></a> +## swap + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void swap(SkPath& other) +</pre> + +Exchanges the <a href="bmh_SkPath_Reference?cl=9919#Verb_Array">Verb Array</a>, <a href="bmh_SkPath_Reference?cl=9919#Point_Array">Point Array</a>, <a href="bmh_SkPath_Reference?cl=9919#Weight">Weights</a>, and <a href="bmh_SkPath_Reference?cl=9919#Fill_Type">Fill Type</a> with <a href="bmh_SkPath_Reference?cl=9919#other">other</a>. +Cached state is also exchanged. <a href="bmh_SkPath_Reference?cl=9919#swap">swap</a> internally exchanges pointers, so +it is lightweight and does not allocate memory. + +<a href="bmh_SkPath_Reference?cl=9919#swap">swap</a> usage has largely been replaced by <a href="bmh_SkPath_Reference?cl=9919#copy_assignment_operator">operator=(const SkPath& path)</a>. +<a href="bmh_SkPath_Reference?cl=9919#Path">Paths</a> do not copy their content on assignment util they are written to, +making assignment as efficient as <a href="bmh_SkPath_Reference?cl=9919#swap">swap</a>. + +### Parameters + +<table> <tr> <td><code><strong>other </strong></code></td> <td> +<a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> exchanged by value.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="4c5ebee2b5039e5faefa07ae63a15467"> + +#### Example Output + +~~~~ +path1 bounds = 0, 0, 0, 0 +path2 bounds = 10, 20, 30, 40 +~~~~ + +</fiddle-embed></div> + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#copy_assignment_operator">operator=(const SkPath& path)</a> + +--- + +<a name="getBounds"></a> +## getBounds + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +const SkRect& getBounds() const +</pre> + +Returns minimum and maximum x and y values of <a href="bmh_SkPath_Reference?cl=9919#Point_Array">Point Array</a>. If <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> contains +no points, <a href="bmh_SkPath_Reference?cl=9919#getBounds">getBounds</a> returns (0, 0, 0, 0). Returned bounds width and height may +be larger or smaller than area affected when <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> is drawn. + +<a href="bmh_SkPath_Reference?cl=9919#getBounds">getBounds</a> includes all <a href="bmh_undocumented?cl=9919#Point">Points</a> added to <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>, including <a href="bmh_undocumented?cl=9919#Point">Points</a> associated with +<a href="bmh_SkPath_Reference?cl=9919#kMove_Verb">kMove Verb</a> that define empty <a href="bmh_SkPath_Reference?cl=9919#Contour">Contours</a>. + +### Return Value + +bounds of all <a href="bmh_undocumented?cl=9919#Point">Points</a> in <a href="bmh_SkPath_Reference?cl=9919#Point_Array">Point Array</a>. + +### Example + +<div><fiddle-embed name="9160aa6d1476bd87d927cfc8a4bf25e7"><div>Bounds of upright <a href="bmh_undocumented?cl=9919#Circle">Circle</a> can be predicted from center and radius. +Bounds of rotated <a href="bmh_undocumented?cl=9919#Circle">Circle</a> includes control <a href="bmh_undocumented?cl=9919#Point">Points</a> outside of filled area.</div> + +#### Example Output + +~~~~ +empty bounds = 0, 0, 0, 0 +circle bounds = 25, 20, 75, 70 +rotated circle bounds = 14.6447, 9.64466, 85.3553, 80.3553 +~~~~ + +</fiddle-embed></div> + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#computeTightBounds">computeTightBounds</a> <a href="bmh_SkPath_Reference?cl=9919#updateBoundsCache">updateBoundsCache</a> + +--- + +<a name="updateBoundsCache"></a> +## updateBoundsCache + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void updateBoundsCache() const +</pre> + +Update internal bounds so that subsequent calls to <a href="bmh_SkPath_Reference?cl=9919#getBounds">getBounds</a> are instantaneous. +Unaltered copies of <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> may also access cached bounds through <a href="bmh_SkPath_Reference?cl=9919#getBounds">getBounds</a>. + +For now, <a href="bmh_SkPath_Reference?cl=9919#updateBoundsCache">updateBoundsCache</a> is identical to <a href="bmh_SkPath_Reference?cl=9919#getBounds">getBounds</a>, where the +returned value is ignored. + +<a href="bmh_SkPath_Reference?cl=9919#updateBoundsCache">updateBoundsCache</a> prepares a <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> subsequently drawn from multiple threads, +to avoid a race condition where each draw separately computes the bounds. + +### Example + +<div><fiddle-embed name="bb761cd858e6d0ca05627262cd22ff5e"> + +#### Example Output + +~~~~ +#Volatile +uncached avg: 0.18048 ms +cached avg: 0.182784 ms +~~~~ + +</fiddle-embed></div> + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#getBounds">getBounds</a> + +--- + +<a name="computeTightBounds"></a> +## computeTightBounds + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +SkRect computeTightBounds() const +</pre> + +Returns minimum and maximum x and y values of the lines and curves in <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>. +If <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> contains no points, <a href="bmh_SkPath_Reference?cl=9919#computeTightBounds">computeTightBounds</a> returns (0, 0, 0, 0). +Returned bounds width and height may be larger or smaller than area affected +when <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> is drawn. + +<a href="bmh_SkPath_Reference?cl=9919#computeTightBounds">computeTightBounds</a> behaves identically to <a href="bmh_SkPath_Reference?cl=9919#getBounds">getBounds</a> when <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> contains +only lines. If <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> contains curves, compute <a href="bmh_SkPath_Reference?cl=9919#computeTightBounds">computeTightBounds</a> includes +the maximum extent of the <a href="bmh_SkPath_Reference?cl=9919#Quad">Quad</a>, <a href="bmh_SkPath_Reference?cl=9919#Conic">Conic</a>, or <a href="bmh_SkPath_Reference?cl=9919#Cubic">Cubic</a>; is slower, +and does not cache the result. + +Like <a href="bmh_SkPath_Reference?cl=9919#getBounds">getBounds</a>, <a href="bmh_SkPath_Reference?cl=9919#computeTightBounds">computeTightBounds</a> includes <a href="bmh_undocumented?cl=9919#Point">Points</a> associated with +<a href="bmh_SkPath_Reference?cl=9919#kMove_Verb">kMove Verb</a> that define empty <a href="bmh_SkPath_Reference?cl=9919#Contour">Contours</a>. + +### Return Value + +### Example + +<div><fiddle-embed name="da34f02e69ec98d5681300aea9a2d0bf"> + +#### Example Output + +~~~~ +empty bounds = 0, 0, 0, 0 +circle bounds = 25, 20, 75, 70 +rotated circle bounds = 25, 20, 75, 70 +~~~~ + +</fiddle-embed></div> + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#getBounds">getBounds</a> + +--- + +<a name="conservativelyContainsRect"></a> +## conservativelyContainsRect + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +bool conservativelyContainsRect(const SkRect& rect) const +</pre> + +Returns true if <a href="bmh_SkPath_Reference?cl=9919#rect">rect</a> is contained by <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>. +May return false when <a href="bmh_SkPath_Reference?cl=9919#rect">rect</a> is contained by <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>. + +For now, only returns true if <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> has one <a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a> and is convex. +<a href="bmh_SkPath_Reference?cl=9919#rect">rect</a> may share points and edges with <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> and be contained. +If <a href="bmh_SkPath_Reference?cl=9919#rect">rect</a> is empty, that is, it has zero width or height; <a href="bmh_SkPath_Reference?cl=9919#conservativelyContainsRect">conservativelyContainsRect</a> +returns true if the <a href="bmh_undocumented?cl=9919#Point">Point</a> or <a href="bmh_undocumented?cl=9919#Line">Line</a> described by <a href="bmh_SkPath_Reference?cl=9919#rect">rect</a> is contained by <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>. + +### Parameters + +<table> <tr> <td><code><strong>rect </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#Rect">Rect</a>, <a href="bmh_undocumented?cl=9919#Line">Line</a>, or <a href="bmh_undocumented?cl=9919#Point">Point</a> checked for containment.</td> + </tr> +</table> + +### Return Value + +true if <a href="bmh_SkPath_Reference?cl=9919#rect">rect</a> is contained. + +### Example + +<div><fiddle-embed name="41638d13e40fa449ece354dde5fb1941"><div><a href="bmh_undocumented?cl=9919#Rect">Rect</a> is drawn in blue if it is contained by red <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>.</div></fiddle-embed></div> + +### See Also + +contains <a href="bmh_undocumented?cl=9919#Op">Op</a> <a href="bmh_undocumented?cl=9919#Rect">Rect</a> <a href="bmh_SkPath_Reference?cl=9919#Convexity">Convexity</a> + +--- + +<a name="incReserve"></a> +## incReserve + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void incReserve(unsigned extraPtCount) +</pre> + +grows <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> <a href="bmh_SkPath_Reference?cl=9919#Verb_Array">Verb Array</a> and <a href="bmh_SkPath_Reference?cl=9919#Point_Array">Point Array</a> to contain <a href="bmh_SkPath_Reference?cl=9919#extraPtCount">extraPtCount</a> additional <a href="bmh_undocumented?cl=9919#Point">Points</a>. +<a href="bmh_SkPath_Reference?cl=9919#incReserve">incReserve</a> may improve performance and use less memory by +reducing the number and size of allocations when creating <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>. + +### Parameters + +<table> <tr> <td><code><strong>extraPtCount </strong></code></td> <td> +number of additional <a href="bmh_undocumented?cl=9919#Point">Points</a> to preallocate.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="f2260f2a170a54aef5bafe5b91c121b3"></fiddle-embed></div> + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#Point_Array">Point Array</a> + +--- + +<a name="moveTo"></a> +## moveTo + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void moveTo(SkScalar x, SkScalar y) +</pre> + +Adds beginning of <a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a> at <a href="bmh_undocumented?cl=9919#Point">Point</a> (<a href="bmh_SkPath_Reference?cl=9919#x">x</a>, <a href="bmh_SkPath_Reference?cl=9919#y">y</a>). + +### Parameters + +<table> <tr> <td><code><strong>x </strong></code></td> <td> +x-coordinate of <a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a> start.</td> + </tr> <tr> <td><code><strong>y </strong></code></td> <td> +y-coordinate of <a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a> start.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="84101d341e934a535a41ad6cf42218ce"></fiddle-embed></div> + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a> <a href="bmh_SkPath_Reference?cl=9919#lineTo">lineTo</a> <a href="bmh_SkPath_Reference?cl=9919#rMoveTo">rMoveTo</a> <a href="bmh_SkPath_Reference?cl=9919#quadTo">quadTo</a> <a href="bmh_SkPath_Reference?cl=9919#conicTo">conicTo</a> <a href="bmh_SkPath_Reference?cl=9919#cubicTo">cubicTo</a> <a href="bmh_SkPath_Reference?cl=9919#close">close</a> + +--- + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void moveTo(const SkPoint& p) +</pre> + +Adds beginning of <a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a> at <a href="bmh_undocumented?cl=9919#Point">Point</a> <a href="bmh_SkPath_Reference?cl=9919#p">p</a>. + +### Parameters + +<table> <tr> <td><code><strong>p </strong></code></td> <td> +<a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a> start.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="53b351d3fac667a4803418238e44a593"></fiddle-embed></div> + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a> <a href="bmh_SkPath_Reference?cl=9919#lineTo">lineTo</a> <a href="bmh_SkPath_Reference?cl=9919#rMoveTo">rMoveTo</a> <a href="bmh_SkPath_Reference?cl=9919#quadTo">quadTo</a> <a href="bmh_SkPath_Reference?cl=9919#conicTo">conicTo</a> <a href="bmh_SkPath_Reference?cl=9919#cubicTo">cubicTo</a> <a href="bmh_SkPath_Reference?cl=9919#close">close</a> + +--- + +<a name="rMoveTo"></a> +## rMoveTo + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void rMoveTo(SkScalar dx, SkScalar dy) +</pre> + +Adds beginning of <a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a> relative to <a href="bmh_SkPath_Reference?cl=9919#Last_Point">Last Point</a>. +If <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> is empty, starts <a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a> at (<a href="bmh_SkPath_Reference?cl=9919#dx">dx</a>, <a href="bmh_SkPath_Reference?cl=9919#dy">dy</a>). +Otherwise, start <a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a> at <a href="bmh_SkPath_Reference?cl=9919#Last_Point">Last Point</a> offset by (<a href="bmh_SkPath_Reference?cl=9919#dx">dx</a>, <a href="bmh_SkPath_Reference?cl=9919#dy">dy</a>). +<a href="bmh_SkPath_Reference?cl=9919#rMoveTo">rMoveTo</a> stands for relative move to. + +### Parameters + +<table> <tr> <td><code><strong>dx </strong></code></td> <td> +offset from <a href="bmh_SkPath_Reference?cl=9919#Last_Point">Last Point</a> x to <a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a> start x.</td> + </tr> <tr> <td><code><strong>dy </strong></code></td> <td> +offset from <a href="bmh_SkPath_Reference?cl=9919#Last_Point">Last Point</a> y to <a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a> start y.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="63e32dec4b2d8440b427f368bf8313a4"></fiddle-embed></div> + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a> <a href="bmh_SkPath_Reference?cl=9919#lineTo">lineTo</a> <a href="bmh_SkPath_Reference?cl=9919#moveTo">moveTo</a> <a href="bmh_SkPath_Reference?cl=9919#quadTo">quadTo</a> <a href="bmh_SkPath_Reference?cl=9919#conicTo">conicTo</a> <a href="bmh_SkPath_Reference?cl=9919#cubicTo">cubicTo</a> <a href="bmh_SkPath_Reference?cl=9919#close">close</a> + +--- + +<a name="lineTo"></a> +## lineTo + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void lineTo(SkScalar x, SkScalar y) +</pre> + +Adds <a href="bmh_undocumented?cl=9919#Line">Line</a> from <a href="bmh_SkPath_Reference?cl=9919#Last_Point">Last Point</a> to (<a href="bmh_SkPath_Reference?cl=9919#x">x</a>, <a href="bmh_SkPath_Reference?cl=9919#y">y</a>). If <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> is empty, or last <a href="bmh_SkPath_Reference?cl=9919#Verb">Verb</a> is +<a href="bmh_SkPath_Reference?cl=9919#kClose_Verb">kClose Verb</a>, <a href="bmh_SkPath_Reference?cl=9919#Last_Point">Last Point</a> is set to (0, 0) before adding <a href="bmh_undocumented?cl=9919#Line">Line</a>. + +<a href="bmh_SkPath_Reference?cl=9919#lineTo">lineTo</a> appends <a href="bmh_SkPath_Reference?cl=9919#kMove_Verb">kMove Verb</a> to <a href="bmh_SkPath_Reference?cl=9919#Verb_Array">Verb Array</a> and (0, 0) to <a href="bmh_SkPath_Reference?cl=9919#Point_Array">Point Array</a>, if needed. +<a href="bmh_SkPath_Reference?cl=9919#lineTo">lineTo</a> then appends <a href="bmh_SkPath_Reference?cl=9919#kLine_Verb">kLine Verb</a> to <a href="bmh_SkPath_Reference?cl=9919#Verb_Array">Verb Array</a> and (<a href="bmh_SkPath_Reference?cl=9919#x">x</a>, <a href="bmh_SkPath_Reference?cl=9919#y">y</a>) to <a href="bmh_SkPath_Reference?cl=9919#Point_Array">Point Array</a>. + +### Parameters + +<table> <tr> <td><code><strong>x </strong></code></td> <td> +end of added <a href="bmh_undocumented?cl=9919#Line">Line</a> in <a href="bmh_SkPath_Reference?cl=9919#x">x</a>.</td> + </tr> <tr> <td><code><strong>y </strong></code></td> <td> +end of added <a href="bmh_undocumented?cl=9919#Line">Line</a> in <a href="bmh_SkPath_Reference?cl=9919#y">y</a>.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="e311cdd451edacec33b50cc22a4dd5dc"></fiddle-embed></div> + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a> <a href="bmh_SkPath_Reference?cl=9919#moveTo">moveTo</a> <a href="bmh_SkPath_Reference?cl=9919#rLineTo">rLineTo</a> <a href="bmh_SkPath_Reference?cl=9919#addRect">addRect</a> + +--- + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void lineTo(const SkPoint& p) +</pre> + +Adds <a href="bmh_undocumented?cl=9919#Line">Line</a> from <a href="bmh_SkPath_Reference?cl=9919#Last_Point">Last Point</a> to <a href="bmh_undocumented?cl=9919#Point">Point</a> <a href="bmh_SkPath_Reference?cl=9919#p">p</a>. If <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> is empty, or last <a href="bmh_SkPath_Reference?cl=9919#Verb">Verb</a> is +<a href="bmh_SkPath_Reference?cl=9919#kClose_Verb">kClose Verb</a>, <a href="bmh_SkPath_Reference?cl=9919#Last_Point">Last Point</a> is set to (0, 0) before adding <a href="bmh_undocumented?cl=9919#Line">Line</a>. + +<a href="bmh_SkPath_Reference?cl=9919#lineTo">lineTo</a> first appends <a href="bmh_SkPath_Reference?cl=9919#kMove_Verb">kMove Verb</a> to <a href="bmh_SkPath_Reference?cl=9919#Verb_Array">Verb Array</a> and (0, 0) to <a href="bmh_SkPath_Reference?cl=9919#Point_Array">Point Array</a>, if needed. +<a href="bmh_SkPath_Reference?cl=9919#lineTo">lineTo</a> then appends <a href="bmh_SkPath_Reference?cl=9919#kLine_Verb">kLine Verb</a> to <a href="bmh_SkPath_Reference?cl=9919#Verb_Array">Verb Array</a> and <a href="bmh_undocumented?cl=9919#Point">Point</a> <a href="bmh_SkPath_Reference?cl=9919#p">p</a> to <a href="bmh_SkPath_Reference?cl=9919#Point_Array">Point Array</a>. + +### Parameters + +<table> <tr> <td><code><strong>p </strong></code></td> <td> +end <a href="bmh_undocumented?cl=9919#Point">Point</a> of added <a href="bmh_undocumented?cl=9919#Line">Line</a>.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="41001546a7f7927d08e5a818bcc304f5"></fiddle-embed></div> + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a> <a href="bmh_SkPath_Reference?cl=9919#moveTo">moveTo</a> <a href="bmh_SkPath_Reference?cl=9919#rLineTo">rLineTo</a> <a href="bmh_SkPath_Reference?cl=9919#addRect">addRect</a> + +--- + +<a name="rLineTo"></a> +## rLineTo + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void rLineTo(SkScalar dx, SkScalar dy) +</pre> + +Adds <a href="bmh_undocumented?cl=9919#Line">Line</a> from <a href="bmh_SkPath_Reference?cl=9919#Last_Point">Last Point</a> to <a href="bmh_undocumented?cl=9919#Vector">Vector</a> (<a href="bmh_SkPath_Reference?cl=9919#dx">dx</a>, <a href="bmh_SkPath_Reference?cl=9919#dy">dy</a>). If <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> is empty, or last <a href="bmh_SkPath_Reference?cl=9919#Verb">Verb</a> is +<a href="bmh_SkPath_Reference?cl=9919#kClose_Verb">kClose Verb</a>, <a href="bmh_SkPath_Reference?cl=9919#Last_Point">Last Point</a> is set to (0, 0) before adding <a href="bmh_undocumented?cl=9919#Line">Line</a>. + +<a href="bmh_SkPath_Reference?cl=9919#rLineTo">rLineTo</a> first appends <a href="bmh_SkPath_Reference?cl=9919#kMove_Verb">kMove Verb</a> to <a href="bmh_SkPath_Reference?cl=9919#Verb_Array">Verb Array</a> and (0, 0) to <a href="bmh_SkPath_Reference?cl=9919#Point_Array">Point Array</a>, if needed. +<a href="bmh_SkPath_Reference?cl=9919#rLineTo">rLineTo</a> then appends <a href="bmh_SkPath_Reference?cl=9919#kLine_Verb">kLine Verb</a> to <a href="bmh_SkPath_Reference?cl=9919#Verb_Array">Verb Array</a> and <a href="bmh_undocumented?cl=9919#Line">Line</a> end to <a href="bmh_SkPath_Reference?cl=9919#Point_Array">Point Array</a>. +<a href="bmh_undocumented?cl=9919#Line">Line</a> end is <a href="bmh_SkPath_Reference?cl=9919#Last_Point">Last Point</a> plus <a href="bmh_undocumented?cl=9919#Vector">Vector</a> (<a href="bmh_SkPath_Reference?cl=9919#dx">dx</a>, <a href="bmh_SkPath_Reference?cl=9919#dy">dy</a>). +<a href="bmh_SkPath_Reference?cl=9919#rLineTo">rLineTo</a> stands for relative line to. + +### Parameters + +<table> <tr> <td><code><strong>dx </strong></code></td> <td> +offset from <a href="bmh_SkPath_Reference?cl=9919#Last_Point">Last Point</a> x to <a href="bmh_undocumented?cl=9919#Line">Line</a> end x.</td> + </tr> <tr> <td><code><strong>dy </strong></code></td> <td> +offset from <a href="bmh_SkPath_Reference?cl=9919#Last_Point">Last Point</a> y to <a href="bmh_undocumented?cl=9919#Line">Line</a> end y.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="6e0be0766b8ca320da51640326e608b3"></fiddle-embed></div> + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a> <a href="bmh_SkPath_Reference?cl=9919#moveTo">moveTo</a> <a href="bmh_SkPath_Reference?cl=9919#lineTo">lineTo</a> <a href="bmh_SkPath_Reference?cl=9919#addRect">addRect</a> + +--- + +# <a name="Quad"></a> Quad +<a href="bmh_SkPath_Reference?cl=9919#Quad">Quad</a> describes a quadratic <a href="bmh_undocumented?cl=9919#Bezier">Bezier</a>, a second-order curve identical to a section +of a parabola. <a href="bmh_SkPath_Reference?cl=9919#Quad">Quad</a> begins at a start <a href="bmh_undocumented?cl=9919#Point">Point</a>, curves towards a control <a href="bmh_undocumented?cl=9919#Point">Point</a>, +and then curves to an end <a href="bmh_undocumented?cl=9919#Point">Point</a>. + +### Example + +<div><fiddle-embed name="78ad51fa1cd33eb84a6f99061e56e067"></fiddle-embed></div> + +<a href="bmh_SkPath_Reference?cl=9919#Quad">Quad</a> is a special case of <a href="bmh_SkPath_Reference?cl=9919#Conic">Conic</a> where <a href="bmh_SkPath_Reference?cl=9919#Conic_Weight">Conic Weight</a> is set to one. + +<a href="bmh_SkPath_Reference?cl=9919#Quad">Quad</a> is always contained by the triangle connecting its three <a href="bmh_undocumented?cl=9919#Point">Points</a>. <a href="bmh_SkPath_Reference?cl=9919#Quad">Quad</a> +begins tangent to the line between start <a href="bmh_undocumented?cl=9919#Point">Point</a> and control <a href="bmh_undocumented?cl=9919#Point">Point</a>, and ends +tangent to the line between control <a href="bmh_undocumented?cl=9919#Point">Point</a> and end <a href="bmh_undocumented?cl=9919#Point">Point</a>. + +### Example + +<div><fiddle-embed name="4082f66a42df11bb20462b232b156bb6"></fiddle-embed></div> + +<a name="quadTo"></a> +## quadTo + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void quadTo(SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2) +</pre> + +Adds <a href="bmh_SkPath_Reference?cl=9919#Quad">Quad</a> from <a href="bmh_SkPath_Reference?cl=9919#Last_Point">Last Point</a> towards (<a href="bmh_SkPath_Reference?cl=9919#x1">x1</a>, <a href="bmh_SkPath_Reference?cl=9919#y1">y1</a>), to (<a href="bmh_SkPath_Reference?cl=9919#x2">x2</a>, <a href="bmh_SkPath_Reference?cl=9919#y2">y2</a>). +If <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> is empty, or last <a href="bmh_SkPath_Reference?cl=9919#Verb">Verb</a> is <a href="bmh_SkPath_Reference?cl=9919#kClose_Verb">kClose Verb</a>, <a href="bmh_SkPath_Reference?cl=9919#Last_Point">Last Point</a> is set to (0, 0) +before adding <a href="bmh_SkPath_Reference?cl=9919#Quad">Quad</a>. + +<a href="bmh_SkPath_Reference?cl=9919#quadTo">quadTo</a> appends <a href="bmh_SkPath_Reference?cl=9919#kMove_Verb">kMove Verb</a> to <a href="bmh_SkPath_Reference?cl=9919#Verb_Array">Verb Array</a> and (0, 0) to <a href="bmh_SkPath_Reference?cl=9919#Point_Array">Point Array</a>, if needed. +<a href="bmh_SkPath_Reference?cl=9919#quadTo">quadTo</a> then appends <a href="bmh_SkPath_Reference?cl=9919#kQuad_Verb">kQuad Verb</a> to <a href="bmh_SkPath_Reference?cl=9919#Verb_Array">Verb Array</a>; and (<a href="bmh_SkPath_Reference?cl=9919#x1">x1</a>, <a href="bmh_SkPath_Reference?cl=9919#y1">y1</a>), (<a href="bmh_SkPath_Reference?cl=9919#x2">x2</a>, <a href="bmh_SkPath_Reference?cl=9919#y2">y2</a>) +to <a href="bmh_SkPath_Reference?cl=9919#Point_Array">Point Array</a>. + +### Parameters + +<table> <tr> <td><code><strong>x1 </strong></code></td> <td> +control <a href="bmh_undocumented?cl=9919#Point">Point</a> of <a href="bmh_SkPath_Reference?cl=9919#Quad">Quad</a> in x.</td> + </tr> <tr> <td><code><strong>y1 </strong></code></td> <td> +control <a href="bmh_undocumented?cl=9919#Point">Point</a> of <a href="bmh_SkPath_Reference?cl=9919#Quad">Quad</a> in y.</td> + </tr> <tr> <td><code><strong>x2 </strong></code></td> <td> +end <a href="bmh_undocumented?cl=9919#Point">Point</a> of <a href="bmh_SkPath_Reference?cl=9919#Quad">Quad</a> in x.</td> + </tr> <tr> <td><code><strong>y2 </strong></code></td> <td> +end <a href="bmh_undocumented?cl=9919#Point">Point</a> of <a href="bmh_SkPath_Reference?cl=9919#Quad">Quad</a> in y.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="60ee3eb747474f5781b0f0dd3a17a866"></fiddle-embed></div> + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a> <a href="bmh_SkPath_Reference?cl=9919#moveTo">moveTo</a> <a href="bmh_SkPath_Reference?cl=9919#conicTo">conicTo</a> <a href="bmh_SkPath_Reference?cl=9919#rQuadTo">rQuadTo</a> + +--- + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void quadTo(const SkPoint& p1, const SkPoint& p2) +</pre> + +Adds <a href="bmh_SkPath_Reference?cl=9919#Quad">Quad</a> from <a href="bmh_SkPath_Reference?cl=9919#Last_Point">Last Point</a> towards <a href="bmh_undocumented?cl=9919#Point">Point</a> <a href="bmh_SkPath_Reference?cl=9919#p1">p1</a>, to <a href="bmh_undocumented?cl=9919#Point">Point</a> <a href="bmh_SkPath_Reference?cl=9919#p2">p2</a>. +If <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> is empty, or last <a href="bmh_SkPath_Reference?cl=9919#Verb">Verb</a> is <a href="bmh_SkPath_Reference?cl=9919#kClose_Verb">kClose Verb</a>, <a href="bmh_SkPath_Reference?cl=9919#Last_Point">Last Point</a> is set to (0, 0) +before adding <a href="bmh_SkPath_Reference?cl=9919#Quad">Quad</a>. + +<a href="bmh_SkPath_Reference?cl=9919#quadTo">quadTo</a> appends <a href="bmh_SkPath_Reference?cl=9919#kMove_Verb">kMove Verb</a> to <a href="bmh_SkPath_Reference?cl=9919#Verb_Array">Verb Array</a> and (0, 0) to <a href="bmh_SkPath_Reference?cl=9919#Point_Array">Point Array</a>, if needed. +<a href="bmh_SkPath_Reference?cl=9919#quadTo">quadTo</a> then appends <a href="bmh_SkPath_Reference?cl=9919#kQuad_Verb">kQuad Verb</a> to <a href="bmh_SkPath_Reference?cl=9919#Verb_Array">Verb Array</a>; and <a href="bmh_undocumented?cl=9919#Point">Points</a> <a href="bmh_SkPath_Reference?cl=9919#p1">p1</a>, <a href="bmh_SkPath_Reference?cl=9919#p2">p2</a> +to <a href="bmh_SkPath_Reference?cl=9919#Point_Array">Point Array</a>. + +### Parameters + +<table> <tr> <td><code><strong>p1 </strong></code></td> <td> +control <a href="bmh_undocumented?cl=9919#Point">Point</a> of added <a href="bmh_SkPath_Reference?cl=9919#Quad">Quad</a>.</td> + </tr> <tr> <td><code><strong>p2 </strong></code></td> <td> +end <a href="bmh_undocumented?cl=9919#Point">Point</a> of added <a href="bmh_SkPath_Reference?cl=9919#Quad">Quad</a>.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="82621c4df8da1e589d9e627494067826"></fiddle-embed></div> + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a> <a href="bmh_SkPath_Reference?cl=9919#moveTo">moveTo</a> <a href="bmh_SkPath_Reference?cl=9919#conicTo">conicTo</a> <a href="bmh_SkPath_Reference?cl=9919#rQuadTo">rQuadTo</a> + +--- + +<a name="rQuadTo"></a> +## rQuadTo + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void rQuadTo(SkScalar dx1, SkScalar dy1, SkScalar dx2, SkScalar dy2) +</pre> + +Adds <a href="bmh_SkPath_Reference?cl=9919#Quad">Quad</a> from <a href="bmh_SkPath_Reference?cl=9919#Last_Point">Last Point</a> towards <a href="bmh_undocumented?cl=9919#Vector">Vector</a> (<a href="bmh_SkPath_Reference?cl=9919#dx1">dx1</a>, <a href="bmh_SkPath_Reference?cl=9919#dy1">dy1</a>), to <a href="bmh_undocumented?cl=9919#Vector">Vector</a> (<a href="bmh_SkPath_Reference?cl=9919#dx2">dx2</a>, <a href="bmh_SkPath_Reference?cl=9919#dy2">dy2</a>). +If <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> is empty, or last <a href="bmh_SkPath_Reference?cl=9919#Verb">Verb</a> +is <a href="bmh_SkPath_Reference?cl=9919#kClose_Verb">kClose Verb</a>, <a href="bmh_SkPath_Reference?cl=9919#Last_Point">Last Point</a> is set to (0, 0) before adding <a href="bmh_SkPath_Reference?cl=9919#Quad">Quad</a>. + +<a href="bmh_SkPath_Reference?cl=9919#rQuadTo">rQuadTo</a> first appends <a href="bmh_SkPath_Reference?cl=9919#kMove_Verb">kMove Verb</a> to <a href="bmh_SkPath_Reference?cl=9919#Verb_Array">Verb Array</a> and (0, 0) to <a href="bmh_SkPath_Reference?cl=9919#Point_Array">Point Array</a>, +if needed. <a href="bmh_SkPath_Reference?cl=9919#rQuadTo">rQuadTo</a> then appends <a href="bmh_SkPath_Reference?cl=9919#kQuad_Verb">kQuad Verb</a> to <a href="bmh_SkPath_Reference?cl=9919#Verb_Array">Verb Array</a>; and appends <a href="bmh_SkPath_Reference?cl=9919#Quad">Quad</a> +control and <a href="bmh_SkPath_Reference?cl=9919#Quad">Quad</a> end to <a href="bmh_SkPath_Reference?cl=9919#Point_Array">Point Array</a>. +<a href="bmh_SkPath_Reference?cl=9919#Quad">Quad</a> control is <a href="bmh_SkPath_Reference?cl=9919#Last_Point">Last Point</a> plus <a href="bmh_undocumented?cl=9919#Vector">Vector</a> (<a href="bmh_SkPath_Reference?cl=9919#dx1">dx1</a>, <a href="bmh_SkPath_Reference?cl=9919#dy1">dy1</a>). +<a href="bmh_SkPath_Reference?cl=9919#Quad">Quad</a> end is <a href="bmh_SkPath_Reference?cl=9919#Last_Point">Last Point</a> plus <a href="bmh_undocumented?cl=9919#Vector">Vector</a> (<a href="bmh_SkPath_Reference?cl=9919#dx2">dx2</a>, <a href="bmh_SkPath_Reference?cl=9919#dy2">dy2</a>). +<a href="bmh_SkPath_Reference?cl=9919#rQuadTo">rQuadTo</a> stands for relative quad to. + +### Parameters + +<table> <tr> <td><code><strong>dx1 </strong></code></td> <td> +offset from <a href="bmh_SkPath_Reference?cl=9919#Last_Point">Last Point</a> x to <a href="bmh_SkPath_Reference?cl=9919#Quad">Quad</a> control x.</td> + </tr> <tr> <td><code><strong>dy1 </strong></code></td> <td> +offset from <a href="bmh_SkPath_Reference?cl=9919#Last_Point">Last Point</a> x to <a href="bmh_SkPath_Reference?cl=9919#Quad">Quad</a> control y.</td> + </tr> <tr> <td><code><strong>dx2 </strong></code></td> <td> +offset from <a href="bmh_SkPath_Reference?cl=9919#Last_Point">Last Point</a> x to <a href="bmh_SkPath_Reference?cl=9919#Quad">Quad</a> end x.</td> + </tr> <tr> <td><code><strong>dy2 </strong></code></td> <td> +offset from <a href="bmh_SkPath_Reference?cl=9919#Last_Point">Last Point</a> x to <a href="bmh_SkPath_Reference?cl=9919#Quad">Quad</a> end y.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="1c1f4cdef1c572c9aa8fdf3e461191d0"></fiddle-embed></div> + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a> <a href="bmh_SkPath_Reference?cl=9919#moveTo">moveTo</a> <a href="bmh_SkPath_Reference?cl=9919#conicTo">conicTo</a> <a href="bmh_SkPath_Reference?cl=9919#quadTo">quadTo</a> + +--- + +# <a name="Conic"></a> Conic +<a href="bmh_SkPath_Reference?cl=9919#Conic">Conic</a> describes a conical section: a piece of an ellipse, or a piece of a +parabola, or a piece of a hyperbola. <a href="bmh_SkPath_Reference?cl=9919#Conic">Conic</a> begins at a start <a href="bmh_undocumented?cl=9919#Point">Point</a>, +curves towards a control <a href="bmh_undocumented?cl=9919#Point">Point</a>, and then curves to an end <a href="bmh_undocumented?cl=9919#Point">Point</a>. The influence +of the control <a href="bmh_undocumented?cl=9919#Point">Point</a> is determined by <a href="bmh_SkPath_Reference?cl=9919#Conic_Weight">Conic Weight</a>. + +Each <a href="bmh_SkPath_Reference?cl=9919#Conic">Conic</a> in <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> adds two <a href="bmh_undocumented?cl=9919#Point">Points</a> and one Weight. <a href="bmh_SkPath_Reference?cl=9919#Weight">Weights</a> in <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> may be +inspected with <a href="bmh_SkPath_Reference?cl=9919#Iter">Iter</a>, or with <a href="bmh_SkPath_Reference?cl=9919#RawIter">RawIter</a>. + +## <a name="Weight"></a> Weight + +<a href="bmh_SkPath_Reference?cl=9919#Conic_Weight">Weight</a> determines both the strength of the control <a href="bmh_undocumented?cl=9919#Point">Point</a> and the type of <a href="bmh_SkPath_Reference?cl=9919#Conic">Conic</a>. +If <a href="bmh_SkPath_Reference?cl=9919#Conic_Weight">Weight</a> is exactly one, then <a href="bmh_SkPath_Reference?cl=9919#Conic">Conic</a> is identical to <a href="bmh_SkPath_Reference?cl=9919#Quad">Quad</a>; it is always a +parabolic segment. + +### Example + +<div><fiddle-embed name="2aadded3d20dfef34d1c8abe28c7bc8d"><div>When <a href="bmh_SkPath_Reference?cl=9919#Conic">Conic</a> weight is one, <a href="bmh_SkPath_Reference?cl=9919#Quad">Quad</a> is added to path; the two are identical.</div> + +#### Example Output + +~~~~ +move {0, 0}, +quad {0, 0}, {20, 30}, {50, 60}, +done +~~~~ + +</fiddle-embed></div> + +If weight is less than one, <a href="bmh_SkPath_Reference?cl=9919#Conic">Conic</a> is an elliptical segment. + +### Example + +<div><fiddle-embed name="e88f554efacfa9f75f270fb1c0add5b4"><div>A 90 degree circular arc has the weight1 / sqrt(2).</div> + +#### Example Output + +~~~~ +move {0, 0}, +conic {0, 0}, {20, 0}, {20, 20}, weight = 0.707107 +done +~~~~ + +</fiddle-embed></div> + +If weight is greater than one, <a href="bmh_SkPath_Reference?cl=9919#Conic">Conic</a> is a hyperbolic segment. As w gets large, +a hyperbolic segment can be approximated by straight lines connecting the +control <a href="bmh_undocumented?cl=9919#Point">Point</a> with the end <a href="bmh_undocumented?cl=9919#Point">Points</a>. + +### Example + +<div><fiddle-embed name="6fb11419e99297fe2fe666c296117fb9"> + +#### Example Output + +~~~~ +move {0, 0}, +line {0, 0}, {20, 0}, +line {20, 0}, {20, 20}, +done +~~~~ + +</fiddle-embed></div> + +<a name="conicTo"></a> +## conicTo + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void conicTo(SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2, SkScalar w) +</pre> + +Adds <a href="bmh_SkPath_Reference?cl=9919#Conic">Conic</a> from <a href="bmh_SkPath_Reference?cl=9919#Last_Point">Last Point</a> towards (<a href="bmh_SkPath_Reference?cl=9919#x1">x1</a>, <a href="bmh_SkPath_Reference?cl=9919#y1">y1</a>), to (<a href="bmh_SkPath_Reference?cl=9919#x2">x2</a>, <a href="bmh_SkPath_Reference?cl=9919#y2">y2</a>), weighted by <a href="bmh_SkPath_Reference?cl=9919#w">w</a>. +If <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> is empty, or last <a href="bmh_SkPath_Reference?cl=9919#Verb">Verb</a> is <a href="bmh_SkPath_Reference?cl=9919#kClose_Verb">kClose Verb</a>, <a href="bmh_SkPath_Reference?cl=9919#Last_Point">Last Point</a> is set to (0, 0) +before adding <a href="bmh_SkPath_Reference?cl=9919#Conic">Conic</a>. + +<a href="bmh_SkPath_Reference?cl=9919#conicTo">conicTo</a> appends <a href="bmh_SkPath_Reference?cl=9919#kMove_Verb">kMove Verb</a> to <a href="bmh_SkPath_Reference?cl=9919#Verb_Array">Verb Array</a> and (0, 0) to <a href="bmh_SkPath_Reference?cl=9919#Point_Array">Point Array</a>, if needed. + +If <a href="bmh_SkPath_Reference?cl=9919#w">w</a> is finite and not one, <a href="bmh_SkPath_Reference?cl=9919#conicTo">conicTo</a> then appends <a href="bmh_SkPath_Reference?cl=9919#kConic_Verb">kConic Verb</a> to <a href="bmh_SkPath_Reference?cl=9919#Verb_Array">Verb Array</a>; +and (<a href="bmh_SkPath_Reference?cl=9919#x1">x1</a>, <a href="bmh_SkPath_Reference?cl=9919#y1">y1</a>), (<a href="bmh_SkPath_Reference?cl=9919#x2">x2</a>, <a href="bmh_SkPath_Reference?cl=9919#y2">y2</a>) to <a href="bmh_SkPath_Reference?cl=9919#Point_Array">Point Array</a>; and <a href="bmh_SkPath_Reference?cl=9919#w">w</a> to <a href="bmh_SkPath_Reference?cl=9919#Weight">Weights</a>. + +If <a href="bmh_SkPath_Reference?cl=9919#w">w</a> is one, <a href="bmh_SkPath_Reference?cl=9919#conicTo">conicTo</a> appends <a href="bmh_SkPath_Reference?cl=9919#kQuad_Verb">kQuad Verb</a> to <a href="bmh_SkPath_Reference?cl=9919#Verb_Array">Verb Array</a>, and +(<a href="bmh_SkPath_Reference?cl=9919#x1">x1</a>, <a href="bmh_SkPath_Reference?cl=9919#y1">y1</a>), (<a href="bmh_SkPath_Reference?cl=9919#x2">x2</a>, <a href="bmh_SkPath_Reference?cl=9919#y2">y2</a>) to <a href="bmh_SkPath_Reference?cl=9919#Point_Array">Point Array</a>. + +If <a href="bmh_SkPath_Reference?cl=9919#w">w</a> is not finite, <a href="bmh_SkPath_Reference?cl=9919#conicTo">conicTo</a> appends <a href="bmh_SkPath_Reference?cl=9919#kLine_Verb">kLine Verb</a> twice to <a href="bmh_SkPath_Reference?cl=9919#Verb_Array">Verb Array</a>, and +(<a href="bmh_SkPath_Reference?cl=9919#x1">x1</a>, <a href="bmh_SkPath_Reference?cl=9919#y1">y1</a>), (<a href="bmh_SkPath_Reference?cl=9919#x2">x2</a>, <a href="bmh_SkPath_Reference?cl=9919#y2">y2</a>) to <a href="bmh_SkPath_Reference?cl=9919#Point_Array">Point Array</a>. + +### Parameters + +<table> <tr> <td><code><strong>x1 </strong></code></td> <td> +control <a href="bmh_undocumented?cl=9919#Point">Point</a> of <a href="bmh_SkPath_Reference?cl=9919#Conic">Conic</a> in x.</td> + </tr> <tr> <td><code><strong>y1 </strong></code></td> <td> +control <a href="bmh_undocumented?cl=9919#Point">Point</a> of <a href="bmh_SkPath_Reference?cl=9919#Conic">Conic</a> in y.</td> + </tr> <tr> <td><code><strong>x2 </strong></code></td> <td> +end <a href="bmh_undocumented?cl=9919#Point">Point</a> of <a href="bmh_SkPath_Reference?cl=9919#Conic">Conic</a> in x.</td> + </tr> <tr> <td><code><strong>y2 </strong></code></td> <td> +end <a href="bmh_undocumented?cl=9919#Point">Point</a> of <a href="bmh_SkPath_Reference?cl=9919#Conic">Conic</a> in y.</td> + </tr> <tr> <td><code><strong>w </strong></code></td> <td> +weight of added <a href="bmh_SkPath_Reference?cl=9919#Conic">Conic</a>.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="358d9b6060b528b0923c007420f09c13"><div>As weight increases, curve is pulled towards control point. +The bottom two curves are elliptical; the next is parabolic; the +top curve is hyperbolic.</div></fiddle-embed></div> + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#rConicTo">rConicTo</a> <a href="bmh_SkPath_Reference?cl=9919#arcTo">arcTo</a> <a href="bmh_SkPath_Reference?cl=9919#addArc">addArc</a> <a href="bmh_SkPath_Reference?cl=9919#quadTo">quadTo</a> + +--- + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void conicTo(const SkPoint& p1, const SkPoint& p2, SkScalar w) +</pre> + +Adds <a href="bmh_SkPath_Reference?cl=9919#Conic">Conic</a> from <a href="bmh_SkPath_Reference?cl=9919#Last_Point">Last Point</a> towards <a href="bmh_undocumented?cl=9919#Point">Point</a> <a href="bmh_SkPath_Reference?cl=9919#p1">p1</a>, to <a href="bmh_undocumented?cl=9919#Point">Point</a> <a href="bmh_SkPath_Reference?cl=9919#p2">p2</a>, weighted by <a href="bmh_SkPath_Reference?cl=9919#w">w</a>. +If <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> is empty, or last <a href="bmh_SkPath_Reference?cl=9919#Verb">Verb</a> is <a href="bmh_SkPath_Reference?cl=9919#kClose_Verb">kClose Verb</a>, <a href="bmh_SkPath_Reference?cl=9919#Last_Point">Last Point</a> is set to (0, 0) +before adding <a href="bmh_SkPath_Reference?cl=9919#Conic">Conic</a>. + +<a href="bmh_SkPath_Reference?cl=9919#conicTo">conicTo</a> appends <a href="bmh_SkPath_Reference?cl=9919#kMove_Verb">kMove Verb</a> to <a href="bmh_SkPath_Reference?cl=9919#Verb_Array">Verb Array</a> and (0, 0) to <a href="bmh_SkPath_Reference?cl=9919#Point_Array">Point Array</a>, if needed. + +If <a href="bmh_SkPath_Reference?cl=9919#w">w</a> is finite and not one, <a href="bmh_SkPath_Reference?cl=9919#conicTo">conicTo</a> then appends <a href="bmh_SkPath_Reference?cl=9919#kConic_Verb">kConic Verb</a> to <a href="bmh_SkPath_Reference?cl=9919#Verb_Array">Verb Array</a>; +and <a href="bmh_undocumented?cl=9919#Point">Points</a> <a href="bmh_SkPath_Reference?cl=9919#p1">p1</a>, <a href="bmh_SkPath_Reference?cl=9919#p2">p2</a> to <a href="bmh_SkPath_Reference?cl=9919#Point_Array">Point Array</a>; and <a href="bmh_SkPath_Reference?cl=9919#w">w</a> to <a href="bmh_SkPath_Reference?cl=9919#Weight">Weights</a>. + +If <a href="bmh_SkPath_Reference?cl=9919#w">w</a> is one, <a href="bmh_SkPath_Reference?cl=9919#conicTo">conicTo</a> appends <a href="bmh_SkPath_Reference?cl=9919#kQuad_Verb">kQuad Verb</a> to <a href="bmh_SkPath_Reference?cl=9919#Verb_Array">Verb Array</a>, and <a href="bmh_undocumented?cl=9919#Point">Points</a> <a href="bmh_SkPath_Reference?cl=9919#p1">p1</a>, <a href="bmh_SkPath_Reference?cl=9919#p2">p2</a> +to <a href="bmh_SkPath_Reference?cl=9919#Point_Array">Point Array</a>. + +If <a href="bmh_SkPath_Reference?cl=9919#w">w</a> is not finite, <a href="bmh_SkPath_Reference?cl=9919#conicTo">conicTo</a> appends <a href="bmh_SkPath_Reference?cl=9919#kLine_Verb">kLine Verb</a> twice to <a href="bmh_SkPath_Reference?cl=9919#Verb_Array">Verb Array</a>, and +<a href="bmh_undocumented?cl=9919#Point">Points</a> <a href="bmh_SkPath_Reference?cl=9919#p1">p1</a>, <a href="bmh_SkPath_Reference?cl=9919#p2">p2</a> to <a href="bmh_SkPath_Reference?cl=9919#Point_Array">Point Array</a>. + +### Parameters + +<table> <tr> <td><code><strong>p1 </strong></code></td> <td> +control <a href="bmh_undocumented?cl=9919#Point">Point</a> of added <a href="bmh_SkPath_Reference?cl=9919#Conic">Conic</a>.</td> + </tr> <tr> <td><code><strong>p2 </strong></code></td> <td> +end <a href="bmh_undocumented?cl=9919#Point">Point</a> of added <a href="bmh_SkPath_Reference?cl=9919#Conic">Conic</a>.</td> + </tr> <tr> <td><code><strong>w </strong></code></td> <td> +weight of added <a href="bmh_SkPath_Reference?cl=9919#Conic">Conic</a>.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="22d25e03b19d5bae92118877e462361b"><div><a href="bmh_SkPath_Reference?cl=9919#Conic">Conics</a> and arcs use identical representations. As the arc sweep increases +the conic weight also increases, but remains smaller than one.</div></fiddle-embed></div> + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#rConicTo">rConicTo</a> <a href="bmh_SkPath_Reference?cl=9919#arcTo">arcTo</a> <a href="bmh_SkPath_Reference?cl=9919#addArc">addArc</a> <a href="bmh_SkPath_Reference?cl=9919#quadTo">quadTo</a> + +--- + +<a name="rConicTo"></a> +## rConicTo + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void rConicTo(SkScalar dx1, SkScalar dy1, SkScalar dx2, SkScalar dy2, SkScalar w) +</pre> + +Adds <a href="bmh_SkPath_Reference?cl=9919#Conic">Conic</a> from <a href="bmh_SkPath_Reference?cl=9919#Last_Point">Last Point</a> towards <a href="bmh_undocumented?cl=9919#Vector">Vector</a> (<a href="bmh_SkPath_Reference?cl=9919#dx1">dx1</a>, <a href="bmh_SkPath_Reference?cl=9919#dy1">dy1</a>), to <a href="bmh_undocumented?cl=9919#Vector">Vector</a> (<a href="bmh_SkPath_Reference?cl=9919#dx2">dx2</a>, <a href="bmh_SkPath_Reference?cl=9919#dy2">dy2</a>), +weighted by <a href="bmh_SkPath_Reference?cl=9919#w">w</a>. If <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> is empty, or last <a href="bmh_SkPath_Reference?cl=9919#Verb">Verb</a> +is <a href="bmh_SkPath_Reference?cl=9919#kClose_Verb">kClose Verb</a>, <a href="bmh_SkPath_Reference?cl=9919#Last_Point">Last Point</a> is set to (0, 0) before adding <a href="bmh_SkPath_Reference?cl=9919#Conic">Conic</a>. + +<a href="bmh_SkPath_Reference?cl=9919#rConicTo">rConicTo</a> first appends <a href="bmh_SkPath_Reference?cl=9919#kMove_Verb">kMove Verb</a> to <a href="bmh_SkPath_Reference?cl=9919#Verb_Array">Verb Array</a> and (0, 0) to <a href="bmh_SkPath_Reference?cl=9919#Point_Array">Point Array</a>, +if needed. +If <a href="bmh_SkPath_Reference?cl=9919#w">w</a> is finite and not one, <a href="bmh_SkPath_Reference?cl=9919#rConicTo">rConicTo</a> then appends <a href="bmh_SkPath_Reference?cl=9919#kConic_Verb">kConic Verb</a> to <a href="bmh_SkPath_Reference?cl=9919#Verb_Array">Verb Array</a>, +and <a href="bmh_SkPath_Reference?cl=9919#w">w</a> is recorded as <a href="bmh_SkPath_Reference?cl=9919#Conic_Weight">Conic Weight</a>; otherwise, if <a href="bmh_SkPath_Reference?cl=9919#w">w</a> is one, <a href="bmh_SkPath_Reference?cl=9919#rConicTo">rConicTo</a> appends +<a href="bmh_SkPath_Reference?cl=9919#kQuad_Verb">kQuad Verb</a> to <a href="bmh_SkPath_Reference?cl=9919#Verb_Array">Verb Array</a>; or if <a href="bmh_SkPath_Reference?cl=9919#w">w</a> is not finite, <a href="bmh_SkPath_Reference?cl=9919#rConicTo">rConicTo</a> appends <a href="bmh_SkPath_Reference?cl=9919#kLine_Verb">kLine Verb</a> +twice to <a href="bmh_SkPath_Reference?cl=9919#Verb_Array">Verb Array</a>. + +In all cases <a href="bmh_SkPath_Reference?cl=9919#rConicTo">rConicTo</a> then appends <a href="bmh_undocumented?cl=9919#Point">Points</a> control and end to <a href="bmh_SkPath_Reference?cl=9919#Point_Array">Point Array</a>. +control is <a href="bmh_SkPath_Reference?cl=9919#Last_Point">Last Point</a> plus <a href="bmh_undocumented?cl=9919#Vector">Vector</a> (<a href="bmh_SkPath_Reference?cl=9919#dx1">dx1</a>, <a href="bmh_SkPath_Reference?cl=9919#dy1">dy1</a>). +end is <a href="bmh_SkPath_Reference?cl=9919#Last_Point">Last Point</a> plus <a href="bmh_undocumented?cl=9919#Vector">Vector</a> (<a href="bmh_SkPath_Reference?cl=9919#dx2">dx2</a>, <a href="bmh_SkPath_Reference?cl=9919#dy2">dy2</a>). + +<a href="bmh_SkPath_Reference?cl=9919#rConicTo">rConicTo</a> stands for relative conic to. + +### Parameters + +<table> <tr> <td><code><strong>dx1 </strong></code></td> <td> +offset from <a href="bmh_SkPath_Reference?cl=9919#Last_Point">Last Point</a> x to <a href="bmh_SkPath_Reference?cl=9919#Conic">Conic</a> control x.</td> + </tr> <tr> <td><code><strong>dy1 </strong></code></td> <td> +offset from <a href="bmh_SkPath_Reference?cl=9919#Last_Point">Last Point</a> x to <a href="bmh_SkPath_Reference?cl=9919#Conic">Conic</a> control y.</td> + </tr> <tr> <td><code><strong>dx2 </strong></code></td> <td> +offset from <a href="bmh_SkPath_Reference?cl=9919#Last_Point">Last Point</a> x to <a href="bmh_SkPath_Reference?cl=9919#Conic">Conic</a> end x.</td> + </tr> <tr> <td><code><strong>dy2 </strong></code></td> <td> +offset from <a href="bmh_SkPath_Reference?cl=9919#Last_Point">Last Point</a> x to <a href="bmh_SkPath_Reference?cl=9919#Conic">Conic</a> end y.</td> + </tr> <tr> <td><code><strong>w </strong></code></td> <td> +weight of added <a href="bmh_SkPath_Reference?cl=9919#Conic">Conic</a>.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="3d52763e7c0e20c0b1d484a0afa622d2"></fiddle-embed></div> + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#conicTo">conicTo</a> <a href="bmh_SkPath_Reference?cl=9919#arcTo">arcTo</a> <a href="bmh_SkPath_Reference?cl=9919#addArc">addArc</a> <a href="bmh_SkPath_Reference?cl=9919#quadTo">quadTo</a> + +--- + +# <a name="Cubic"></a> Cubic +<a href="bmh_SkPath_Reference?cl=9919#Cubic">Cubic</a> describes a cubic <a href="bmh_undocumented?cl=9919#Bezier">Bezier</a>, a third-order curve. +<a href="bmh_SkPath_Reference?cl=9919#Cubic">Cubic</a> begins at a start <a href="bmh_undocumented?cl=9919#Point">Point</a>, curving towards the first control <a href="bmh_undocumented?cl=9919#Point">Point</a>; +and curves from the end <a href="bmh_undocumented?cl=9919#Point">Point</a> towards the second control <a href="bmh_undocumented?cl=9919#Point">Point</a>. + +### Example + +<div><fiddle-embed name="466445ed991d86de08587066392d654a"></fiddle-embed></div> + +<a name="cubicTo"></a> +## cubicTo + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void cubicTo(SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2, SkScalar x3, + SkScalar y3) +</pre> + +Adds <a href="bmh_SkPath_Reference?cl=9919#Cubic">Cubic</a> from <a href="bmh_SkPath_Reference?cl=9919#Last_Point">Last Point</a> towards (<a href="bmh_SkPath_Reference?cl=9919#x1">x1</a>, <a href="bmh_SkPath_Reference?cl=9919#y1">y1</a>), then towards (<a href="bmh_SkPath_Reference?cl=9919#x2">x2</a>, <a href="bmh_SkPath_Reference?cl=9919#y2">y2</a>), ending at +(<a href="bmh_SkPath_Reference?cl=9919#x3">x3</a>, <a href="bmh_SkPath_Reference?cl=9919#y3">y3</a>). If <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> is empty, or last <a href="bmh_SkPath_Reference?cl=9919#Verb">Verb</a> is <a href="bmh_SkPath_Reference?cl=9919#kClose_Verb">kClose Verb</a>, <a href="bmh_SkPath_Reference?cl=9919#Last_Point">Last Point</a> is set to +(0, 0) before adding <a href="bmh_SkPath_Reference?cl=9919#Cubic">Cubic</a>. + +<a href="bmh_SkPath_Reference?cl=9919#cubicTo">cubicTo</a> appends <a href="bmh_SkPath_Reference?cl=9919#kMove_Verb">kMove Verb</a> to <a href="bmh_SkPath_Reference?cl=9919#Verb_Array">Verb Array</a> and (0, 0) to <a href="bmh_SkPath_Reference?cl=9919#Point_Array">Point Array</a>, if needed. +<a href="bmh_SkPath_Reference?cl=9919#cubicTo">cubicTo</a> then appends <a href="bmh_SkPath_Reference?cl=9919#kCubic_Verb">kCubic Verb</a> to <a href="bmh_SkPath_Reference?cl=9919#Verb_Array">Verb Array</a>; and (<a href="bmh_SkPath_Reference?cl=9919#x1">x1</a>, <a href="bmh_SkPath_Reference?cl=9919#y1">y1</a>), (<a href="bmh_SkPath_Reference?cl=9919#x2">x2</a>, <a href="bmh_SkPath_Reference?cl=9919#y2">y2</a>), (<a href="bmh_SkPath_Reference?cl=9919#x3">x3</a>, <a href="bmh_SkPath_Reference?cl=9919#y3">y3</a>) +to <a href="bmh_SkPath_Reference?cl=9919#Point_Array">Point Array</a>. + +### Parameters + +<table> <tr> <td><code><strong>x1 </strong></code></td> <td> +first control <a href="bmh_undocumented?cl=9919#Point">Point</a> of <a href="bmh_SkPath_Reference?cl=9919#Cubic">Cubic</a> in x.</td> + </tr> <tr> <td><code><strong>y1 </strong></code></td> <td> +first control <a href="bmh_undocumented?cl=9919#Point">Point</a> of <a href="bmh_SkPath_Reference?cl=9919#Cubic">Cubic</a> in y.</td> + </tr> <tr> <td><code><strong>x2 </strong></code></td> <td> +second control <a href="bmh_undocumented?cl=9919#Point">Point</a> of <a href="bmh_SkPath_Reference?cl=9919#Cubic">Cubic</a> in x.</td> + </tr> <tr> <td><code><strong>y2 </strong></code></td> <td> +second control <a href="bmh_undocumented?cl=9919#Point">Point</a> of <a href="bmh_SkPath_Reference?cl=9919#Cubic">Cubic</a> in y.</td> + </tr> <tr> <td><code><strong>x3 </strong></code></td> <td> +end <a href="bmh_undocumented?cl=9919#Point">Point</a> of <a href="bmh_SkPath_Reference?cl=9919#Cubic">Cubic</a> in x.</td> + </tr> <tr> <td><code><strong>y3 </strong></code></td> <td> +end <a href="bmh_undocumented?cl=9919#Point">Point</a> of <a href="bmh_SkPath_Reference?cl=9919#Cubic">Cubic</a> in y.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="3e476378e3e0550ab134bbaf61112d98"></fiddle-embed></div> + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a> <a href="bmh_SkPath_Reference?cl=9919#moveTo">moveTo</a> <a href="bmh_SkPath_Reference?cl=9919#rCubicTo">rCubicTo</a> <a href="bmh_SkPath_Reference?cl=9919#quadTo">quadTo</a> + +--- + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void cubicTo(const SkPoint& p1, const SkPoint& p2, const SkPoint& p3) +</pre> + +Adds <a href="bmh_SkPath_Reference?cl=9919#Cubic">Cubic</a> from <a href="bmh_SkPath_Reference?cl=9919#Last_Point">Last Point</a> towards <a href="bmh_undocumented?cl=9919#Point">Point</a> <a href="bmh_SkPath_Reference?cl=9919#p1">p1</a>, then towards <a href="bmh_undocumented?cl=9919#Point">Point</a> <a href="bmh_SkPath_Reference?cl=9919#p2">p2</a>, ending at +<a href="bmh_undocumented?cl=9919#Point">Point</a> <a href="bmh_SkPath_Reference?cl=9919#p3">p3</a>. If <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> is empty, or last <a href="bmh_SkPath_Reference?cl=9919#Verb">Verb</a> is <a href="bmh_SkPath_Reference?cl=9919#kClose_Verb">kClose Verb</a>, <a href="bmh_SkPath_Reference?cl=9919#Last_Point">Last Point</a> is set to +(0, 0) before adding <a href="bmh_SkPath_Reference?cl=9919#Cubic">Cubic</a>. + +<a href="bmh_SkPath_Reference?cl=9919#cubicTo">cubicTo</a> appends <a href="bmh_SkPath_Reference?cl=9919#kMove_Verb">kMove Verb</a> to <a href="bmh_SkPath_Reference?cl=9919#Verb_Array">Verb Array</a> and (0, 0) to <a href="bmh_SkPath_Reference?cl=9919#Point_Array">Point Array</a>, if needed. +<a href="bmh_SkPath_Reference?cl=9919#cubicTo">cubicTo</a> then appends <a href="bmh_SkPath_Reference?cl=9919#kCubic_Verb">kCubic Verb</a> to <a href="bmh_SkPath_Reference?cl=9919#Verb_Array">Verb Array</a>; and <a href="bmh_undocumented?cl=9919#Point">Points</a> <a href="bmh_SkPath_Reference?cl=9919#p1">p1</a>, <a href="bmh_SkPath_Reference?cl=9919#p2">p2</a>, <a href="bmh_SkPath_Reference?cl=9919#p3">p3</a> +to <a href="bmh_SkPath_Reference?cl=9919#Point_Array">Point Array</a>. + +### Parameters + +<table> <tr> <td><code><strong>p1 </strong></code></td> <td> +first control <a href="bmh_undocumented?cl=9919#Point">Point</a> of <a href="bmh_SkPath_Reference?cl=9919#Cubic">Cubic</a>.</td> + </tr> <tr> <td><code><strong>p2 </strong></code></td> <td> +second control <a href="bmh_undocumented?cl=9919#Point">Point</a> of <a href="bmh_SkPath_Reference?cl=9919#Cubic">Cubic</a>.</td> + </tr> <tr> <td><code><strong>p3 </strong></code></td> <td> +end <a href="bmh_undocumented?cl=9919#Point">Point</a> of <a href="bmh_SkPath_Reference?cl=9919#Cubic">Cubic</a>.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="d38aaf12c6ff5b8d901a2201bcee5476"></fiddle-embed></div> + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a> <a href="bmh_SkPath_Reference?cl=9919#moveTo">moveTo</a> <a href="bmh_SkPath_Reference?cl=9919#rCubicTo">rCubicTo</a> <a href="bmh_SkPath_Reference?cl=9919#quadTo">quadTo</a> + +--- + +<a name="rCubicTo"></a> +## rCubicTo + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void rCubicTo(SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2, SkScalar x3, + SkScalar y3) +</pre> + +Adds <a href="bmh_SkPath_Reference?cl=9919#Cubic">Cubic</a> from <a href="bmh_SkPath_Reference?cl=9919#Last_Point">Last Point</a> towards <a href="bmh_undocumented?cl=9919#Vector">Vector</a> (dx1, dy1), then towards +<a href="bmh_undocumented?cl=9919#Vector">Vector</a> (dx2, dy2), to <a href="bmh_undocumented?cl=9919#Vector">Vector</a> (dx3, dy3). +If <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> is empty, or last <a href="bmh_SkPath_Reference?cl=9919#Verb">Verb</a> +is <a href="bmh_SkPath_Reference?cl=9919#kClose_Verb">kClose Verb</a>, <a href="bmh_SkPath_Reference?cl=9919#Last_Point">Last Point</a> is set to (0, 0) before adding <a href="bmh_SkPath_Reference?cl=9919#Cubic">Cubic</a>. + +<a href="bmh_SkPath_Reference?cl=9919#rCubicTo">rCubicTo</a> first appends <a href="bmh_SkPath_Reference?cl=9919#kMove_Verb">kMove Verb</a> to <a href="bmh_SkPath_Reference?cl=9919#Verb_Array">Verb Array</a> and (0, 0) to <a href="bmh_SkPath_Reference?cl=9919#Point_Array">Point Array</a>, +if needed. <a href="bmh_SkPath_Reference?cl=9919#rCubicTo">rCubicTo</a> then appends <a href="bmh_SkPath_Reference?cl=9919#kCubic_Verb">kCubic Verb</a> to <a href="bmh_SkPath_Reference?cl=9919#Verb_Array">Verb Array</a>; and appends <a href="bmh_SkPath_Reference?cl=9919#Cubic">Cubic</a> +control and <a href="bmh_SkPath_Reference?cl=9919#Cubic">Cubic</a> end to <a href="bmh_SkPath_Reference?cl=9919#Point_Array">Point Array</a>. +<a href="bmh_SkPath_Reference?cl=9919#Cubic">Cubic</a> control is <a href="bmh_SkPath_Reference?cl=9919#Last_Point">Last Point</a> plus <a href="bmh_undocumented?cl=9919#Vector">Vector</a> (dx1, dy1). +<a href="bmh_SkPath_Reference?cl=9919#Cubic">Cubic</a> end is <a href="bmh_SkPath_Reference?cl=9919#Last_Point">Last Point</a> plus <a href="bmh_undocumented?cl=9919#Vector">Vector</a> (dx2, dy2). +<a href="bmh_SkPath_Reference?cl=9919#rCubicTo">rCubicTo</a> stands for relative cubic to. + +### Parameters + +<table> <tr> <td><code><strong>x1 </strong></code></td> <td> +offset from <a href="bmh_SkPath_Reference?cl=9919#Last_Point">Last Point</a> x to first <a href="bmh_SkPath_Reference?cl=9919#Cubic">Cubic</a> control x.</td> + </tr> <tr> <td><code><strong>y1 </strong></code></td> <td> +offset from <a href="bmh_SkPath_Reference?cl=9919#Last_Point">Last Point</a> x to first <a href="bmh_SkPath_Reference?cl=9919#Cubic">Cubic</a> control y.</td> + </tr> <tr> <td><code><strong>x2 </strong></code></td> <td> +offset from <a href="bmh_SkPath_Reference?cl=9919#Last_Point">Last Point</a> x to second <a href="bmh_SkPath_Reference?cl=9919#Cubic">Cubic</a> control x.</td> + </tr> <tr> <td><code><strong>y2 </strong></code></td> <td> +offset from <a href="bmh_SkPath_Reference?cl=9919#Last_Point">Last Point</a> x to second <a href="bmh_SkPath_Reference?cl=9919#Cubic">Cubic</a> control y.</td> + </tr> <tr> <td><code><strong>x3 </strong></code></td> <td> +offset from <a href="bmh_SkPath_Reference?cl=9919#Last_Point">Last Point</a> x to <a href="bmh_SkPath_Reference?cl=9919#Cubic">Cubic</a> end x.</td> + </tr> <tr> <td><code><strong>y3 </strong></code></td> <td> +offset from <a href="bmh_SkPath_Reference?cl=9919#Last_Point">Last Point</a> x to <a href="bmh_SkPath_Reference?cl=9919#Cubic">Cubic</a> end y.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="19f0cfc7eeba8937fe19446ec0b5f932"></fiddle-embed></div> + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a> <a href="bmh_SkPath_Reference?cl=9919#moveTo">moveTo</a> <a href="bmh_SkPath_Reference?cl=9919#cubicTo">cubicTo</a> <a href="bmh_SkPath_Reference?cl=9919#quadTo">quadTo</a> + +--- + +# <a name="Arc"></a> Arc +<a href="bmh_SkPath_Reference?cl=9919#Arc">Arc</a> can be constructed in a number of ways. <a href="bmh_SkPath_Reference?cl=9919#Arc">Arc</a> may be described by part of <a href="bmh_undocumented?cl=9919#Oval">Oval</a> and angles, +by start point and end point, and by radius and tangent lines. Each construction has advantages, +and some constructions correspond to <a href="bmh_SkPath_Reference?cl=9919#Arc">Arc</a> drawing in graphics standards. + +All <a href="bmh_SkPath_Reference?cl=9919#Arc">Arc</a> draws are implemented by one or more <a href="bmh_SkPath_Reference?cl=9919#Conic">Conic</a> draws. When <a href="bmh_SkPath_Reference?cl=9919#Conic_Weight">Conic Weight</a> is less than one, +<a href="bmh_SkPath_Reference?cl=9919#Conic">Conic</a> describes an <a href="bmh_SkPath_Reference?cl=9919#Arc">Arc</a> of some <a href="bmh_undocumented?cl=9919#Oval">Oval</a> or <a href="bmh_undocumented?cl=9919#Circle">Circle</a>. + +<a href="bmh_SkPath_Reference?cl=9919#arcTo">arcTo(const SkRect& oval, SkScalar startAngle, SkScalar sweepAngle, bool forceMoveTo)</a> +describes <a href="bmh_SkPath_Reference?cl=9919#Arc">Arc</a> as a piece of <a href="bmh_undocumented?cl=9919#Oval">Oval</a>, beginning at start angle, sweeping clockwise or counterclockwise, +which may continue <a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a> or start a new one. This construction is similar to <a href="bmh_undocumented?cl=9919#PostScript">PostScript</a> and +<a href="bmh_undocumented?cl=9919#HTML_Canvas">HTML Canvas</a> arcs. Variation <a href="bmh_SkPath_Reference?cl=9919#addArc">addArc</a> always starts new <a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a>. Canvas::drawArc draws without +requiring <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>. + +<a href="bmh_SkPath_Reference?cl=9919#arcTo_2">arcTo(SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2, SkScalar radius)</a> +describes <a href="bmh_SkPath_Reference?cl=9919#Arc">Arc</a> as tangent to the line (x0, y0), (x1, y1) and tangent to the line (x1, y1), (x2, y2) +where (x0, y0) is the last <a href="bmh_undocumented?cl=9919#Point">Point</a> added to <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>. This construction is similar to <a href="bmh_undocumented?cl=9919#PostScript">PostScript</a> and +<a href="bmh_undocumented?cl=9919#HTML_Canvas">HTML Canvas</a> arcs. + +<a href="bmh_SkPath_Reference?cl=9919#arcTo_4">arcTo(SkScalar rx, SkScalar ry, SkScalar xAxisRotate, ArcSize largeArc, Direction sweep, +SkScalar x, SkScalar y)</a> +describes <a href="bmh_SkPath_Reference?cl=9919#Arc">Arc</a> as part of <a href="bmh_undocumented?cl=9919#Oval">Oval</a> with radii (rx, ry), beginning at +last <a href="bmh_undocumented?cl=9919#Point">Point</a> added to <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> and ending at (x, y). More than one <a href="bmh_SkPath_Reference?cl=9919#Arc">Arc</a> satisfies this criteria, +so additional values choose a single solution. This construction is similar to <a href="bmh_undocumented?cl=9919#SVG">SVG</a> arcs. + +<a href="bmh_SkPath_Reference?cl=9919#conicTo">conicTo</a> describes <a href="bmh_SkPath_Reference?cl=9919#Arc">Arc</a> of less than 180 degrees as a pair of tangent lines and <a href="bmh_SkPath_Reference?cl=9919#Conic_Weight">Conic Weight</a>. +<a href="bmh_SkPath_Reference?cl=9919#conicTo">conicTo</a> can represent any <a href="bmh_SkPath_Reference?cl=9919#Arc">Arc</a> with a sweep less than 180 degrees at any rotation. All <a href="bmh_SkPath_Reference?cl=9919#arcTo">arcTo</a> +constructions are converted to <a href="bmh_SkPath_Reference?cl=9919#Conic">Conic</a> data when added to <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>. + +### Example + +<div><fiddle-embed name="891ac93abd0cdb27c4156685d3b1bb4c"><div> + +<table> <tr> + <td><sup>1</sup> <a href="bmh_SkPath_Reference?cl=9919#arcTo">arcTo(const SkRect& oval, SkScalar startAngle, SkScalar sweepAngle, bool forceMoveTo)</a></td> </tr> <tr> + <td><sup>2</sup> parameter sets force MoveTo</td> </tr> <tr> + <td><sup>3</sup> start angle must be multiple of 90 degrees.</td> </tr> <tr> + <td><sup>4</sup> <a href="bmh_SkPath_Reference?cl=9919#arcTo_2">arcTo(SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2, SkScalar radius)</a></td> </tr> <tr> + <td><sup>5</sup> <a href="bmh_SkPath_Reference?cl=9919#arcTo_4">arcTo(SkScalar rx, SkScalar ry, SkScalar xAxisRotate, ArcSize largeArc, +Direction sweep, SkScalar x, SkScalar y)</a></td> </tr> +</table> + +</div></fiddle-embed></div> + +### Example + +<div><fiddle-embed name="5acc77eba0cb4d00bbf3a8f4db0c0aee"><div>1 describes an arc from an oval, a starting angle, and a sweep angle. +2 is similar to 1, but does not require building a path to draw. +3 is similar to 1, but always begins new <a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a>. +4 describes an arc from a pair of tangent lines and a radius. +5 describes an arc from <a href="bmh_undocumented?cl=9919#Oval">Oval</a> center, arc start <a href="bmh_undocumented?cl=9919#Point">Point</a> and arc end <a href="bmh_undocumented?cl=9919#Point">Point</a>. +6 describes an arc from a pair of tangent lines and a <a href="bmh_SkPath_Reference?cl=9919#Conic_Weight">Conic Weight</a>.</div></fiddle-embed></div> + +<a name="arcTo"></a> +## arcTo + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void arcTo(const SkRect& oval, SkScalar startAngle, SkScalar sweepAngle, + bool forceMoveTo) +</pre> + +Append <a href="bmh_SkPath_Reference?cl=9919#Arc">Arc</a> to <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>. <a href="bmh_SkPath_Reference?cl=9919#Arc">Arc</a> added is part of ellipse +bounded by <a href="bmh_SkPath_Reference?cl=9919#oval">oval</a>, from <a href="bmh_SkPath_Reference?cl=9919#startAngle">startAngle</a> through <a href="bmh_SkPath_Reference?cl=9919#sweepAngle">sweepAngle</a>. Both <a href="bmh_SkPath_Reference?cl=9919#startAngle">startAngle</a> and +<a href="bmh_SkPath_Reference?cl=9919#sweepAngle">sweepAngle</a> are measured in degrees, where zero degrees is aligned with the +positive x-axis, and positive sweeps extends <a href="bmh_SkPath_Reference?cl=9919#Arc">Arc</a> clockwise. + +<a href="bmh_SkPath_Reference?cl=9919#arcTo">arcTo</a> adds <a href="bmh_undocumented?cl=9919#Line">Line</a> connecting <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> last <a href="bmh_undocumented?cl=9919#Point">Point</a> to initial <a href="bmh_SkPath_Reference?cl=9919#Arc">Arc</a> <a href="bmh_undocumented?cl=9919#Point">Point</a> if <a href="bmh_SkPath_Reference?cl=9919#forceMoveTo">forceMoveTo</a> +is false and <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> is not empty. Otherwise, added <a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a> begins with first point +of <a href="bmh_SkPath_Reference?cl=9919#Arc">Arc</a>. Angles greater than -360 and less than 360 are treated modulo 360. + +### Parameters + +<table> <tr> <td><code><strong>oval </strong></code></td> <td> +bounds of ellipse containing <a href="bmh_SkPath_Reference?cl=9919#Arc">Arc</a>.</td> + </tr> <tr> <td><code><strong>startAngle </strong></code></td> <td> +starting angle of <a href="bmh_SkPath_Reference?cl=9919#Arc">Arc</a> in degrees.</td> + </tr> <tr> <td><code><strong>sweepAngle </strong></code></td> <td> +sweep, in degrees. Positive is clockwise; treated modulo 360.</td> + </tr> <tr> <td><code><strong>forceMoveTo </strong></code></td> <td> +true to start a new contour with <a href="bmh_SkPath_Reference?cl=9919#Arc">Arc</a>.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="5f02890edaa10cb5e1a4243a82b6a382"><div><a href="bmh_SkPath_Reference?cl=9919#arcTo">arcTo</a> continues a previous contour when <a href="bmh_SkPath_Reference?cl=9919#forceMoveTo">forceMoveTo</a> is false and when <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> +is not empty.</div></fiddle-embed></div> + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#addArc">addArc</a> <a href="bmh_SkCanvas_Reference?cl=9919#drawArc">SkCanvas::drawArc</a> <a href="bmh_SkPath_Reference?cl=9919#conicTo">conicTo</a> + +--- + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void arcTo(SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2, SkScalar radius) +</pre> + +Append <a href="bmh_SkPath_Reference?cl=9919#Arc">Arc</a> to <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>, after appending <a href="bmh_undocumented?cl=9919#Line">Line</a> if needed. <a href="bmh_SkPath_Reference?cl=9919#Arc">Arc</a> is implemented by <a href="bmh_SkPath_Reference?cl=9919#Conic">Conic</a> +weighted to describe part of <a href="bmh_undocumented?cl=9919#Circle">Circle</a>. <a href="bmh_SkPath_Reference?cl=9919#Arc">Arc</a> is contained by tangent from +last <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> point (x0, y0) to (<a href="bmh_SkPath_Reference?cl=9919#x1">x1</a>, <a href="bmh_SkPath_Reference?cl=9919#y1">y1</a>), and tangent from (<a href="bmh_SkPath_Reference?cl=9919#x1">x1</a>, <a href="bmh_SkPath_Reference?cl=9919#y1">y1</a>) to (<a href="bmh_SkPath_Reference?cl=9919#x2">x2</a>, <a href="bmh_SkPath_Reference?cl=9919#y2">y2</a>). <a href="bmh_SkPath_Reference?cl=9919#Arc">Arc</a> +is part of <a href="bmh_undocumented?cl=9919#Circle">Circle</a> sized to <a href="bmh_SkPath_Reference?cl=9919#radius">radius</a>, positioned so it touches both tangent lines. + +### Example + +<div><fiddle-embed name="d9c6435f26f37b3d63c664a99028f77f"></fiddle-embed></div> + +If last <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> <a href="bmh_undocumented?cl=9919#Point">Point</a> does not start <a href="bmh_SkPath_Reference?cl=9919#Arc">Arc</a>, <a href="bmh_SkPath_Reference?cl=9919#arcTo">arcTo</a> appends connecting <a href="bmh_undocumented?cl=9919#Line">Line</a> to <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>. +The length of <a href="bmh_undocumented?cl=9919#Vector">Vector</a> from (<a href="bmh_SkPath_Reference?cl=9919#x1">x1</a>, <a href="bmh_SkPath_Reference?cl=9919#y1">y1</a>) to (<a href="bmh_SkPath_Reference?cl=9919#x2">x2</a>, <a href="bmh_SkPath_Reference?cl=9919#y2">y2</a>) does not affect <a href="bmh_SkPath_Reference?cl=9919#Arc">Arc</a>. + +### Example + +<div><fiddle-embed name="01d2ddfd539ab86a86989e210640dffc"></fiddle-embed></div> + +<a href="bmh_SkPath_Reference?cl=9919#Arc">Arc</a> sweep is always less than 180 degrees. If <a href="bmh_SkPath_Reference?cl=9919#radius">radius</a> is zero, or if +tangents are nearly parallel, <a href="bmh_SkPath_Reference?cl=9919#arcTo">arcTo</a> appends <a href="bmh_undocumented?cl=9919#Line">Line</a> from last <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> <a href="bmh_undocumented?cl=9919#Point">Point</a> to (<a href="bmh_SkPath_Reference?cl=9919#x1">x1</a>, <a href="bmh_SkPath_Reference?cl=9919#y1">y1</a>). + +<a href="bmh_SkPath_Reference?cl=9919#arcTo">arcTo</a> appends at most one <a href="bmh_undocumented?cl=9919#Line">Line</a> and one <a href="bmh_SkPath_Reference?cl=9919#Conic">Conic</a>. +<a href="bmh_SkPath_Reference?cl=9919#arcTo">arcTo</a> implements the functionality of <a href="bmh_undocumented?cl=9919#PostScript_arct">PostScript arct</a> and <a href="bmh_undocumented?cl=9919#HTML_Canvas_arcTo">HTML Canvas arcTo</a>. + +### Parameters + +<table> <tr> <td><code><strong>x1 </strong></code></td> <td> +x common to pair of tangents.</td> + </tr> <tr> <td><code><strong>y1 </strong></code></td> <td> +y common to pair of tangents.</td> + </tr> <tr> <td><code><strong>x2 </strong></code></td> <td> +x end of second tangent.</td> + </tr> <tr> <td><code><strong>y2 </strong></code></td> <td> +y end of second tangent.</td> + </tr> <tr> <td><code><strong>radius </strong></code></td> <td> +distance from <a href="bmh_SkPath_Reference?cl=9919#Arc">Arc</a> to <a href="bmh_undocumented?cl=9919#Circle">Circle</a> center.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="498360fa0a201cc5db04b1c27256358f"><div><a href="bmh_SkPath_Reference?cl=9919#arcTo">arcTo</a> is represented by <a href="bmh_undocumented?cl=9919#Line">Line</a> and circular <a href="bmh_SkPath_Reference?cl=9919#Conic">Conic</a> in <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>.</div> + +#### Example Output + +~~~~ +move to (156,20) +line (156,20),(79.2893,20) +conic (79.2893,20),(200,20),(114.645,105.355) weight 0.382683 +~~~~ + +</fiddle-embed></div> + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#conicTo">conicTo</a> + +--- + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void arcTo(const SkPoint p1, const SkPoint p2, SkScalar radius) +</pre> + +Append <a href="bmh_SkPath_Reference?cl=9919#Arc">Arc</a> to <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>, after appending <a href="bmh_undocumented?cl=9919#Line">Line</a> if needed. <a href="bmh_SkPath_Reference?cl=9919#Arc">Arc</a> is implemented by <a href="bmh_SkPath_Reference?cl=9919#Conic">Conic</a> +weighted to describe part of <a href="bmh_undocumented?cl=9919#Circle">Circle</a>. <a href="bmh_SkPath_Reference?cl=9919#Arc">Arc</a> is contained by tangent from +last <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> point to <a href="bmh_SkPath_Reference?cl=9919#p1">p1</a>, and tangent from <a href="bmh_SkPath_Reference?cl=9919#p1">p1</a> to <a href="bmh_SkPath_Reference?cl=9919#p2">p2</a>. <a href="bmh_SkPath_Reference?cl=9919#Arc">Arc</a> +is part of <a href="bmh_undocumented?cl=9919#Circle">Circle</a> sized to <a href="bmh_SkPath_Reference?cl=9919#radius">radius</a>, positioned so it touches both tangent lines. + +If last <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> <a href="bmh_undocumented?cl=9919#Point">Point</a> does not start <a href="bmh_SkPath_Reference?cl=9919#Arc">Arc</a>, <a href="bmh_SkPath_Reference?cl=9919#arcTo">arcTo</a> appends connecting <a href="bmh_undocumented?cl=9919#Line">Line</a> to <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>. +The length of <a href="bmh_undocumented?cl=9919#Vector">Vector</a> from <a href="bmh_SkPath_Reference?cl=9919#p1">p1</a> to <a href="bmh_SkPath_Reference?cl=9919#p2">p2</a> does not affect <a href="bmh_SkPath_Reference?cl=9919#Arc">Arc</a>. + +<a href="bmh_SkPath_Reference?cl=9919#Arc">Arc</a> sweep is always less than 180 degrees. If <a href="bmh_SkPath_Reference?cl=9919#radius">radius</a> is zero, or if +tangents are nearly parallel, <a href="bmh_SkPath_Reference?cl=9919#arcTo">arcTo</a> appends <a href="bmh_undocumented?cl=9919#Line">Line</a> from last <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> <a href="bmh_undocumented?cl=9919#Point">Point</a> to <a href="bmh_SkPath_Reference?cl=9919#p1">p1</a>. + +<a href="bmh_SkPath_Reference?cl=9919#arcTo">arcTo</a> appends at most one <a href="bmh_undocumented?cl=9919#Line">Line</a> and one <a href="bmh_SkPath_Reference?cl=9919#Conic">Conic</a>. +<a href="bmh_SkPath_Reference?cl=9919#arcTo">arcTo</a> implements the functionality of <a href="bmh_undocumented?cl=9919#PostScript_arct">PostScript arct</a> and <a href="bmh_undocumented?cl=9919#HTML_Canvas_arcTo">HTML Canvas arcTo</a>. + +### Parameters + +<table> <tr> <td><code><strong>p1 </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#Point">Point</a> common to pair of tangents.</td> + </tr> <tr> <td><code><strong>p2 </strong></code></td> <td> +end of second tangent.</td> + </tr> <tr> <td><code><strong>radius </strong></code></td> <td> +distance from <a href="bmh_SkPath_Reference?cl=9919#Arc">Arc</a> to <a href="bmh_undocumented?cl=9919#Circle">Circle</a> center.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="0c056264a361579c18e5d02d3172d4d4"><div>Because tangent lines are parallel, <a href="bmh_SkPath_Reference?cl=9919#arcTo">arcTo</a> appends line from last <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> <a href="bmh_undocumented?cl=9919#Point">Point</a> to +<a href="bmh_SkPath_Reference?cl=9919#p1">p1</a>, but does not append a circular <a href="bmh_SkPath_Reference?cl=9919#Conic">Conic</a>.</div> + +#### Example Output + +~~~~ +move to (156,20) +line (156,20),(200,20) +~~~~ + +</fiddle-embed></div> + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#conicTo">conicTo</a> + +--- + +## <a name="SkPath::ArcSize"></a> Enum SkPath::ArcSize + +<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0"> +enum <a href="bmh_SkPath_Reference?cl=9919#ArcSize">ArcSize</a> { +<a href="bmh_SkPath_Reference?cl=9919#kSmall_ArcSize">kSmall ArcSize</a> +<a href="bmh_SkPath_Reference?cl=9919#kLarge_ArcSize">kLarge ArcSize</a> +};</pre> + +Four <a href="bmh_undocumented?cl=9919#Oval">Oval</a> parts with radii (rx, ry) start at last <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> <a href="bmh_undocumented?cl=9919#Point">Point</a> and ends at (x, y). +<a href="bmh_SkPath_Reference?cl=9919#ArcSize">ArcSize</a> and <a href="bmh_SkPath_Reference?cl=9919#Direction">Direction</a> select one of the four <a href="bmh_undocumented?cl=9919#Oval">Oval</a> parts. + +### Constants + +<table> + <tr> + <td><a name="SkPath::kSmall_ArcSize"></a> <code><strong>SkPath::kSmall_ArcSize </strong></code></td><td>0</td><td>Smaller of <a href="bmh_SkPath_Reference?cl=9919#Arc">Arc</a> pair.</td> + </tr> + <tr> + <td><a name="SkPath::kLarge_ArcSize"></a> <code><strong>SkPath::kLarge_ArcSize </strong></code></td><td>1</td><td>Larger of <a href="bmh_SkPath_Reference?cl=9919#Arc">Arc</a> pair.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="8e40c546eecd9cc213200717240898ba"><div><a href="bmh_SkPath_Reference?cl=9919#Arc">Arc</a> begins at top of <a href="bmh_undocumented?cl=9919#Oval">Oval</a> pair and ends at bottom. <a href="bmh_SkPath_Reference?cl=9919#Arc">Arc</a> can take four routes to get there. +Two routes are large, and two routes are counterclockwise. The one route both large +and counterclockwise is blue.</div></fiddle-embed></div> + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#arcTo">arcTo</a> <a href="bmh_SkPath_Reference?cl=9919#Direction">Direction</a> + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void arcTo(SkScalar rx, SkScalar ry, SkScalar xAxisRotate, ArcSize largeArc, + Direction sweep, SkScalar x, SkScalar y) +</pre> + +Append <a href="bmh_SkPath_Reference?cl=9919#Arc">Arc</a> to <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>. <a href="bmh_SkPath_Reference?cl=9919#Arc">Arc</a> is implemented by one or more <a href="bmh_SkPath_Reference?cl=9919#Conic">Conic</a> weighted to describe part of <a href="bmh_undocumented?cl=9919#Oval">Oval</a> +with radii (<a href="bmh_SkPath_Reference?cl=9919#rx">rx</a>, <a href="bmh_SkPath_Reference?cl=9919#ry">ry</a>) rotated by <a href="bmh_SkPath_Reference?cl=9919#xAxisRotate">xAxisRotate</a> degrees. <a href="bmh_SkPath_Reference?cl=9919#Arc">Arc</a> curves from last <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> <a href="bmh_undocumented?cl=9919#Point">Point</a> to (<a href="bmh_SkPath_Reference?cl=9919#x">x</a>, <a href="bmh_SkPath_Reference?cl=9919#y">y</a>), +choosing one of four possible routes: clockwise or counterclockwise, and smaller or larger. + +<a href="bmh_SkPath_Reference?cl=9919#Arc">Arc</a> <a href="bmh_SkPath_Reference?cl=9919#sweep">sweep</a> is always less than 360 degrees. <a href="bmh_SkPath_Reference?cl=9919#arcTo">arcTo</a> appends <a href="bmh_undocumented?cl=9919#Line">Line</a> to (<a href="bmh_SkPath_Reference?cl=9919#x">x</a>, <a href="bmh_SkPath_Reference?cl=9919#y">y</a>) if either radii are zero, +or if last <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> <a href="bmh_undocumented?cl=9919#Point">Point</a> equals (<a href="bmh_SkPath_Reference?cl=9919#x">x</a>, <a href="bmh_SkPath_Reference?cl=9919#y">y</a>). <a href="bmh_SkPath_Reference?cl=9919#arcTo">arcTo</a> scales radii (<a href="bmh_SkPath_Reference?cl=9919#rx">rx</a>, <a href="bmh_SkPath_Reference?cl=9919#ry">ry</a>) to fit last <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> <a href="bmh_undocumented?cl=9919#Point">Point</a> and +(<a href="bmh_SkPath_Reference?cl=9919#x">x</a>, <a href="bmh_SkPath_Reference?cl=9919#y">y</a>) if both are greater than zero but too small. + +<a href="bmh_SkPath_Reference?cl=9919#arcTo">arcTo</a> appends up to four <a href="bmh_SkPath_Reference?cl=9919#Conic">Conic</a> curves. +<a href="bmh_SkPath_Reference?cl=9919#arcTo">arcTo</a> implements the functionatlity of <a href="bmh_undocumented?cl=9919#Arc">SVG Arc</a>, although <a href="bmh_undocumented?cl=9919#SVG">SVG</a> sweep-flag value is +opposite the integer value of <a href="bmh_SkPath_Reference?cl=9919#sweep">sweep</a>; <a href="bmh_undocumented?cl=9919#SVG">SVG</a> sweep-flag uses 1 for clockwise, while <a href="bmh_SkPath_Reference?cl=9919#kCW_Direction">kCW Direction</a> +cast to int is zero. + +### Parameters + +<table> <tr> <td><code><strong>rx </strong></code></td> <td> +radius in <a href="bmh_SkPath_Reference?cl=9919#x">x</a> before x-axis rotation.</td> + </tr> <tr> <td><code><strong>ry </strong></code></td> <td> +radius in <a href="bmh_SkPath_Reference?cl=9919#y">y</a> before x-axis rotation.</td> + </tr> <tr> <td><code><strong>xAxisRotate </strong></code></td> <td> +x-axis rotation in degrees; positve values are clockwise.</td> + </tr> <tr> <td><code><strong>largeArc </strong></code></td> <td> +chooses smaller or larger <a href="bmh_SkPath_Reference?cl=9919#Arc">Arc</a>.</td> + </tr> <tr> <td><code><strong>sweep </strong></code></td> <td> +chooses clockwise or counterclockwise <a href="bmh_SkPath_Reference?cl=9919#Arc">Arc</a>.</td> + </tr> <tr> <td><code><strong>x </strong></code></td> <td> +end of <a href="bmh_SkPath_Reference?cl=9919#Arc">Arc</a>.</td> + </tr> <tr> <td><code><strong>y </strong></code></td> <td> +end of <a href="bmh_SkPath_Reference?cl=9919#Arc">Arc</a>.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="6b6ea44f659b27918f3a6fa621bf6173"></fiddle-embed></div> + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#rArcTo">rArcTo</a> <a href="bmh_SkPath_Reference?cl=9919#ArcSize">ArcSize</a> <a href="bmh_SkPath_Reference?cl=9919#Direction">Direction</a> + +--- + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void arcTo(const SkPoint r, SkScalar xAxisRotate, ArcSize largeArc, + Direction sweep, const SkPoint xy) +</pre> + +Append <a href="bmh_SkPath_Reference?cl=9919#Arc">Arc</a> to <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>. <a href="bmh_SkPath_Reference?cl=9919#Arc">Arc</a> is implemented by one or more <a href="bmh_SkPath_Reference?cl=9919#Conic">Conic</a> weighted to describe part of <a href="bmh_undocumented?cl=9919#Oval">Oval</a> +with radii (<a href="bmh_SkPath_Reference?cl=9919#r">r</a>.fX, <a href="bmh_SkPath_Reference?cl=9919#r">r</a>.fY) rotated by <a href="bmh_SkPath_Reference?cl=9919#xAxisRotate">xAxisRotate</a> degrees. <a href="bmh_SkPath_Reference?cl=9919#Arc">Arc</a> curves from last <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> <a href="bmh_undocumented?cl=9919#Point">Point</a> to +(<a href="bmh_SkPath_Reference?cl=9919#xy">xy</a>.fX, <a href="bmh_SkPath_Reference?cl=9919#xy">xy</a>.fY), choosing one of four possible routes: clockwise or counterclockwise, +and smaller or larger. + +<a href="bmh_SkPath_Reference?cl=9919#Arc">Arc</a> <a href="bmh_SkPath_Reference?cl=9919#sweep">sweep</a> is always less than 360 degrees. <a href="bmh_SkPath_Reference?cl=9919#arcTo">arcTo</a> appends <a href="bmh_undocumented?cl=9919#Line">Line</a> to <a href="bmh_SkPath_Reference?cl=9919#xy">xy</a> if either radii are zero, +or if last <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> <a href="bmh_undocumented?cl=9919#Point">Point</a> equals (x, y). <a href="bmh_SkPath_Reference?cl=9919#arcTo">arcTo</a> scales radii <a href="bmh_SkPath_Reference?cl=9919#r">r</a> to fit last <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> <a href="bmh_undocumented?cl=9919#Point">Point</a> and +<a href="bmh_SkPath_Reference?cl=9919#xy">xy</a> if both are greater than zero but too small. + +<a href="bmh_SkPath_Reference?cl=9919#arcTo">arcTo</a> appends up to four <a href="bmh_SkPath_Reference?cl=9919#Conic">Conic</a> curves. +<a href="bmh_SkPath_Reference?cl=9919#arcTo">arcTo</a> implements the functionatlity of <a href="bmh_undocumented?cl=9919#Arc">SVG Arc</a>, although <a href="bmh_undocumented?cl=9919#SVG">SVG</a> sweep-flag value is +opposite the integer value of <a href="bmh_SkPath_Reference?cl=9919#sweep">sweep</a>; <a href="bmh_undocumented?cl=9919#SVG">SVG</a> sweep-flag uses 1 for clockwise, while <a href="bmh_SkPath_Reference?cl=9919#kCW_Direction">kCW Direction</a> +cast to int is zero. + +### Parameters + +<table> <tr> <td><code><strong>r </strong></code></td> <td> +radii in x and y before x-axis rotation.</td> + </tr> <tr> <td><code><strong>xAxisRotate </strong></code></td> <td> +x-axis rotation in degrees; positve values are clockwise.</td> + </tr> <tr> <td><code><strong>largeArc </strong></code></td> <td> +chooses smaller or larger <a href="bmh_SkPath_Reference?cl=9919#Arc">Arc</a>.</td> + </tr> <tr> <td><code><strong>sweep </strong></code></td> <td> +chooses clockwise or counterclockwise <a href="bmh_SkPath_Reference?cl=9919#Arc">Arc</a>.</td> + </tr> <tr> <td><code><strong>xy </strong></code></td> <td> +end of <a href="bmh_SkPath_Reference?cl=9919#Arc">Arc</a>.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="3f76a1007416181a4848c1a87fc81dbd"></fiddle-embed></div> + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#rArcTo">rArcTo</a> <a href="bmh_SkPath_Reference?cl=9919#ArcSize">ArcSize</a> <a href="bmh_SkPath_Reference?cl=9919#Direction">Direction</a> + +--- + +<a name="rArcTo"></a> +## rArcTo + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void rArcTo(SkScalar rx, SkScalar ry, SkScalar xAxisRotate, ArcSize largeArc, + Direction sweep, SkScalar dx, SkScalar dy) +</pre> + +Append <a href="bmh_SkPath_Reference?cl=9919#Arc">Arc</a> to <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>, relative to last <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> <a href="bmh_undocumented?cl=9919#Point">Point</a>. <a href="bmh_SkPath_Reference?cl=9919#Arc">Arc</a> is implemented by one or +more <a href="bmh_SkPath_Reference?cl=9919#Conic">Conic</a>, weighted to describe part of <a href="bmh_undocumented?cl=9919#Oval">Oval</a> with radii (r.fX, r.fY) rotated by +<a href="bmh_SkPath_Reference?cl=9919#xAxisRotate">xAxisRotate</a> degrees. <a href="bmh_SkPath_Reference?cl=9919#Arc">Arc</a> curves from last <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> <a href="bmh_undocumented?cl=9919#Point">Point</a> (x0, y0) to +(x0 + <a href="bmh_SkPath_Reference?cl=9919#dx">dx</a>, y0 + <a href="bmh_SkPath_Reference?cl=9919#dy">dy</a>), choosing one of four possible routes: clockwise or +counterclockwise, and smaller or larger. If <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> is empty, the start <a href="bmh_SkPath_Reference?cl=9919#Arc">Arc</a> <a href="bmh_undocumented?cl=9919#Point">Point</a> +is (0, 0). + +<a href="bmh_SkPath_Reference?cl=9919#Arc">Arc</a> <a href="bmh_SkPath_Reference?cl=9919#sweep">sweep</a> is always less than 360 degrees. <a href="bmh_SkPath_Reference?cl=9919#arcTo">arcTo</a> appends <a href="bmh_undocumented?cl=9919#Line">Line</a> to xy if either +radii are zero, or if last <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> <a href="bmh_undocumented?cl=9919#Point">Point</a> equals (x, y). <a href="bmh_SkPath_Reference?cl=9919#arcTo">arcTo</a> scales radii r to fit +last <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> <a href="bmh_undocumented?cl=9919#Point">Point</a> and xy if both are greater than zero but too small. + +<a href="bmh_SkPath_Reference?cl=9919#arcTo">arcTo</a> appends up to four <a href="bmh_SkPath_Reference?cl=9919#Conic">Conic</a> curves. +<a href="bmh_SkPath_Reference?cl=9919#arcTo">arcTo</a> implements the functionatlity of <a href="bmh_undocumented?cl=9919#Arc">SVG Arc</a>, although <a href="bmh_undocumented?cl=9919#SVG">SVG</a> sweep-flag value is +opposite the integer value of <a href="bmh_SkPath_Reference?cl=9919#sweep">sweep</a>; <a href="bmh_undocumented?cl=9919#SVG">SVG</a> sweep-flag uses 1 for clockwise, while +<a href="bmh_SkPath_Reference?cl=9919#kCW_Direction">kCW Direction</a> cast to int is zero. + +### Parameters + +<table> <tr> <td><code><strong>rx </strong></code></td> <td> +radius in x before x-axis rotation.</td> + </tr> <tr> <td><code><strong>ry </strong></code></td> <td> +radius in y before x-axis rotation.</td> + </tr> <tr> <td><code><strong>xAxisRotate </strong></code></td> <td> +x-axis rotation in degrees; positve values are clockwise.</td> + </tr> <tr> <td><code><strong>largeArc </strong></code></td> <td> +chooses smaller or larger <a href="bmh_SkPath_Reference?cl=9919#Arc">Arc</a>.</td> + </tr> <tr> <td><code><strong>sweep </strong></code></td> <td> +chooses clockwise or counterclockwise <a href="bmh_SkPath_Reference?cl=9919#Arc">Arc</a>.</td> + </tr> <tr> <td><code><strong>dx </strong></code></td> <td> +x offset end of <a href="bmh_SkPath_Reference?cl=9919#Arc">Arc</a> from last <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> <a href="bmh_undocumented?cl=9919#Point">Point</a>.</td> + </tr> <tr> <td><code><strong>dy </strong></code></td> <td> +y offset end of <a href="bmh_SkPath_Reference?cl=9919#Arc">Arc</a> from last <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> <a href="bmh_undocumented?cl=9919#Point">Point</a>.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="3f76a1007416181a4848c1a87fc81dbd"></fiddle-embed></div> + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#arcTo">arcTo</a> <a href="bmh_SkPath_Reference?cl=9919#ArcSize">ArcSize</a> <a href="bmh_SkPath_Reference?cl=9919#Direction">Direction</a> + +--- + +<a name="close"></a> +## close + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void close() +</pre> + +Append <a href="bmh_SkPath_Reference?cl=9919#kClose_Verb">kClose Verb</a> to <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>. A closed <a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a> connects the first and last <a href="bmh_undocumented?cl=9919#Point">Point</a> +with <a href="bmh_undocumented?cl=9919#Line">Line</a>, forming a continous loop. Open and closed <a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a> draw the same +with <a href="bmh_SkPaint_Reference?cl=9919#kFill_Style">SkPaint::kFill Style</a>. With <a href="bmh_SkPaint_Reference?cl=9919#kStroke_Style">SkPaint::kStroke Style</a>, open <a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a> draws +<a href="bmh_SkPaint_Reference?cl=9919#Stroke_Cap">Paint Stroke Cap</a> at <a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a> start and end; closed <a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a> draws +<a href="bmh_SkPaint_Reference?cl=9919#Stroke_Join">Paint Stroke Join</a> at <a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a> start and end. + +<a href="bmh_SkPath_Reference?cl=9919#close">close</a> has no effect if <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> is empty or last <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> <a href="bmh_SkPath_Reference?cl=9919#Verb">Verb</a> is <a href="bmh_SkPath_Reference?cl=9919#kClose_Verb">kClose Verb</a>. + +### Example + +<div><fiddle-embed name="9235f6309271d6420fa5c45dc28664c5"></fiddle-embed></div> + +### See Also + +--- + +<a name="IsInverseFillType"></a> +## IsInverseFillType + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +static bool IsInverseFillType(FillType fill) +</pre> + +Returns true if <a href="bmh_SkPath_Reference?cl=9919#IsInverseFillType">fill</a> is inverted and <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> with <a href="bmh_SkPath_Reference?cl=9919#IsInverseFillType">fill</a> represents area outside +of its geometric bounds. + +| <a href="bmh_SkPath_Reference?cl=9919#FillType">FillType</a> | is inverse | +| --- | --- | +| <a href="bmh_SkPath_Reference?cl=9919#kWinding_FillType">kWinding FillType</a> | false | +| <a href="bmh_SkPath_Reference?cl=9919#kEvenOdd_FillType">kEvenOdd FillType</a> | false | +| <a href="bmh_SkPath_Reference?cl=9919#kInverseWinding_FillType">kInverseWinding FillType</a> | true | +| <a href="bmh_SkPath_Reference?cl=9919#kInverseEvenOdd_FillType">kInverseEvenOdd FillType</a> | true | + +### Parameters + +<table> <tr> <td><code><strong>fill </strong></code></td> <td> +one of: <a href="bmh_SkPath_Reference?cl=9919#kWinding_FillType">kWinding FillType</a>, <a href="bmh_SkPath_Reference?cl=9919#kEvenOdd_FillType">kEvenOdd FillType</a>, +<a href="bmh_SkPath_Reference?cl=9919#kInverseWinding_FillType">kInverseWinding FillType</a>, <a href="bmh_SkPath_Reference?cl=9919#kInverseEvenOdd_FillType">kInverseEvenOdd FillType</a>.</td> + </tr> +</table> + +### Return Value + +true if <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> fills outside its bounds. + +### Example + +<div><fiddle-embed name="1453856a9d0c73e8192bf298c4143563"> + +#### Example Output + +~~~~ +IsInverseFillType(kWinding_FillType) == false +IsInverseFillType(kEvenOdd_FillType) == false +IsInverseFillType(kInverseWinding_FillType) == true +IsInverseFillType(kInverseEvenOdd_FillType) == true +~~~~ + +</fiddle-embed></div> + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#FillType">FillType</a> <a href="bmh_SkPath_Reference?cl=9919#getFillType">getFillType</a> <a href="bmh_SkPath_Reference?cl=9919#setFillType">setFillType</a> <a href="bmh_SkPath_Reference?cl=9919#ConvertToNonInverseFillType">ConvertToNonInverseFillType</a> + +--- + +<a name="ConvertToNonInverseFillType"></a> +## ConvertToNonInverseFillType + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +static FillType ConvertToNonInverseFillType(FillType fill) +</pre> + +Returns equivalent <a href="bmh_SkPath_Reference?cl=9919#Fill_Type">Fill Type</a> representing <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> <a href="bmh_SkPath_Reference?cl=9919#ConvertToNonInverseFillType">fill</a> inside its bounds. +. + +| <a href="bmh_SkPath_Reference?cl=9919#FillType">FillType</a> | inside <a href="bmh_SkPath_Reference?cl=9919#FillType">FillType</a> | +| --- | --- | +| <a href="bmh_SkPath_Reference?cl=9919#kWinding_FillType">kWinding FillType</a> | <a href="bmh_SkPath_Reference?cl=9919#kWinding_FillType">kWinding FillType</a> | +| <a href="bmh_SkPath_Reference?cl=9919#kEvenOdd_FillType">kEvenOdd FillType</a> | <a href="bmh_SkPath_Reference?cl=9919#kEvenOdd_FillType">kEvenOdd FillType</a> | +| <a href="bmh_SkPath_Reference?cl=9919#kInverseWinding_FillType">kInverseWinding FillType</a> | <a href="bmh_SkPath_Reference?cl=9919#kWinding_FillType">kWinding FillType</a> | +| <a href="bmh_SkPath_Reference?cl=9919#kInverseEvenOdd_FillType">kInverseEvenOdd FillType</a> | <a href="bmh_SkPath_Reference?cl=9919#kEvenOdd_FillType">kEvenOdd FillType</a> | + +### Parameters + +<table> <tr> <td><code><strong>fill </strong></code></td> <td> +one of: <a href="bmh_SkPath_Reference?cl=9919#kWinding_FillType">kWinding FillType</a>, <a href="bmh_SkPath_Reference?cl=9919#kEvenOdd_FillType">kEvenOdd FillType</a>, +<a href="bmh_SkPath_Reference?cl=9919#kInverseWinding_FillType">kInverseWinding FillType</a>, <a href="bmh_SkPath_Reference?cl=9919#kInverseEvenOdd_FillType">kInverseEvenOdd FillType</a>.</td> + </tr> +</table> + +### Return Value + +<a href="bmh_SkPath_Reference?cl=9919#ConvertToNonInverseFillType">fill</a>, or <a href="bmh_SkPath_Reference?cl=9919#kWinding_FillType">kWinding FillType</a> or <a href="bmh_SkPath_Reference?cl=9919#kEvenOdd_FillType">kEvenOdd FillType</a> if <a href="bmh_SkPath_Reference?cl=9919#ConvertToNonInverseFillType">fill</a> is inverted. + +### Example + +<div><fiddle-embed name="adfae398bbe9e37495f8220ad544c8f8"> + +#### Example Output + +~~~~ +ConvertToNonInverseFillType(kWinding_FillType) == kWinding_FillType +ConvertToNonInverseFillType(kEvenOdd_FillType) == kEvenOdd_FillType +ConvertToNonInverseFillType(kInverseWinding_FillType) == kWinding_FillType +ConvertToNonInverseFillType(kInverseEvenOdd_FillType) == kEvenOdd_FillType +~~~~ + +</fiddle-embed></div> + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#FillType">FillType</a> <a href="bmh_SkPath_Reference?cl=9919#getFillType">getFillType</a> <a href="bmh_SkPath_Reference?cl=9919#setFillType">setFillType</a> <a href="bmh_SkPath_Reference?cl=9919#IsInverseFillType">IsInverseFillType</a> + +--- + +<a name="ConvertConicToQuads"></a> +## ConvertConicToQuads + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +static int ConvertConicToQuads(const SkPoint& p0, const SkPoint& p1, + const SkPoint& p2, SkScalar w, SkPoint pts[], + int pow2) +</pre> + +Approximates <a href="bmh_SkPath_Reference?cl=9919#Conic">Conic</a> with <a href="bmh_SkPath_Reference?cl=9919#Quad">Quad</a> array. <a href="bmh_SkPath_Reference?cl=9919#Conic">Conic</a> is constructed from start <a href="bmh_undocumented?cl=9919#Point">Point</a> <a href="bmh_SkPath_Reference?cl=9919#p0">p0</a>, +control <a href="bmh_undocumented?cl=9919#Point">Point</a> <a href="bmh_SkPath_Reference?cl=9919#p1">p1</a>, end <a href="bmh_undocumented?cl=9919#Point">Point</a> <a href="bmh_SkPath_Reference?cl=9919#p2">p2</a>, and weight <a href="bmh_SkPath_Reference?cl=9919#w">w</a>. +<a href="bmh_SkPath_Reference?cl=9919#Quad">Quad</a> array is stored in <a href="bmh_SkPath_Reference?cl=9919#pts">pts</a>; this storage is supplied by caller. +Maximum <a href="bmh_SkPath_Reference?cl=9919#Quad">Quad</a> count is 2 to the <a href="bmh_SkPath_Reference?cl=9919#pow2">pow2</a>. +Every third point in array shares last <a href="bmh_undocumented?cl=9919#Point">Point</a> of previous <a href="bmh_SkPath_Reference?cl=9919#Quad">Quad</a> and first <a href="bmh_undocumented?cl=9919#Point">Point</a> of +next <a href="bmh_SkPath_Reference?cl=9919#Quad">Quad</a>. Maximum <a href="bmh_SkPath_Reference?cl=9919#pts">pts</a> storage size is given by: +(1 + 2 * (1 << <a href="bmh_SkPath_Reference?cl=9919#pow2">pow2</a>)) * sizeof(SkPoint)<a href="bmh_SkPath_Reference?cl=9919#ConvertConicToQuads">ConvertConicToQuads</a> returns <a href="bmh_SkPath_Reference?cl=9919#Quad">Quad</a> count used the approximation, which may be smaller +than the number requested. +<a href="bmh_SkPath_Reference?cl=9919#Conic_Weight">Conic Weight</a> determines the amount of influence <a href="bmh_SkPath_Reference?cl=9919#Conic">Conic</a> control point has on the curve. +<a href="bmh_SkPath_Reference?cl=9919#w">w</a> less than one represents an elliptical section. <a href="bmh_SkPath_Reference?cl=9919#w">w</a> greater than one represents +a hyperbolic section. <a href="bmh_SkPath_Reference?cl=9919#w">w</a> equal to one represents a parabolic section. + +Two <a href="bmh_SkPath_Reference?cl=9919#Quad">Quad</a> curves are sufficient to approximate an elliptical <a href="bmh_SkPath_Reference?cl=9919#Conic">Conic</a> with a sweep +of up to 90 degrees; in this case, set <a href="bmh_SkPath_Reference?cl=9919#pow2">pow2</a> to one. + +### Parameters + +<table> <tr> <td><code><strong>p0 </strong></code></td> <td> +<a href="bmh_SkPath_Reference?cl=9919#Conic">Conic</a> start <a href="bmh_undocumented?cl=9919#Point">Point</a>.</td> + </tr> <tr> <td><code><strong>p1 </strong></code></td> <td> +<a href="bmh_SkPath_Reference?cl=9919#Conic">Conic</a> control <a href="bmh_undocumented?cl=9919#Point">Point</a>.</td> + </tr> <tr> <td><code><strong>p2 </strong></code></td> <td> +<a href="bmh_SkPath_Reference?cl=9919#Conic">Conic</a> end <a href="bmh_undocumented?cl=9919#Point">Point</a>.</td> + </tr> <tr> <td><code><strong>w </strong></code></td> <td> +<a href="bmh_SkPath_Reference?cl=9919#Conic">Conic</a> weight.</td> + </tr> <tr> <td><code><strong>pts </strong></code></td> <td> +storage for <a href="bmh_SkPath_Reference?cl=9919#Quad">Quad</a> array.</td> + </tr> <tr> <td><code><strong>pow2 </strong></code></td> <td> +<a href="bmh_SkPath_Reference?cl=9919#Quad">Quad</a> count, as power of two, normally 0 to 5 (1 to 32 <a href="bmh_SkPath_Reference?cl=9919#Quad">Quad</a> curves).</td> + </tr> +</table> + +### Return Value + +Number of <a href="bmh_SkPath_Reference?cl=9919#Quad">Quad</a> curves written to <a href="bmh_SkPath_Reference?cl=9919#pts">pts</a>. + +### Example + +<div><fiddle-embed name="3ba94448a4ba48f926e643baeb5b1016"><div>A pair of <a href="bmh_SkPath_Reference?cl=9919#Quad">Quad</a> curves are drawn in red on top of the elliptical <a href="bmh_SkPath_Reference?cl=9919#Conic">Conic</a> curve in black. +The middle curve is nearly circular. The top-right curve is parabolic, which can +be drawn exactly with a single <a href="bmh_SkPath_Reference?cl=9919#Quad">Quad</a>.</div></fiddle-embed></div> + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#Conic">Conic</a> <a href="bmh_SkPath_Reference?cl=9919#Quad">Quad</a> + +--- + +<a name="isRect"></a> +## isRect + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +bool isRect(SkRect* rect, bool* isClosed = NULL, Direction* direction = NULL) const +</pre> + +Returns true if <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> is eqivalent to <a href="bmh_undocumented?cl=9919#Rect">Rect</a> when filled. +If <a href="bmh_SkPath_Reference?cl=9919#isRect">isRect</a> returns false: <a href="bmh_SkPath_Reference?cl=9919#rect">rect</a>, <a href="bmh_SkPath_Reference?cl=9919#isClosed">isClosed</a>, and <a href="bmh_SkPath_Reference?cl=9919#direction">direction</a> are unchanged. +If <a href="bmh_SkPath_Reference?cl=9919#isRect">isRect</a> returns true: <a href="bmh_SkPath_Reference?cl=9919#rect">rect</a>, <a href="bmh_SkPath_Reference?cl=9919#isClosed">isClosed</a>, and <a href="bmh_SkPath_Reference?cl=9919#direction">direction</a> are written to if not nullptr. + +<a href="bmh_SkPath_Reference?cl=9919#rect">rect</a> may be smaller than the <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> bounds. <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> bounds may include <a href="bmh_SkPath_Reference?cl=9919#kMove_Verb">kMove Verb</a> points +that do not alter the area drawn by the returned <a href="bmh_SkPath_Reference?cl=9919#rect">rect</a>. + +### Parameters + +<table> <tr> <td><code><strong>rect </strong></code></td> <td> +storage for bounds of <a href="bmh_undocumented?cl=9919#Rect">Rect</a>; may be nullptr.</td> + </tr> <tr> <td><code><strong>isClosed </strong></code></td> <td> +storage set to true if <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> is closed; may be nullptr</td> + </tr> <tr> <td><code><strong>direction </strong></code></td> <td> +storage set to <a href="bmh_undocumented?cl=9919#Rect">Rect</a> <a href="bmh_SkPath_Reference?cl=9919#direction">direction</a>; may be nullptr.</td> + </tr> +</table> + +### Return Value + +true if <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> contains <a href="bmh_undocumented?cl=9919#Rect">Rect</a>. + +### Example + +<div><fiddle-embed name="063a5f0a8de1fe998d227393e0866557"><div>After <a href="bmh_SkPath_Reference?cl=9919#addRect">addRect</a>, <a href="bmh_SkPath_Reference?cl=9919#isRect">isRect</a> returns true. Following <a href="bmh_SkPath_Reference?cl=9919#moveTo">moveTo</a> permits <a href="bmh_SkPath_Reference?cl=9919#isRect">isRect</a> to return true, but +following <a href="bmh_SkPath_Reference?cl=9919#lineTo">lineTo</a> does not. <a href="bmh_SkPath_Reference?cl=9919#addPoly">addPoly</a> returns true even though <a href="bmh_SkPath_Reference?cl=9919#rect">rect</a> is not closed, and one +side of <a href="bmh_SkPath_Reference?cl=9919#rect">rect</a> is made up of consecutive line segments.</div> + +#### Example Output + +~~~~ +empty is not rect +addRect is rect (10, 20, 30, 40); is closed; direction CW +moveTo is rect (10, 20, 30, 40); is closed; direction CW +lineTo is not rect +addPoly is rect (0, 0, 80, 80); is not closed; direction CCW +~~~~ + +</fiddle-embed></div> + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#computeTightBounds">computeTightBounds</a> <a href="bmh_SkPath_Reference?cl=9919#conservativelyContainsRect">conservativelyContainsRect</a> <a href="bmh_SkPath_Reference?cl=9919#getBounds">getBounds</a> <a href="bmh_SkPath_Reference?cl=9919#isConvex">isConvex</a> <a href="bmh_SkPath_Reference?cl=9919#isLastContourClosed">isLastContourClosed</a> <a href="bmh_SkPath_Reference?cl=9919#isNestedFillRects">isNestedFillRects</a> + +--- + +<a name="isNestedFillRects"></a> +## isNestedFillRects + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +bool isNestedFillRects(SkRect rect[2], Direction dirs[2] = NULL) const +</pre> + +Returns true if <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> is equivalent to nested <a href="bmh_undocumented?cl=9919#Rect">Rect</a> pair when filled. +If <a href="bmh_SkPath_Reference?cl=9919#isNestedFillRects">isNestedFillRects</a> returns false, <a href="bmh_SkPath_Reference?cl=9919#rect">rect</a> and <a href="bmh_SkPath_Reference?cl=9919#dirs">dirs</a> are unchanged. +If <a href="bmh_SkPath_Reference?cl=9919#isNestedFillRects">isNestedFillRects</a> returns true, <a href="bmh_SkPath_Reference?cl=9919#rect">rect</a> and <a href="bmh_SkPath_Reference?cl=9919#dirs">dirs</a> are written to if not nullptr: +setting <a href="bmh_SkPath_Reference?cl=9919#rect">rect</a>[0] to outer <a href="bmh_undocumented?cl=9919#Rect">Rect</a>, and <a href="bmh_SkPath_Reference?cl=9919#rect">rect</a>[1] to inner <a href="bmh_undocumented?cl=9919#Rect">Rect</a>; +setting <a href="bmh_SkPath_Reference?cl=9919#dirs">dirs</a>[0] to <a href="bmh_SkPath_Reference?cl=9919#Direction">Direction</a> of outer <a href="bmh_undocumented?cl=9919#Rect">Rect</a>, and <a href="bmh_SkPath_Reference?cl=9919#dirs">dirs</a>[1] to <a href="bmh_SkPath_Reference?cl=9919#Direction">Direction</a> of inner +<a href="bmh_undocumented?cl=9919#Rect">Rect</a>. + +### Parameters + +<table> <tr> <td><code><strong>rect </strong></code></td> <td> +storage for <a href="bmh_undocumented?cl=9919#Rect">Rect</a> pair; may be nullptr.</td> + </tr> <tr> <td><code><strong>dirs </strong></code></td> <td> +storage for <a href="bmh_SkPath_Reference?cl=9919#Direction">Direction</a> pair; may be nullptr.</td> + </tr> +</table> + +### Return Value + +true if <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> contains nested <a href="bmh_undocumented?cl=9919#Rect">Rect</a> pair. + +### Example + +<div><fiddle-embed name="77e4394caf9fa083c19c21c2462efe14"> + +#### Example Output + +~~~~ +outer (7.5, 17.5, 32.5, 42.5); direction CW +inner (12.5, 22.5, 27.5, 37.5); direction CCW +~~~~ + +</fiddle-embed></div> + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#computeTightBounds">computeTightBounds</a> <a href="bmh_SkPath_Reference?cl=9919#conservativelyContainsRect">conservativelyContainsRect</a> <a href="bmh_SkPath_Reference?cl=9919#getBounds">getBounds</a> <a href="bmh_SkPath_Reference?cl=9919#isConvex">isConvex</a> <a href="bmh_SkPath_Reference?cl=9919#isLastContourClosed">isLastContourClosed</a> <a href="bmh_SkPath_Reference?cl=9919#isRect">isRect</a> + +--- + +<a name="addRect"></a> +## addRect + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void addRect(const SkRect& rect, Direction dir = kCW_Direction) +</pre> + +Add <a href="bmh_undocumented?cl=9919#Rect">Rect</a> to <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>, appending <a href="bmh_SkPath_Reference?cl=9919#kMove_Verb">kMove Verb</a>, three <a href="bmh_SkPath_Reference?cl=9919#kLine_Verb">kLine Verb</a>, and <a href="bmh_SkPath_Reference?cl=9919#kClose_Verb">kClose Verb</a>, +starting with top-left corner of <a href="bmh_undocumented?cl=9919#Rect">Rect</a>; followed by top-right, bottom-right, +and bottom-left if <a href="bmh_SkPath_Reference?cl=9919#dir">dir</a> is <a href="bmh_SkPath_Reference?cl=9919#kCW_Direction">kCW Direction</a>; or followed by bottom-left, +bottom-right, and top-right if <a href="bmh_SkPath_Reference?cl=9919#dir">dir</a> is <a href="bmh_SkPath_Reference?cl=9919#kCCW_Direction">kCCW Direction</a>. + +### Parameters + +<table> <tr> <td><code><strong>rect </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#Rect">Rect</a> to add as a closed contour.</td> + </tr> <tr> <td><code><strong>dir </strong></code></td> <td> +<a href="bmh_SkPath_Reference?cl=9919#Direction">Direction</a> to wind added contour.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="0f841e4eaebb613b5069800567917c2d"><div>The left <a href="bmh_undocumented?cl=9919#Rect">Rect</a> dashes starting at the top-left corner, to the right. +The right <a href="bmh_undocumented?cl=9919#Rect">Rect</a> dashes starting at the top-left corner, towards the bottom.</div></fiddle-embed></div> + +### See Also + +<a href="bmh_SkCanvas_Reference?cl=9919#drawRect">SkCanvas::drawRect</a> <a href="bmh_SkPath_Reference?cl=9919#Direction">Direction</a> + +--- + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void addRect(const SkRect& rect, Direction dir, unsigned start) +</pre> + +Add <a href="bmh_undocumented?cl=9919#Rect">Rect</a> to <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>, appending <a href="bmh_SkPath_Reference?cl=9919#kMove_Verb">kMove Verb</a>, three <a href="bmh_SkPath_Reference?cl=9919#kLine_Verb">kLine Verb</a>, and <a href="bmh_SkPath_Reference?cl=9919#kClose_Verb">kClose Verb</a>. +If <a href="bmh_SkPath_Reference?cl=9919#dir">dir</a> is <a href="bmh_SkPath_Reference?cl=9919#kCW_Direction">kCW Direction</a>, <a href="bmh_undocumented?cl=9919#Rect">Rect</a> corners are added clockwise; if <a href="bmh_SkPath_Reference?cl=9919#dir">dir</a> is +<a href="bmh_SkPath_Reference?cl=9919#kCCW_Direction">kCCW Direction</a>, <a href="bmh_undocumented?cl=9919#Rect">Rect</a> corners are added counterclockwise. +<a href="bmh_SkPath_Reference?cl=9919#start">start</a> determines the first corner added. + +| <a href="bmh_SkPath_Reference?cl=9919#start">start</a> | first corner | +| --- | --- | +| 0 | top-left | +| 1 | top-right | +| 2 | bottom-right | +| 3 | bottom-left | + +### Parameters + +<table> <tr> <td><code><strong>rect </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#Rect">Rect</a> to add as a closed contour.</td> + </tr> <tr> <td><code><strong>dir </strong></code></td> <td> +<a href="bmh_SkPath_Reference?cl=9919#Direction">Direction</a> to wind added contour.</td> + </tr> <tr> <td><code><strong>start </strong></code></td> <td> +Initial corner of <a href="bmh_undocumented?cl=9919#Rect">Rect</a> to add.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="9202430b3f4f5275af8eec5cc9d7baa8"><div>The arrow is just after the initial corner and points towards the next +corner appended to <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>.</div></fiddle-embed></div> + +### See Also + +<a href="bmh_SkCanvas_Reference?cl=9919#drawRect">SkCanvas::drawRect</a> <a href="bmh_SkPath_Reference?cl=9919#Direction">Direction</a> + +--- + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void addRect(SkScalar left, SkScalar top, SkScalar right, SkScalar bottom, + Direction dir = kCW_Direction) +</pre> + +Add <a href="bmh_undocumented?cl=9919#Rect">Rect</a> (<a href="bmh_SkPath_Reference?cl=9919#left">left</a>, <a href="bmh_SkPath_Reference?cl=9919#top">top</a>, <a href="bmh_SkPath_Reference?cl=9919#right">right</a>, <a href="bmh_SkPath_Reference?cl=9919#bottom">bottom</a>) to <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>, +appending <a href="bmh_SkPath_Reference?cl=9919#kMove_Verb">kMove Verb</a>, three <a href="bmh_SkPath_Reference?cl=9919#kLine_Verb">kLine Verb</a>, and <a href="bmh_SkPath_Reference?cl=9919#kClose_Verb">kClose Verb</a>, +starting with top-left corner of <a href="bmh_undocumented?cl=9919#Rect">Rect</a>; followed by top-right, bottom-right, +and bottom-left if <a href="bmh_SkPath_Reference?cl=9919#dir">dir</a> is <a href="bmh_SkPath_Reference?cl=9919#kCW_Direction">kCW Direction</a>; or followed by bottom-left, +bottom-right, and top-right if <a href="bmh_SkPath_Reference?cl=9919#dir">dir</a> is <a href="bmh_SkPath_Reference?cl=9919#kCCW_Direction">kCCW Direction</a>. + +### Parameters + +<table> <tr> <td><code><strong>left </strong></code></td> <td> +smaller x of <a href="bmh_undocumented?cl=9919#Rect">Rect</a>.</td> + </tr> <tr> <td><code><strong>top </strong></code></td> <td> +smaller y of <a href="bmh_undocumented?cl=9919#Rect">Rect</a>.</td> + </tr> <tr> <td><code><strong>right </strong></code></td> <td> +larger x of <a href="bmh_undocumented?cl=9919#Rect">Rect</a>.</td> + </tr> <tr> <td><code><strong>bottom </strong></code></td> <td> +larger y of <a href="bmh_undocumented?cl=9919#Rect">Rect</a>.</td> + </tr> <tr> <td><code><strong>dir </strong></code></td> <td> +<a href="bmh_SkPath_Reference?cl=9919#Direction">Direction</a> to wind added contour.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="3837827310e8b88b8c2e128ef9fbbd65"><div>The <a href="bmh_SkPath_Reference?cl=9919#left">left</a> <a href="bmh_undocumented?cl=9919#Rect">Rect</a> dashes start at the top-left corner, and continue to the <a href="bmh_SkPath_Reference?cl=9919#right">right</a>. +The <a href="bmh_SkPath_Reference?cl=9919#right">right</a> <a href="bmh_undocumented?cl=9919#Rect">Rect</a> dashes start at the top-left corner, and continue down.</div></fiddle-embed></div> + +### See Also + +<a href="bmh_SkCanvas_Reference?cl=9919#drawRect">SkCanvas::drawRect</a> <a href="bmh_SkPath_Reference?cl=9919#Direction">Direction</a> + +--- + +<a name="addOval"></a> +## addOval + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void addOval(const SkRect& oval, Direction dir = kCW_Direction) +</pre> + +Add <a href="bmh_undocumented?cl=9919#Oval">Oval</a> to path, appending <a href="bmh_SkPath_Reference?cl=9919#kMove_Verb">kMove Verb</a>, four <a href="bmh_SkPath_Reference?cl=9919#kConic_Verb">kConic Verb</a>, and <a href="bmh_SkPath_Reference?cl=9919#kClose_Verb">kClose Verb</a>. +<a href="bmh_undocumented?cl=9919#Oval">Oval</a> is upright ellipse bounded by <a href="bmh_undocumented?cl=9919#Rect">Rect</a> <a href="bmh_SkPath_Reference?cl=9919#oval">oval</a> with radii equal to half <a href="bmh_SkPath_Reference?cl=9919#oval">oval</a> width +and half <a href="bmh_SkPath_Reference?cl=9919#oval">oval</a> height. <a href="bmh_undocumented?cl=9919#Oval">Oval</a> begins at (<a href="bmh_SkPath_Reference?cl=9919#oval">oval</a>.fRight, <a href="bmh_SkPath_Reference?cl=9919#oval">oval</a>.centerY()) and continues +clockwise if <a href="bmh_SkPath_Reference?cl=9919#dir">dir</a> is <a href="bmh_SkPath_Reference?cl=9919#kCW_Direction">kCW Direction</a>, counterclockwise if <a href="bmh_SkPath_Reference?cl=9919#dir">dir</a> is <a href="bmh_SkPath_Reference?cl=9919#kCCW_Direction">kCCW Direction</a>. + +This form is identical to + +### Parameters + +<table> <tr> <td><code><strong>oval </strong></code></td> <td> +bounds of ellipse added.</td> + </tr> <tr> <td><code><strong>dir </strong></code></td> <td> +<a href="bmh_SkPath_Reference?cl=9919#Direction">Direction</a> to wind ellipse.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="cac84cf68e63a453c2a8b64c91537704"></fiddle-embed></div> + +### See Also + +<a href="bmh_SkCanvas_Reference?cl=9919#drawOval">SkCanvas::drawOval</a> <a href="bmh_SkPath_Reference?cl=9919#Direction">Direction</a> <a href="bmh_undocumented?cl=9919#Oval">Oval</a> + +--- + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void addOval(const SkRect& oval, Direction dir, unsigned start) +</pre> + +Add <a href="bmh_undocumented?cl=9919#Oval">Oval</a> to <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>, appending <a href="bmh_SkPath_Reference?cl=9919#kMove_Verb">kMove Verb</a>, four <a href="bmh_SkPath_Reference?cl=9919#kConic_Verb">kConic Verb</a>, and <a href="bmh_SkPath_Reference?cl=9919#kClose_Verb">kClose Verb</a>. +<a href="bmh_undocumented?cl=9919#Oval">Oval</a> is upright ellipse bounded by <a href="bmh_undocumented?cl=9919#Rect">Rect</a> <a href="bmh_SkPath_Reference?cl=9919#oval">oval</a> with radii equal to half <a href="bmh_SkPath_Reference?cl=9919#oval">oval</a> width +and half <a href="bmh_SkPath_Reference?cl=9919#oval">oval</a> height. <a href="bmh_undocumented?cl=9919#Oval">Oval</a> begins at <a href="bmh_SkPath_Reference?cl=9919#start">start</a> and continues +clockwise if <a href="bmh_SkPath_Reference?cl=9919#dir">dir</a> is <a href="bmh_SkPath_Reference?cl=9919#kCW_Direction">kCW Direction</a>, counterclockwise if <a href="bmh_SkPath_Reference?cl=9919#dir">dir</a> is <a href="bmh_SkPath_Reference?cl=9919#kCCW_Direction">kCCW Direction</a>. + +| <a href="bmh_SkPath_Reference?cl=9919#start">start</a> | <a href="bmh_undocumented?cl=9919#Point">Point</a> | +| --- | --- | +| 0 | <a href="bmh_SkPath_Reference?cl=9919#oval">oval</a>.centerX(), <a href="bmh_SkPath_Reference?cl=9919#oval">oval</a>.fTop | +| 1 | <a href="bmh_SkPath_Reference?cl=9919#oval">oval</a>.fRight, <a href="bmh_SkPath_Reference?cl=9919#oval">oval</a>.centerY() | +| 2 | <a href="bmh_SkPath_Reference?cl=9919#oval">oval</a>.centerX(), <a href="bmh_SkPath_Reference?cl=9919#oval">oval</a>.fBottom | +| 3 | <a href="bmh_SkPath_Reference?cl=9919#oval">oval</a>.fLeft, <a href="bmh_SkPath_Reference?cl=9919#oval">oval</a>.centerY() | + +### Parameters + +<table> <tr> <td><code><strong>oval </strong></code></td> <td> +bounds of ellipse added.</td> + </tr> <tr> <td><code><strong>dir </strong></code></td> <td> +<a href="bmh_SkPath_Reference?cl=9919#Direction">Direction</a> to wind ellipse.</td> + </tr> <tr> <td><code><strong>start </strong></code></td> <td> +index of initial point of ellipse.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="ab9753174060e4a551727ef3af12924d"></fiddle-embed></div> + +### See Also + +<a href="bmh_SkCanvas_Reference?cl=9919#drawOval">SkCanvas::drawOval</a> <a href="bmh_SkPath_Reference?cl=9919#Direction">Direction</a> <a href="bmh_undocumented?cl=9919#Oval">Oval</a> + +--- + +<a name="addCircle"></a> +## addCircle + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void addCircle(SkScalar x, SkScalar y, SkScalar radius, + Direction dir = kCW_Direction) +</pre> + +Add <a href="bmh_undocumented?cl=9919#Circle">Circle</a> centered at (<a href="bmh_SkPath_Reference?cl=9919#x">x</a>, <a href="bmh_SkPath_Reference?cl=9919#y">y</a>) of size <a href="bmh_SkPath_Reference?cl=9919#radius">radius</a> to <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>, appending <a href="bmh_SkPath_Reference?cl=9919#kMove_Verb">kMove Verb</a>, +four <a href="bmh_SkPath_Reference?cl=9919#kConic_Verb">kConic Verb</a>, and <a href="bmh_SkPath_Reference?cl=9919#kClose_Verb">kClose Verb</a>. <a href="bmh_undocumented?cl=9919#Circle">Circle</a> begins at (<a href="bmh_SkPath_Reference?cl=9919#x">x</a> + <a href="bmh_SkPath_Reference?cl=9919#radius">radius</a>, <a href="bmh_SkPath_Reference?cl=9919#y">y</a>) and +continues clockwise if <a href="bmh_SkPath_Reference?cl=9919#dir">dir</a> is <a href="bmh_SkPath_Reference?cl=9919#kCW_Direction">kCW Direction</a>, counterclockwise if <a href="bmh_SkPath_Reference?cl=9919#dir">dir</a> is +<a href="bmh_SkPath_Reference?cl=9919#kCCW_Direction">kCCW Direction</a>. + +<a href="bmh_SkPath_Reference?cl=9919#addCircle">addCircle</a> has no effect if <a href="bmh_SkPath_Reference?cl=9919#radius">radius</a> is zero or negative. + +### Parameters + +<table> <tr> <td><code><strong>x </strong></code></td> <td> +center of <a href="bmh_undocumented?cl=9919#Circle">Circle</a>.</td> + </tr> <tr> <td><code><strong>y </strong></code></td> <td> +center of <a href="bmh_undocumented?cl=9919#Circle">Circle</a>.</td> + </tr> <tr> <td><code><strong>radius </strong></code></td> <td> +distance from center to edge.</td> + </tr> <tr> <td><code><strong>dir </strong></code></td> <td> +<a href="bmh_SkPath_Reference?cl=9919#Direction">Direction</a> to wind <a href="bmh_undocumented?cl=9919#Circle">Circle</a>.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="bd5286cb9a5e5c32cd980f72b8f400fb"></fiddle-embed></div> + +### See Also + +<a href="bmh_SkCanvas_Reference?cl=9919#drawCircle">SkCanvas::drawCircle</a> <a href="bmh_SkPath_Reference?cl=9919#Direction">Direction</a> <a href="bmh_undocumented?cl=9919#Circle">Circle</a> + +--- + +<a name="addArc"></a> +## addArc + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void addArc(const SkRect& oval, SkScalar startAngle, SkScalar sweepAngle) +</pre> + +Append <a href="bmh_SkPath_Reference?cl=9919#Arc">Arc</a> to <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>, as the start of new <a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a>. <a href="bmh_SkPath_Reference?cl=9919#Arc">Arc</a> added is part of ellipse +bounded by <a href="bmh_SkPath_Reference?cl=9919#oval">oval</a>, from <a href="bmh_SkPath_Reference?cl=9919#startAngle">startAngle</a> through <a href="bmh_SkPath_Reference?cl=9919#sweepAngle">sweepAngle</a>. Both <a href="bmh_SkPath_Reference?cl=9919#startAngle">startAngle</a> and +<a href="bmh_SkPath_Reference?cl=9919#sweepAngle">sweepAngle</a> are measured in degrees, where zero degrees is aligned with the +positive x-axis, and positive sweeps extends <a href="bmh_SkPath_Reference?cl=9919#Arc">Arc</a> clockwise. + +If <a href="bmh_SkPath_Reference?cl=9919#sweepAngle">sweepAngle</a> <= -360, or <a href="bmh_SkPath_Reference?cl=9919#sweepAngle">sweepAngle</a> >= 360; and <a href="bmh_SkPath_Reference?cl=9919#startAngle">startAngle</a> modulo 90 is nearly +zero, append <a href="bmh_undocumented?cl=9919#Oval">Oval</a> instead of <a href="bmh_SkPath_Reference?cl=9919#Arc">Arc</a>. Otherwise, <a href="bmh_SkPath_Reference?cl=9919#sweepAngle">sweepAngle</a> values are treated +modulo 360, and <a href="bmh_SkPath_Reference?cl=9919#Arc">Arc</a> may or may not draw depending on numeric rounding. + +### Parameters + +<table> <tr> <td><code><strong>oval </strong></code></td> <td> +bounds of ellipse containing <a href="bmh_SkPath_Reference?cl=9919#Arc">Arc</a>.</td> + </tr> <tr> <td><code><strong>startAngle </strong></code></td> <td> +starting angle of <a href="bmh_SkPath_Reference?cl=9919#Arc">Arc</a> in degrees.</td> + </tr> <tr> <td><code><strong>sweepAngle </strong></code></td> <td> +sweep, in degrees. Positive is clockwise; treated modulo 360.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="9cf5122475624e4cf39f06c698f80b1a"><div>The middle row of the left and right columns draw differently from the entries +above and below because <a href="bmh_SkPath_Reference?cl=9919#sweepAngle">sweepAngle</a> is outside of the range of +/-360, +and <a href="bmh_SkPath_Reference?cl=9919#startAngle">startAngle</a> modulo 90 is not zero.</div></fiddle-embed></div> + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#Arc">Arc</a> <a href="bmh_SkPath_Reference?cl=9919#arcTo">arcTo</a> <a href="bmh_SkCanvas_Reference?cl=9919#drawArc">SkCanvas::drawArc</a> + +--- + +<a name="addRoundRect"></a> +## addRoundRect + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void addRoundRect(const SkRect& rect, SkScalar rx, SkScalar ry, + Direction dir = kCW_Direction) +</pre> + +Append <a href="bmh_undocumented?cl=9919#Round_Rect">Round Rect</a> to <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>, creating a new closed <a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a>. <a href="bmh_undocumented?cl=9919#Round_Rect">Round Rect</a> has bounds +equal to <a href="bmh_SkPath_Reference?cl=9919#rect">rect</a>; each corner is 90 degrees of an ellipse with radii (<a href="bmh_SkPath_Reference?cl=9919#rx">rx</a>, <a href="bmh_SkPath_Reference?cl=9919#ry">ry</a>). If +<a href="bmh_SkPath_Reference?cl=9919#dir">dir</a> is <a href="bmh_SkPath_Reference?cl=9919#kCW_Direction">kCW Direction</a>, <a href="bmh_undocumented?cl=9919#Round_Rect">Round Rect</a> starts at top-left of the lower-left corner and +winds clockwise. If <a href="bmh_SkPath_Reference?cl=9919#dir">dir</a> is <a href="bmh_SkPath_Reference?cl=9919#kCCW_Direction">kCCW Direction</a>, <a href="bmh_undocumented?cl=9919#Round_Rect">Round Rect</a> starts at the bottom-left +of the upper-left corner and winds counterclockwise. + +If either <a href="bmh_SkPath_Reference?cl=9919#rx">rx</a> or <a href="bmh_SkPath_Reference?cl=9919#ry">ry</a> is too large, <a href="bmh_SkPath_Reference?cl=9919#rx">rx</a> and <a href="bmh_SkPath_Reference?cl=9919#ry">ry</a> are scaled uniformly until the +corners fit. If <a href="bmh_SkPath_Reference?cl=9919#rx">rx</a> or <a href="bmh_SkPath_Reference?cl=9919#ry">ry</a> is less than or equal to zero, <a href="bmh_SkPath_Reference?cl=9919#addRoundRect">addRoundRect</a> appends +<a href="bmh_undocumented?cl=9919#Rect">Rect</a> <a href="bmh_SkPath_Reference?cl=9919#rect">rect</a> to <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>. + +After appending, <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> may be empty, or may contain: <a href="bmh_undocumented?cl=9919#Rect">Rect</a>, <a href="bmh_undocumented?cl=9919#Oval">Oval</a>, or RoundRect. + +### Parameters + +<table> <tr> <td><code><strong>rect </strong></code></td> <td> +bounds of <a href="bmh_undocumented?cl=9919#Round_Rect">Round Rect</a>.</td> + </tr> <tr> <td><code><strong>rx </strong></code></td> <td> +x-radius of rounded corners on the <a href="bmh_undocumented?cl=9919#Round_Rect">Round Rect</a></td> + </tr> <tr> <td><code><strong>ry </strong></code></td> <td> +y-radius of rounded corners on the <a href="bmh_undocumented?cl=9919#Round_Rect">Round Rect</a></td> + </tr> <tr> <td><code><strong>dir </strong></code></td> <td> +<a href="bmh_SkPath_Reference?cl=9919#Direction">Direction</a> to wind <a href="bmh_undocumented?cl=9919#Round_Rect">Round Rect</a>.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="24736f685f265cf533f1700c042db353"><div>If either radius is zero, path contains <a href="bmh_undocumented?cl=9919#Rect">Rect</a> and is drawn red. +If sides are only radii, path contains <a href="bmh_undocumented?cl=9919#Oval">Oval</a> and is drawn blue. +All remaining path draws are convex, and are drawn in gray; no +paths constructed from <a href="bmh_SkPath_Reference?cl=9919#addRoundRect">addRoundRect</a> are concave, so none are +drawn in green.</div></fiddle-embed></div> + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#addRRect">addRRect</a> <a href="bmh_SkCanvas_Reference?cl=9919#drawRoundRect">SkCanvas::drawRoundRect</a> + +--- + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void addRoundRect(const SkRect& rect, const SkScalar radii[], + Direction dir = kCW_Direction) +</pre> + +Append <a href="bmh_undocumented?cl=9919#Round_Rect">Round Rect</a> to <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>, creating a new closed <a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a>. <a href="bmh_undocumented?cl=9919#Round_Rect">Round Rect</a> has bounds +equal to <a href="bmh_SkPath_Reference?cl=9919#rect">rect</a>; each corner is 90 degrees of an ellipse with <a href="bmh_SkPath_Reference?cl=9919#radii">radii</a> from the +array. + +| <a href="bmh_SkPath_Reference?cl=9919#radii">radii</a> index | location | +| --- | --- | +| 0 | x-radius of top-left corner | +| 1 | y-radius of top-left corner | +| 2 | x-radius of top-right corner | +| 3 | y-radius of top-right corner | +| 4 | x-radius of bottom-right corner | +| 5 | y-radius of bottom-right corner | +| 6 | x-radius of bottom-left corner | +| 7 | y-radius of bottom-left corner | + +If <a href="bmh_SkPath_Reference?cl=9919#dir">dir</a> is <a href="bmh_SkPath_Reference?cl=9919#kCW_Direction">kCW Direction</a>, <a href="bmh_undocumented?cl=9919#Round_Rect">Round Rect</a> starts at top-left of the lower-left corner +and winds clockwise. If <a href="bmh_SkPath_Reference?cl=9919#dir">dir</a> is <a href="bmh_SkPath_Reference?cl=9919#kCCW_Direction">kCCW Direction</a>, <a href="bmh_undocumented?cl=9919#Round_Rect">Round Rect</a> starts at the +bottom-left of the upper-left corner and winds counterclockwise. + +If both <a href="bmh_SkPath_Reference?cl=9919#radii">radii</a> on any side of <a href="bmh_SkPath_Reference?cl=9919#rect">rect</a> exceed its length, all <a href="bmh_SkPath_Reference?cl=9919#radii">radii</a> are scaled +uniformly until the corners fit. If either radius of a corner is less than or +equal to zero, both are treated as zero. + +After appending, <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> may be empty, or may contain: <a href="bmh_undocumented?cl=9919#Rect">Rect</a>, <a href="bmh_undocumented?cl=9919#Oval">Oval</a>, or RoundRect. + +### Parameters + +<table> <tr> <td><code><strong>rect </strong></code></td> <td> +bounds of <a href="bmh_undocumented?cl=9919#Round_Rect">Round Rect</a>.</td> + </tr> <tr> <td><code><strong>radii </strong></code></td> <td> +array of 8 <a href="bmh_undocumented?cl=9919#SkScalar">SkScalar</a> values, a radius pair for each corner.</td> + </tr> <tr> <td><code><strong>dir </strong></code></td> <td> +<a href="bmh_SkPath_Reference?cl=9919#Direction">Direction</a> to wind <a href="bmh_undocumented?cl=9919#Round_Rect">Round Rect</a>.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="c43d70606b4ee464d2befbcf448c5e73"></fiddle-embed></div> + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#addRRect">addRRect</a> <a href="bmh_SkCanvas_Reference?cl=9919#drawRoundRect">SkCanvas::drawRoundRect</a> + +--- + +<a name="addRRect"></a> +## addRRect + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void addRRect(const SkRRect& rrect, Direction dir = kCW_Direction) +</pre> + +Add <a href="bmh_SkPath_Reference?cl=9919#rrect">rrect</a> to <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>, creating a new closed <a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a>. If +<a href="bmh_SkPath_Reference?cl=9919#dir">dir</a> is <a href="bmh_SkPath_Reference?cl=9919#kCW_Direction">kCW Direction</a>, <a href="bmh_SkPath_Reference?cl=9919#rrect">rrect</a> starts at top-left of the lower-left corner and +winds clockwise. If <a href="bmh_SkPath_Reference?cl=9919#dir">dir</a> is <a href="bmh_SkPath_Reference?cl=9919#kCCW_Direction">kCCW Direction</a>, <a href="bmh_SkPath_Reference?cl=9919#rrect">rrect</a> starts at the bottom-left +of the upper-left corner and winds counterclockwise. + +After appending, <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> may be empty, or may contain: <a href="bmh_undocumented?cl=9919#Rect">Rect</a>, <a href="bmh_undocumented?cl=9919#Oval">Oval</a>, or RRect. + +### Parameters + +<table> <tr> <td><code><strong>rrect </strong></code></td> <td> +bounds and radii of rounded rectangle.</td> + </tr> <tr> <td><code><strong>dir </strong></code></td> <td> +<a href="bmh_SkPath_Reference?cl=9919#Direction">Direction</a> to wind <a href="bmh_undocumented?cl=9919#Round_Rect">Round Rect</a>.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="d9ecd58081b5bc77a157636fcb345dc6"></fiddle-embed></div> + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#addRoundRect">addRoundRect</a> <a href="bmh_SkCanvas_Reference?cl=9919#drawRRect">SkCanvas::drawRRect</a> + +--- + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void addRRect(const SkRRect& rrect, Direction dir, unsigned start) +</pre> + +Add <a href="bmh_SkPath_Reference?cl=9919#rrect">rrect</a> to <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>, creating a new closed <a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a>. If <a href="bmh_SkPath_Reference?cl=9919#dir">dir</a> is <a href="bmh_SkPath_Reference?cl=9919#kCW_Direction">kCW Direction</a>, <a href="bmh_SkPath_Reference?cl=9919#rrect">rrect</a> +winds clockwise; if <a href="bmh_SkPath_Reference?cl=9919#dir">dir</a> is <a href="bmh_SkPath_Reference?cl=9919#kCCW_Direction">kCCW Direction</a>, <a href="bmh_SkPath_Reference?cl=9919#rrect">rrect</a> winds counterclockwise. +<a href="bmh_SkPath_Reference?cl=9919#start">start</a> determines the first point of <a href="bmh_SkPath_Reference?cl=9919#rrect">rrect</a> to add. + +| <a href="bmh_SkPath_Reference?cl=9919#start">start</a> | location | +| --- | --- | +| 0 | right of top-left corner | +| 1 | left of top-right corner | +| 2 | bottom of top-right corner | +| 3 | top of bottom-right corner | +| 4 | left of bottom-right corner | +| 5 | right of bottom-left corner | +| 6 | top of bottom-left corner | +| 7 | bottom of top-left corner | + +After appending, <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> may be empty, or may contain: <a href="bmh_undocumented?cl=9919#Rect">Rect</a>, <a href="bmh_undocumented?cl=9919#Oval">Oval</a>, or RRect. + +### Parameters + +<table> <tr> <td><code><strong>rrect </strong></code></td> <td> +bounds and radii of rounded rectangle.</td> + </tr> <tr> <td><code><strong>dir </strong></code></td> <td> +<a href="bmh_SkPath_Reference?cl=9919#Direction">Direction</a> to wind RRect.</td> + </tr> <tr> <td><code><strong>start </strong></code></td> <td> +Index of initial point of RRect.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="f18740ffcb10a499007488948c2cd60d"></fiddle-embed></div> + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#addRoundRect">addRoundRect</a> <a href="bmh_SkCanvas_Reference?cl=9919#drawRRect">SkCanvas::drawRRect</a> + +--- + +<a name="addPoly"></a> +## addPoly + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void addPoly(const SkPoint pts[], int count, bool close) +</pre> + +Add <a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a> created from <a href="bmh_undocumented?cl=9919#Line">Line</a> Array. Given <a href="bmh_SkPath_Reference?cl=9919#count">count</a> <a href="bmh_SkPath_Reference?cl=9919#pts">pts</a>, <a href="bmh_SkPath_Reference?cl=9919#addPoly">addPoly</a> adds +<a href="bmh_SkPath_Reference?cl=9919#count">count</a> - 1 <a href="bmh_undocumented?cl=9919#Line">Line</a> segments. <a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a> added starts at pt[0], then adds a line +for every additional <a href="bmh_undocumented?cl=9919#Point">Point</a> in <a href="bmh_SkPath_Reference?cl=9919#pts">pts</a> array. If <a href="bmh_SkPath_Reference?cl=9919#close">close</a> is true, <a href="bmh_SkPath_Reference?cl=9919#addPoly">addPoly</a> +appends <a href="bmh_SkPath_Reference?cl=9919#kClose_Verb">kClose Verb</a> to <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>, connecting <a href="bmh_SkPath_Reference?cl=9919#pts">pts</a>[<a href="bmh_SkPath_Reference?cl=9919#count">count</a> - 1] and <a href="bmh_SkPath_Reference?cl=9919#pts">pts</a>[0]. + +If <a href="bmh_SkPath_Reference?cl=9919#count">count</a> is zero, append <a href="bmh_SkPath_Reference?cl=9919#kMove_Verb">kMove Verb</a> to path. +<a href="bmh_SkPath_Reference?cl=9919#addPoly">addPoly</a> has no effect if <a href="bmh_SkPath_Reference?cl=9919#count">count</a> is less than one. + +### Parameters + +<table> <tr> <td><code><strong>pts </strong></code></td> <td> +Array of <a href="bmh_undocumented?cl=9919#Line">Line</a> sharing end and start <a href="bmh_undocumented?cl=9919#Point">Point</a>.</td> + </tr> <tr> <td><code><strong>count </strong></code></td> <td> +Length of <a href="bmh_undocumented?cl=9919#Point">Point</a> array.</td> + </tr> <tr> <td><code><strong>close </strong></code></td> <td> +true to add <a href="bmh_undocumented?cl=9919#Line">Line</a> connecting <a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a> end and start.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="182b3999772f330f3b0b891b492634ae"></fiddle-embed></div> + +### See Also + +<a href="bmh_SkCanvas_Reference?cl=9919#drawPoints">SkCanvas::drawPoints</a> + +--- + +## <a name="SkPath::AddPathMode"></a> Enum SkPath::AddPathMode + +<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0"> +enum <a href="bmh_SkPath_Reference?cl=9919#AddPathMode">AddPathMode</a> { +<a href="bmh_SkPath_Reference?cl=9919#kAppend_AddPathMode">kAppend AddPathMode</a> +<a href="bmh_SkPath_Reference?cl=9919#kExtend_AddPathMode">kExtend AddPathMode</a> +};</pre> + +<a href="bmh_SkPath_Reference?cl=9919#AddPathMode">AddPathMode</a> chooses how <a href="bmh_SkPath_Reference?cl=9919#addPath">addPath</a> appends. Adding one <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> to another can extend +the last <a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a> or start a new <a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a>. + +### Constants + +<table> + <tr> + <td><a name="SkPath::kAppend_AddPathMode"></a> <code><strong>SkPath::kAppend_AddPathMode </strong></code></td><td>Path Verbs, Points, and Weights are appended to destination unaltered.</td><td>Since <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> <a href="bmh_SkPath_Reference?cl=9919#Verb_Array">Verb Array</a> begins with <a href="bmh_SkPath_Reference?cl=9919#kMove_Verb">kMove Verb</a> if src is not empty, this +starts a new <a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a>.</td> + </tr> + <tr> + <td><a name="SkPath::kExtend_AddPathMode"></a> <code><strong>SkPath::kExtend_AddPathMode </strong></code></td><td>If destination is closed or empty, start a new Contour. If destination</td><td>is not empty, add <a href="bmh_undocumented?cl=9919#Line">Line</a> from <a href="bmh_SkPath_Reference?cl=9919#Last_Point">Last Point</a> to added <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> first <a href="bmh_undocumented?cl=9919#Point">Point</a>. Skip added +<a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> initial <a href="bmh_SkPath_Reference?cl=9919#kMove_Verb">kMove Verb</a>, then append remining <a href="bmh_SkPath_Reference?cl=9919#Verb">Verbs</a>, <a href="bmh_undocumented?cl=9919#Point">Points</a>, and <a href="bmh_SkPath_Reference?cl=9919#Weight">Weights</a>.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="801b02e74c64aafdb734f2e5cf3e5ab0"><div>test is built from path, open on the top row, and closed on the bottom row. +The left column uses <a href="bmh_SkPath_Reference?cl=9919#kAppend_AddPathMode">kAppend AddPathMode</a>; the right uses <a href="bmh_SkPath_Reference?cl=9919#kExtend_AddPathMode">kExtend AddPathMode</a>. +The top right composition is made up of one contour; the other three have two.</div></fiddle-embed></div> + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#addPath">addPath</a> <a href="bmh_SkPath_Reference?cl=9919#reverseAddPath">reverseAddPath</a> + + + +<a name="addPath"></a> +## addPath + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void addPath(const SkPath& src, SkScalar dx, SkScalar dy, + AddPathMode mode = kAppend_AddPathMode) +</pre> + +Append <a href="bmh_SkPath_Reference?cl=9919#src">src</a> to <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>, offset by (<a href="bmh_SkPath_Reference?cl=9919#dx">dx</a>, <a href="bmh_SkPath_Reference?cl=9919#dy">dy</a>). + +If <a href="bmh_SkPath_Reference?cl=9919#mode">mode</a> is <a href="bmh_SkPath_Reference?cl=9919#kAppend_AddPathMode">kAppend AddPathMode</a>, <a href="bmh_SkPath_Reference?cl=9919#src">src</a> <a href="bmh_SkPath_Reference?cl=9919#Verb_Array">Verb Array</a>, <a href="bmh_SkPath_Reference?cl=9919#Point_Array">Point Array</a>, and <a href="bmh_SkPath_Reference?cl=9919#Weight">Weights</a> are +added unaltered. If <a href="bmh_SkPath_Reference?cl=9919#mode">mode</a> is <a href="bmh_SkPath_Reference?cl=9919#kExtend_AddPathMode">kExtend AddPathMode</a>, add <a href="bmh_undocumented?cl=9919#Line">Line</a> before appending +<a href="bmh_SkPath_Reference?cl=9919#Verb">Verbs</a>, <a href="bmh_undocumented?cl=9919#Point">Points</a>, and <a href="bmh_SkPath_Reference?cl=9919#Weight">Weights</a>. + +### Parameters + +<table> <tr> <td><code><strong>src </strong></code></td> <td> +<a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> <a href="bmh_SkPath_Reference?cl=9919#Verb">Verbs</a>, <a href="bmh_undocumented?cl=9919#Point">Points</a>, and <a href="bmh_SkPath_Reference?cl=9919#Weight">Weights</a> to add.</td> + </tr> <tr> <td><code><strong>dx </strong></code></td> <td> +offset added to <a href="bmh_SkPath_Reference?cl=9919#src">src</a> <a href="bmh_SkPath_Reference?cl=9919#Point_Array">Point Array</a> x coordinates.</td> + </tr> <tr> <td><code><strong>dy </strong></code></td> <td> +offset added to <a href="bmh_SkPath_Reference?cl=9919#src">src</a> <a href="bmh_SkPath_Reference?cl=9919#Point_Array">Point Array</a> y coordinates.</td> + </tr> <tr> <td><code><strong>mode </strong></code></td> <td> +<a href="bmh_SkPath_Reference?cl=9919#kAppend_AddPathMode">kAppend AddPathMode</a> or <a href="bmh_SkPath_Reference?cl=9919#kExtend_AddPathMode">kExtend AddPathMode</a>.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="c416bddfe286628974e1c7f0fd66f3f4"></fiddle-embed></div> + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#AddPathMode">AddPathMode</a> <a href="bmh_SkPath_Reference?cl=9919#offset">offset</a> <a href="bmh_SkPath_Reference?cl=9919#reverseAddPath">reverseAddPath</a> + +--- + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void addPath(const SkPath& src, AddPathMode mode = kAppend_AddPathMode) +</pre> + +Append <a href="bmh_SkPath_Reference?cl=9919#src">src</a> to <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>. + +If <a href="bmh_SkPath_Reference?cl=9919#mode">mode</a> is <a href="bmh_SkPath_Reference?cl=9919#kAppend_AddPathMode">kAppend AddPathMode</a>, <a href="bmh_SkPath_Reference?cl=9919#src">src</a> <a href="bmh_SkPath_Reference?cl=9919#Verb_Array">Verb Array</a>, <a href="bmh_SkPath_Reference?cl=9919#Point_Array">Point Array</a>, and <a href="bmh_SkPath_Reference?cl=9919#Weight">Weights</a> are +added unaltered. If <a href="bmh_SkPath_Reference?cl=9919#mode">mode</a> is <a href="bmh_SkPath_Reference?cl=9919#kExtend_AddPathMode">kExtend AddPathMode</a>, add <a href="bmh_undocumented?cl=9919#Line">Line</a> before appending +<a href="bmh_SkPath_Reference?cl=9919#Verb">Verbs</a>, <a href="bmh_undocumented?cl=9919#Point">Points</a>, and <a href="bmh_SkPath_Reference?cl=9919#Weight">Weights</a>. + +### Parameters + +<table> <tr> <td><code><strong>src </strong></code></td> <td> +<a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> <a href="bmh_SkPath_Reference?cl=9919#Verb">Verbs</a>, <a href="bmh_undocumented?cl=9919#Point">Points</a>, and <a href="bmh_SkPath_Reference?cl=9919#Weight">Weights</a> to add.</td> + </tr> <tr> <td><code><strong>mode </strong></code></td> <td> +<a href="bmh_SkPath_Reference?cl=9919#kAppend_AddPathMode">kAppend AddPathMode</a> or <a href="bmh_SkPath_Reference?cl=9919#kExtend_AddPathMode">kExtend AddPathMode</a>.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="84b2d1c0fc29f1b35e855b6fc6672f9e"></fiddle-embed></div> + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#AddPathMode">AddPathMode</a> <a href="bmh_SkPath_Reference?cl=9919#reverseAddPath">reverseAddPath</a> + +--- + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void addPath(const SkPath& src, const SkMatrix& matrix, + AddPathMode mode = kAppend_AddPathMode) +</pre> + +Append <a href="bmh_SkPath_Reference?cl=9919#src">src</a> to <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>, transformed by <a href="bmh_SkPath_Reference?cl=9919#matrix">matrix</a>. Transformed curves may have different +<a href="bmh_SkPath_Reference?cl=9919#Verb">Verbs</a>, <a href="bmh_undocumented?cl=9919#Point">Points</a>, and <a href="bmh_SkPath_Reference?cl=9919#Weight">Weights</a>. + +If <a href="bmh_SkPath_Reference?cl=9919#mode">mode</a> is <a href="bmh_SkPath_Reference?cl=9919#kAppend_AddPathMode">kAppend AddPathMode</a>, <a href="bmh_SkPath_Reference?cl=9919#src">src</a> <a href="bmh_SkPath_Reference?cl=9919#Verb_Array">Verb Array</a>, <a href="bmh_SkPath_Reference?cl=9919#Point_Array">Point Array</a>, and <a href="bmh_SkPath_Reference?cl=9919#Weight">Weights</a> are +added unaltered. If <a href="bmh_SkPath_Reference?cl=9919#mode">mode</a> is <a href="bmh_SkPath_Reference?cl=9919#kExtend_AddPathMode">kExtend AddPathMode</a>, add <a href="bmh_undocumented?cl=9919#Line">Line</a> before appending +<a href="bmh_SkPath_Reference?cl=9919#Verb">Verbs</a>, <a href="bmh_undocumented?cl=9919#Point">Points</a>, and <a href="bmh_SkPath_Reference?cl=9919#Weight">Weights</a>. + +### Parameters + +<table> <tr> <td><code><strong>src </strong></code></td> <td> +<a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> <a href="bmh_SkPath_Reference?cl=9919#Verb">Verbs</a>, <a href="bmh_undocumented?cl=9919#Point">Points</a>, and <a href="bmh_SkPath_Reference?cl=9919#Weight">Weights</a> to add.</td> + </tr> <tr> <td><code><strong>matrix </strong></code></td> <td> +Transform applied to <a href="bmh_SkPath_Reference?cl=9919#src">src</a>.</td> + </tr> <tr> <td><code><strong>mode </strong></code></td> <td> +<a href="bmh_SkPath_Reference?cl=9919#kAppend_AddPathMode">kAppend AddPathMode</a> or <a href="bmh_SkPath_Reference?cl=9919#kExtend_AddPathMode">kExtend AddPathMode</a>.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="3a90a91030f7289d5df0671d342dbbad"></fiddle-embed></div> + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#AddPathMode">AddPathMode</a> <a href="bmh_SkPath_Reference?cl=9919#transform">transform</a> <a href="bmh_SkPath_Reference?cl=9919#offset">offset</a> <a href="bmh_SkPath_Reference?cl=9919#reverseAddPath">reverseAddPath</a> + +--- + +<a name="reverseAddPath"></a> +## reverseAddPath + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void reverseAddPath(const SkPath& src) +</pre> + +Append <a href="bmh_SkPath_Reference?cl=9919#src">src</a> to <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>, from back to front. +Reversed <a href="bmh_SkPath_Reference?cl=9919#src">src</a> always appends a new <a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a> to <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>. + +### Parameters + +<table> <tr> <td><code><strong>src </strong></code></td> <td> +<a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> <a href="bmh_SkPath_Reference?cl=9919#Verb">Verbs</a>, <a href="bmh_undocumented?cl=9919#Point">Points</a>, and <a href="bmh_SkPath_Reference?cl=9919#Weight">Weights</a> to add.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="5e8513f073db09acde3ff616f6426e3d"></fiddle-embed></div> + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#AddPathMode">AddPathMode</a> <a href="bmh_SkPath_Reference?cl=9919#transform">transform</a> <a href="bmh_SkPath_Reference?cl=9919#offset">offset</a> <a href="bmh_SkPath_Reference?cl=9919#addPath">addPath</a> + +--- + +<a name="offset"></a> +## offset + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void offset(SkScalar dx, SkScalar dy, SkPath* dst) const +</pre> + +Offset <a href="bmh_SkPath_Reference?cl=9919#Point_Array">Point Array</a> by (<a href="bmh_SkPath_Reference?cl=9919#dx">dx</a>, <a href="bmh_SkPath_Reference?cl=9919#dy">dy</a>). Offset <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> replaces <a href="bmh_SkPath_Reference?cl=9919#dst">dst</a>. +If <a href="bmh_SkPath_Reference?cl=9919#dst">dst</a> is nullptr, <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> is replaced by offset data. + +### Parameters + +<table> <tr> <td><code><strong>dx </strong></code></td> <td> +offset added to <a href="bmh_SkPath_Reference?cl=9919#Point_Array">Point Array</a> x coordinates.</td> + </tr> <tr> <td><code><strong>dy </strong></code></td> <td> +offset added to <a href="bmh_SkPath_Reference?cl=9919#Point_Array">Point Array</a> y coordinates.</td> + </tr> <tr> <td><code><strong>dst </strong></code></td> <td> +overwritten, translated copy of <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>; may be nullptr.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="1d1892196ba5bda257df4f3351abd084"></fiddle-embed></div> + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#addPath">addPath</a> transform + +--- + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void offset(SkScalar dx, SkScalar dy) +</pre> + +Offset <a href="bmh_SkPath_Reference?cl=9919#Point_Array">Point Array</a> by (<a href="bmh_SkPath_Reference?cl=9919#dx">dx</a>, <a href="bmh_SkPath_Reference?cl=9919#dy">dy</a>). <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> is replaced by offset data. + +### Parameters + +<table> <tr> <td><code><strong>dx </strong></code></td> <td> +offset added to <a href="bmh_SkPath_Reference?cl=9919#Point_Array">Point Array</a> x coordinates.</td> + </tr> <tr> <td><code><strong>dy </strong></code></td> <td> +offset added to <a href="bmh_SkPath_Reference?cl=9919#Point_Array">Point Array</a> y coordinates.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="5188d77585715db30bef228f2dfbcccd"></fiddle-embed></div> + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#addPath">addPath</a> transform <a href="bmh_SkCanvas_Reference?cl=9919#translate">SkCanvas::translate()</a> + +--- + +<a name="transform"></a> +## transform + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void transform(const SkMatrix& matrix, SkPath* dst) const +</pre> + +Transform <a href="bmh_SkPath_Reference?cl=9919#Verb_Array">Verb Array</a>, <a href="bmh_SkPath_Reference?cl=9919#Point_Array">Point Array</a>, and weight by <a href="bmh_SkPath_Reference?cl=9919#matrix">matrix</a>. +transform may change <a href="bmh_SkPath_Reference?cl=9919#Verb">Verbs</a> and increase their number. +Transformed <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> replaces <a href="bmh_SkPath_Reference?cl=9919#dst">dst</a>; if <a href="bmh_SkPath_Reference?cl=9919#dst">dst</a> is nullptr, original data +is replaced. + +### Parameters + +<table> <tr> <td><code><strong>matrix </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#Matrix">Matrix</a> to apply to <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>.</td> + </tr> <tr> <td><code><strong>dst </strong></code></td> <td> +overwritten, transformed copy of <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>; may be nullptr.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="99761add116ce3b0730557224c1b0105"></fiddle-embed></div> + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#addPath">addPath</a> offset <a href="bmh_SkCanvas_Reference?cl=9919#concat">SkCanvas::concat()</a> <a href="bmh_undocumented?cl=9919#SkMatrix">SkMatrix</a> + +--- + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void transform(const SkMatrix& matrix) +</pre> + +Transform <a href="bmh_SkPath_Reference?cl=9919#Verb_Array">Verb Array</a>, <a href="bmh_SkPath_Reference?cl=9919#Point_Array">Point Array</a>, and weight by <a href="bmh_SkPath_Reference?cl=9919#matrix">matrix</a>. +transform may change <a href="bmh_SkPath_Reference?cl=9919#Verb">Verbs</a> and increase their number. +<a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> is replaced by transformed data. + +### Parameters + +<table> <tr> <td><code><strong>matrix </strong></code></td> <td> +<a href="bmh_undocumented?cl=9919#Matrix">Matrix</a> to apply to <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="c40979a3b92a30cfb7bae36abcc1d805"></fiddle-embed></div> + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#addPath">addPath</a> offset <a href="bmh_SkCanvas_Reference?cl=9919#concat">SkCanvas::concat()</a> <a href="bmh_undocumented?cl=9919#SkMatrix">SkMatrix</a> + +--- + +## <a name="Last_Point"></a> Last Point + +<a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> is defined cumulatively, often by adding a segment to the end of last +<a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a>. <a href="bmh_SkPath_Reference?cl=9919#Last_Point">Last Point</a> of <a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a> is shared as first <a href="bmh_undocumented?cl=9919#Point">Point</a> of added <a href="bmh_undocumented?cl=9919#Line">Line</a> or <a href="bmh_undocumented?cl=9919#Curve">Curve</a>. +<a href="bmh_SkPath_Reference?cl=9919#Last_Point">Last Point</a> can be read and written directly with <a href="bmh_SkPath_Reference?cl=9919#getLastPt">getLastPt</a> and <a href="bmh_SkPath_Reference?cl=9919#setLastPt">setLastPt</a>. + +<a name="getLastPt"></a> +## getLastPt + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +bool getLastPt(SkPoint* lastPt) const +</pre> + +Returns <a href="bmh_SkPath_Reference?cl=9919#Last_Point">Last Point</a> on <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> in <a href="bmh_SkPath_Reference?cl=9919#lastPt">lastPt</a>. Returns false if <a href="bmh_SkPath_Reference?cl=9919#Point_Array">Point Array</a> is empty, +storing (0, 0) if <a href="bmh_SkPath_Reference?cl=9919#lastPt">lastPt</a> is not nullptr. + +### Parameters + +<table> <tr> <td><code><strong>lastPt </strong></code></td> <td> +storage for final <a href="bmh_undocumented?cl=9919#Point">Point</a> in <a href="bmh_SkPath_Reference?cl=9919#Point_Array">Point Array</a>; may be nullptr.</td> + </tr> +</table> + +### Return Value + +true if <a href="bmh_SkPath_Reference?cl=9919#Point_Array">Point Array</a> contains one or more <a href="bmh_undocumented?cl=9919#Point">Points</a>. + +### Example + +<div><fiddle-embed name="df8160dd7ac8aa4b40fce7286fe49952"> + +#### Example Output + +~~~~ +last point: 35.2786, 52.9772 +~~~~ + +</fiddle-embed></div> + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#setLastPt">setLastPt</a> + +--- + +<a name="setLastPt"></a> +## setLastPt + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void setLastPt(SkScalar x, SkScalar y) +</pre> + +Set <a href="bmh_SkPath_Reference?cl=9919#Last_Point">Last Point</a> to (<a href="bmh_SkPath_Reference?cl=9919#x">x</a>, <a href="bmh_SkPath_Reference?cl=9919#y">y</a>). If <a href="bmh_SkPath_Reference?cl=9919#Point_Array">Point Array</a> is empty, append <a href="bmh_SkPath_Reference?cl=9919#kMove_Verb">kMove Verb</a> to +<a href="bmh_SkPath_Reference?cl=9919#Verb_Array">Verb Array</a> and (<a href="bmh_SkPath_Reference?cl=9919#x">x</a>, <a href="bmh_SkPath_Reference?cl=9919#y">y</a>) to <a href="bmh_SkPath_Reference?cl=9919#Point_Array">Point Array</a>. + +### Parameters + +<table> <tr> <td><code><strong>x </strong></code></td> <td> +set x-coordinate of <a href="bmh_SkPath_Reference?cl=9919#Last_Point">Last Point</a>.</td> + </tr> <tr> <td><code><strong>y </strong></code></td> <td> +set y-coordinate of <a href="bmh_SkPath_Reference?cl=9919#Last_Point">Last Point</a>.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="542c5afaea5f57baa11d0561dd402e18"></fiddle-embed></div> + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#getLastPt">getLastPt</a> + +--- + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void setLastPt(const SkPoint& p) +</pre> + +Set the last point on the path. If no points have been added, + +### Parameters + +<table> <tr> <td><code><strong>p </strong></code></td> <td> +set value of <a href="bmh_SkPath_Reference?cl=9919#Last_Point">Last Point</a>.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="6fa5e8f9513b3225e106778592e27e94"></fiddle-embed></div> + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#getLastPt">getLastPt</a> + +--- + +## <a name="SkPath::SegmentMask"></a> Enum SkPath::SegmentMask + +<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0"> +enum <a href="bmh_SkPath_Reference?cl=9919#SegmentMask">SegmentMask</a> { +<a href="bmh_SkPath_Reference?cl=9919#kLine_SegmentMask">kLine SegmentMask</a> = 1 << 0 +<a href="bmh_SkPath_Reference?cl=9919#kQuad_SegmentMask">kQuad SegmentMask</a> = 1 << 1 +<a href="bmh_SkPath_Reference?cl=9919#kConic_SegmentMask">kConic SegmentMask</a> = 1 << 2 +<a href="bmh_SkPath_Reference?cl=9919#kCubic_SegmentMask">kCubic SegmentMask</a> = 1 << 3 +};</pre> + +<a href="bmh_SkPath_Reference?cl=9919#SegmentMask">SegmentMask</a> constants correspond to each drawing <a href="bmh_SkPath_Reference?cl=9919#Verb">Verb</a> type in <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>; for +instance, if <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> only contains <a href="bmh_undocumented?cl=9919#Line">Lines</a>, only the <a href="bmh_SkPath_Reference?cl=9919#kLine_SegmentMask">kLine SegmentMask</a> bit is set. + +### Constants + +<table> + <tr> + <td><a name="SkPath::kLine_SegmentMask"></a> <code><strong>SkPath::kLine_SegmentMask </strong></code></td><td>1</td><td>Set if <a href="bmh_SkPath_Reference?cl=9919#Verb_Array">Verb Array</a> contains <a href="bmh_SkPath_Reference?cl=9919#kLine_Verb">kLine Verb</a>.</td> + </tr> + <tr> + <td><a name="SkPath::kQuad_SegmentMask"></a> <code><strong>SkPath::kQuad_SegmentMask </strong></code></td><td>2</td><td>Set if <a href="bmh_SkPath_Reference?cl=9919#Verb_Array">Verb Array</a> contains <a href="bmh_SkPath_Reference?cl=9919#kQuad_Verb">kQuad Verb</a>. Note that <a href="bmh_SkPath_Reference?cl=9919#conicTo">conicTo</a> may add a <a href="bmh_SkPath_Reference?cl=9919#Quad">Quad</a>.</td> + </tr> + <tr> + <td><a name="SkPath::kConic_SegmentMask"></a> <code><strong>SkPath::kConic_SegmentMask </strong></code></td><td>4</td><td>Set if <a href="bmh_SkPath_Reference?cl=9919#Verb_Array">Verb Array</a> contains <a href="bmh_SkPath_Reference?cl=9919#kConic_Verb">kConic Verb</a>.</td> + </tr> + <tr> + <td><a name="SkPath::kCubic_SegmentMask"></a> <code><strong>SkPath::kCubic_SegmentMask </strong></code></td><td>8</td><td>Set if <a href="bmh_SkPath_Reference?cl=9919#Verb_Array">Verb Array</a> contains <a href="bmh_SkPath_Reference?cl=9919#kCubic_Verb">kCubic Verb</a>.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="0972a1bd6e012c7519d3998afc32e69f"><div>When <a href="bmh_SkPath_Reference?cl=9919#conicTo">conicTo</a> has a weight of one, <a href="bmh_SkPath_Reference?cl=9919#Quad">Quad</a> is added to <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>.</div> + +#### Example Output + +~~~~ +Path kConic_SegmentMask is clear +Path kQuad_SegmentMask is set +~~~~ + +</fiddle-embed></div> + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#getSegmentMasks">getSegmentMasks</a> <a href="bmh_SkPath_Reference?cl=9919#Verb">Verb</a> + + + +<a name="getSegmentMasks"></a> +## getSegmentMasks + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +uint32_t getSegmentMasks() const +</pre> + +Returns a mask, where each set bit corresponds to a <a href="bmh_SkPath_Reference?cl=9919#SegmentMask">SegmentMask</a> constant +if <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> contains one or more <a href="bmh_SkPath_Reference?cl=9919#Verb">Verbs</a> of that type. +Returns zero if <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> contains no <a href="bmh_undocumented?cl=9919#Line">Lines</a>, Quads, <a href="bmh_SkPath_Reference?cl=9919#Conic">Conics</a>, or <a href="bmh_SkPath_Reference?cl=9919#Cubic">Cubics</a>. + +<a href="bmh_SkPath_Reference?cl=9919#getSegmentMasks">getSegmentMasks</a> returns a cached result; it is very fast. + +### Return Value + +<a href="bmh_SkPath_Reference?cl=9919#SegmentMask">SegmentMask</a> bits or zero. + +### Example + +<div><fiddle-embed name="dd9f620b419c8ca18cd306c881aadb5f"> + +#### Example Output + +~~~~ +mask quad set +~~~~ + +</fiddle-embed></div> + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#getSegmentMasks">getSegmentMasks</a> <a href="bmh_SkPath_Reference?cl=9919#Verb">Verb</a> + +--- + +<a name="contains"></a> +## contains + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +bool contains(SkScalar x, SkScalar y) const +</pre> + +Returns true if the point (<a href="bmh_SkPath_Reference?cl=9919#x">x</a>, <a href="bmh_SkPath_Reference?cl=9919#y">y</a>) is contained by <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>, taking into +account <a href="bmh_SkPath_Reference?cl=9919#FillType">FillType</a>. + +| <a href="bmh_SkPath_Reference?cl=9919#FillType">FillType</a> | <a href="bmh_SkPath_Reference?cl=9919#contains">contains</a> returns true if <a href="bmh_undocumented?cl=9919#Point">Point</a> is enclosed by | +| --- | --- | +| <a href="bmh_SkPath_Reference?cl=9919#kWinding_FillType">kWinding FillType</a> | a non-zero sum of <a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a> <a href="bmh_SkPath_Reference?cl=9919#Direction">Directions</a>. | +| <a href="bmh_SkPath_Reference?cl=9919#kEvenOdd_FillType">kEvenOdd FillType</a> | an odd number of <a href="bmh_SkPath_Reference?cl=9919#Contour">Contours</a>. | +| <a href="bmh_SkPath_Reference?cl=9919#kInverseWinding_FillType">kInverseWinding FillType</a> | a zero sum of <a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a> <a href="bmh_SkPath_Reference?cl=9919#Direction">Directions</a>. | +| <a href="bmh_SkPath_Reference?cl=9919#kInverseEvenOdd_FillType">kInverseEvenOdd FillType</a> | and even number of <a href="bmh_SkPath_Reference?cl=9919#Contour">Contours</a>. | + +### Parameters + +<table> <tr> <td><code><strong>x </strong></code></td> <td> +x-coordinate of containment test.</td> + </tr> <tr> <td><code><strong>y </strong></code></td> <td> +y-coordinate of containment test.</td> + </tr> +</table> + +### Return Value + +true if <a href="bmh_undocumented?cl=9919#Point">Point</a> is in <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>. + +### Example + +<div><fiddle-embed name="c0216b3f7ebd80b9589ae5728f08fc80"></fiddle-embed></div> + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#conservativelyContainsRect">conservativelyContainsRect</a> <a href="bmh_SkPath_Reference?cl=9919#Fill_Type">Fill Type</a> <a href="bmh_undocumented?cl=9919#Op">Op</a> + +--- + +<a name="dump"></a> +## dump + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void dump(SkWStream* stream, bool forceClose, bool dumpAsHex) const +</pre> + +Writes text representation of <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> to <a href="bmh_SkPath_Reference?cl=9919#stream">stream</a>. If <a href="bmh_SkPath_Reference?cl=9919#stream">stream</a> is nullptr, <a href="bmh_SkPath_Reference?cl=9919#dump">dump</a> writes to +stdout. Set <a href="bmh_SkPath_Reference?cl=9919#forceClose">forceClose</a> to true to get +edges used to fill <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>. Set <a href="bmh_SkPath_Reference?cl=9919#dumpAsHex">dumpAsHex</a> true to get exact binary representations +of floating point numbers used in <a href="bmh_SkPath_Reference?cl=9919#Point_Array">Point Array</a> and <a href="bmh_SkPath_Reference?cl=9919#Weight">Weights</a>. + +### Parameters + +<table> <tr> <td><code><strong>stream </strong></code></td> <td> +writable <a href="bmh_undocumented?cl=9919#Stream">Stream</a> receiving <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> text representation; may be nullptr.</td> + </tr> <tr> <td><code><strong>forceClose </strong></code></td> <td> +true if missing <a href="bmh_SkPath_Reference?cl=9919#kClose_Verb">kClose Verb</a> is output.</td> + </tr> <tr> <td><code><strong>dumpAsHex </strong></code></td> <td> +true if <a href="bmh_undocumented?cl=9919#SkScalar">SkScalar</a> values are written as hexidecimal.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="8036d764452a62f9953af50846f0f3c0"> + +#### Example Output + +~~~~ +path.setFillType(SkPath::kWinding_FillType); +path.moveTo(0, 0); +path.quadTo(20, 30, 40, 50); +path.setFillType(SkPath::kWinding_FillType); +path.moveTo(SkBits2Float(0x00000000), SkBits2Float(0x00000000)); // 0, 0 +path.quadTo(SkBits2Float(0x41a00000), SkBits2Float(0x41f00000), SkBits2Float(0x42200000), SkBits2Float(0x42480000)); // 20, 30, 40, 50 +path.setFillType(SkPath::kWinding_FillType); +path.moveTo(0, 0); +path.quadTo(20, 30, 40, 50); +path.lineTo(0, 0); +path.close(); +path.setFillType(SkPath::kWinding_FillType); +path.moveTo(SkBits2Float(0x00000000), SkBits2Float(0x00000000)); // 0, 0 +path.quadTo(SkBits2Float(0x41a00000), SkBits2Float(0x41f00000), SkBits2Float(0x42200000), SkBits2Float(0x42480000)); // 20, 30, 40, 50 +path.lineTo(SkBits2Float(0x00000000), SkBits2Float(0x00000000)); // 0, 0 +path.close(); +~~~~ + +</fiddle-embed></div> + +### See Also + +<a href="bmh_undocumented?cl=9919#dump">SkRect::dump()</a> <a href="bmh_undocumented?cl=9919#dump">SkRRect::dump()</a> <a href="bmh_undocumented?cl=9919#dump">SkPathMeasure::dump()</a> + +--- + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void dump() const +</pre> + +Writes text representation of <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> to stdout. The representation may be +directly compiled as <a href="bmh_usingBookmaker?cl=9919#C">C</a>++ code. Floating point values are written +with limited precision; it may not be possible to reconstruct original <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> +from output. + +### Example + +<div><fiddle-embed name="92e0032f85181795d1f8b5a2c8e4e4b7"> + +#### Example Output + +~~~~ +path.setFillType(SkPath::kWinding_FillType); +path.moveTo(0, 0); +path.lineTo(0.857143f, 0.666667f); +path is not equal to copy +~~~~ + +</fiddle-embed></div> + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#dumpHex">dumpHex</a> <a href="bmh_undocumented?cl=9919#dump">SkRect::dump()</a> <a href="bmh_undocumented?cl=9919#dump">SkRRect::dump()</a> <a href="bmh_undocumented?cl=9919#dump">SkPathMeasure::dump()</a> <a href="bmh_SkPath_Reference?cl=9919#writeToMemory">writeToMemory</a> + +--- + +<a name="dumpHex"></a> +## dumpHex + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void dumpHex() const +</pre> + +Writes text representation of <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> to stdout. The representation may be +directly compiled as <a href="bmh_usingBookmaker?cl=9919#C">C</a>++ code. Floating point values are written +in hexadecimal to preserve their exact bit pattern. The output reconstructs the +original <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>. + +Use <a href="bmh_SkPath_Reference?cl=9919#dumpHex">dumpHex</a> when submittingbug reports against <a href="bmh_undocumented?cl=9919#Skia">Skia</a>http://bug.skia.org. +Slight value changes in <a href="bmh_SkPath_Reference?cl=9919#Point_Array">Point Array</a> may cause the bug to disappear. + +### Example + +<div><fiddle-embed name="72a92fe058e8b3be6c8a30fad7fd1266"> + +#### Example Output + +~~~~ +path.setFillType(SkPath::kWinding_FillType); +path.moveTo(SkBits2Float(0x00000000), SkBits2Float(0x00000000)); // 0, 0 +path.lineTo(SkBits2Float(0x3f5b6db7), SkBits2Float(0x3f2aaaab)); // 0.857143f, 0.666667f +path is equal to copy +~~~~ + +</fiddle-embed></div> + +### See Also + +dump + +--- + +<a name="writeToMemory"></a> +## writeToMemory + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +size_t writeToMemory(void* buffer) const +</pre> + +Write <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> to <a href="bmh_SkPath_Reference?cl=9919#buffer">buffer</a>, returning the number of bytes written. +Pass nullptr to obtain the storage size. + +<a href="bmh_SkPath_Reference?cl=9919#writeToMemory">writeToMemory</a> writes <a href="bmh_SkPath_Reference?cl=9919#Fill_Type">Fill Type</a>, <a href="bmh_SkPath_Reference?cl=9919#Verb_Array">Verb Array</a>, <a href="bmh_SkPath_Reference?cl=9919#Point_Array">Point Array</a>, <a href="bmh_SkPath_Reference?cl=9919#Conic_Weight">Conic Weight</a>, and +additionally writes computed information like <a href="bmh_SkPath_Reference?cl=9919#Convexity">Convexity</a> and bounds. + +<a href="bmh_SkPath_Reference?cl=9919#writeToMemory">writeToMemory</a> should only be used in concert with <a href="bmh_SkPath_Reference?cl=9919#readFromMemory">readFromMemory</a>. +The format used for <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> in memory is not guaranteed. + +### Parameters + +<table> <tr> <td><code><strong>buffer </strong></code></td> <td> +storage for <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>; may be nullptr.</td> + </tr> +</table> + +### Return Value + +size of storage required for <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>; always a multiple of 4. + +### Example + +<div><fiddle-embed name="e5f16eda6a1c2d759556285f72598445"></fiddle-embed></div> + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#readFromMemory">readFromMemory</a> dump <a href="bmh_SkPath_Reference?cl=9919#dumpHex">dumpHex</a> + +--- + +<a name="readFromMemory"></a> +## readFromMemory + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +size_t readFromMemory(const void* buffer, size_t length) +</pre> + +Initializes <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> from <a href="bmh_SkPath_Reference?cl=9919#buffer">buffer</a> of size <a href="bmh_SkPath_Reference?cl=9919#length">length</a>. Returns zero if the <a href="bmh_SkPath_Reference?cl=9919#buffer">buffer</a> is +data is inconsistent, or the <a href="bmh_SkPath_Reference?cl=9919#length">length</a> is too small. + +<a href="bmh_SkPath_Reference?cl=9919#readFromMemory">readFromMemory</a> reads <a href="bmh_SkPath_Reference?cl=9919#Fill_Type">Fill Type</a>, <a href="bmh_SkPath_Reference?cl=9919#Verb_Array">Verb Array</a>, <a href="bmh_SkPath_Reference?cl=9919#Point_Array">Point Array</a>, <a href="bmh_SkPath_Reference?cl=9919#Conic_Weight">Conic Weight</a>, and +additionally reads computed information like <a href="bmh_SkPath_Reference?cl=9919#Convexity">Convexity</a> and bounds. + +<a href="bmh_SkPath_Reference?cl=9919#readFromMemory">readFromMemory</a> should only be used in concert with <a href="bmh_SkPath_Reference?cl=9919#writeToMemory">writeToMemory</a>. +The format used for <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> in memory is not guaranteed. + +### Parameters + +<table> <tr> <td><code><strong>buffer </strong></code></td> <td> +storage for <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>.</td> + </tr> <tr> <td><code><strong>length </strong></code></td> <td> +<a href="bmh_SkPath_Reference?cl=9919#buffer">buffer</a> size in bytes; must be multiple of 4.</td> + </tr> +</table> + +### Return Value + +number of bytes read, or zero on failure. + +### Example + +<div><fiddle-embed name="9c6edd836c573a0fd232d2b8aa11a678"> + +#### Example Output + +~~~~ +length = 60; returned by readFromMemory = 0 +length = 68; returned by readFromMemory = 64 +~~~~ + +</fiddle-embed></div> + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#writeToMemory">writeToMemory</a> + +--- + +# <a name="Generation_ID"></a> Generation ID +<a href="bmh_SkPath_Reference?cl=9919#Generation_ID">Generation ID</a> provides a quick way to check if <a href="bmh_SkPath_Reference?cl=9919#Verb_Array">Verb Array</a>, <a href="bmh_SkPath_Reference?cl=9919#Point_Array">Point Array</a>, or +<a href="bmh_SkPath_Reference?cl=9919#Conic_Weight">Conic Weight</a> has changed. <a href="bmh_SkPath_Reference?cl=9919#Generation_ID">Generation ID</a> is not a hash; identical <a href="bmh_SkPath_Reference?cl=9919#Path">Paths</a> will +not necessarily have matching <a href="bmh_SkPath_Reference?cl=9919#Generation_ID">Generation IDs</a>. + +Empty <a href="bmh_SkPath_Reference?cl=9919#Path">Paths</a> have a <a href="bmh_SkPath_Reference?cl=9919#Generation_ID">Generation ID</a> of one. + +<a name="getGenerationID"></a> +## getGenerationID + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +uint32_t getGenerationID() const +</pre> + +Returns a non-zero, globally unique value. A different value is returned +if <a href="bmh_SkPath_Reference?cl=9919#Verb_Array">Verb Array</a>, <a href="bmh_SkPath_Reference?cl=9919#Point_Array">Point Array</a>, or <a href="bmh_SkPath_Reference?cl=9919#Conic_Weight">Conic Weight</a> changes. + +Setting <a href="bmh_SkPath_Reference?cl=9919#Fill_Type">Fill Type</a> does not change <a href="bmh_SkPath_Reference?cl=9919#Generation_ID">Generation ID</a>. + +Each time the path is modified, a different <a href="bmh_SkPath_Reference?cl=9919#Generation_ID">Generation ID</a> will be returned. + +### Return Value + +non-zero, globally unique value. + +### Example + +<div><fiddle-embed name="a0f166715d6479f91258d854e63e586d"> + +#### Example Output + +~~~~ +empty genID = 1 +1st lineTo genID = 2 +empty genID = 1 +2nd lineTo genID = 3 +~~~~ + +</fiddle-embed></div> + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#equal_operator">operator==(const SkPath& a, const SkPath& b)</a> + +--- + +<a name="validate"></a> +## validate + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void validate() const +</pre> + +Debugging check to see if <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> data is consistent. +Not currently maintained. + +--- + +<a name="experimentalValidateRef"></a> +## experimentalValidateRef + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void experimentalValidateRef() const +</pre> + +--- + +# <a name="Iter"></a> Class Iter +Iterates through <a href="bmh_SkPath_Reference?cl=9919#Verb_Array">Verb Array</a>, and associated <a href="bmh_SkPath_Reference?cl=9919#Point_Array">Point Array</a> and <a href="bmh_SkPath_Reference?cl=9919#Conic_Weight">Conic Weight</a>. +Provides options to treat open <a href="bmh_SkPath_Reference?cl=9919#Contour">Contours</a> as closed, and to ignore +degenerate data. + +### Example + +<div><fiddle-embed name="3ca8417e2a1466bf5b3ac97780a8070c"><div>Ignoring the actual <a href="bmh_SkPath_Reference?cl=9919#Verb">Verbs</a> and replacing them with quads rounds the +path of the glyph.</div></fiddle-embed></div> + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#RawIter">RawIter</a> + +<a name="empty_constructor"></a> +## Iter + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +Iter() +</pre> + +Initializes <a href="bmh_SkPath_Reference?cl=9919#Iter">Iter</a> with an empty <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>. <a href="bmh_SkPath_Reference?cl=9919#next">next</a> on <a href="bmh_SkPath_Reference?cl=9919#Iter">Iter</a> returns <a href="bmh_SkPath_Reference?cl=9919#kDone_Verb">kDone Verb</a>. +Call <a href="bmh_SkPath_Reference?cl=9919#setPath">setPath</a> to initialize <a href="bmh_SkPath_Reference?cl=9919#Iter">Iter</a> at a later time. + +### Return Value + +<a href="bmh_SkPath_Reference?cl=9919#Iter">Iter</a> of empty <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>. + +### Example + +<div><fiddle-embed name="01648775cb9b354b2f1836dad82a25ab"> + +#### Example Output + +~~~~ +iter is done +iter is done +~~~~ + +</fiddle-embed></div> + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#setPath">setPath</a> + +--- + +<a name="const_SkPath"></a> +## Iter + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +Iter(const SkPath& path, bool forceClose) +</pre> + +Sets <a href="bmh_SkPath_Reference?cl=9919#Iter">Iter</a> to return elements of <a href="bmh_SkPath_Reference?cl=9919#Verb_Array">Verb Array</a>, <a href="bmh_SkPath_Reference?cl=9919#Point_Array">Point Array</a>, and <a href="bmh_SkPath_Reference?cl=9919#Conic_Weight">Conic Weight</a> in <a href="bmh_SkPath_Reference?cl=9919#path">path</a>. +If <a href="bmh_SkPath_Reference?cl=9919#forceClose">forceClose</a> is true, <a href="bmh_SkPath_Reference?cl=9919#Iter">Iter</a> will add <a href="bmh_SkPath_Reference?cl=9919#kLine_Verb">kLine Verb</a> and <a href="bmh_SkPath_Reference?cl=9919#kClose_Verb">kClose Verb</a> after each +open <a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a>. <a href="bmh_SkPath_Reference?cl=9919#path">path</a> is not altered. + +### Parameters + +<table> <tr> <td><code><strong>path </strong></code></td> <td> +<a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> to iterate.</td> + </tr> <tr> <td><code><strong>forceClose </strong></code></td> <td> +true if open <a href="bmh_SkPath_Reference?cl=9919#Contour">Contours</a> generate <a href="bmh_SkPath_Reference?cl=9919#kClose_Verb">kClose Verb</a>.</td> + </tr> +</table> + +### Return Value + +<a href="bmh_SkPath_Reference?cl=9919#Iter">Iter</a> of <a href="bmh_SkPath_Reference?cl=9919#path">path</a>. + +### Example + +<div><fiddle-embed name="13044dbf68885c0f15322c0633b633a3"> + +#### Example Output + +~~~~ +open: +kMove_Verb {0, 0}, +kQuad_Verb {0, 0}, {10, 20}, {30, 40}, +kDone_Verb +closed: +kMove_Verb {0, 0}, +kQuad_Verb {0, 0}, {10, 20}, {30, 40}, +kLine_Verb {30, 40}, {0, 0}, +kClose_Verb {0, 0}, +kDone_Verb +~~~~ + +</fiddle-embed></div> + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#setPath">setPath</a> + +--- + +<a name="setPath"></a> +## setPath + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void setPath(const SkPath& path, bool forceClose) +</pre> + +Sets <a href="bmh_SkPath_Reference?cl=9919#Iter">Iter</a> to return elements of <a href="bmh_SkPath_Reference?cl=9919#Verb_Array">Verb Array</a>, <a href="bmh_SkPath_Reference?cl=9919#Point_Array">Point Array</a>, and <a href="bmh_SkPath_Reference?cl=9919#Conic_Weight">Conic Weight</a> in <a href="bmh_SkPath_Reference?cl=9919#path">path</a>. +If <a href="bmh_SkPath_Reference?cl=9919#forceClose">forceClose</a> is true, <a href="bmh_SkPath_Reference?cl=9919#Iter">Iter</a> will add <a href="bmh_SkPath_Reference?cl=9919#kLine_Verb">kLine Verb</a> and <a href="bmh_SkPath_Reference?cl=9919#kClose_Verb">kClose Verb</a> after each +open <a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a>. <a href="bmh_SkPath_Reference?cl=9919#path">path</a> is not altered. + +### Parameters + +<table> <tr> <td><code><strong>path </strong></code></td> <td> +<a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> to iterate.</td> + </tr> <tr> <td><code><strong>forceClose </strong></code></td> <td> +true if open <a href="bmh_SkPath_Reference?cl=9919#Contour">Contours</a> generate <a href="bmh_SkPath_Reference?cl=9919#kClose_Verb">kClose Verb</a>.</td> + </tr> +</table> + +### Example + +<div><fiddle-embed name="6c9688008cea8937ad5cc188b38ecf16"> + +#### Example Output + +~~~~ +quad open: +kMove_Verb {0, 0}, +kQuad_Verb {0, 0}, {10, 20}, {30, 40}, +kDone_Verb +conic closed: +kMove_Verb {0, 0}, +kConic_Verb {0, 0}, {1, 2}, {3, 4}, weight = 0.5 +kLine_Verb {3, 4}, {0, 0}, +kClose_Verb {0, 0}, +kDone_Verb +~~~~ + +</fiddle-embed></div> + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#const_SkPath">Iter(const SkPath& path, bool forceClose)</a> + +--- + +<a name="next"></a> +## next + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +Verb next(SkPoint pts[4], bool doConsumeDegenerates = true, bool exact = false) +</pre> + +Returns next <a href="bmh_SkPath_Reference?cl=9919#Verb">Verb</a> in <a href="bmh_SkPath_Reference?cl=9919#Verb_Array">Verb Array</a>, and advances <a href="bmh_SkPath_Reference?cl=9919#Iter">Iter</a>. +When <a href="bmh_SkPath_Reference?cl=9919#Verb_Array">Verb Array</a> is exhausted, returns <a href="bmh_SkPath_Reference?cl=9919#kDone_Verb">kDone Verb</a>. +Zero to four <a href="bmh_undocumented?cl=9919#Point">Points</a> are stored in <a href="bmh_SkPath_Reference?cl=9919#pts">pts</a>, depending on the returned <a href="bmh_SkPath_Reference?cl=9919#Verb">Verb</a>. +If <a href="bmh_SkPath_Reference?cl=9919#doConsumeDegenerates">doConsumeDegenerates</a> is true, skip consecutive <a href="bmh_SkPath_Reference?cl=9919#kMove_Verb">kMove Verb</a> entries, returning +only the last in the series; and skip very small <a href="bmh_undocumented?cl=9919#Line">Lines</a>, Quads, and <a href="bmh_SkPath_Reference?cl=9919#Conic">Conics</a>; and +skip <a href="bmh_SkPath_Reference?cl=9919#kClose_Verb">kClose Verb</a> following <a href="bmh_SkPath_Reference?cl=9919#kMove_Verb">kMove Verb</a>. +if <a href="bmh_SkPath_Reference?cl=9919#doConsumeDegenerates">doConsumeDegenerates</a> is true and <a href="bmh_SkPath_Reference?cl=9919#next">exact</a> is true, only skip <a href="bmh_undocumented?cl=9919#Line">Lines</a>, Quads, and +<a href="bmh_SkPath_Reference?cl=9919#Conic">Conics</a> with zero lengths. + +### Parameters + +<table> <tr> <td><code><strong>pts </strong></code></td> <td> +Storage for <a href="bmh_undocumented?cl=9919#Point">Point</a> data describing returned <a href="bmh_SkPath_Reference?cl=9919#Verb">Verb</a>.</td> + </tr> <tr> <td><code><strong>doConsumeDegenerates </strong></code></td> <td> +If true, skip degenerate <a href="bmh_SkPath_Reference?cl=9919#Verb">Verbs</a>.</td> + </tr> <tr> <td><code><strong>exact </strong></code></td> <td> +If true, skip zero length curves. Has no effect if <a href="bmh_SkPath_Reference?cl=9919#doConsumeDegenerates">doConsumeDegenerates</a> +is false.</td> + </tr> +</table> + +### Return Value + +next <a href="bmh_SkPath_Reference?cl=9919#Verb">Verb</a> from <a href="bmh_SkPath_Reference?cl=9919#Verb_Array">Verb Array</a>. + +### Example + +<div><fiddle-embed name="00ae8984856486bdb626d0ed6587855a"><div>skip degenerate skips the first in a <a href="bmh_SkPath_Reference?cl=9919#kMove_Verb">kMove Verb</a> pair, the <a href="bmh_SkPath_Reference?cl=9919#kMove_Verb">kMove Verb</a> +followed by the <a href="bmh_SkPath_Reference?cl=9919#kClose_Verb">kClose Verb</a>, the zero length <a href="bmh_undocumented?cl=9919#Line">Line</a> and the very small <a href="bmh_undocumented?cl=9919#Line">Line</a>. + +skip degenerate if <a href="bmh_SkPath_Reference?cl=9919#next">exact</a> skips the same as skip degenerate, but shows +the very small <a href="bmh_undocumented?cl=9919#Line">Line</a>. + +skip none shows all of the <a href="bmh_SkPath_Reference?cl=9919#Verb">Verbs</a> and <a href="bmh_undocumented?cl=9919#Point">Points</a> in <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>.</div> + +#### Example Output + +~~~~ +skip degenerate: +kMove_Verb {20, 20}, +kQuad_Verb {20, 20}, {10, 20}, {30, 40}, +kDone_Verb +skip degenerate if exact: +kMove_Verb {20, 20}, +kQuad_Verb {20, 20}, {10, 20}, {30, 40}, +kMove_Verb {30, 30}, +kLine_Verb {30, 30}, {30.00001, 30}, +kDone_Verb +skip none: +kMove_Verb {10, 10}, +kMove_Verb {20, 20}, +kQuad_Verb {20, 20}, {10, 20}, {30, 40}, +kMove_Verb {1, 1}, +kClose_Verb {1, 1}, +kMove_Verb {30, 30}, +kLine_Verb {30, 30}, {30, 30}, +kMove_Verb {30, 30}, +kLine_Verb {30, 30}, {30.00001, 30}, +kDone_Verb +~~~~ + +</fiddle-embed></div> + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#Verb">Verb</a> <a href="bmh_SkPath_Reference?cl=9919#IsLineDegenerate">IsLineDegenerate</a> <a href="bmh_SkPath_Reference?cl=9919#IsCubicDegenerate">IsCubicDegenerate</a> <a href="bmh_SkPath_Reference?cl=9919#IsQuadDegenerate">IsQuadDegenerate</a> + +--- + +<a name="conicWeight"></a> +## conicWeight + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +SkScalar conicWeight() const +</pre> + +Returns <a href="bmh_SkPath_Reference?cl=9919#Conic_Weight">Conic Weight</a> if <a href="bmh_SkPath_Reference?cl=9919#next">next</a> returned <a href="bmh_SkPath_Reference?cl=9919#kConic_Verb">kConic Verb</a>. + +If <a href="bmh_SkPath_Reference?cl=9919#next">next</a> has not been called, or <a href="bmh_SkPath_Reference?cl=9919#next">next</a> did not return <a href="bmh_SkPath_Reference?cl=9919#kConic_Verb">kConic Verb</a>, +result is undefined. + +### Return Value + +<a href="bmh_SkPath_Reference?cl=9919#Conic_Weight">Conic Weight</a> for <a href="bmh_SkPath_Reference?cl=9919#Conic">Conic</a> <a href="bmh_undocumented?cl=9919#Point">Points</a> returned by <a href="bmh_SkPath_Reference?cl=9919#next">next</a>. + +### Example + +<div><fiddle-embed name="f97cc1191cf2eef161d6b97fcba67b02"> + +#### Example Output + +~~~~ +first verb is move +next verb is conic +conic points: {0,0}, {1,2}, {3,4} +conic weight: 0.5 +~~~~ + +</fiddle-embed></div> + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#Conic_Weight">Conic Weight</a> + +--- + +<a name="isCloseLine"></a> +## isCloseLine + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +bool isCloseLine() const +</pre> + +Returns true if last <a href="bmh_SkPath_Reference?cl=9919#kLine_Verb">kLine Verb</a> returned by <a href="bmh_SkPath_Reference?cl=9919#next">next</a> was generated +by <a href="bmh_SkPath_Reference?cl=9919#kClose_Verb">kClose Verb</a>. When true, the end point returned by <a href="bmh_SkPath_Reference?cl=9919#next">next</a> is +also the start point of <a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a>. + +If <a href="bmh_SkPath_Reference?cl=9919#next">next</a> has not been called, or <a href="bmh_SkPath_Reference?cl=9919#next">next</a> did not return <a href="bmh_SkPath_Reference?cl=9919#kLine_Verb">kLine Verb</a>, +result is undefined. + +### Return Value + +true if last <a href="bmh_SkPath_Reference?cl=9919#kLine_Verb">kLine Verb</a> was generated by <a href="bmh_SkPath_Reference?cl=9919#kClose_Verb">kClose Verb</a>. + +### Example + +<div><fiddle-embed name="345e0646a010f7dce571078d1321f4df"> + +#### Example Output + +~~~~ +1st verb is move +moveTo point: {6,7} +2nd verb is conic +3rd verb is line +line points: {3,4}, {6,7} +line generated by close +4th verb is close +~~~~ + +</fiddle-embed></div> + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#close">close</a> + +--- + +<a name="isClosedContour"></a> +## isClosedContour + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +bool isClosedContour() const +</pre> + +Returns true if subsequent calls to <a href="bmh_SkPath_Reference?cl=9919#next">next</a> return <a href="bmh_SkPath_Reference?cl=9919#kClose_Verb">kClose Verb</a> before returning +<a href="bmh_SkPath_Reference?cl=9919#kMove_Verb">kMove Verb</a>. if true, <a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a> <a href="bmh_SkPath_Reference?cl=9919#Iter">Iter</a> is processing may end with <a href="bmh_SkPath_Reference?cl=9919#kClose_Verb">kClose Verb</a>, or +<a href="bmh_SkPath_Reference?cl=9919#Iter">Iter</a> may have been initialized with force close set to true. + +### Return Value + +true if <a href="bmh_SkPath_Reference?cl=9919#Contour">Contour</a> is closed. + +### Example + +<div><fiddle-embed name="145ead5d4f5fb9ba0a0320cb6a5bf3e8"> + +#### Example Output + +~~~~ +without close(), forceClose is false: isClosedContour returns false +with close(), forceClose is false: isClosedContour returns true +without close(), forceClose is true : isClosedContour returns true +with close(), forceClose is true : isClosedContour returns true +~~~~ + +</fiddle-embed></div> + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#const_SkPath">Iter(const SkPath& path, bool forceClose)</a> + +--- + +# <a name="RawIter"></a> Class RawIter +Iterates through <a href="bmh_SkPath_Reference?cl=9919#Verb_Array">Verb Array</a>, and associated <a href="bmh_SkPath_Reference?cl=9919#Point_Array">Point Array</a> and <a href="bmh_SkPath_Reference?cl=9919#Conic_Weight">Conic Weight</a>. +<a href="bmh_SkPath_Reference?cl=9919#Verb_Array">Verb Array</a>, <a href="bmh_SkPath_Reference?cl=9919#Point_Array">Point Array</a>, and <a href="bmh_SkPath_Reference?cl=9919#Conic_Weight">Conic Weight</a> are returned unaltered. + +<a name="empty_constructor"></a> +## RawIter + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +RawIter() +</pre> + +Initializes <a href="bmh_SkPath_Reference?cl=9919#RawIter">RawIter</a> with an empty <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>. <a href="bmh_SkPath_Reference?cl=9919#next">next</a> on <a href="bmh_SkPath_Reference?cl=9919#RawIter">RawIter</a> returns <a href="bmh_SkPath_Reference?cl=9919#kDone_Verb">kDone Verb</a>. +Call <a href="bmh_SkPath_Reference?cl=9919#setPath">setPath</a> to initialize <a href="bmh_SkPath_Reference?cl=9919#Iter">Iter</a> at a later time. + +### Return Value + +<a href="bmh_SkPath_Reference?cl=9919#RawIter">RawIter</a> of empty <a href="bmh_SkPath_Reference?cl=9919#Path">Path</a>. + +--- + +<a name="copy_constructor"></a> +## RawIter + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +RawIter(const SkPath& path) +</pre> + +Sets <a href="bmh_SkPath_Reference?cl=9919#RawIter">RawIter</a> to return elements of <a href="bmh_SkPath_Reference?cl=9919#Verb_Array">Verb Array</a>, <a href="bmh_SkPath_Reference?cl=9919#Point_Array">Point Array</a>, and <a href="bmh_SkPath_Reference?cl=9919#Conic_Weight">Conic Weight</a> in <a href="bmh_SkPath_Reference?cl=9919#path">path</a>. + +### Parameters + +<table> <tr> <td><code><strong>path </strong></code></td> <td> +<a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> to iterate.</td> + </tr> +</table> + +### Return Value + +<a href="bmh_SkPath_Reference?cl=9919#RawIter">RawIter</a> of <a href="bmh_SkPath_Reference?cl=9919#path">path</a>. + +--- + +<a name="setPath"></a> +## setPath + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void setPath(const SkPath& path) +</pre> + +Sets <a href="bmh_SkPath_Reference?cl=9919#Iter">Iter</a> to return elements of <a href="bmh_SkPath_Reference?cl=9919#Verb_Array">Verb Array</a>, <a href="bmh_SkPath_Reference?cl=9919#Point_Array">Point Array</a>, and <a href="bmh_SkPath_Reference?cl=9919#Conic_Weight">Conic Weight</a> in <a href="bmh_SkPath_Reference?cl=9919#path">path</a>. + +### Parameters + +<table> <tr> <td><code><strong>path </strong></code></td> <td> +<a href="bmh_SkPath_Reference?cl=9919#Path">Path</a> to iterate.</td> + </tr> +</table> + +--- + +<a name="next"></a> +## next + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +Verb next(SkPoint pts[4]) +</pre> + +Returns next <a href="bmh_SkPath_Reference?cl=9919#Verb">Verb</a> in <a href="bmh_SkPath_Reference?cl=9919#Verb_Array">Verb Array</a>, and advances <a href="bmh_SkPath_Reference?cl=9919#RawIter">RawIter</a>. +When <a href="bmh_SkPath_Reference?cl=9919#Verb_Array">Verb Array</a> is exhausted, returns <a href="bmh_SkPath_Reference?cl=9919#kDone_Verb">kDone Verb</a>. +Zero to four <a href="bmh_undocumented?cl=9919#Point">Points</a> are stored in <a href="bmh_SkPath_Reference?cl=9919#pts">pts</a>, depending on the returned <a href="bmh_SkPath_Reference?cl=9919#Verb">Verb</a>. + +### Parameters + +<table> <tr> <td><code><strong>pts </strong></code></td> <td> +Storage for <a href="bmh_undocumented?cl=9919#Point">Point</a> data describing returned <a href="bmh_SkPath_Reference?cl=9919#Verb">Verb</a>.</td> + </tr> +</table> + +### Return Value + +next <a href="bmh_SkPath_Reference?cl=9919#Verb">Verb</a> from <a href="bmh_SkPath_Reference?cl=9919#Verb_Array">Verb Array</a>. + +### Example + +<div><fiddle-embed name="944a80c7ff8c04e1fecc4aec4a47ea60"> + +#### Example Output + +~~~~ +kMove_Verb {50, 60}, +kQuad_Verb {50, 60}, {10, 20}, {30, 40}, +kClose_Verb {50, 60}, +kMove_Verb {50, 60}, +kLine_Verb {50, 60}, {30, 30}, +kConic_Verb {30, 30}, {1, 2}, {3, 4}, weight = 0.5 +kCubic_Verb {3, 4}, {-1, -2}, {-3, -4}, {-5, -6}, +kDone_Verb +~~~~ + +</fiddle-embed></div> + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#peek">peek</a> + +--- + +<a name="peek"></a> +## peek + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +Verb peek() const +</pre> + +Returns next <a href="bmh_SkPath_Reference?cl=9919#Verb">Verb</a>, but does not advance <a href="bmh_SkPath_Reference?cl=9919#RawIter">RawIter</a>. + +### Return Value + +next <a href="bmh_SkPath_Reference?cl=9919#Verb">Verb</a> from <a href="bmh_SkPath_Reference?cl=9919#Verb_Array">Verb Array</a>. + +### Example + +<div><fiddle-embed name="eb5fa5bea23059ce538e883502f828f5"> + +#### Example Output + +~~~~ +#Volatile +peek Move == verb Move +peek Quad == verb Quad +peek Conic == verb Conic +peek Cubic == verb Cubic +peek Done == verb Done +peek Done == verb Done +~~~~ + +</fiddle-embed></div> + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#next">next</a> + +--- + +<a name="conicWeight"></a> +## conicWeight + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +SkScalar conicWeight() const +</pre> + +Returns <a href="bmh_SkPath_Reference?cl=9919#Conic_Weight">Conic Weight</a> if <a href="bmh_SkPath_Reference?cl=9919#next">next</a> returned <a href="bmh_SkPath_Reference?cl=9919#kConic_Verb">kConic Verb</a>. + +If <a href="bmh_SkPath_Reference?cl=9919#next">next</a> has not been called, or <a href="bmh_SkPath_Reference?cl=9919#next">next</a> did not return <a href="bmh_SkPath_Reference?cl=9919#kConic_Verb">kConic Verb</a>, +result is undefined. + +### Return Value + +<a href="bmh_SkPath_Reference?cl=9919#Conic_Weight">Conic Weight</a> for <a href="bmh_SkPath_Reference?cl=9919#Conic">Conic</a> <a href="bmh_undocumented?cl=9919#Point">Points</a> returned by <a href="bmh_SkPath_Reference?cl=9919#next">next</a>. + +### Example + +<div><fiddle-embed name="9747e8177a50ea551471ba0b706f544b"> + +#### Example Output + +~~~~ +first verb is move +next verb is conic +conic points: {0,0}, {1,2}, {3,4} +conic weight: 0.5 +~~~~ + +</fiddle-embed></div> + +### See Also + +<a href="bmh_SkPath_Reference?cl=9919#Conic_Weight">Conic Weight</a> + +--- + diff --git a/site/user/api/canvas.md b/site/user/api/creating_skcanvas.md index d6aa7b6b7c..d6aa7b6b7c 100644 --- a/site/user/api/canvas.md +++ b/site/user/api/creating_skcanvas.md diff --git a/site/user/api/index.md b/site/user/api/index.md index 3d02eddc7f..008f9a15d1 100644 --- a/site/user/api/index.md +++ b/site/user/api/index.md @@ -24,14 +24,17 @@ attributes of the drawing are controlled by the paint. Using the SkCanvas API: -1. **[SkCanvas](/user/api/skcanvas)** - the drawing context. -2. **[SkPaint](/user/api/skpaint)** - color, stroke, font, effects -3. **[SkRect](/user/api/skrect)** - rectangles -4. **[SkRegion](/user/api/skregion)** - set operations with rectangles and paths +1. **[SkCanvas Overview](/user/api/skcanvas_overview)** - the drawing context. +2. **[Creating SkCanvas Objects](/user/api/creating_skcanvas)** +3. **[SkPaint Overview](/user/api/skpaint_overview)** - color, stroke, font, effects +4. **[SkRect Overview](/user/api/skrect_overview)** - rectangles +5. **[SkRegion Overview](/user/api/skregion_overview)** - set operations with rectangles and paths -Appendix: +Reference: -1. **[Creating SkCanvas Objects](/user/api/canvas)** +1. **[SkCanvas Reference](/user/api/SkCanvas_Reference)** - the drawing context. +2. **[SkPaint Reference](/user/api/SkPaint_Reference)** - color, stroke, font, effects +3. **[SkPath Reference](/user/api/SkPath_Reference)** - paths Autogenerated Doxygen Documentaion ---------------------------------- diff --git a/site/user/api/skcanvas.md b/site/user/api/skcanvas_overivew.md index a1e3428a32..250b561d94 100644 --- a/site/user/api/skcanvas.md +++ b/site/user/api/skcanvas_overivew.md @@ -1,4 +1,4 @@ -SkCanvas +SkCanvas Overview ======== *The drawing context* diff --git a/site/user/api/skmatrix.md b/site/user/api/skmatrix_overivew.md index 3048cdc19f..5dce28cc62 100644 --- a/site/user/api/skmatrix.md +++ b/site/user/api/skmatrix_overivew.md @@ -1,4 +1,4 @@ -SkMatrix +SkMatrix Overview ======== *3x3 transforms* diff --git a/site/user/api/skpaint.md b/site/user/api/skpaint_overview.md index 0d404cacc8..df89812bb5 100644 --- a/site/user/api/skpaint.md +++ b/site/user/api/skpaint_overview.md @@ -1,4 +1,4 @@ -SkPaint +SkPaint Overview ======= <span id="top"></span> diff --git a/site/user/api/skrect.md b/site/user/api/skrect_overivew.md index c2ebef1d0f..757c751498 100644 --- a/site/user/api/skrect.md +++ b/site/user/api/skrect_overivew.md @@ -1,4 +1,4 @@ -SkRect +SkRect Overview ====== *Rectangles* diff --git a/site/user/api/skregion.md b/site/user/api/skregion_overview.md index f4f46c951b..9d7e57170b 100644 --- a/site/user/api/skregion.md +++ b/site/user/api/skregion_overview.md @@ -1,4 +1,4 @@ -SkRegion +SkRegion Overview ======== *Regions - set operations with rectangles* diff --git a/site/user/api/undocumented.md b/site/user/api/undocumented.md new file mode 100644 index 0000000000..2a50f14246 --- /dev/null +++ b/site/user/api/undocumented.md @@ -0,0 +1,638 @@ +(to be documented) +=== + +# <a name="Glyph"></a> Glyph + +# <a name="Curve"></a> Curve + +# <a name="Document"></a> Document + +# <a name="SkDocument"></a> Class SkDocument + +<a name="beginPage"></a> +## beginPage + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +SkCanvas* beginPage(SkScalar width, SkScalar height, + const SkRect* content = NULL) +</pre> + +--- + +## <a name="PDF"></a> PDF + +# <a name="Arc"></a> Arc + +# <a name="Rect"></a> Rect + +# <a name="SkRect"></a> Struct SkRect + +<a name="MakeEmpty"></a> +## MakeEmpty + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +static constexpr SkRect SK_WARN_UNUSED_RESULT MakeEmpty() +</pre> + +--- + +<a name="dump"></a> +## dump + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void dump() const +</pre> + +--- + +<a name="dumpHex"></a> +## dumpHex + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void dumpHex() const +</pre> + +--- + +# <a name="Line"></a> Line + +# <a name="Region"></a> Region + +# <a name="SkRegion"></a> Class SkRegion + +# <a name="Device"></a> Device + +# <a name="SkBaseDevice"></a> Class SkBaseDevice + +# <a name="Vector"></a> Vector + +# <a name="SkVector"></a> Struct SkVector + +# <a name="Point"></a> Point + +# <a name="SkPoint"></a> Struct SkPoint + +<a name="equalsWithinTolerance"></a> +## equalsWithinTolerance + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +bool equalsWithinTolerance(const SkPoint& p) const +</pre> + +--- + +## <a name="Array"></a> Array + +# <a name="Patch"></a> Patch + +# <a name="Typeface"></a> Typeface + +# <a name="SkTypeface"></a> Class SkTypeface + +# <a name="Dump_Canvas"></a> Dump Canvas + +# <a name="SkDumpCanvas"></a> Class SkDumpCanvas + +# <a name="BBH_Factory"></a> BBH Factory + +# <a name="SkBBHFactory"></a> Class SkBBHFactory + +# <a name="Bitmap"></a> Bitmap + +# <a name="SkBitmap"></a> Class SkBitmap + +## <a name="Row_Bytes"></a> Row Bytes + +# <a name="Blend_Mode"></a> Blend Mode + +## <a name="SkBlendMode"></a> Enum SkBlendMode + +### Constants + +<table> + <tr> + <td><a name="SkBlendMode::kSrc"></a> <code><strong>SkBlendMode::kSrc </strong></code></td><td>1</td><td></td> + </tr> + <tr> + <td><a name="SkBlendMode::kSrcOver"></a> <code><strong>SkBlendMode::kSrcOver </strong></code></td><td>3</td><td></td> + </tr> + <tr> + <td><a name="SkBlendMode::kPlus"></a> <code><strong>SkBlendMode::kPlus </strong></code></td><td>12</td><td></td> + </tr> + +</table> + +# <a name="Circle"></a> Circle + +# <a name="Clip_Op"></a> Clip Op + +## <a name="SkClipOp"></a> Enum SkClipOp + +### Constants + +<table> + <tr> + <td><a name="SkClipOp::kDifference"></a> <code><strong>SkClipOp::kDifference </strong></code></td><td>0</td><td></td> + </tr> + <tr> + <td><a name="SkClipOp::kIntersect"></a> <code><strong>SkClipOp::kIntersect </strong></code></td><td>1</td><td></td> + </tr> + +</table> + +# <a name="Color"></a> Color + +<a name="SkColorGetA"></a> +## SkColorGetA + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +int SkColorGetA(color) +</pre> + +--- + +<a name="SkColorGetR"></a> +## SkColorGetR + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +int SkColorGetR(color) +</pre> + +--- + +<a name="SkColorGetG"></a> +## SkColorGetG + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +int SkColorGetG(color) +</pre> + +--- + +<a name="SkColorGetB"></a> +## SkColorGetB + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +int SkColorGetB(color) +</pre> + +--- + +<a name="SkColorSetARGB"></a> +## SkColorSetARGB + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +int SkColorSetARGB(a, r, g, b) +</pre> + +--- + +### Constants + +<table> + <tr> + <td><a name="SK_ColorBLACK"></a> <code><strong>SK_ColorBLACK </strong></code></td><td>0xFF000000 </td><td></td> + </tr> + <tr> + <td><a name="SK_ColorBLUE"></a> <code><strong>SK_ColorBLUE </strong></code></td><td>0xFF0000FF </td><td></td> + </tr> + <tr> + <td><a name="SK_ColorGREEN"></a> <code><strong>SK_ColorGREEN </strong></code></td><td>0xFF00FF00 </td><td></td> + </tr> + <tr> + <td><a name="SK_ColorRED"></a> <code><strong>SK_ColorRED </strong></code></td><td>0xFFFF0000 </td><td></td> + </tr> + <tr> + <td><a name="SK_ColorWHITE"></a> <code><strong>SK_ColorWHITE </strong></code></td><td>0xFFFFFFFF </td><td></td> + </tr> +</table> + +## <a name="Alpha"></a> Alpha + +## <a name="RGB"></a> RGB + +## <a name="Red"></a> Red + +## <a name="Blue"></a> Blue + +## <a name="Green"></a> Green + +## <a name="ARGB"></a> ARGB + +## <a name="RBG"></a> RBG + +## <a name="RGB-565"></a> RGB-565 + +# <a name="Color_Filter"></a> Color Filter + +# <a name="SkColorFilter"></a> Class SkColorFilter + +# <a name="Color_Space"></a> Color Space + +# <a name="Data"></a> Data + +# <a name="Draw_Filter"></a> Draw Filter + +# <a name="SkDrawFilter"></a> Class SkDrawFilter + +# <a name="Draw_Looper"></a> Draw Looper + +# <a name="SkDrawLooper"></a> Class SkDrawLooper + +# <a name="Drawable"></a> Drawable + +# <a name="SkDrawable"></a> Class SkDrawable + +<a name="draw"></a> +## draw + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void draw(SkCanvas*, const SkMatrix* = NULL) +</pre> + +--- + +# <a name="Raster_Handle_Allocator"></a> Raster Handle Allocator + +# <a name="SkRasterHandleAllocator"></a> Class SkRasterHandleAllocator + +# <a name="SkRasterHandleAllocator::Rec"></a> Struct SkRasterHandleAllocator::Rec + +<a name="MakeCanvas"></a> +## MakeCanvas + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +static std::unique_ptr<SkCanvas> + MakeCanvas(std::unique_ptr<SkRasterHandleAllocator>, + const SkImageInfo&, + const Rec* rec = nullptr) +</pre> + +--- + +# <a name="Filter_Quality"></a> Filter Quality + +## <a name="SkFilterQuality"></a> Enum SkFilterQuality + +### Constants + +<table> + <tr> + <td><a name="kNone_SkFilterQuality"></a> <code><strong>kNone_SkFilterQuality </strong></code></td><td>0</td><td></td> + </tr> + <tr> + <td><a name="kLow_SkFilterQuality"></a> <code><strong>kLow_SkFilterQuality </strong></code></td><td>1</td><td></td> + </tr> + <tr> + <td><a name="kMedium_SkFilterQuality"></a> <code><strong>kMedium_SkFilterQuality </strong></code></td><td>2</td><td></td> + </tr> + <tr> + <td><a name="kHigh_SkFilterQuality"></a> <code><strong>kHigh_SkFilterQuality </strong></code></td><td>3</td><td></td> + </tr> + +</table> + +# <a name="Font"></a> Font + +## <a name="Advance"></a> Advance + +## <a name="Engine"></a> Engine + +# <a name="Oval"></a> Oval + +# <a name="Font_Manager"></a> Font Manager + +# <a name="Image"></a> Image + +## <a name="Alpha_Type"></a> Alpha Type + +## <a name="SkAlphaType"></a> Enum SkAlphaType + +### Constants + +<table> + <tr> + <td><a name="kPremul_SkAlphaType"></a> <code><strong>kPremul_SkAlphaType </strong></code></td><td>2</td><td></td> + </tr> + +</table> + +## <a name="Color_Type"></a> Color Type + +## <a name="SkColorType"></a> Enum SkColorType + +### Constants + +<table> + <tr> + <td><a name="kUnknown_SkColorType"></a> <code><strong>kUnknown_SkColorType </strong></code></td><td>0</td><td></td> + </tr> + <tr> + <td><a name="kAlpha_8_SkColorType"></a> <code><strong>kAlpha_8_SkColorType </strong></code></td><td>1</td><td></td> + </tr> + <tr> + <td><a name="kRGB_565_SkColorType"></a> <code><strong>kRGB_565_SkColorType </strong></code></td><td>2</td><td></td> + </tr> + <tr> + <td><a name="kARGB_4444_SkColorType"></a> <code><strong>kARGB_4444_SkColorType </strong></code></td><td>3</td><td></td> + </tr> + <tr> + <td><a name="kRGBA_8888_SkColorType"></a> <code><strong>kRGBA_8888_SkColorType </strong></code></td><td>4</td><td></td> + </tr> + <tr> + <td><a name="kBGRA_8888_SkColorType"></a> <code><strong>kBGRA_8888_SkColorType </strong></code></td><td>5</td><td></td> + </tr> + <tr> + <td><a name="kIndex_8_SkColorType"></a> <code><strong>kIndex_8_SkColorType </strong></code></td><td>6</td><td></td> + </tr> + <tr> + <td><a name="kGray_8_SkColorType"></a> <code><strong>kGray_8_SkColorType </strong></code></td><td>7</td><td></td> + </tr> + <tr> + <td><a name="kRGBA_F16_SkColorType"></a> <code><strong>kRGBA_F16_SkColorType </strong></code></td><td>8</td><td></td> + </tr> +</table> + +### Constants + +<table> + <tr> + <td><a name="kN32_SkColorType"></a> <code><strong>kN32_SkColorType </strong></code></td><td>4</td><td></td> + </tr> + +</table> + +## <a name="Info"></a> Info + +# <a name="SkImageInfo"></a> Struct SkImageInfo + +<a name="empty_constructor"></a> +## SkImageInfo + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +SkImageInfo() +</pre> + +--- + +# <a name="SkImage"></a> Class SkImage + +<a name="makeShader"></a> +## makeShader + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +sk_sp<SkShader> makeShader(SkShader::TileMode, SkShader::TileMode, + const SkMatrix* localMatrix = nullptr) const +</pre> + +--- + +# <a name="Image_Filter"></a> Image Filter + +## <a name="Scaling"></a> Scaling + +# <a name="SkImageFilter"></a> Class SkImageFilter + +# <a name="Image_Scaling"></a> Image Scaling + +# <a name="IRect"></a> IRect + +# <a name="SkIRect"></a> Struct SkIRect + +# <a name="Mask"></a> Mask + +# <a name="Mask_Alpha"></a> Mask Alpha + +# <a name="Mask_Filter"></a> Mask Filter + +# <a name="SkMaskFilter"></a> Class SkMaskFilter + +# <a name="Matrix"></a> Matrix + +# <a name="SkMatrix"></a> Struct SkMatrix + +# <a name="Nine_Patch"></a> Nine Patch + +# <a name="Number_Types"></a> Number Types + +### Constants + +<table> + <tr> + <td><a name="SK_ScalarMax"></a> <code><strong>SK_ScalarMax </strong></code></td><td>to be written</td><td></td> + </tr> + <tr> + <td><a name="SK_ScalarInfinity"></a> <code><strong>SK_ScalarInfinity </strong></code></td><td>to be written</td><td></td> + </tr> + <tr> + <td><a name="SK_ScalarNegativeInfinity"></a> <code><strong>SK_ScalarNegativeInfinity </strong></code></td><td>to be written</td><td></td> + </tr> + <tr> + <td><a name="SK_ScalarNaN"></a> <code><strong>SK_ScalarNaN </strong></code></td><td>to be written</td><td></td> + </tr> +</table> + +# <a name="Paint_Defaults"></a> Paint Defaults + +### Constants + +<table> + <tr> + <td><a name="SkPaintDefaults_Flags"></a> <code><strong>SkPaintDefaults_Flags </strong></code></td><td>0</td><td></td> + </tr> + <tr> + <td><a name="SkPaintDefaults_Hinting"></a> <code><strong>SkPaintDefaults_Hinting </strong></code></td><td>2</td><td></td> + </tr> + <tr> + <td><a name="SkPaintDefaults_TextSize"></a> <code><strong>SkPaintDefaults_TextSize </strong></code></td><td>12</td><td></td> + </tr> + <tr> + <td><a name="SkPaintDefaults_MiterLimit"></a> <code><strong>SkPaintDefaults_MiterLimit </strong></code></td><td>4</td><td></td> + </tr> +</table> + +# <a name="Path_Effect"></a> Path Effect + +# <a name="SkPathEffect"></a> Class SkPathEffect + +# <a name="Path_Measure"></a> Path Measure + +# <a name="SkPathMeasure"></a> Class SkPathMeasure + +<a name="dump"></a> +## dump + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void dump() const +</pre> + +--- + +# <a name="PathOps"></a> PathOps + +<a name="Op"></a> +## Op + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +bool SK_API Op(const SkPath& one, const SkPath& two, SkPathOp op, SkPath* result) +</pre> + +--- + +# <a name="Picture"></a> Picture + +## <a name="Recorder"></a> Recorder + +# <a name="SkPictureRecorder"></a> Class SkPictureRecorder + +<a name="beginRecording"></a> +## beginRecording + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +SkCanvas* beginRecording(const SkRect& bounds, SkBBHFactory* bbhFactory = NULL, + uint32_t recordFlags = 0) +</pre> + +--- + +# <a name="Pixel"></a> Pixel + +## <a name="Storage"></a> Storage + +# <a name="Pixmap"></a> Pixmap + +# <a name="SkPixmap"></a> Class SkPixmap + +# <a name="Rasterizer"></a> Rasterizer + +# <a name="SkRasterizer"></a> Class SkRasterizer + +## <a name="Layer"></a> Layer + +# <a name="Reference_Count"></a> Reference Count + +# <a name="sk_sp"></a> Class sk_sp + +# <a name="Round_Rect"></a> Round Rect + +# <a name="SkRRect"></a> Class SkRRect + +<a name="dump"></a> +## dump + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void dump() const +</pre> + +--- + +<a name="dumpHex"></a> +## dumpHex + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +void dumpHex() const +</pre> + +--- + +# <a name="RSXform"></a> RSXform + +# <a name="SkRSXform"></a> Struct SkRSXform + +# <a name="Shader"></a> Shader + +# <a name="SkShader"></a> Class SkShader + +## <a name="SkShader::TileMode"></a> Enum SkShader::TileMode + +### Constants + +<table> + <tr> + <td><a name="SkShader::kClamp_TileMode"></a> <code><strong>SkShader::kClamp_TileMode </strong></code></td><td>0</td><td></td> + </tr> + +</table> + +<a name="MakeBitmapShader"></a> +## MakeBitmapShader + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +static sk_sp<SkShader> MakeBitmapShader(const SkBitmap& src, TileMode tmx, + TileMode tmy, + const SkMatrix* localMatrix = nullptr) +</pre> + +--- + +## <a name="Gradient"></a> Gradient + +# <a name="Sprite"></a> Sprite + +# <a name="Stream"></a> Stream + +# <a name="SkFlattenable"></a> Class SkFlattenable + +# <a name="String"></a> String + +# <a name="SkString"></a> Class SkString + +# <a name="Surface"></a> Surface + +# <a name="SkSurface"></a> Class SkSurface + +<a name="MakeRasterDirect"></a> +## MakeRasterDirect + +<pre style="padding: 1em 1em 1em 1em;width: 50em; background-color: #f0f0f0"> +static sk_sp<SkSurface> MakeRasterDirect(const SkImageInfo&, void* pixels, + size_t rowBytes, + const SkSurfaceProps* = nullptr) +</pre> + +--- + +## <a name="Properties"></a> Properties + +# <a name="SkSurfaceProps"></a> Class SkSurfaceProps + +## <a name="SkSurfaceProps::InitType"></a> Enum SkSurfaceProps::InitType + +### Constants + +<table> + <tr> + <td><a name="SkSurfaceProps::kLegacyFontHost_InitType"></a> <code><strong>SkSurfaceProps::kLegacyFontHost_InitType </strong></code></td><td>0</td><td></td> + </tr> + +</table> + +## <a name="GPU"></a> GPU + +## <a name="Raster"></a> Raster + +# <a name="SVG"></a> SVG + +## <a name="Canvas"></a> Canvas + +## <a name="Arc"></a> Arc + +# <a name="Text"></a> Text + +# <a name="Text_Blob"></a> Text Blob + +# <a name="SkTextBlob"></a> Class SkTextBlob + +# <a name="Vertices"></a> Vertices + +## <a name="Colors"></a> Colors + +## <a name="Texs"></a> Texs + +# <a name="Read_Buffer"></a> Read Buffer + +# <a name="SkReadBuffer"></a> Struct SkReadBuffer + +# <a name="Write_Buffer"></a> Write Buffer + +# <a name="SkWriteBuffer"></a> Struct SkWriteBuffer diff --git a/site/user/api/usingBookmaker.md b/site/user/api/usingBookmaker.md new file mode 100644 index 0000000000..d98f52bc79 --- /dev/null +++ b/site/user/api/usingBookmaker.md @@ -0,0 +1,79 @@ +using Bookmaker +=== + +# <a name="Bookmaker"></a> Bookmaker +How to use the <a href="bmh_usingBookmaker?cl=9919#Bookmaker">Bookmaker</a> utility. + +Get the fiddle command line interface tool. + +<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0"> +$ go get go.skia.org/infra/fiddle/go/fiddlecli</pre> + +Get the <a href="bmh_usingBookmaker?cl=9919#Bookmaker">Bookmaker</a> <a href="bmh_usingBookmaker?cl=9919#CL">CL</a> and build it. + +<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0"> +$ git cl patch 9919 +$ ninja -<a href="bmh_usingBookmaker?cl=9919#C">C</a> out/dir bookmaker</pre> + +Generate an starter <a href="bmh_usingBookmaker?cl=9919#Bookmaker">Bookmaker</a> file from an existing include. +This writes <a href="bmh_usingBookmaker?cl=9919#SkXXX">SkXXX</a>.bmh in the current directory, which is +out/dir/obj/ from an IDE. + +<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0"> +$ ./out/dir/bookmaker -t -i include/core/<a href="bmh_usingBookmaker?cl=9919#SkXXX">SkXXX</a>.h</pre> + +Use your favorite editor to fill out <a href="bmh_usingBookmaker?cl=9919#SkXXX">SkXXX</a>.bmh. + +Generate fiddle.json from all examples, including the ones you just wrote. +Error checking is syntatic: starting keywords are closed, keywords have the +correct parents. +If you run <a href="bmh_usingBookmaker?cl=9919#Bookmaker">Bookmaker</a> inside <a href="bmh_usingBookmaker?cl=9919#Visual_Studio">Visual Studio</a>, you can click on errors and it +will take you to the source line in question. + +<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0"> +$ ./out/dir/bookmaker -e fiddle.json -b current_directory</pre> + +Once complete, run fiddlecli to generate the example hashes. +Errors are contained by the output but aren't reported yet. + +<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0"> +$ $GOPATH/bin/fiddlecli --input fiddle.json --output fiddleout.json</pre> + +Generate <a href="bmh_usingBookmaker?cl=9919#bmh_SkXXX">bmh SkXXX</a>.md from <a href="bmh_usingBookmaker?cl=9919#SkXXX">SkXXX</a>.bmh and fiddleout.json. +Error checking includes: undefined references, fiddle compiler errors, +missing or mismatched printf output. +Again, you can click on any errors inside <a href="bmh_usingBookmaker?cl=9919#Visual_Studio">Visual Studio</a>. + +<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0"> +$ ./out/dir/bookmaker -r site/user/api -b current_directory -f fiddleout.json</pre> + +The original include may have changed since you started creating the markdown. +Check to see if it is up to date. +This reports if a method no longer exists or its parameters have changed. + +<pre style="padding: 1em 1em 1em 1em;width: 44em; background-color: #f0f0f0"> +$ ./out/dir/bookmaker -x -b current_directory/<a href="bmh_usingBookmaker?cl=9919#SkXXX">SkXXX</a>.bmh -i include/core/<a href="bmh_usingBookmaker?cl=9919#SkXXX">SkXXX</a>.h</pre> + +# <a name="Bugs"></a> Bugs + +<table> +overaggressive reference finding in code block +missing examples +redundant examples -- got tired so used the same one more than once +some examples need vertical resizing +list doesn't work (ironic, huh)</table> + +# <a name="To_Do"></a> To Do + +<table> +check that all methods have one line descriptions in overview +see also -- anything that can be done automatically? maybe any ref shows up everywhere +index by example png +generate pdf or pdf-like out +generate b/w out instead of color -- have b/w versions of examples? +formalize voice / syntax for parts of topic and method +write bmh data back into include +have a way to write one block that covers multiple nearly indentical methods? +may want to do this for pdf view as well +write a one-method-per-page online view?</table> + |