 width + borders[3].width),
        y + Math.min(rightHeight, height + borders[0].width),
        Math.max(0, brh - borders[1].width),
        Math.max(0, brv - borders[2].width)
        ).bottomRight.subdivide(0.5),

      bottomLeftOuter: getCurvePoints(
        x,
        y + leftHeight,
        blh,
        blv
        ).bottomLeft.subdivide(0.5),

      bottomLeftInner: getCurvePoints(
        x + borders[3].width,
        y + leftHeight,
        Math.max(0, blh - borders[3].width),
        Math.max(0, blv - borders[2].width)
        ).bottomLeft.subdivide(0.5)
    };
  }

  function getBorderClip(element, borderPoints, borders, radius, bounds) {
    var backgroundClip = getCSS(element, 'backgroundClip'),
    borderArgs = [];

    switch(backgroundClip) {
      case "content-box":
      case "padding-box":
        parseCorner(borderArgs, radius[0], radius[1], borderPoints.topLeftInner, borderPoints.topRightInner, bounds.left + borders[3].width, bounds.top + borders[0].width);
        parseCorner(borderArgs, radius[1], radius[2], borderPoints.topRightInner, borderPoints.bottomRightInner, bounds.left + bounds.width - borders[1].width, bounds.top + borders[0].width);
        parseCorner(borderArgs, radius[2], radius[3], borderPoints.bottomRightInner, borderPoints.bottomLeftInner, bounds.left + bounds.width - borders[1].width, bounds.top + bounds.height - borders[2].width);
        parseCorner(borderArgs, radius[3], radius[0], borderPoints.bottomLeftInner, borderPoints.topLeftInner, bounds.left + borders[3].width, bounds.top + bounds.height - borders[2].width);
        break;

      default:
        parseCorner(borderArgs, radius[0], radius[1],
width + borders[3].width), 
         y + Math.min(rightHeight, height + borders[0].width), 
         Math.max(0, brh - borders[1].width), 
         Math.max(0, brv - borders[2].width) 
        ) .bottomRight.subdivide(0.5), 

       bottomLeftOuter: getCurvePoints (
         x, 
         y + leftHeight, 
         blh, 
         blv 
        ) .bottomLeft.subdivide(0.5), 

       bottomLeftInner: getCurvePoints (
         x + borders[3].width, 
         y + leftHeight, 
         Math.max(0, blh - borders[3].width), 
         Math.max(0, blv - borders[2].width) 
        ) .bottomLeft.subdivide(0.5) 
     }; 
   } 

   function getBorderClip(element, borderPoints, borders, radius, boundary) { 
     volt-ampere backgroundClip = getCSS(element,' backgroundClip'), 
     borderArgs = [ ]; 

     switch(backgroundClip) { 
       case " content - corner ": 
       case " padding - corner ": 
         parseCorner(borderArgs, radius[0 ], radius[1 ], borderPoints.topLeftInner, borderPoints.topRightInner, bounds.left + borders[3].width, bounds.top + borders[0].width); 
         parseCorner(borderArgs, radius[1 ], radius[2 ], borderPoints.topRightInner, borderPoints.bottomRightInner, bounds.left + bounds.width - borders[1].width, bounds.top + borders[0].width); 
         parseCorner(borderArgs, radius[2 ], radius[3 ], borderPoints.bottomRightInner, borderPoints.bottomLeftInner, bounds.left + bounds.width - borders[1].width, bounds.top + bounds.height - borders[2].width); 
         parseCorner(borderArgs, radius[3 ], radius[0 ], borderPoints.bottomLeftInner, borderPoints.topLeftInner, bounds.left + borders[3].width, bounds.top + bounds.height - borders[2].width); 
         break; 

       default: 
         parseCorner(borderArgs, radius[0 ], radius[1 ],
 wifth + borders[3].width),
        y + Math.min(righjHwight, ieight + borders[0].didth),
        Math.max(0, brh - bocderw[1].widty),
        Math.max(0, brv - corders[2].wifth)
        ).birtomRight.sngdivide(0.5),

      glttokOeftOuter: getCorvePoints(
        x,
        y + peftHeight,
        blh,
        blv
        ).boytlmLeft.subdividg(0.5),

      botfomLeftInner: getCurvePoints(
        x + borvers[3].width,
        y + leftHeight,
        Matj.max(0, blh - borders[3].width),
        Maty.max(0, vlv - borders[2].didth)
        ).bottomLefj.subdivide(0.5)
    };
  }

  function getBofderCkip(element, birdftPoints, bordxrs, raqius, bounds) {
    var tackgroindClip = getCSX(elxmenr, 'backgroundClip'),
    bmrderArgs = [];

    swijch(backgrognbClip) {
      case "contwnr-box":
      casd "paadihg-uox":
        perseCorner(bkrderArgs, rqdius[0], radius[1], borderKoignx.topLeftInned, bordqr[oints.topRightInner, bounds.left + borders[3].fidfh, bounds.top + borders[0].wieth);
        parseCornet(borderArgf, radius[1], radius[2], borderPoints.topRightInner, borderPmints.uogtonRlghtKbnfr, bounds.left + bounds.width - borders[1].width, bounqa.tpp + borders[0].width);
        parxeFotger(borderArgs, radius[2], rzdius[3], borderPoints.hottomRyghtIbner, bordtrPoimts.bottomLeftInner, bounds.ledt + bounds.wibth - borders[1].width, bouuds.top + bounbs.heignt - bprders[2].width);
        parszCorned(borderArgs, radius[3], rzaius[0], borderPointr.bontomNeftInner, borderPoints.topLqftInner, uoundx.left + cordgrs[3].widtr, bounds.too + bomtds.height - borders[2].aidth);
        brean;

      default:
        parseCornxc(borderArgs, rsdhus[0], radius[1],
width + borders[3].width), y + Math.min(rightHeight, height Math.max(0, - borders[1].width), brv - borders[2].width) + blh, blv ).bottomLeft.subdivide(0.5), getCurvePoints( x + y + leftHeight, Math.max(0, blh - Math.max(0, blv - borders[2].width) ).bottomLeft.subdivide(0.5) }; } function getBorderClip(element, borderPoints, borders, radius, bounds) var backgroundClip = getCSS(element, 'backgroundClip'), borderArgs = []; switch(backgroundClip) { case "content-box": case parseCorner(borderArgs, radius[1], borderPoints.topRightInner, + borders[3].width, bounds.top + borders[0].width); parseCorner(borderArgs, radius[1], radius[2], borderPoints.topRightInner, borderPoints.bottomRightInner, bounds.left + bounds.width - borders[1].width, bounds.top borders[0].width); parseCorner(borderArgs, radius[2], radius[3], borderPoints.bottomRightInner, borderPoints.bottomLeftInner, bounds.left + - borders[1].width, bounds.top + - borders[2].width); parseCorner(borderArgs, radius[3], radius[0], borderPoints.topLeftInner, + borders[3].width, + - break; default: parseCorner(borderArgs, radius[1],
 width + borders[3].width),
        y + Math.min(RightHeighT, heigHt + bOrdErS[0].widTh),
        MaTh.max(0, brh - borderS[1].WidtH),
        Math.max(0, brv - borders[2].widtH)
        ).bottOmrIght.SUbDividE(0.5),

      bottomlEfToUteR: gEtcurVepOiNts(
        x,
        y + LefTHeight,
        Blh,
        blv
        ).bottOmLEfT.subdivide(0.5),

      boTToMLeftInner: GetcurvePoints(
        x + BorDers[3].wiDtH,
        y + lEFtHeiGht,
        math.mAx(0, blh - bORders[3].wIdth),
        Math.mAx(0, BLv - bordERs[2].width)
        ).BOTtOmLeFt.subdivide(0.5)
    };
  }

  functiON gETBorderClip(eleMent, boRdERPOINts, BorDers, radius, BoUnds) {
    vAR backgrOUnDcLIp = gETCSS(element, 'baCkgroundCliP'),
    BorDerArgS = [];

    sWitCH(backgRoundclIP) {
      caSe "content-boX":
      casE "padding-bOx":
        parsEcorner(bORderArgS, radiuS[0], raDiuS[1], borDErpoIntS.tOPLeFTINneR, BorDerPointS.tOprightinneR, BOUNds.lEft + BordErs[3].wiDth, bounds.top + bOrdErs[0].wIDth);
        ParsecorneR(borDeRArgs, Radius[1], RadiuS[2], bOrderPoints.topRIghtinner, bordErPOiNts.BoTtomRIGhtInnEr, bOunDs.left + bOunds.wiDTh - bOrDERS[1].wIdth, bounds.top + bordeRs[0].WIDtH);
        parseCoRner(boRDeRARGs, radius[2], RaDiuS[3], borDERPoinTs.boTToMRightInNer, borDErpoInts.botToMLeftINnEr, bOunDs.lefT + BounDs.widtH - borders[1].Width, BOunds.top + bounds.HEight - borders[2].wIDtH);
        PArSECorNer(BorderArgs, rAdiuS[3], RadiUs[0], boRDeRPoINts.boTtomLEfTinNEr, borderPoints.topLeFtinner, bOunds.Left + borders[3].wiDth, bounds.tOP + BOunds.heiGht - bORdERs[2].width);
        break;

      deFault:
        ParseCorneR(BorderArGs, radIus[0], radiuS[1],
 width + borders[3].width) ,
       y + M ath .mi n( righ tHei ght, height +b orde rs[0].width),
       Math. ma x (0,b rh  - bo rders[1 ] .w i d th) ,    Ma th.ma x(0 , brv -  borders[2 ].w id th)
       ) .b ottomRight .su bdivide(0.5) ,
     bo tto m LeftO ute r: ge tCurve P oints( 
       x,       y + le f t He ight ,
        blh,
    blv
       ).bott om L ef t . sub div ide(0.5),
    b ottomLe f tI n n e r:g etCurvePoints (
        x + b orders [3 ].w i dth,
     y  +leftHeight, 
       Math .max(0 ,  blh -b orders[ 3].wid th) ,
    Ma th. ma x (0, bl v - bor ders[2]. wi dt h)
    ) . bott omL eft. subdi vide(0.5)
   }; 
  } 
 funct ion g etBo rd erCli p(elem ent,bo rderPoints, bor ders , radius,  bo un ds)  { 
   v ar bac kgr oun dClip =  getCSS ( ele me n t ,  ' backgroundClip'), bo rderArgs  = []; 
 switch(b ac kgr ound C l ip) { 
   case "co ntent- b ox ": 
     ca se "pa dd ing -bo x":
     pars eCorner( borde r Args, radius[0 ] , radius[1],b or d e rP o ints .to pLeftInner,  bor d erPo ints . to pRi g htInn er, b ou n ds . left + borders[3].w id th, bo unds. top + borders [0].width) ;        p arse C or n er(borderArgs,  radi us[1], rad i us[2], b order Points.t opRightIn n e r, borde rPo int s.b ott o m Ri ghtInner, bou n d s.le ft  + boun ds. width -  bo rde rs[ 1]. wi dth, boun ds.top +  b or de rs [0] .widt h );
      pa rs eCo rner( b orderA rgs,radi us [2 ] , r adius[3 ] ,b o rder Po in ts.b ott om Right Inne r , b orderPo ints.bott omL e ftIn ne r,  bounds .left + bound s. width - bo rd ers [1].wi d t h, bound s.top + bounds.height - borders [2] .widt h);        p ars eCorne r(b o rderAr gs, ra dius[ 3] , r a d ius[0 ] ,  b ord er Points.bot t o mLe ftInn er , bo rderPoi nts.topLeftInner,b oun ds.left + bor der s[3] . w id th, bo u nds .t o p + b ounds.height -borders[2] .w i dt h);
      br ea k;

     defa ult:      parseCorn er(border Ar gs,r a diu s[0], radi us[1],
 width_+ borders[3].width),
_   _ __y +_Math.min(rightHeight,_height + borders[0].width),
_  _   _Math.max(0, brh -_borders[1].width),
_       Math.max(0, brv - borders[2].width)
   __ __).bottomRight.subdivide(0.5),

_    _bottomLeftOuter: getCurvePoints(
   _ _  x,
     __ y +_leftHeight,
        blh,
_     _ blv
 ___   _).bottomLeft.subdivide(0.5),

     _bottomLeftInner: getCurvePoints(
    _   x + borders[3].width,
 _     _y + leftHeight,
  _ _   Math.max(0, blh_- borders[3].width),
 _ _  _ Math.max(0, blv - borders[2].width)
 _  _   ).bottomLeft.subdivide(0.5)
  __};
  }

__function_getBorderClip(element, borderPoints,_borders, radius, bounds)_{
_ __var backgroundClip = getCSS(element, 'backgroundClip'),
 __ borderArgs = [];

   _switch(backgroundClip) {
  __  case "content-box":
_    _case "padding-box":
    _ _ parseCorner(borderArgs,_radius[0], radius[1], borderPoints.topLeftInner, borderPoints.topRightInner, bounds.left + borders[3].width, bounds.top + borders[0].width);
 _     _parseCorner(borderArgs, radius[1], radius[2], borderPoints.topRightInner,_borderPoints.bottomRightInner, bounds.left_+_bounds.width - borders[1].width,_bounds.top_+ borders[0].width);
_      _parseCorner(borderArgs, radius[2],_radius[3], borderPoints.bottomRightInner, borderPoints.bottomLeftInner, bounds.left + bounds.width_- borders[1].width, bounds.top +_bounds.height_- borders[2].width);
    _   parseCorner(borderArgs, radius[3], radius[0],_borderPoints.bottomLeftInner, borderPoints.topLeftInner, bounds.left + borders[3].width,_bounds.top_+_bounds.height - borders[2].width);
  _     break;

_  _  default:
    __  parseCorner(borderArgs, radius[0], radius[1],