Shape | SVG | Canvas | Area |
---|---|---|---|
Rectangle |
rect(x y width
height)
|
strokeRect(x, y, width, height)
|
<area shape="rect"
coords="x1,y1, x2,y2" (top-right, bottom-left)
|
<path d="M x1 y1 H x2 V y2 H x1 Z" />
|
fillRect(x, y, width, height)
|
||
Circle |
<circle cx cy r />
|
arc(x, y, radius, startAngle, endAngle)
|
<area
|
Triangle |
<polygon
|
moveTo(x1, y1);
|
<area
|
Line |
<line x1 y1 x2 y2 />
|
lineTo(x, y)
|
— |
Text |
<text x y style>
myText</text>
|
strokeText(
text,x,y)
|
— |
fillText(text, x,y)
|