MCPcopy Create free account
hub / github.com/heygen-com/hyperframes / roundedRectAlpha

Function roundedRectAlpha

packages/engine/src/utils/alphaBlit.ts:387–400  ·  view source on GitHub ↗
(
  px: number,
  py: number,
  w: number,
  h: number,
  radii: [number, number, number, number],
)

Source from the content-addressed store, hash-verified

385 * @param radii Corner radii [topLeft, topRight, bottomRight, bottomLeft]
386 */
387export function roundedRectAlpha(
388 px: number,
389 py: number,
390 w: number,
391 h: number,
392 radii: [number, number, number, number],
393): number {
394 const [tl, tr, br, bl] = radii;
395 if (px < tl && py < tl) return cornerAlpha(px, py, tl, tl, tl);
396 if (px >= w - tr && py < tr) return cornerAlpha(px, py, w - tr, tr, tr);
397 if (px >= w - br && py >= h - br) return cornerAlpha(px, py, w - br, h - br, br);
398 if (px < bl && py >= h - bl) return cornerAlpha(px, py, bl, h - bl, bl);
399 return 1;
400}
401
402// ── Positioned HDR region copy ────────────────────────────────────────────────
403

Callers 3

alphaBlit.test.tsFile · 0.85
blitRgb48leRegionFunction · 0.85
blitRgb48leAffineFunction · 0.85

Calls 1

cornerAlphaFunction · 0.85

Tested by

no test coverage detected