I have an SVG:
<svg height="781.8" width="1077.15" xmlns="http://www.w3.org/2000/svg">
<radialGradient cx="0" cy="0" gradientTransform="matrix(-0.0664, 0.0141, 0.0063, 0.0288, 137.9, -123.45)" gradientUnits="userSpaceOnUse" id="gradient0" r="819.2" spreadMethod="pad">
<stop offset="0.0" stop-color="#ff0000" stop-opacity="0.34901962"/>
<stop offset="1.0" stop-color="#ff0000" stop-opacity="0.0"/>
</radialGradient>
<g transform="translate(309.85, 414.55) rotate(0, 600, 300)">
<path transform="translate(-125, -10)" d="M161.0 -139.65 L160.25 -139.45 160.8 -139.85 Q161.55 -140.4 163.6 -140.15 L161.0 -139.65 M92.55 -115.35 Q91.1 -122.1 97.5 -128.9 107.45 -139.25 134.7 -146.75 L142.55 -148.35 Q147.4 -149.25 152.3 -148.3 L160.45 -147.3 161.4 -147.25 159.25 -145.4 Q152.35 -139.0 152.35 -135.5 L152.4 -134.75 152.4 -134.6 151.85 -132.55 151.6 -131.55 151.65 -131.45 Q152.45 -130.95 153.3 -131.0 L153.55 -130.1 Q153.55 -129.7 153.7 -129.45 154.0 -128.9 155.05 -128.9 158.8 -128.9 162.2 -130.4 164.8 -131.5 165.55 -132.55 L166.7 -134.25 166.75 -134.25 170.0 -136.6 Q171.95 -138.0 172.25 -139.25 L172.1 -140.5 172.1 -141.75 Q172.35 -142.6 172.95 -143.65 173.35 -144.25 173.15 -144.7 L172.9 -145.25 173.0 -145.5 175.35 -144.6 Q179.2 -142.4 180.8 -139.7 181.8 -138.0 182.7 -134.5 184.3 -127.3 179.2 -119.65 170.45 -106.4 143.85 -100.8 135.15 -98.9 123.45 -99.6 110.8 -100.5 101.05 -104.15 95.85 -106.15 94.15 -109.2 93.65 -110.15 92.55 -115.35" fill="url(#gradient0)" fill-rule="evenodd" stroke="none"/>
</g>
</svg>
which I am trying to reproduce using the Canvas 2D API here:
var cv = document.createElement('canvas');
cv.width = 1077.15;
cv.height = 781.8;
var c = cv.getContext('2d');
document.body.appendChild(cv);
c.translate(600,300);
c.rotate(0);
c.translate(-600,-300);
// The rotation above was set to 0 to exclude it from implementation until this issue is resolved... though if this is not the correct way to rotate using the API, please let me know...
c.translate(80,60);// I'm not sure where I missed out on the math to calculate this offset... I included it to position the path approximately where it should be
c.beginPath();
c.moveTo(256.863018149747,203.30007674597084);
c.lineTo(256.3059926658311,203.45356868764392);
c.lineTo(256.7144780207028,203.14658480429782);
c.quadraticCurveTo(257.2715035046187,202.72448196469685,258.79403982732214,202.91634689178818);
c.lineTo(256.863018149747,203.30007674597084);
c.moveTo(206.0251589843569,221.94934765924793);
c.quadraticCurveTo(204.94824304878617,216.7689946277821,209.70152717820176,211.55026861089792);
c.quadraticCurveTo(217.09139859815252,203.60706062931698,237.32999118042983,197.85111281657714);
c.lineTo(243.16019124541617,196.6231772831927);
c.quadraticCurveTo(246.76228937473888,195.93246354566386,250.40152253632272,196.6615502686109);
c.lineTo(256.4545327948754,197.4290099769762);
c.lineTo(257.1600984078355,197.46738296239448);
c.lineTo(255.56329202060994,198.8871834228703);
c.quadraticCurveTo(250.43865756858378,203.7989255564083,250.43865756858378,206.4850345356869);
c.lineTo(250.4757926008448,207.06062931696087);
c.lineTo(250.4757926008448,207.1757482732157);
c.lineTo(250.06730724597318,208.74904067536454);
c.lineTo(249.8816320846679,209.51650038372986);
c.lineTo(249.91876711692893,209.59324635456642);
c.quadraticCurveTo(250.51292763310587,209.97697620874908,251.1442231815439,209.9386032233308);
c.lineTo(251.3298983428492,210.6293169608596);
c.quadraticCurveTo(251.3298983428492,210.9363008442057,251.44130343963235,211.12816577129703);
c.quadraticCurveTo(251.66411363319872,211.55026861089792,252.44394931068098,211.55026861089792);
c.quadraticCurveTo(255.22907673026043,211.55026861089792,257.75425892401245,210.39907904834996);
c.quadraticCurveTo(259.6852806015875,209.55487336914814,260.2423060855034,208.74904067536454);
c.lineTo(261.0964118275078,207.44435917114353);
c.lineTo(261.13354685976884,207.44435917114353);
c.lineTo(263.54732395673767,205.6408288564851);
c.quadraticCurveTo(264.995590214919,204.56638526477363,265.21840040848537,203.60706062931698);
c.lineTo(265.1069953117022,202.64773599386035);
c.lineTo(265.1069953117022,201.6884113584037);
c.quadraticCurveTo(265.2926704730075,201.0360706062932,265.7382908601402,200.23023791250958);
c.quadraticCurveTo(266.0353711182287,199.76976208749042,265.88683098918443,199.42440521872604);
c.lineTo(265.7011558278791,199.00230237912513);
c.lineTo(265.77542589240124,198.8104374520338);
c.lineTo(267.52077240867106,199.5011511895626);
c.quadraticCurveTo(270.3801698927726,201.18956254796623,271.5684909251265,203.2617037605526);
c.quadraticCurveTo(272.3111915703477,204.56638526477363,272.9796221510467,207.2524942440522);
c.quadraticCurveTo(274.16794318340067,212.77820414428243,270.3801698927726,218.64927091327704);
c.quadraticCurveTo(263.88153924708723,228.81811204911742,244.1257020842037,233.11588641596316);
c.quadraticCurveTo(237.66420647077936,234.57405986185725,228.9746089216915,234.0368380660016);
c.quadraticCurveTo(219.57944575964353,233.34612432847277,212.33811446873696,230.54489639293936);
c.quadraticCurveTo(208.4760711135868,229.00997697620875,207.21348001671075,226.6692248656946);
c.quadraticCurveTo(206.84212969410015,225.9401381427475,206.0251589843569,221.94934765924793);
c.closePath();
var gradient=c.createRadialGradient(206.0251589843569,196.6231772831927,0,206.0251589843569,196.6231772831927,819.2*66.95446316668983);// Obviously this cannot be the correct conversion from the bounding box (x:206.0251589843569, y:196.6231772831927, w:66.95446316668983, h:37.413660782808904) to user system coordinates..
gradient.addColorStop(0,'rgba(255,0,0,0.34901962)');
gradient.addColorStop(1,'rgba(255,0,0,0)');
c.transform(-0.0664,0.0141,0.0063,0.0288,137.9,-123.45);
c.fillStyle=gradient;
c.fill('evenodd');
As stated in the comments above, I cannot get the correct center for the gradient & I believe I must have misunderstood the implementation guidelines for SVG. Could I get an explanation as to how to achieve this with userSpaceOnUse or what I am not doing correctly, since using objectBoundingBox works perfectly?