Function

HarfBuzz-0.0HarfBuzzpaint_reduce_linear_anchorsSince 14.2.0

  • Reduces a COLRv1 linear gradient's 3-anchor spec (P0=color stop 0, P1=color stop 1, P2=rotation reference) to the 2-point axis (P0, P1') used by SVG / cairo / most software renderers. P1' is the foot of P1 on the line through P0 perpendicular to (P2 - P0); the resulting axis is the gradient's actual direction (perpendicular to the rotation line). Degenerate (P0 == P2) passes through unchanged.

    Parameters

    • x0: number

      x coordinate of P0 (color stop 0).

    • y0: number

      y coordinate of P0 (color stop 0).

    • x1: number

      x coordinate of P1 (color stop 1).

    • y1: number

      y coordinate of P1 (color stop 1).

    • x2: number

      x coordinate of P2 (rotation reference).

    • y2: number

      y coordinate of P2 (rotation reference).

    Returns [number, number, number, number]

    14.2.0