1--- 2title: 'SkPath Overview' 3linkTitle: 'SkPath Overview' 4 5weight: 270 6--- 7 8<a href='https://api.skia.org/classSkPath.html'>Path</a> contains 9<a href='undocumented#Line'>Lines</a> and 10<a href='undocumented#Curve'>Curves</a> which can be stroked or filled. 11<a href='#Contour'>Contour</a> is composed of a series of connected 12<a href='undocumented#Line'>Lines</a> and 13<a href='undocumented#Curve'>Curves</a>. 14<a href='https://api.skia.org/classSkPath.html'>Path</a> may contain zero, one, 15or more <a href='#Contour'>Contours</a>. Each 16<a href='undocumented#Line'>Line</a> and <a href='undocumented#Curve'>Curve</a> 17are described by Verb, 18<a href='https://api.skia.org/structSkPoint.html'>Points</a>, and optional 19<a href='#Path_Conic_Weight'>Path_Conic_Weight</a>. 20 21Each pair of connected <a href='undocumented#Line'>Lines</a> and 22<a href='undocumented#Curve'>Curves</a> share common 23<a href='https://api.skia.org/structSkPoint.html'>Point</a>; for instance, 24<a href='https://api.skia.org/classSkPath.html'>Path</a> containing two 25connected <a href='undocumented#Line'>Lines</a> are described the 26<a href='#Path_Verb'>Path_Verb</a> sequence: 27<a href='https://api.skia.org/classSkPath.html'>SkPath</a>::<a href='#SkPath_kMove_Verb'>kMove_Verb</a>, 28<a href='https://api.skia.org/classSkPath.html'>SkPath</a>::<a href='#SkPath_kLine_Verb'>kLine_Verb</a>, 29<a href='https://api.skia.org/classSkPath.html'>SkPath</a>::<a href='#SkPath_kLine_Verb'>kLine_Verb</a>; 30and a <a href='https://api.skia.org/structSkPoint.html'>Point</a> sequence with 31three entries, sharing the middle entry as the end of the first 32<a href='undocumented#Line'>Line</a> and the start of the second 33<a href='undocumented#Line'>Line</a>. 34 35<a href='https://api.skia.org/classSkPath.html'>Path</a> components 36<a href='undocumented#Arc'>Arc</a>, 37<a href='https://api.skia.org/classSkPath.html#af037025a1adad16072abbbcd83b621f2'>Rect</a>, 38<a href='#RRect'>Round_Rect</a>, <a href='undocumented#Circle'>Circle</a>, and 39<a href='undocumented#Oval'>Oval</a> are composed of 40<a href='undocumented#Line'>Lines</a> and 41<a href='undocumented#Curve'>Curves</a> with as many 42<a href='https://api.skia.org/classSkPath.html#ac36f638ac96f3428626e993eacf84ff0'>Verbs</a> 43and <a href='https://api.skia.org/structSkPoint.html'>Points</a> required for an 44exact description. Once added to 45<a href='https://api.skia.org/classSkPath.html'>Path</a>, these components may 46lose their identity; although 47<a href='https://api.skia.org/classSkPath.html'>Path</a> can be inspected to 48determine if it describes a single 49<a href='https://api.skia.org/classSkPath.html#af037025a1adad16072abbbcd83b621f2'>Rect</a>, 50<a href='undocumented#Oval'>Oval</a>, <a href='#RRect'>Round_Rect</a>, and so 51on. 52 53### Example 54 55<div><fiddle-embed name="93887af0c1dac49521972698cf04069c"><div><a href='https://api.skia.org/classSkPath.html'>Path</a> contains three <a href='#Contour'>Contours</a>: <a href='undocumented#Line'>Line</a>, <a href='undocumented#Circle'>Circle</a>, and <a href='https://api.skia.org/classSkPath.html#ad75d5a934476ac6543d6d7ddd8dbb90a'>Quad</a>. <a href='undocumented#Line'>Line</a> is stroked but 56not filled. <a href='undocumented#Circle'>Circle</a> is stroked and filled; <a href='undocumented#Circle'>Circle</a> stroke forms a loop. <a href='https://api.skia.org/classSkPath.html#ad75d5a934476ac6543d6d7ddd8dbb90a'>Quad</a> 57is stroked and filled, but since it is not closed, <a href='https://api.skia.org/classSkPath.html#ad75d5a934476ac6543d6d7ddd8dbb90a'>Quad</a> does not stroke a loop. 58</div></fiddle-embed></div> 59 60<a href='https://api.skia.org/classSkPath.html'>Path</a> contains a 61<a href='#Path_Fill_Type'>Path_Fill_Type</a> which determines whether 62overlapping <a href='#Contour'>Contours</a> form fills or holes. 63<a href='#Path_Fill_Type'>Path_Fill_Type</a> also determines whether area inside 64or outside <a href='undocumented#Line'>Lines</a> and 65<a href='undocumented#Curve'>Curves</a> is filled. 66 67### Example 68 69<div><fiddle-embed name="36a995442c081ee779ecab2962d36e69"><div><a href='https://api.skia.org/classSkPath.html'>Path</a> is drawn filled, then stroked, then stroked and filled. 70</div></fiddle-embed></div> 71 72<a href='https://api.skia.org/classSkPath.html'>Path</a> contents are never 73shared. Copying <a href='https://api.skia.org/classSkPath.html'>Path</a> by 74value effectively creates a new 75<a href='https://api.skia.org/classSkPath.html'>Path</a> independent of the 76original. Internally, the copy does not duplicate its contents until it is 77edited, to reduce memory use and improve performance. 78 79<a name='Contour'></a> 80 81--- 82 83<a href='#Contour'>Contour</a> contains one or more 84<a href='https://api.skia.org/classSkPath.html#ac36f638ac96f3428626e993eacf84ff0'>Verbs</a>, 85and as many <a href='https://api.skia.org/structSkPoint.html'>Points</a> as are 86required to satisfy <a href='#Path_Verb_Array'>Path_Verb_Array</a>. First 87<a href='#Path_Verb'>Path_Verb</a> in 88<a href='https://api.skia.org/classSkPath.html'>Path</a> is always 89<a href='https://api.skia.org/classSkPath.html'>SkPath</a>::<a href='#SkPath_kMove_Verb'>kMove_Verb</a>; 90each 91<a href='https://api.skia.org/classSkPath.html'>SkPath</a>::<a href='#SkPath_kMove_Verb'>kMove_Verb</a> 92that follows starts a new <a href='#Contour'>Contour</a>. 93 94### Example 95 96<div><fiddle-embed name="0374f2dcd7effeb1dd435205a6c2de6f"><div>Each <a href='https://api.skia.org/classSkPath.html'>SkPath</a>::<a href='#SkPath_moveTo'>moveTo</a> starts a new <a href='#Contour'>Contour</a>, and content after <a href='https://api.skia.org/classSkPath.html'>SkPath</a>::<a href='#SkPath_close'>close()</a> 97also starts a new <a href='#Contour'>Contour</a>. Since <a href='https://api.skia.org/classSkPath.html'>SkPath</a>::<a href='#SkPath_conicTo'>conicTo</a> is not preceded by 98<a href='https://api.skia.org/classSkPath.html'>SkPath</a>::<a href='#SkPath_moveTo'>moveTo</a>, the first <a href='https://api.skia.org/structSkPoint.html'>Point</a> of the third <a href='#Contour'>Contour</a> starts at the last <a href='https://api.skia.org/structSkPoint.html'>Point</a> 99of the second <a href='#Contour'>Contour</a>. 100</div></fiddle-embed></div> 101 102If final <a href='#Path_Verb'>Path_Verb</a> in <a href='#Contour'>Contour</a> is 103<a href='https://api.skia.org/classSkPath.html'>SkPath</a>::<a href='#SkPath_kClose_Verb'>kClose_Verb</a>, 104<a href='undocumented#Line'>Line</a> connects 105<a href='#Path_Last_Point'>Path_Last_Point</a> in <a href='#Contour'>Contour</a> 106with first <a href='https://api.skia.org/structSkPoint.html'>Point</a>. A closed 107<a href='#Contour'>Contour</a>, stroked, draws 108<a href='#Paint_Stroke_Join'>Paint_Stroke_Join</a> at 109<a href='#Path_Last_Point'>Path_Last_Point</a> and first 110<a href='https://api.skia.org/structSkPoint.html'>Point</a>. Without 111<a href='https://api.skia.org/classSkPath.html'>SkPath</a>::<a href='#SkPath_kClose_Verb'>kClose_Verb</a> 112as final Verb, <a href='#Path_Last_Point'>Path_Last_Point</a> and first 113<a href='https://api.skia.org/structSkPoint.html'>Point</a> are not connected; 114<a href='#Contour'>Contour</a> remains open. An open 115<a href='#Contour'>Contour</a>, stroked, draws 116<a href='#Paint_Stroke_Cap'>Paint_Stroke_Cap</a> at 117<a href='#Path_Last_Point'>Path_Last_Point</a> and first 118<a href='https://api.skia.org/structSkPoint.html'>Point</a>. 119 120### Example 121 122<div><fiddle-embed name="7a1f39b12d2cd8b7f5b1190879259cb2"><div><a href='https://api.skia.org/classSkPath.html'>Path</a> is drawn stroked, with an open <a href='#Contour'>Contour</a> and a closed <a href='#Contour'>Contour</a>. 123</div></fiddle-embed></div> 124 125<a name='Contour_Zero_Length'></a> 126 127--- 128 129<a href='#Contour'>Contour</a> length is distance traveled from first 130<a href='https://api.skia.org/structSkPoint.html'>Point</a> to 131<a href='#Path_Last_Point'>Path_Last_Point</a>, plus, if 132<a href='#Contour'>Contour</a> is closed, distance from 133<a href='#Path_Last_Point'>Path_Last_Point</a> to first 134<a href='https://api.skia.org/structSkPoint.html'>Point</a>. Even if 135<a href='#Contour'>Contour</a> length is zero, stroked 136<a href='undocumented#Line'>Lines</a> are drawn if 137<a href='#Paint_Stroke_Cap'>Paint_Stroke_Cap</a> makes them visible. 138 139### Example 140 141<div><fiddle-embed name="62848df605af6258653d9e16b27d8f7f"></fiddle-embed></div> 142